Sunday 7 October 2018

utlrp.sql & adutlrpcmp.sql hangs

Issue:

Compiling the invalid objects hangs on both utlrp.sql & adadmin

SQL> @utlrp.sql

TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_BGN  2018-10-07 08:50:38

DOC>   The following PL/SQL block invokes UTL_RECOMP to recompile invalid
DOC>   objects in the database. Recompilation time is proportional to the
DOC>   number of invalid objects in the database, so this command may take
DOC>   a long time to execute on a database with a large number of invalid
DOC>   objects.
DOC>
DOC>   Use the following queries to track recompilation progress:
DOC>
DOC>   1. Query returning the number of invalid objects remaining. This
DOC>      number should decrease with time.
DOC>         SELECT COUNT(*) FROM obj$ WHERE status IN (4, 5, 6);
DOC>
DOC>   2. Query returning the number of objects compiled so far. This number
DOC>      should increase with time.
DOC>         SELECT COUNT(*) FROM UTL_RECOMP_COMPILED;
DOC>
DOC>   This script automatically chooses serial or parallel recompilation
DOC>   based on the number of CPUs available (parameter cpu_count) multiplied
DOC>   by the number of threads per CPU (parameter parallel_threads_per_cpu).
DOC>   On RAC, this number is added across all RAC nodes.
DOC>
DOC>   UTL_RECOMP uses DBMS_SCHEDULER to create jobs for parallel
DOC>   recompilation. Jobs are created without instance affinity so that they
DOC>   can migrate across RAC nodes. Use the following queries to verify
DOC>   whether UTL_RECOMP jobs are being created and run correctly:
DOC>
DOC>   1. Query showing jobs created by UTL_RECOMP
DOC>         SELECT job_name FROM dba_scheduler_jobs
DOC>            WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC>
DOC>   2. Query showing UTL_RECOMP jobs that are running
DOC>         SELECT job_name FROM dba_scheduler_running_jobs
DOC>            WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC>#
^CDECLARE
*
ERROR at line 1:
ORA-01013: user requested cancel of current operation
ORA-06512: at "SYS.DBMS_UTILITY", line 1294
ORA-06512: at line 1
ORA-06512: at "SYS.UTL_RECOMP", line 413
ORA-06512: at "SYS.UTL_RECOMP", line 559
ORA-06512: at "SYS.UTL_RECOMP", line 807
ORA-06512: at line 4



SQL>


Fix:

Find the JOB_NAME responsible for recompile the objects. JOB_NAME will be "UTL_RECOMP_SALVE_#".
SELECT * FROM DBA_SCHEDULER_RUNNING_JOBS;

Find out the OBJ# of those jobs:
SELECT * FROM SCHEDULER$_JOB;

Change the status to 1 for those jobs :
UPDATE SCHEDULER$_JOB SET JOB_STATUS = 1 WHERE OBJ# in (1577769);
COMMIT:

Now run recompile using utlrp.sql or adadmin


SQL Developer displaying Junk characters (??????)

Change the Encoding in SQL Developer Preferences as below Tools --> Preferences --> Environment --> Encoding --> UTF...