User Tools

Site Tools


oracle_errors

Table of Contents

ORA-00060: Deadlock detected. See Note 60.1 at My Oracle Support for Troubleshooting ORA-60 Errors

  • Reference: How to Identify ORA-00060 Deadlock Types Using Deadlock Graphs in Trace (Doc ID 1507093.1)

Using this document shows the most common causes of deadlock and how to identify them.

ORA-00600

ORA-07445: exception encountered: core dump [PC:0xEE00] [SIGSEGV] [ADDR:0x7C7A03A67C7242A6] [PC:0xEE00] [Address not mapped to object] []

An ORA-0600 error is a 'handled' exception. An 07445 error is an unhandled exception.

When a 7445 error occurs, there will always be a core dump. Check the alertlog for the trace files.

2021-05-01T14:04:22.421773+02:00
Exception [type: SIGSEGV, Address not mapped to object] [ADDR:0x7C7A03A67C7242A6] [PC:0xEE00, {empty}] [flags: 0x0, count: 1]
Errors in file /cln/exp/ora_bin1/app/oracle/diag/rdbms/cwm/cwm/trace/cwm_j002_44959600.trc  (incident=199498):
ORA-07445: exception encountered: core dump [PC:0xEE00] [SIGSEGV] [ADDR:0x7C7A03A67C7242A6] [PC:0xEE00] [Address not mapped to object] []
Incident details in: /cln/exp/ora_bin1/app/oracle/diag/rdbms/cwm/cwm/incident/incdir_199498/cwm_j002_44959600_i199498.trc

Use adrci to package up the problem.

Also use stackx to grab a stack trace from the core dump file and send that to Oracle as well. TECH: Getting a Stack Trace from a CORE file on Unix (Doc ID 1812.1)

Solution

Dumps did not provide a clear answer but Oracle suggest disabling the SQL Tuning Advisor

select client_name, status from dba_autotask_client;

 CLIENT_NAME                           STATUS
-------------------------------       ---------
auto optimizer stats collection       ENABLED
auto space advisor                    ENABLED
sql tuning advisor                    ENABLED
begin
dbms_auto_task_admin.disable ( client_name => 'sql stats advisor'
                             , operation   => null
                             , window_name => null
                             );
end;
/

or this should work also

exec dbms_stats.set_global_prefs('AUTO_STATS_ADVISOR_TASK','FALSE');
select client_name, status from dba_autotask_client;

 CLIENT_NAME                           STATUS
-------------------------------       ---------
auto optimizer stats collection       DISABLED
auto space advisor                    ENABLED
sql tuning advisor                    ENABLED

ORA-01422: exact fetch returns more than requested number of rows in EM Cloud control GUI

Updating Monitoring Configuration to changing database monitoring credentials via GUI fails with ORA-1422 * Cause Target was in not promoted list. The following query show the target twice. One with status promoted and the other with status no promoted.

SET echo on 
SELECT chld.target_name, chld.target_type, count(*)
  FROM em_targets prnt,
  mgmt_assoc_instances inst,
  mgmt_assoc_type_extends ext,
  mgmt_targets agt,
  mgmt_targets chld
  WHERE prnt.target_guid = inst.source_me_guid
  AND inst.dest_me_guid = chld.target_guid
  AND inst.assoc_type = ext.assoc_type
  AND ext.extended_assoc_type = 'app_composite_contains'
  AND agt.emd_url = prnt.emd_url
  AND agt.target_type = 'oracle_emd'
  GROUP BY chld.target_name, chld.target_type HAVING count(*)>1
  order by chld.target_name;

* Solution Remove the duplicate target which was not promoted.

Go to Setup → Add Target → Auto discover results → Targets on Hosts () tab → Look for the target and delete or ignore it.

ORA-29280: invalid directory object

A dba directory has been setup and read,write permissions granted on it to a user, the oracle user has the correct permissions at Unix level and still there are errors.

set serveroutput on
declare
    l_file utl_file.file_type;
begin
    l_file := utl_file.fopen ('iam_directory_file_output', 'some_new_file_name.txt', 'w');
    utl_file.put_line (l_file, 'content of the file');
    utl_file.fclose (l_file);
end;
declare
*
ERROR at line 1:
ORA-29283: invalid file operation: cannot open file [29435]
ORA-06512: at "SYS.UTL_FILE", line 41
ORA-06512: at "SYS.UTL_FILE", line 478
ORA-06512: at line 4

If users will be accessing the directory over tns, the listener needs to be restarted (reloading is not good enough) to pick up the new directory and its grants!

There is an asktom thread about it here ORA-29283 Invalid file operation - asktom.com

exec(): 0509-036 Cannot load program sqlplus because of the following errors:

exec(): 0509-036 Cannot load program sqlplus because of the following errors:
rtld: 0712-001 Symbol CreateIoCompletionPort was referenced
      from module /cln/dev/ora_bin/app/oracle/product/12.1.0.2/dbhome_1/lib/libttsh12.so(), but a runtime definition
      of the symbol was not found.
rtld: 0712-001 Symbol GetMultipleCompletionStatus was referenced
      from module /cln/dev/ora_bin/app/oracle/product/12.1.0.2/dbhome_1/lib/libttsh12.so(), but a runtime definition
      of the symbol was not found.
rtld: 0712-002 fatal error: exiting.

Cause

This is caused by the I/O Completion Ports being set to “Defined” instead of “Available”

Solution

To check if the IOCP module is enabled, run the lsdev command:

$ lsdev | grep iocp

The following sample output shows the IOCP status is set to Defined and hence not enabled:

iocp0 Defined I/O Completion Ports

By default, IOCP is set to Defined. To enable IOCP, set IOCP to Available using the following procedure:

Log in as root and run the following command:

# smitty iocp

Select Change / Show Characteristics of I/O Completion Ports. Change configured state at system restart from Defined to Available. Run the lsdev command to confirm the IOCP status is set to Available:

$ lsdev | grep iocp

iocp0 Available I/O Completion Ports

Restart the system to make the changes permanent

Autotask not running gather_stats on some databases

Problem:

No errors shown anywhere but running a query to see last_analysed date shows nothing being done recently.

select count('e'), trunc(last_analyzed) from dba_tables group by trunc(last_analyzed) order by 2 desc
/
COUNT('E') TRUNC(LAST_ANALYZED)
---------- ---------------------------
       146
         1 08-FEB-21 00:00:00
         1 31-AUG-20 00:00:00
         2 28-AUG-20 00:00:00
         1 26-AUG-20 00:00:00
         1 25-AUG-20 00:00:00
         5 04-JUL-20 00:00:00
         2 03-JUL-20 00:00:00
       670 14-JUN-20 00:00:00
        15 12-JUN-20 00:00:00
         5 10-JUN-20 00:00:00
         1 08-JUN-20 00:00:00

So something happened in June to stop the stats from being gathered.

There is a whole host of things to check:

  • maintenance window definitions
  • maintenance window schedules
  • whether the autotask jobs are enabled
  • whether the autotask jobs are enabled in the window

Checked all of these and everything was ok.

Turned out to be the job_queue_processes database parameter. It was set too low so there was simply no processes available within the window to allow the 'auto optimizer stats collection' to run.

Solution:

Tune the job_queue_processes parameter. It should be set to the lower of these 2 values

select c.value*20 based_on_cpu, s.value/4 based_on_sessions from v$parameter c, v$parameter s where c.name = 'cpu_count' and s.name = 'sessions'
/
alter system set job_queue_processes = 387 scope=both;

System altered.

EMD upload error: uploadXMLFiles skipped :: OMS version not checked yet

Error when uploading from an agent

emctl upload agent

Oracle Enterprise Manager Cloud Control 13c Release 5
Copyright (c) 1996, 2021 Oracle Corporation.  All rights reserved.
---------------------------------------------------------------
EMD upload error: uploadXMLFiles skipped :: OMS version not checked yet. If this issue persists check trace files for ping to OMS related errors.

Solution

emctl stop agent
emctl unsecure agent
emctl secure agent
emctl clearstate agent

Try again

emctl upload agent

Oracle Enterprise Manager Cloud Control 13c Release 5
Copyright (c) 1996, 2021 Oracle Corporation.  All rights reserved.
---------------------------------------------------------------
EMD upload completed successfully

Good explanation of possible causes in MOS document Alert.log shows ORA-609 with TNS-12537: TNS:connection closed (Doc ID 1538717.1)

Fatal NI connect error 12537, connecting to:
 (LOCAL=NO)

  VERSION INFORMATION:
	TNS for IBM/AIX RISC System/6000: Version 12.1.0.2.0 - Production
	TCP/IP NT Protocol Adapter for IBM/AIX RISC System/6000: Version 12.1.0.2.0 - Production
	Oracle Bequeath NT Protocol Adapter for IBM/AIX RISC System/6000: Version 12.1.0.2.0 - Production
  Time: 21-APR-2021 06:17:44
  Tracing not turned on.
  Tns error struct:
    ns main err code: 12537
    
TNS-12537: TNS:connection closed
    ns secondary err code: 12560
    nt main err code: 0
    nt secondary err code: 0
    nt OS err code: 0
Wed Apr 21 06:17:44 2021
opiodr aborting process unknown ospid (65536354) as a result of ORA-609

runInstaller fails with "[FATAL] [INS-30060] Check for group existence failed.

[WARNING] [INS-13001] Oracle Database is not supported on this operating system. Installer will not perform prerequisite checks on the system.
  CAUSE: This operating system may not have been in the certified list at the time of the release of this software.
  ACTION: Refer to My Oracle Support portal for the latest certification information for this operating system. Proceed with the installation if the operating system has been certified after the release of this software.
[WARNING] [INS-32056] The specified Oracle Base contains the existing Central Inventory location: /db_home/oracle/product/oraInventory.
  ACTION: Oracle recommends that the Central Inventory location is outside the Oracle Base directory. Specify a different location for the Oracle Base.
[FATAL] [INS-30060] Check for group existence failed.
  CAUSE: Unexpected error occurred while trying to check for group existence.
  ACTION: Refer to the logs or contact Oracle Support Services. Note for advanced users: Launch the installer by passing the following flag '-ignoreInternalDriverError'.

According to Doc ID 2464358.1, this can be ignored (in this case) as we know 19.16 is certified on RedHat 6.1.

Solution

Add option '-ignoreInternalDriverError' to the runInstaller command line.

dbca - [FATAL] [DBT-50000] Unable to check for available memory.

dbca fails with this odd error before attempting to create the databae.

./dbca -silent -createDatabase                                                   \
>      -gdbname olmdb -sid  olmdb -responseFile NO_VALUE         \
>       -templateName General_Purpose.dbc                                         \
>      -characterSet AL32UTF8                                                    \
>      -sysPassword Welcome1                                                 \
>      -systemPassword Welcome1                                              \
>      -createAsContainerDatabase true                                           \
>      -pdbAdminPassword Welcome1                                            \
>      -databaseType MULTIPURPOSE                                                \
>      -datafileDestination "/opt/oradata"                                        \
>      -memoryMgmtType auto_sga                                                  \
>      -totalMemory 2000                                                         \
>      -storageType FS                                                           \
>      -datafileDestination "/opt/oradata"                                        \
>      -redoLogFileSize 50                                                       \
>      -emConfiguration NONE                                                     \
>      -ignorePreReqs
[FATAL] [DBT-50000] Unable to check for available memory.
[FATAL] [DBT-50001] Unable to check the value of kernel parameter {0}

Solution

Enable x11-forwarding and to mount /tmp in exec mode, this normally in noexec (otherwise you will get an error in dbca when reading the memory of the server) or export TMP to a directory that has exec privilege.

trace directory contains very large .trc files containing SQL*Loader (sqlldr) AWR data

Trace file contains a file of almost 7Gb

-rw-rw----    1 oracle   oinstall       1042 Oct 13 11:04 portala_ora_58918122.trc
-rw-rw----    1 oracle   oinstall         66 Oct 13 12:01 portala_ora_39977800.trm
-rw-rw----    1 oracle   oinstall        920 Oct 13 12:01 portala_ora_39977800.trc
-rw-r-----    1 oracle   oinstall      59550 Oct 13 12:01 alert_portala.log
-rw-rw----    1 oracle   oinstall         76 Oct 13 12:04 portala_ora_12714240.trm
-rw-rw----    1 oracle   oinstall       1070 Oct 13 12:04 portala_ora_12714240.trc
-rw-r-----    1 oracle   oinstall     738682 Oct 13 12:52 portala_mmnl_15859950.trm
-rw-r-----    1 oracle   oinstall 6780484687 Oct 13 12:52 portala_mmnl_15859950.trc
drwxr-xr-x    3 oracle   oinstall     548864 Oct 13 12:56 .
-rw-r-----    1 oracle   oinstall        335 Oct 13 12:56 portala_ora_59966554.trm
-rw-r-----    1 oracle   oinstall       7223 Oct 13 12:56 portala_ora_59966554.trc
-rw-rw-r--    1 oracle   dba         3228704 Oct 13 12:56 sbtio.log

The AWR collection background process mmnl created this trace file.

Checking on the filesystem we can see the process is not running for this database

ps -ef|grep "${ORACLE_SID}"|grep mmnl

Check when the last AWR snapshots were created (default is every hour)

col instance_number     format 999  heading 'Inst'
col startup_time        format a15  heading 'Startup'
col begin_interval_time format a15  heading 'Begin snap'
col end_interval_time   format a15  heading 'End Snap'
col flush_elapsed       format a20  heading 'flush elapsed'
col error_count         format 9999 heading 'Err#'

select *
from
(
    select instance_number
    ,      startup_time
    ,      begin_interval_time
    ,      end_interval_time
    ,      flush_elapsed
    ,      error_count
    from   dba_hist_snapshot
    order  by begin_interval_time desc
)
where  rownum < 5
/

According to “MMNL Background Process Creates Large Trace Files Containing ASH Information (Doc ID 1952274.1)” and “Missing Automatic Workload Repository (AWR) Snapshots and Other Collection Issues (Doc ID 1301503.1)”, our case here is tha fact that the background process no longer exists.

Leading to “AWR Snapshots Are Not Being Created Because MMON Is Not Being Respawned (Doc ID 2023652.1)”, we can restart the process like this

alter system enable restricted session;
alter system disable restricted session;

If this fails to restart the process, then an instance restart should do it.

ORA-19051: Cannot use fast path insert for this XMLType table

Think LD_LIBRARY_PATH on Linux or LIBPATH on AIX.

Export: Release 11.2.0.4.0 - Production on Thu Jun 1 06:41:55 2017

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "DWH_EXPORT"."SYS_EXPORT_TABLE_03":  dwh_export/******** parfile=cadis_foto_export_credit_dba.par
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 64.08 GB
ORA-39126: Worker unexpected fatal error in KUPW$WORKER.FETCH_XML_OBJECTS [[]]
ORA-19051: Cannot use fast path insert for this XMLType table

ORA-06512: at "SYS.DBMS_SYS_ERROR", line 86
ORA-06512: at "SYS.KUPW$WORKER", line 9710

Problem

When the 11g DB was started, LD_LIBRARY_PATH and LIBPATH were still pointing to paths in the 10g Home.

Solution

There may have been some odd values setup in LD_LIBRARY_PATH before the call to oraenv (if oraenv was indeed called!)

unset LD_LIBRARY_PATH LIBPATH
export ORACLE_SID=<correct 11g SID>
. oraenv
echo $LD_LIBRARY_PATH
echo $LIBPATH

They should now be correct.

ORA-39346: data loss in character set conversion for object TABLE_STATISTICS:

When importing data from a .dmp file using Data Pump, get these errors

ORA-39346: data loss in character set conversion for object TABLE_STATISTICS:"<owner>"."<table_name>"

. . imported "LIG_DATA_DBA"."BATCH_DEMANDE"                  0 KB       0 rows
. . imported "LIG_DATA_DBA"."GARANTIE_CONTRATS"          7.937 MB  213359 rows
Processing object type SCHEMA_EXPORT/VIEW/VIEW
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
ORA-39346: data loss in character set conversion for object TABLE_STATISTICS:"LIG_DATA_DBA"."GARANTIE"

ORA-39346: data loss in character set conversion for object TABLE_STATISTICS:"LIG_DATA_DBA"."CLIENT_IDJS"

ORA-39346: data loss in character set conversion for object TABLE_STATISTICS:"LIG_DATA_DBA"."IDJ"

ORA-39346: data loss in character set conversion for object TABLE_STATISTICS:"LIG_DATA_DBA"."TIERS"

ORA-39346: data loss in character set conversion for object TABLE_STATISTICS:"LIG_DATA_DBA"."MOUVEMENT"

Solution

exec dbms_stats.gather_table_stats ('<OWNER>', '<TABLE NAME>', method_opt => 'FOR ALL COLUMNS');

exec dbms_stats.gather_table_stats('LIG_DATA_DBA','GARANTIE', method_opt => 'FOR ALL COLUMNS');
exec dbms_stats.gather_table_stats('LIG_DATA_DBA','CLIENT_IDJS', method_opt => 'FOR ALL COLUMNS');
exec dbms_stats.gather_table_stats('LIG_DATA_DBA','IDJ', method_opt => 'FOR ALL COLUMNS');
exec dbms_stats.gather_table_stats('LIG_DATA_DBA','TIERS', method_opt => 'FOR ALL COLUMNS');

ORA-20247: EMD_URL is invalid: Cannot provide null emd url.

When on the oms and attempting to add_target with an argfile, this cryptic error shows up

emcli argfile /tmp/emcli_add_targets.argfile
Error: Cannot save the target to the agent
ORA-20247: EMD_URL is invalid:  Cannot provide null emd url.
Error: Cannot save the target to the agent
ORA-20247: EMD_URL is invalid:  Cannot provide null emd url.
Error: Cannot save the target to the agent
ORA-20247: EMD_URL is invalid:  Cannot provide null emd url.
Error: Cannot save the target to the agent
ORA-20247: EMD_URL is invalid:  Cannot provide null emd url.

Two things to check

  • hostname is incorrect in the argfile. Does it have the domain on it? Is it a cluster name instead of a node name?
  • was it a recent agent install or an upgrade? Check the host was added. From the host:
emctl secure agent
emctl status agent

How many targets are monitored? Let's see what they are

emctl config agent listtargets

If only the oracle_emd is mentioned and not the host, add it

emctl config agent addInternaltargets
emctl upload agent
emctl status agent

Now go back to the oms server and add the targets again. Should work now. See also Agent and Host Targets not Shown in the Enterprise Manager Cloud Control

ORA-27092: size of file exceeds file size limit of the process

Think ulimit…

Cause: an attempt was made to open a file that exceeds the process's file size limit (ulimit), additional information shows the current limit (logical blocks) and the size of the file (logical blocks)
Action: increase the processes file size limit (ulimit) and retry
truncate table pibadm.test_ph
                      *
Error at line 1 :
ORA-00604: error ocurred at recursive SQL level 1
ORA-01116: error in opening database file 2
ORA-01110: datafile 2 : '/opt/u01/data/PIBQA/UNDO_01.dbf'
ORA-27092: size of file exceeds file size limit of the process
Additional information: 262143
Additional information: 2621441

Check the fs_size limit for this user in /etc/security/limits
Compare this with another user, say oracle. Probably -1 (unlimited)

ORA-01157: cannot identify/lock data file 201 - see DBWR trace file

After restore or duplicate database, TEMP tablespace gives errors

SQL> select * from dba_temp_files;
select * from dba_temp_files
              *
ERROR at line 1:
ORA-01157: cannot identify/lock data file 201 - see DBWR trace file
ORA-01110: data file 201: '/cln/acc/ora_data3/credoa/credoa/temp01.dbf'

But we can still select from v$tempfile

SQL> select file#,name from v$tempfile;

     FILE# NAME
---------- --------------------------------------------------------------------------------
         1 /cln/acc/ora_data3/credoa/credoa/temp01.dbf

This entry can be removed from the controlfile as the file does not actually exist on disk

SQL> alter database tempfile '/cln/acc/ora_data3/credoa/credoa/temp01.dbf' drop;

Database altered.

SQL> select file#,name from v$tempfile;

no rows selected

TEMP tablespace exists but has no tempfiles in it, add one

SQL> alter tablespace temp add tempfile '/cln/acc/ora_data3/credoa/temp01.dbf' size 1g autoextend on maxsize unlimited;

Tablespace altered.

SP2-1503: Unable to initialize Oracle call interface

When trying to login to the database via SQL*Plus, these messages a displayed

hn5118 /home/oracle $sqlplus / as sysdba
SP2-1503: Unable to initialize Oracle call interface
SP2-0152: ORACLE may not be functioning properly

Seems to be a problem unique to AIX (in this case).
Check to see what the LIBPATH variable is. It may still contain a path to an old ORACLE_HOME…

hn5118 /home/oracle $env|grep LIBPATH
LIBPATH=/oracle/exp/ora_bin1/app/oracle/product/10.2.0/db_1/lib:/oracle/exp/ora_bin1/app/oracle/product/10.2.0/db_1/lib

Disco! Unset it and rerun.

hn5118 /home/oracle $unset LIBPATH

hn5118 /home/oracle $sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Jul 12 17:17:54 2017

Copyright (c) 1982, 2014, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL>

UDE-31623: operation generated ORACLE error 31623

When using Data pump, get following errors almost immediately:

UDE-31623: operation generated ORACLE error 31623
ORA-31623: a job is not attached to this session via the specified handle
ORA-06512: at "SYS.DBMS_DATAPUMP", line 3326
ORA-06512: at "SYS.DBMS_DATAPUMP", line 4551
ORA-06512: at line 1

Solution 1:
In one case, I simplified the parameter file that was used. Maybe related to Streams Pool size, who knows?!
I removed these 2 lines and the export started working:

compression_algorithm=medium
logtime=all

Solution 2:
There is a note about this on Metalink, 1080775.1 which suggests that Streams Pool Size needs setting.

For this DataPump error, you will need to configure the database with some Streams Pool.

Perform the following query to find out how much STREAMS_POOL_SIZE has been allocated

 select * from v$sgainfo;
 ...
 Streams Pool Size                               0 Yes

Data Pump now uses Advanced Queuing (AQ) internally, so it can handle job stops/starts/re-starts.  However, AQ using the Streams Pool, where the database currently has the STREAMS_POOL_SIZE set to ZERO.

Manually set the STREAMS_POOL_SIZE (using ALTER SYSTEM or by changing the value in the the PFILE/SPFILE), re-start the database and re-attempt the Data Pump Export.

Alternately, turn on Automatic Shared Memory management (ASMM) by setting SGA_TARGET or MEMORY_TARGET.

From Oracle Documentation

Setting the Size Of the Buffer Cache In a Streams Environment

Oracle Data Pump uses Streams functionality to communicate between processes.
If the SGA_TARGET initialization parameter is set, then the STREAMS_POOL_SIZE initialization parameter is automatically set to a reasonable value.
If the SGA_TARGET initialization parameter is not set and the STREAMS_POOL_SIZE initialization parameter is not defined,
then the size of the streams pool automatically defaults to 10% of the size of the shared pool.

When the streams pool is created, the required SGA memory is taken from memory allocated to the buffer cache,
reducing the size of the cache to less than what was specified by the DB_CACHE_SIZE initialization parameter.
This means that if the buffer cache was configured with only the minimal required SGA, then Data Pump operations may not work properly.
A minimum size of 10M is recommended for STREAMS_POOL_SIZE in order to ensure successful Data Pump operations.

ORA-00020: maximum number of processes (150) exceeded

Check the current resource limits with:

set lines 300
select * from v$resource_limit;

Unfortunately this limit cannot be increased without a restart.
It may be a necessary to increase the limit with

alter system set processes=500 scope=spfile;

followed by a shutdown/startup
Or it may be some user is running away with the limit.
Check to see who is running what with: See_what_statements_all_users_are_running

ORA-01555: snapshot too old: rollback segment number nn with name "xxx" too small

Problem

A long running transaction has run out of space to store its read-consistent image

Solution 1

If it's a one-off, maybe leave it alone. It may have been a user leaving a session open overnight without committing or rolling back.

Solution 2

Make sure there's enough space to allow the transaction to finish.

Things to check

How much undo did the biggest transaction take? What is the undo retention parameter set to?

set lines 200
col name        for a30
col description for a50
col value       for a20
col maxquerylen for 999999
select p.name
,      p.description
,      p.value
,      max(u.maxquerylen) maxquerylen
from   v$parameter p
,      v$undostat  u
where  1=1
and    p.name = 'undo_retention'
group  by p.name
,      p.description
,      p.value;

Set the retention to about 20% bigger than the maxquerylen.

select 'alter system set undo_retention='||round(1.2*max(maxquerylen))||' scope=both;' "Run this" from v$undostat;

and set the undo retention guarantee (being aware of the consequences)

select tablespace_name
,      retention
from   dba_tablespaces;
alter tablespace &undo_ts_name retention guarantee;

Optimise Oracle UNDO Parameters

The ideal undo_retention would be enough to hold rollback for the longest transaction that happened so far (can't see into the future)
So current undo_retention = current value of undo / (db_block_size * undo blocks per sec)

  • Undo Blocks per Second
SELECT MAX(undoblks/((end_time-begin_time)*3600*24)) "UNDO_BLOCKS_PER_SEC"
FROM   v$undostat;

Optimal Undo Retention

col actual for 9999999999.99 heading "ACTUAL UNDO SIZE [[MByte]]"
col retent for 9999999999    heading "UNDO RETENTION [[Sec]]"
col needed for 9999999999.99 heading "NEEDED UNDO SIZE [[Secs]]"

SELECT d.undo_size/(1024*1024) actual,
       to_number(SUBSTR(e.value,1,25)) retent,
       ROUND((d.undo_size / (to_number(f.value) *
       g.undo_block_per_sec))) needed
  FROM (
       SELECT SUM(a.bytes) undo_size
          FROM v$datafile a,
               v$tablespace b,
               dba_tablespaces c
         WHERE c.contents = 'UNDO'
           AND c.status = 'ONLINE'
           AND b.name = c.tablespace_name
           AND a.ts# = b.ts#
       ) d,
       v$parameter e,
       v$parameter f,
       (
       SELECT MAX(undoblks/((end_time-begin_time)*3600*24))
              undo_block_per_sec
         FROM v$undostat
       ) g
WHERE e.name = 'undo_retention'
  AND f.name = 'db_block_size'
/
  • Calculate Needed UNDO Size for given Database Activity
col actual for 9999999999.99 heading "ACTUAL UNDO SIZE [[MByte]]"
col retent for 9999999999    heading "UNDO RETENTION [[Sec]]"
col needed for 9999999999.99 heading "NEEDED UNDO SIZE [[MByte]]"

SELECT d.undo_size/(1024*1024) actual
,      to_number(SUBSTR(e.value,1,25)) retent
,      (TO_NUMBER(e.value) * TO_NUMBER(f.value) *
       g.undo_block_per_sec) / (1024*1024)  needed
  FROM (
       SELECT SUM(a.bytes) undo_size
         FROM v$datafile a,
              v$tablespace b,
              dba_tablespaces c
        WHERE c.contents = 'UNDO'
          AND c.status = 'ONLINE'
          AND b.name = c.tablespace_name
          AND a.ts# = b.ts#
       ) d,
      v$parameter e,
       v$parameter f,
       (
       SELECT MAX(undoblks/((end_time-begin_time)*3600*24))
         undo_block_per_sec
         FROM v$undostat
       ) g
 WHERE e.name = 'undo_retention'
  AND f.name = 'db_block_size'
/

It might be that the Export still fails with ORA-01555 even though retention seems long enough.
Are you running an export with the flashback_time parameter? If so, the undo_retention should be longer than the total export running time!

Check LOB undo retention

The retention settings for LOBS is different for the rest of the database.
When you change the UNDO_RETENTION parameter, the LOB segment’s retention value is NOT modified.
If you query the RETENTION column of the DBA_LOBS view, you will notice the old UNDO_RETENTION value still remains after you have modified the UNDO_RETENTION parameter.

SQL> show parameter undo_

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
undo_management                      string      AUTO
undo_retention                       integer     36000
undo_tablespace                      string      UNDOTBS1
SQL> desc SITEADMIN.AUDIT_LOG_MESSAGE
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 AUDIT_LOG_MESSAGE_ID                      NOT NULL NUMBER
 AUDIT_LOG_ID                              NOT NULL NUMBER
 SEQUENCE                                           NUMBER
 MESSAGE                                            CLOB
 CREATE_DATE                                        TIMESTAMP(6)
 COMPONENT_ID                                       VARCHAR2(50 CHAR)
set lines 300
col column_name for a32
select table_name,column_name, pctversion,retention from dba_lobs where owner='&table_owner';

TABLE_NAME                COLUMN_NAME                    PCTVERSION  RETENTION
------------------------- ------------------------------ ---------- ----------
EMAIL_STORE               CONTENT                                 0
EMAIL_STORE_ATTACHEMENT   ATTACHEMENT                             0
TRACKING                  ORIGINAL_MESSAGE                                 900
TRACKING                  MESSAGE                                          900
TRACKING                  SIEBEL_MESSAGE                                   900
WISE_WMS_LOG              WISE_WMS_XML                                     900
ATTACHMENT                ORIGINAL_MESSAGE                                 900
PLAN_TABLE                OTHER_XML                                        900
AUDIT_LOG_MESSAGE         MESSAGE                                          900
EXCEPTIONS                STACK_TRACE                                      900

To change the LOB segment’s RETENTION value to match the new UNDO_RETENTION value, do the following:

ALTER TABLE my_table MODIFY LOB (lob_column) (PCTVERSION 20);
ALTER TABLE my_table MODIFY LOB (lob_column) (RETENTION);

By momentarily changing the LOB to use PCTVERSION and then back to RETENTION, the new value of UNDO_RETENTION will be used.
You need to do this for all LOB segments that you intend to modify.

select 'ALTER TABLE '||owner||'.'||table_name||' MODIFY LOB ('||column_name||') (PCTVERSION 20);' from dba_lobs where owner='TIBCO'

select 'ALTER TABLE '||owner||'.'||table_name||' MODIFY LOB ('||column_name||') (RETENTION);'     from dba_lobs where owner='TIBCO';

There is a table DBA_LOBS that displays information about all the LOB columns in the database, but it doesn't actually store any LOB data, just metadata. The actual LOB segments in the database have system-generated names that take the form SYS_LOB*identifier*$$. For example if you identify a segment named SYS_LOBidentifier$$ that is consuming space, you can find out what column of what table that LOB column maps to using the DBA_LOBS table:

set lines 1000
col owner       for a20
col table_name  for a32
col column_name for a32
select owner
,      table_name
,      column_name
from   dba_lobs
where  1=1
and    segment_name = 'SYS_LOB<<identifier>>$$'

The Undo Advisor PL/SQL Interface

You can activate the Undo Advisor by creating an undo advisor task through the advisor framework.
The following example creates an undo advisor task to evaluate the undo tablespace. The name of the advisor is 'Undo Advisor'.
The analysis is based on Automatic Workload Repository snapshots, which you must specify by setting parameters START_SNAPSHOT and END_SNAPSHOT.
In the following example, the START_SNAPSHOT is “1” and END_SNAPSHOT is “2”.

DECLARE
   tid    NUMBER;
   tname  VARCHAR2(30);
   oid    NUMBER;
BEGIN
   DBMS_ADVISOR.CREATE_TASK('Undo Advisor', tid, tname, 'Undo Advisor Task');
   DBMS_ADVISOR.CREATE_OBJECT(tname, 'UNDO_TBS', null, null, null, 'null', oid);
   DBMS_ADVISOR.SET_TASK_PARAMETER(tname, 'TARGET_OBJECTS', oid);
   DBMS_ADVISOR.SET_TASK_PARAMETER(tname, 'START_SNAPSHOT', 1);
   DBMS_ADVISOR.SET_TASK_PARAMETER(tname, 'END_SNAPSHOT', 2);
   DBMS_ADVISOR.SET_TASK_PARAMETER(tname, 'INSTANCE', 1);
   DBMS_ADVISOR.execute_task(tname);
        END;
/

After you have created the advisor task, you can view the output and recommendations in the Automatic Database Diagnostic Monitor in Enterprise Manager.
This information is also available in the DBA_ADVISOR_* data dictionary views (DBA_ADVISOR_TASKS, DBA_ADVISOR_OBJECTS, DBA_ADVISOR_FINDINGS, DBA_ADVISOR_RECOMMENDATIONS, and so on).

References

Error 6 initializing SQL*Plus

Using sqlplus or rman under Cygwin, ORACLE_HOME still needs to be windows format!

Message file sp1<lang>.msb not found
SP2-0750 :You may need to set ORACLE_HOME to your Oracle software directory

so…

export ORACLE_SID=KITRYD
ORAENV_ASK=NO
. oraenv
[[ "`uname`" == CYGWIN* ]] && ORACLE_HOME=`cygpath -w ${ORACLE_HOME}`

ORA-2002: error while writing to audit trail

Check the space left in the audit tablespace with:

select sum(bytes)/1024/1024 mb from dba_free_space where tablespace_name ='AUDIT_DT';

If plenty of space, it can be due to Oracle clearing out the recyclebin at the same time.
If not, extend the datafile…

select * from dba_data_files where tablespace_name ='AUDIT_DT';
alter database datafile 6 resize 30G;

If that is not possible, clean out some audit data or add a datafile.

ORA-00449: background process 'CKPT' unexpectedly terminated with error 7446

SQL> startup nomount pfile="/oracle/TRSCRP1/admin/initTRSCRP1.ora"
ORA-00449: background process 'CKPT' unexpectedly terminated with error 7446
ORA-07446: sdnfy: bad value // for parameter .
SQL> exit

Solution

SQL> mkdir /oracle/TRSCRP1/admin/bdump /oracle/TRSCRP1/admin/cdump

ORA-00845: MEMORY_TARGET not supported on this system

Problem Description

SQL> STARTUP
ORA-00845: MEMORY_TARGET not supported on this system

Cause

  • Starting from Oracle 11g the automatic memory management feature is now defined with parameter MEMORY_TARGET and MEMMORY_MAX_TARGET.
  • On linux file system the shared memory need to be mounted on /dev/shm directory on the operating system.
  • And the size of /dev/shm needs to be greater than MEMORY_TARGET or MEMMORY_MAX_TARGET.
  • The AMM (Automatic Memory Management) now in 11g manages both SGA and PGA together by MMAN process.
  • The MEMORY_TARGET parameter in 11g comes for (SGA_TARGET+PGA_AGGREGATE_TARGET) which was in 10g.
  • And MEMORY_MAX_TARGET parameter in 11g comes instead of SGA_MAX_TARGET parameter which was in 10g.
  • The ORA-00845:can arises for the following two reasons on linux system.

1)If the shared memory which is mapped to /dev/shm directory is less than the size of MEMORY_TARGET or MEMORY_MAX_TARGET or 2)If the shared memory is not mapped to /dev/shm directory.

Solution

Make sure /dev/shm is properly mounted. You can see it by,
  - df -h or #df -k command.
The output should be similar to:

$ df -k
Filesystem            Size  Used Avail Use% Mounted on
...
shmfs                 1G    512M 512M  50% /dev/shm


We see here for /dev/shm we have assigned 1G memory. Now if you set MEMORY_TARGET more than 1G then above ORA-845 will arise. For example if you have MEMORY_TARGET or MEMORY_MAX_TARGET set to 12G then you can mount shared memory to 13g like below.
As a root user,
  -  mount -t tmpfs shmfs -o size=13g /dev/shm
In order to make the settings persistence so that it will affect after restarting machine add an entry in /etc/fstab similar to the following:

shmfs /dev/shm tmpfs size=13g 0

ORA-23515: materialized views and/or their indices exist in the tablespace

While trying to drop a tablespace, this error is shown.
Problem:
As the message suggests, you cannot drop a tablespace while it contains materialised views or their dependent objects.
Solution:
Find view dependencies, drop them. Drop the views. Drop the tablespace.

set pages 100 lines 1000
col owner      format a15;
col table_name format a45;
select t.owner
,      t.table_name
from   dba_tables  t
,      dba_indexes i
where  i.index_type      = 'DOMAIN'
and    t.owner           = i.table_owner
and    t.table_name      = i.table_name 
and    t.tablespace_name = upper('&tablespace_name')
/

Materialised view indexes

select o.owner
,      o.object_name index_name
,      o.object_type object_type
,      sq.mv_owner   mv_owner
,      sq.mv_name    mv_name
,      sq.tablespace mv_tablespace
from   dba_objects o
,      (
       select i.obj#
       ,      s.sowner mv_owner
       ,      s.tname  mv_name
       ,      p.name   tablespace
       from   sys.obj$  o
       ,      sys.tab$  t
       ,      sys.ind$  i
       ,      sys.user$ u
       ,      sys.snap$ s
       ,      sys.ts$   p
       where  i.ts#    = p.ts#
       and    p.name   = '&TABLESPACE'
       and    i.bo#    = t.obj#
       and    t.obj#   = o.obj#
       and    o.owner# = u.user#
       and    u.name   = s.sowner
       and    o.name   = s.tname
       ) sq
where  sq.obj# = o.object_id
order  by 1,2,3
/

Materialised views

set pages 100 lines 1000
col mv_owner    format a15;
col mv_name     format a45;
col tablespace  format a45;
select s.sowner mv_owner
,      s.tname  mv_name
,      p.name   tablespace
from   sys.obj$ o
,      sys.tab$ t
,      sys.user$ u
,      sys.snap$ s 
,      sys.ts$ p
where  t.ts#    = p.ts#
and    p.name   = upper('&TABLESPACE')
and    t.obj#   = o.obj#
and    o.owner# = u.user#
and    u.name   = s.sowner
and    o.name   = s.tname
order  by 1,2
/

ORA-02429: cannot drop index used for enforcement of unique/primary key

Atempting to drop a tablespace but got this error message. It means that some tables have constraints used to enforce uniqueness. These have to be found and dropped/diabled before the table(space) can be removed.
Of course the owning schema could also just be dropped with cascade option if this is part of the users request.

select 'ALTER TABLE '||owner||'.'||table_name||' DISABLE CONSTRAINT '|| constraint_name||' cascade;'
from   dba_constraints
where  (index_owner,index_name) in (
       select owner,index_name
       from   dba_indexes
       where  tablespace_name = upper('&tablespace_name')
       )
'ALTERTABLE'||OWNER||'.'||TABLE_NAME||'DISABLECONSTRAINT'||CONSTRAINT_NAME||';'
---------------------------------------------------------------------------------
ALTER TABLE OWBSYS.CMPFCOSTORAGE DISABLE CONSTRAINT IDX_FCOELEMENTID_VER;
ALTER TABLE OWBSYS.CMPSCOCFGSTORAGE DISABLE CONSTRAINT IDX_SCOCFGELEMENTID_VER;
ALTER TABLE OWBSYS.CMPSCOSTORAGE DISABLE CONSTRAINT IDX_SCOELEMENTID_VER;
ALTER TABLE OWBSYS.CMPSCOMAPSTORAGE DISABLE CONSTRAINT IDX_SCOMAPELEMENTID_VER;
ALTER TABLE OWBSYS.CMPSCOPRPSTORAGE DISABLE CONSTRAINT IDX_SCOPRPELEMENTID_VER;
ALTER TABLE OWBSYS.CMPSYSSTORAGE DISABLE CONSTRAINT IDX_SYSELEMENTID_VER;

6 rows selected.

ORA-24247: network access denied by access control list (ACL)

Cause: No access control list (ACL) has been assigned to the target host or the privilege necessary to access the target host has not been granted to the user in the access control list.

Action: Ensure that an access control list (ACL) has been assigned to the target host and the privilege necessary to access the target host has been granted to the user.

Your application will encounter an ORA-24247 error if it relies on one of the network packages and no proper ACL has been created. For the use of the following packages it is mandatory to have an ACL for the application user in place in 11g:

  • UTL_TCP
  • UTL_SMTP
  • UTL_MAIL
  • UTL_HTTP
  • UTL_INADDR

Here is a very good explanation of how to setup the necessary ACLs: whitehorses.nl

ORA-00600: internal error code, arguments: [17114]

ORA-00603: ORACLE server session terminated by fatal error
ORA-24557: error 600 encountered while handling error 600; exiting server process
ORA-00600

...
********** Internal heap ERROR 17114 addr=1109c20f0 *********
...



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error/Stack/SQL/Version from file "lbk5_p007_58852410_i509563.trc"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error: ORA-00600 [17114] [0x1109C20F0]

Error Stack: ORA-600[17114]/ORA-603/ORA-24557/ORA-600
Main Stack:
kgherror <- kghrcdepth <- kghrcdepth <- kghrcappl <- ksmdpg <- opidcl <- opidrv <- sou2o
<- opimai_real <- ssthrdmain <- main

Opened SR 3-24837203691 at Oracle. It seems to be bug 18909196 related to the xml version of the alertlog (X$DBGALERTEXT).

Either apply patch 18909196 or “Remove (i.e. delete) the xml-based alert log within <ADR_HOME>/alert/log.xml (and log_*.xml). Or manually locate the specific alert log records with problem keys exceeding 64 characters and delete only those.”

ORA-00600: internal error code, arguments: [kewrsp_split_partition_2], [8], [2982267510], [183212], [], [], [], [], [], [], [], []

Reference [https://support.oracle.com/epmos/faces/DocumentDisplay?id=17042658.8|Bug 17042658 - ORA-600 [kewrsp_split_partition_2] during AWR purge (Doc ID 17042658.8)]

ORA-00600: internal error code, arguments: [[qmx: no ref]]

Search “Master Note for Oracle XML Database (XDB) Install / Deinstall (Doc ID 1292089.1)” for more info.

Problem:

Sometimes one or more of the following errors can be encountered when installing or upgrading XDB, configuring APEX, running an Export, or selecting from xdb.xdb$resource or sys.dba_network_acls:

Errors of this sort generally occur when the init routines for the internal XDB functions are run in an invalid environment causing memory corruption.

This can happen if the database was ever started with the LD_LIBRARY_PATH (LIBPATH for AIX or SHLIB_PATH for HP) pointing to the wrong $ORACLE_HOME/lib directory rather than to the correct location for the instance.
The LD_LIBRARY_PATH/LIBPATH/SHLIB_PATH environment variable is used to resolve the location of the shared library “libxdb.so (libxdb.sl on HP)”.

Solution:

  • Stop Listener
  • Stop database
  • Ensure $ORACLE_HOME/lib is at the start of LD_LIBRARY_PATH / LIBPATH / SHLIB_PATH
  • If AIX, run /usr/sbin/slibclean as root
  • Start database
  • Start listener

ORA-00201: control file version nn.nn.nn.nn incompatible with ORACLE version

Trying to restore a database after complete failure
first step is to startup the database in nomount mode and restore the controlfile - succeeded.
second step, startup the database in mount mode ready for database restore…

SQL*Plus: Release 10.2.0.3.0 - Production on Wed Aug 19 18:16:47 2015

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options

SYS@CODWHP1> startup mount
ORACLE instance started.

Total System Global Area  260046848 bytes
Fixed Size                  2029296 bytes
Variable Size             113248528 bytes
Database Buffers          134217728 bytes
Redo Buffers               10551296 bytes
ORA-00201: control file version 10.2.0.0.0 incompatible with ORACLE version 10.2.0.3.0
ORA-00202: control file: '/oracle/CODWHP1/product/10203/dbs/cntrlCODWHP1.dbf'

The problem was there was no compatible parameter in the simple init file I used to start up the instance.
Adding compatible parameter to init file to be same version (10.2.0.3) allowed the db to mount.

ORA-12012: error on auto execute of job "SYS"."ORA$AT_OS_OPT_SY_131081

Following found in trace file from a autotask job run

ORA-12012: error on auto execute of job "SYS"."ORA$AT_OS_OPT_SY_131081"
<error barrier> at 0xfffffffffff3758 placed jslv.c@1659
ORA-20001: Statistics Advisor: Invalid task name for the current user
ORA-06512: at "SYS.DBMS_STATS", line 49540
ORA-06512: at "SYS.DBMS_STATS_ADVISOR", line 881
ORA-06512: at "SYS.DBMS_STATS_INTERNAL", line 21631
ORA-06512: at "SYS.DBMS_STATS_INTERNAL", line 23763
ORA-06512: at "SYS.DBMS_STATS", line 49528

See ORA-20001: Statistics Advisor: Invalid task name for the current user

set lines 1000
col name       for a40
col owner_name for a10
select name
,      ctime
,      how_created
,      owner_name
from   sys.wri$_adv_tasks 
where  name in ('AUTO_STATS_ADVISOR_TASK', 'INDIVIDUAL_STATS_ADVISOR_TASK')
/

If records are retrieved but not owned by SYS or not created by CMD then drop them first…

DECLARE
v_tname VARCHAR2(32767);
BEGIN
v_tname := 'AUTO_STATS_ADVISOR_TASK';
DBMS_STATS.DROP_ADVISOR_TASK(v_tname);
END;
/ 
 
DECLARE
v_tname VARCHAR2(32767);
BEGIN
v_tname := 'INDIVIDUAL_STATS_ADVISOR_TASK';
DBMS_STATS.DROP_ADVISOR_TASK(v_tname);
END;
/  

If no rows retrieved or they have just been dropped, now recreate them

exec dbms_stats.init_package();

TNS-00525: Insufficient privilege for operation

lsnrctl start LISTENER_UCLID55V

LSNRCTL for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production on 26-MAR-2015 13:36:14

Copyright (c) 1991, 2011, Oracle.  All rights reserved.

Starting /oracle/product/11.2.0.3/bin/tnslsnr: please wait...

TNSLSNR for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production
System parameter file is /oracle/product/11.2.0.3/network/admin/listener.ora
Log messages written to /oracle/product/diag/tnslsnr/solax082/listener_uclid55v/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=150.251.114.238)(PORT=1525)))
Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1525)))
TNS-12555: TNS:permission denied
 TNS-12560: TNS:protocol adapter error
  TNS-00525: Insufficient privilege for operation
   IBM/AIX RISC System/6000 Error: 1: Not owner

Listener failed to start. See the error message(s) above...

This would suggest the user attempting to start the listener has no access to either the Oracle binaries or the TNS listener/tnsnames files.
But… checkout the /tmp/.oracle directory :-)
That hidden gem shows who started the listener last time. Delete the relevant entry and try again!
To start from a clean sheet, stop all listeners, delete this directory and restart the listeners.

ORA-12537: TNS:connection closed

04-NOV-2019 10:37:53 * (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=devopse)(CID=(PROGRAM=sqlplus@hn5118)(HOST=hn5118)(USER=oracle))) * (ADDRESS=(PROTOCOL=tcp)(HOST=10.8.90.27)(PORT=35278)) * establish * devopse * 12518
TNS-12518: TNS:listener could not hand off client connection
 TNS-12547: TNS:lost contact
  TNS-12560: TNS:protocol adapter error
   TNS-00517: Lost contact
    IBM/AIX RISC System/6000 Error: 32: Broken pipe

Not the usual problems… listener log full, oracle executable without setuid bit set.
This turned out to be not very relevant to the error message but…
tnsnames.ora looked like this

DEVOPSE,DEVOPSE.WORLD =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = hn511)(PORT = 3531))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = devopse)
    )
  )

and database parameters looked like this

SQL> show parameter service

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
service_names                        string      devopse

SQL> show parameter domain

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_domain                            string      

The database registers dynamically so there is nothing in the listener.ora other than the listener definition itself.
This should work! I have no idea why it doesn't. But, as all the other databases use .world in their connections, I modified this setup to match:

SQL> alter system set db_domain='world' scope=spfile;

System altered.
SQL>

Restart the database.

Now look at what the parameters look like

SQL> show parameter service

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
service_names                        string      devopse.world

SQL> show parameter domain

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_domain                            string      world

Note the service name changed to have the domain tagged on to it so we have to modify the tnsnames.ora service name otherwise we'll get ORA-12514.

so now the tnsnames.ora looks like this

DEVOPSE,DEVOPSE.WORLD =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = hn511)(PORT = 3531))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = devopse.world)
    )
  )

Strangely, it now all works (either connecting to sqlplus user/pass@devopse or sqlplus user/[email protected]).

minact-scn: got error during useg scan e:12751 usn:5

and

minact-scn: useg scan erroring out with error e:12751
Sat Aug 26 13:40:55 2023
Incremental checkpoint up to RBA [0x4c28.f4b86.0], current log tail at RBA [0x4c28.116367.0]
Sat Aug 26 13:48:53 2023
Non critical error ORA-48913 caught while writing to trace file "/cln/tst/ora_ebstt1/db12cR1/tech_st/12.1.0.2/admin/EBSTT1_hn5122/diag/rdbms/ebstt1/EBSTT1/trace/EBSTT1_lg00_61276276.trc"
Error message: ORA-48913: Writing into trace file failed, file size limit [10485760] reached
Writing to the above trace file is disabled for now on...
Sat Aug 26 13:49:29 2023
minact-scn: got error during useg scan e:12751 usn:5
minact-scn: useg scan erroring out with error e:12751
Sat Aug 26 13:54:36 2023
Suspending MMON action 'undo usage' for 82800 seconds
Sat Aug 26 13:59:36 2023
minact-scn: got error during useg scan e:12751 usn:5
minact-scn: useg scan erroring out with error e:12751
Suspending MMON action 'Block Cleanout Optim, Undo Segment Scan' for 82800 seconds

in alertlog.

The archiving has stopped. Jobs are backing up in Commvault. Now the database has stopped responding.

Strangely, if you do a

sho parameter log_archive_dest_state_1

you see

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_1                   string      location=/cln/tst/ora_ebstt
                                                 1/db/apps_st/data/archive mand
                                                 atory max_failure=1 alternate=
                                                 log_archive_dest_2

log_archive_dest_state_1             string      ENABLE

but querying v$archive_dest shows

set head off
select*from v$archive_dest where dest_name='LOG_ARCHIVE_DEST_1';
         1
LOG_ARCHIVE_DEST_1
DEFERRED  MANDATORY SYSTEM  PRIMARY          ARCH       ACTIVE
/cln/tst/ora_ebstt1/db/apps_st/data/archive
       17391         300          0               1           0 ARCH       YES
23-JUL-23 23:48:43               17391          0             1           1
ORA-19502: write error on file "", block number  (block size=)

Resetting log_archive_dest_1 to itself does not help. But setting the state to defer and back to enable does the trick.

SQL> alter system set log_archive_dest_state_1='defer';

System altered.

SQL> alter system set log_archive_dest_state_1='enable';

System altered.

SQL> select*from v$archive_dest where dest_name='LOG_ARCHIVE_DEST_1';

         1
LOG_ARCHIVE_DEST_1
VALID     MANDATORY SYSTEM  PRIMARY          ARCH       ACTIVE
/cln/tst/ora_ebstt1/db/apps_st/data/archive
       17391         300          0               1           0 ARCH       YES
                                     0          0             0           0

If the jobs start running, all is good. Otherwise a db restart fixes the issue.

See Doc ID 1478691.1 for reasons why this might happen (generally performance issues).

ORA-01031: insufficient privileges

Scratching my head over this seemingly simple looking error.
This was the error seen on the screen

Connected to:
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.4.0.0.0

SQL> alter trigger cre_dba.trg_con_users disable;
alter trigger cre_dba.trg_con_users disable
              *
ERROR at line 1:
ORA-01031: insufficient privileges

SQL>

This was in te alertlog

2019-03-21T18:24:33.352191+01:00
SERVER COMPONENT id=UTLRP_BGN: timestamp=2019-03-21 18:24:33
2019-03-21T18:28:08.081207+01:00
Errors in file /cln/tst/ora_bin1/app/oracle/diag/rdbms/upg/upg/trace/upg_ora_46728206.trc:
ORA-04045: errors during recompilation/revalidation of CRE_DBA.TRG_CON_USERS
ORA-01031: insufficient privileges

The clue was when looking at the content of the trigger type. It was a database logon trigger.
It seems a special privilege is required!

SQL> grant administer database trigger to cre_dba;

Grant succeeded.

SQL>
Connected to:
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.4.0.0.0

SQL> alter trigger cre_dba.trg_con_users disable;

Trigger altered.

SQL>

RMAN-05624: data file name not found in the repository for data file number=80

Getting these errors using a targetless connection (only auxiliary and repository). And doing this because we don't want the transportable checks to be done!

RMAN-03002: failure of Duplicate Db command at 08-MAR-24
RMAN-05501: aborting duplication of target database
RMAN-05624: data file name not found in the repository for data file number=80
RMAN-05624: data file name not found in the repository for data file number=801
RMAN-05624: data file name not found in the repository for data file number=802
RMAN-05624: data file name not found in the repository for data file number=803

The reason seems to be a corruption of the database in the repository.

unregister database;
register database;

and the problem is fixed.

ORA-27044: unable to write the header block of file

Multiple errors in alertlog related to redo and archiving.

2024-05-09T00:10:12.708010+02:00
Errors in file /cln/acc/ora_bin/app/oracle/diag/rdbms/credoaa2/credoaa2/trace/credoaa2_arc3_51839560.trc:
ORA-19504: failed to create file "/cln/acc/ora_data/archivelog/credoaa2/log_1_1165_1167383538.arc"
ORA-27044: unable to write the header block of file
IBM AIX RISC System/6000 Error: 89: Invalid file system control data detected
Additional information: 3
Additional information: 4294967295
Additional information: 1
ARC3 (PID:51839560): Error 19504 Creating archive log file to '/cln/acc/ora_data/archivelog/credoaa2/log_1_1165_1167383538.arc'
ARC3 (PID:51839560): Stuck archiver: insufficient local LADs
ARC3 (PID:51839560): Stuck archiver condition declared

It seems the filesystem (or several of them) is (are) corrupt.
Operating system admins need to be involved to fsck the relevant filesystems.

ORA-19563: Inspect Datafile Copy: SCN number validation unsuccessful header validation failed for file <filename>

Following errors occured after restoring all the datafiles, switching them and then shutting down to rename the database in the controlfile

contents of Memory Script:
{
   sql clone "alter system set  db_name =
 ''CRELTT1'' comment=
 ''Reset to original value by RMAN'' scope=spfile";
   sql clone "alter system reset  db_unique_name scope=spfile";
   shutdown clone immediate;
}
executing Memory Script

sql statement: alter system set  db_name =  ''CRELTT1'' comment= ''Reset to original value by RMAN'' scope=spfile

sql statement: alter system reset  db_unique_name scope=spfile

Oracle instance shut down
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 07/21/2023 13:39:07
RMAN-05501: aborting duplication of target database
RMAN-03015: error occurred in stored script Memory Script
RMAN-06136: Oracle error from auxiliary database: ORA-19563: Inspect Datafile Copy: SCN number validation unsuccessful header validation failed for file /cln/tst/ora_data/creltt1/ts_thaler_data_361.dbf

Recovery Manager complete.

The message is misleading at first but after 'a while' the penny dropped.
There were two files with the same name in different directories on the source system. Unusual, but not an issue in itself. But this duplicate had a db_filename_convert parameter which caused all the files to be collected into one big filesystem.
So the controlfile saw two filenames the same (with different file numbers) but only one file on the destination filesystem (the other being overwritten).
Tried and failed to continue opening the database (to restore the other datafile) so renamed one of the duplicate filenames on the source system and reran the duplicate.

UPDATE: Happened again but this time there were 19 duplicate datafiles so not worth the energy of finding them and renaming them. The answer is to use %U in the set newname command. It makes a mess of the filenames but at least they are all guaranteed to be unique!

set echo on
connect auxiliary /;
connect catalog rman/****@rmancat;

run
{
    allocate auxiliary channel t0 type sbt_tape parms 'SBT_LIBRARY=/opt/commvault/Base/libobk.a(shr.o)' ;
    allocate auxiliary channel t1 type sbt_tape parms 'SBT_LIBRARY=/opt/commvault/Base/libobk.a(shr.o)' ;
    allocate auxiliary channel t2 type sbt_tape parms 'SBT_LIBRARY=/opt/commvault/Base/libobk.a(shr.o)' ;
    allocate auxiliary channel t3 type sbt_tape parms 'SBT_LIBRARY=/opt/commvault/Base/libobk.a(shr.o)' ;
    set until time '2024-01-05 22:29:14';
    set newname for database to '/cln/tst/ora_data/creltt2/%U';
    duplicate database clne dbid 3045137910 to creltt2
    nofilenamecheck skip tablespace TS_THALER_IOT_OLD,TS_THALER_CU,TS_THALER_BACKUP,TS_THALER_PART_OLD
    ;
}

RMAN-05548: The set of duplicated tablespaces is not self-contained

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 01/16/2024 10:53:48
RMAN-05501: aborting duplication of target database
RMAN-05548: The set of duplicated tablespaces is not self-contained

This error means that there are probably partitioned tables with partitions in different tablespaces (or other such things). Depending on the version of the database, there may be violation messages posted higher up in the logfile…

     Violation: ORA-39921: Default Partition (Table) Tablespace TS_THALER_DATA for PGD29 not contained in transportable set.
     Violation: ORA-39901: Partitioned table EPK.PGD33 is partially contained in the transportable set.
     Violation: ORA-39910: Partitioned Global index EPK.PGD33_1 in tablespace TS_THALER_INDEX points to partition P10 of table EPK.PGD33 in tablespace TS_THALER_PART_OLD outside of transportable set.
     Violation: ORA-39911: Index EPK.AGD11_4 in tablespace TS_THALER_INDEX points to partition P0413 of table EPK.AGD11 in tablespace TS_THALER_PART_OLD outside of transportable set.

This is entirely legal thing to do in the database so RMAN should handle it, but it doesn't. The workaround is to perform the duplicate without connecting to the target. Just use auxiliary and catalog connection.

RMAN-06025: no backup of log thread 1 seq 2668 lowscn 1079975830 found to restore

Duplicate failed during recovery. Seemingly cannot find an archived log. Looking at the sequence# shows it is a lot older than it should be (very likely already aged out of the controlfile and the catalog).

According to Doc ID 238422.1, it is due to a previously failed recovery that was completed using SQL instead of RMAN. From the rman catalog database, test with:

set lines 1000 pages 100
col name for a50
set numwid 20 lines 1000
col name for a50
select name, resetlogs_change#, recid, stamp, sequence#, archived, first_change#, first_time, next_change#, next_time, status
from   v$archived_log
where  &&recovery_scn between first_change# and next_change#
/

If there is a record where the name is not null, the archived is 'N' and the next_scn is extremely high, then this is the case.

Solution

From the rman catalog database… Find dbinc_key of the database using

select * from rc_database
/

then delete the offending records

delete
from   rman.al
where  1=1
and    archived  = 'N'
and    name      is not null
and    dbinc_key = <dbinc_key of database>  # do we want this? Maybe we want these gone for all databases!
/

and rerun the duplicate.

The chances are that this corrupt record exists in v$archived_log (so, the controlfile) This cannot be fixed without rebuilding the controlfile.

RMAN-06136: Oracle error from auxiliary database: ORA-19715: invalid format b for generated name

When duplicating a database with “set newname for database to …”, cloning fails after restoring the controlfiles with:

Also received

ORA-19838: cannot use this control file to mount or open database

Led to the same fix

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 07/21/2023 11:21:29
RMAN-05501: aborting duplication of target database
RMAN-06136: Oracle error from auxiliary database: ORA-19715: invalid format b for generated name
ORA-27302: failure occurred at: slgpn

Doc ID 2771480.1 explains the issue but does not explain how the error occurred.
I suspect something went wrong with the restore of the controlfiles during a previous attempt and the source db_name got an extra entry in the catalog using the destination db_unique_name.

Solution:

Go to the source db server, set the environment of the source database and connect to the catalog

RMAN> list db_unique_name of database;


List of Databases
DB Key  DB Name  DB ID            Database Role    Db_unique_name
------- ------- ----------------- ---------------  ------------------
2012947 CRELTST  3803052590       PRIMARY          CRELTST
2012947 CRELTST  3803052590       STANDBY          CRELTT1

An extra entry has been inserted (as a standby)

RMAN> unregister db_unique_name creltt1;

database db_unique_name is "creltt1", db_name is "CRELTST" and DBID is 3803052590

Want to unregister the database with target db_unique_name (enter YES or NO)? yes
database with db_unique_name creltt1 unregistered from the recovery catalog

RMAN> list db_unique_name of database;


List of Databases
DB Key  DB Name  DB ID            Database Role    Db_unique_name
------- ------- ----------------- ---------------  ------------------
2012947 CRELTST  3803052590       PRIMARY          CRELTST

RMAN> exit


Recovery Manager complete.

Rerun the duplicate and it works

RMAN-06564: must use the TO clause when the instance is started with SPFILE

From the Commvault console, running a restore…

Rman Script:
[run {
allocate channel ch1 type 'sbt_tape'
PARMS="SBT_LIBRARY=/opt/commvault/Base64/libobk.a(shr.o), BLKSIZE=1048576 ENV=(CV_mmsApiVsn=2,CV_channelPar=ch1,ThreadCommandLine= -cn CI00031899-hn481 -cs 212.113.81.130)"
TRACE 0;
send " -jm 131082 -a 2:-1 -cl 18194 -ins 4351 -at 22 -j 73218120 -jt 73218120:2:1:0:61384 -rcp 0 -ms 2 -p 1 -df";
 restore spfile ;
 startup force nomount;
}
exit;
]
Rman Log:[
Recovery Manager: Release 12.1.0.2.0 - Production on Tue Dec 28 14:58:37 2021
Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.
RMAN> 
connected to recovery catalog database
recovery catalog schema release 19.13.00.00. is newer than RMAN release
RMAN> 
connected to target database: EBST (not mounted)
RMAN> 2> 3> 4> 5> 6> 7> 8> 
allocated channel: ch1
channel ch1: SID=406 device type=SBT_TAPE
channel ch1: CommVault Systems for Oracle: Version 11.0.0(BUILD80)
sent command to channel: ch1
Starting restore at Dec 28 2021 14:58:39
released channel: ch1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 12/28/2021 14:58:39
RMAN-06564: must use the TO clause when the instance is started with SPFILE
RMAN> 
Recovery Manager complete.
]

Solution: Make sure there is an init<SID>.ora file and delete the spfile.

RMAN-06004: ORACLE error from recovery catalog database: RMAN-20005: target database name is ambiguous

Again from the Commvault console but could have been the RMAN command line, the problem here is that the database was registered twice with different DBIDs

Rman Script:
[run {
allocate channel ch1 type 'sbt_tape'
PARMS="SBT_LIBRARY=/opt/commvault/Base64/libobk.a(shr.o), BLKSIZE=1048576 ENV=(CV_mmsApiVsn=2,CV_channelPar=ch1,ThreadCommandLine= -cn CI00031899-hn481 -cs 212.113.81.130)"
TRACE 0;
send " -jm 131082 -a 2:-1 -cl 18194 -ins 4351 -at 22 -j 73218120 -jt 73218120:2:2:0:61384 -rcp 0 -ms 2 -p 1 -df";
 restore spfile ;
 startup force nomount;
}
exit;
]
Rman Log:[
Recovery Manager: Release 12.1.0.2.0 - Production on Tue Dec 28 15:07:18 2021
Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.
RMAN> 
connected to recovery catalog database
recovery catalog schema release 19.13.00.00. is newer than RMAN release
RMAN> 
connected to target database: EBST (not mounted)
RMAN> 2> 3> 4> 5> 6> 7> 8> 
allocated channel: ch1
channel ch1: SID=406 device type=SBT_TAPE
channel ch1: CommVault Systems for Oracle: Version 11.0.0(BUILD80)
sent command to channel: ch1
Starting restore at Dec 28 2021 15:07:20
released channel: ch1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 12/28/2021 15:07:20
RMAN-06004: ORACLE error from recovery catalog database: RMAN-20005: target database name is ambiguous
RMAN> 
Recovery Manager complete.
]

Solution: Find the bad (probably latest?) DBID and unregister it.

select * from (
    select rbs.db_key
    ,      rd.name
    ,      rbs.db_id
    ,      rbs.bs_key
    ,      rbs.recid
    ,      rbs.stamp
    ,      rbs.backup_type
    ,      rbs.start_time
    ,      status
    from   rc_backup_set rbs
    ,      rc_database   rd
    where  rbs.db_key = rd.db_key
    and    rbs.db_id  = rd.dbid
    and    rd.name    = 'EBST'
    order  by rbs.start_time desc
    )
where rownum <201
/

    DB_KEY NAME          DB_ID     BS_KEY      RECID      STAMP B START_TIME         S
---------- -------- ---------- ---------- ---------- ---------- - ------------------ -
 741456984 EBST     3520647526  741457647          6 1092416606 D 021-12-27 17:03:23 A
 741456984 EBST     3520647526  741457646          5 1092416602 L 021-12-27 17:03:16 A
 741456984 EBST     3520647526  741457645          4 1092413930 D 021-12-27 16:18:48 A
 741456984 EBST     3520647526  741457644          3 1092413921 L 021-12-27 16:18:33 A
 741456984 EBST     3520647526  741457643          2 1092413741 D 021-12-27 16:15:40 A
 741456984 EBST     3520647526  741457642          1 1092413737 L 021-12-27 16:15:33 A
 551048814 EBST     3456740606  741424657      73972 1092398632 D 021-12-27 12:03:51 A
 551048814 EBST     3456740606  741424548      73971 1092398625 L 021-12-27 12:03:33 A
 551048814 EBST     3456740606  741419265      73970 1092395122 D 021-12-27 11:05:19 A
 551048814 EBST     3456740606  741419247      73969 1092395108 L 021-12-27 11:04:52 A
 551048814 EBST     3456740606  741414454      73968 1092391453 D 021-12-27 10:04:10 A
 551048814 EBST     3456740606  741414363      73967 1092391448 L 021-12-27 10:03:53 A
 551048814 EBST     3456740606  741409969      73966 1092387855 D 021-12-27 09:04:11 A
 551048814 EBST     3456740606  741409839      73965 1092387842 L 021-12-27 09:03:44 A
 551048814 EBST     3456740606  741405228      73964 1092384264 D 021-12-27 08:04:22 A
 551048814 EBST     3456740606  741405074      73963 1092384252 L 021-12-27 08:04:05 A
 551048814 EBST     3456740606  741402238      73962 1092382479 D 021-12-27 07:34:37 A
 551048814 EBST     3456740606  741402176      73961 1092382471 L 021-12-27 07:34:27 A
 551048814 EBST     3456740606  741399145      73960 1092380631 D 021-12-27 07:03:49 A
 551048814 EBST     3456740606  741398898      73959 1092380623 L 021-12-27 07:03:40 A
 551048814 EBST     3456740606  741394709      73958 1092377070 D 021-12-27 06:04:28 A
RMAN> set dbid 3520647526;

executing command: SET DBID
database name is "EBST" and DBID is 3520647526

RMAN> unregister database;

database name is "EBST" and DBID is 3520647526

Do you really want to unregister the database (enter YES or NO)? yes
database unregistered from the recovery catalog

RMAN> exit

Recovery Manager complete.

RMAN-03009: failure of full resync command on default channel at <date/time>

After a database duplicate from production to a lower environment, no rman commands were possible. Unable to even allocate a channel.

RMAN> resync catalog;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of show command at 09/17/2021 09:28:44
RMAN-03014: implicit resync of recovery catalog failed
RMAN-03009: failure of full resync command on default channel at 09/17/2021 09:28:44
ORA-01403: no data found

RMAN> 

The issue is unexpected but relatively simple to fix, even if it is a bit drastic. It seems the problem is that the database controlfile has become corrupted.

alter database backup controlfile to trace as '/tmp/control_&dbname.sql';
declare
    j number;
    k number;
    filepath varchar2(4000) := '/cln/acc/ora_data/crelaa1/redo';
    sqlstr   varchar2(4000);
begin
    k := 1;
    for logfile in (select member from v$logfile)
    loop
        j := mod(k,4)+1;
        sqlstr := 'alter database rename file '''||logfile.member||''' to ''||filepath||j||'/redo'||k||'.log''';
        --dbms_output.put_line(sqlstr);
        execute immediate sqlstr;
        k := k + 1;
    end loop;
    if k = 1 then
        dbms_output.put_line('Online log already renamed');
    end if;
end;
/

Now edit the file and remove the unwanted sections, shutdown the database, recreate the controlfile and all will work again.

How to Recover from Loss Of Online Redo Log And ORA-312 And ORA-313 (Doc ID 117481.1)

Complete loss of database following rm of all members of all redolog groups. * https://support.oracle.com/epmos/faces/DocumentDisplay?id=117481.1 Oracle support requested following queries to be run

spool /tmp/recovery_3_info.txt
set pagesize 20000
set linesize 180
set pause off
set serveroutput on
set feedback on
set echo on
set numformat 999999999999999
alter session set nls_date_format = 'dd-mon-yyyy hh24:mi:ss';
archive log list;
select name,dbid,controlfile_type,open_mode,log_mode,checkpoint_change#,archive_change#,database_role from v$database;
select * from v$database_incarnation;
col name for a75
select * from v$restore_point;
select flashback_on from v$database;
select file#,name,status,enabled from v$datafile;
select file#,name,status,enabled from v$tempfile;
select TS#,NAME,INCLUDED_IN_DATABASE_BACKUP,FLASHBACK_ON from v$tablespace;
select * from v$recover_file;
select * from v$backup;
select member from v$logfile;
select * from v$log;
select * from v$logfile;
select file#,name,recover,fuzzy,checkpoint_change#,creation_change#,checkpoint_time,creation_time,RESETLOGS_TIME,status from v$datafile_header;
select status, to_char(checkpoint_change#), to_char(checkpoint_time, 'DD-MON-YYYY HH24:MI:SS') as checkpoint_time,
count(*) from v$datafile_header
group by status, checkpoint_change#, checkpoint_time order by status, checkpoint_change#, checkpoint_time;
select count(*),fhsta from x$kcvfh group by fhsta;
select count(*),fhrba_seq from x$kcvfh group by fhrba_seq;
select count(*),fhscn from x$kcvfh group by fhscn;
select count(*),fhafs from x$kcvfh group by fhafs;
select min(FHSCN) "LOW FILEHDR SCN" , max(FHSCN) "MAX FILEHDR SCN", max(FHAFS) "Min PITR ABSSCN" from X$KCVFH ;
select fhdbn,fhdbi,hxfil,fhsta,fhscn,fhafs,fhrba_seq,fhtnm tbs_name from x$kcvfh;
spool off

ORA-00392: log 10 of thread 1 is being cleared, operation not allowed

Cannot open the database with resetlogs after a clone process using RMAN duplicate.
In the alertlog we get pointed to a tracefile which hints at the problem

ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: '/cln/exp/ora_data1/dwh/redolog/redo01.log'
ORA-27037: unable to obtain file status
IBM AIX RISC System/6000 Error: 2: No such file or directory
Additional information: 3

The issue is that the clone process failed to transform the source path names into destination path names and so obviously the redolog files don't exist where the controlfile thinks they do.
Solution The answer is to simply rename the files while the database is mounted

SQL> select open_mode from v$database;

OPEN_MODE
--------------------
MOUNTED

SQL> alter database rename file '/cln/exp/ora_data1/dwh/redolog/redo01.log' to '/cln/tst/ora_data1/dwht/redolog/redo01.log';

Database altered.

SQL> alter database rename file '/cln/exp/ora_data1/dwh/redolog/redo02.log' to '/cln/tst/ora_data1/dwht/redolog/redo02.log';

Database altered.

SQL> alter database rename file '/cln/exp/ora_data1/dwh/redolog/redo03.log' to '/cln/tst/ora_data1/dwht/redolog/redo03.log';

Database altered.

As we are going to open the database with resetlogs, it doesn't matter where they are at the moment, so we can do this a bit quicker


Attempting to open the database shows another issue
<code>
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-00392: log 3 of thread 1 is being cleared, operation not allowed
ORA-00312: online log 3 thread 1: '/cln/exp/ora_data1/dwh/redolog/redo03.log'

Look at the status of the redologs

SQL> select group#,thread#,status from v$log;

    GROUP#    THREAD# STATUS
---------- ---------- ----------------
         1          1 CLEARING
         2          1 CLEARING
         3          1 CLEARING_CURRENT

10 rows selected.

Manually clear out the offending logfile

SQL> alter database clear logfile group 3;

Database altered.

SQL> select group#,thread#,status from v$log;

    GROUP#    THREAD# STATUS
---------- ---------- ----------------
         1          1 CLEARING
         2          1 CLEARING
         3          1 CURRENT

3 rows selected.

Try to open the database again

SQL> alter database open resetlogs;

Database altered.

Disco!

ORA-12003: materialized view or zonemap "KPK"."EVD01_NEW" does not exist

Here's one you shouldn't see very often.
Trying to drop a tablespace but prevented from doing so because a materialized view has referential contraints on a table in this tablespace.

SQL> drop tablespace TS_THALER_PART_OLD including contents and datafiles cascade constraints;
drop tablespace TS_THALER_PART_OLD including contents and datafiles cascade constraints
  * 
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-12083: must use DROP MATERIALIZED VIEW to drop "KPK"."EVD01_NEW"

Ok, nice of Oracle to tell us what we have to do. Simple enough. Let's drop the materialized view.

SQL> DROP MATERIALIZED VIEW "KPK"."EVD01_NEW";
DROP MATERIALIZED VIEW "KPK"."EVD01_NEW"
  * 
ERROR at line 1:
ORA-12003: materialized view or zonemap "KPK"."EVD01_NEW" does not exist

Aah. Not so obvious then.

desc "KPK"."EVD01_NEW"
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 DATMAJ                                             VARCHAR2(8 CHAR)
 HEUMAJ                                             VARCHAR2(8 CHAR)
 PGMMAJ                                             VARCHAR2(6 CHAR)
 NATOPN                                             VARCHAR2(6 CHAR)
 REFEXN                                             VARCHAR2(50 CHAR)
 SWIOLN                                             VARCHAR2(1 CHAR)
 STAEVT                                             VARCHAR2(4 CHAR)
 REFEVT                                             VARCHAR2(16 CHAR)
 NUMIDT                                             VARCHAR2(30 CHAR)
 ORIEVT                                             VARCHAR2(10 CHAR)
 REFLOG                                             VARCHAR2(16 CHAR)
 MSGEVT_CPL                                         VARCHAR2(1500 CHAR)
 REFOPN                                             VARCHAR2(16 CHAR)
 DATEVT                                             VARCHAR2(8 CHAR)
 MSGEVT_FIL_1                                       VARCHAR2(2000 CHAR)
 MSGEVT_FIL_2                                       VARCHAR2(2000 CHAR)
 MSGEVT_SPE                                         VARCHAR2(200 CHAR)
 DATEFF                                             VARCHAR2(8 CHAR)
 TMSTMP                                             VARCHAR2(15 CHAR)
 VEREVT                                             VARCHAR2(3 CHAR)
 MSGEVT_FIL_3                                       VARCHAR2(2000 CHAR)
 MSGEVT_FIL_4                                       VARCHAR2(2000 CHAR)
 TYPEVT                                             VARCHAR2(5 CHAR)
 SBP_CODAPP                                         VARCHAR2(10 CHAR)
 SBP_REFINT                                         VARCHAR2(36 CHAR)
 SBP_TYPACT                                         VARCHAR2(2 CHAR)

It exists… but as a table.
Something has gone wrong in the database somewhere. As it turns out after some deeper investigation, this database is a copy of production but “with modifications”.
After the cloning process, a schema needed renaming. Oracle have a procedure for this but it is very long-winded and time-consuming. It uses export and import with transportable tablespaces to do the remap of the schema.
An unsupported workaround to rename schema is to simply update the username in sys.user$ and restart the database.
This works for the most part but now we see a consequence of that action.

col owner      for a30
col mview_name for a30
select owner
,      mview_name
from   dba_mviews
/


OWNER                          MVIEW_NAME
------------------------------ ------------------------------
EPK                            EVD01_NEW

Ahaa, there's the materialized view but the owner is different from the one described by the database error message above. This one is the owner as it was on production.
This means the owner of materialized views has been denormalised for some reason. Reading the (complex) view text of dba_mviews, we see the owner column is based on sys.snap$.sowner

col sowner for a20
col vname  for a20
col tname  for a20
select sowner
,      vname
,      tname
from   sys.snap$
/

SOWNER               VNAME                TNAME
-------------------- -------------------- --------------------
EPK                  EVD01_NEW            EVD01_NEW

For future reference when updating the username in sys.user$, update the snapshot owner in this table as well!

update sys.snap$
set    sowner = 'KPK'
where  sowner = 'EPK'
/

Try again

DROP MATERIALIZED VIEW "KPK"."EVD01_NEW";

Materialized view dropped.

yep, and the tablespace?

drop tablespace TS_THALER_PART_OLD including contents and datafiles cascade constraints;

Tablespace dropped.

ORA-12162: TNS:net service name is incorrectly specified

Probably nothing to do with TNS. Check your ORACLE_SID is set correctly!

ORA-00054: resource busy and acquire with NOWAIT specified

SELECT O.OBJECT_NAME, S.SID, S.SERIAL#, P.SPID, S.PROGRAM,S.USERNAME,
S.MACHINE,S.PORT , S.LOGON_TIME,SQ.SQL_FULLTEXT
FROM V$LOCKED_OBJECT L, DBA_OBJECTS O, V$SESSION S,
V$PROCESS P, V$SQL SQ
WHERE L.OBJECT_ID = O.OBJECT_ID
AND L.SESSION_ID = S.SID AND S.PADDR = P.ADDR
AND S.SQL_ADDRESS = SQ.ADDRESS;
select object_name, s.sid, s.serial#, p.spid
from v$locked_object l, dba_objects o, v$session s, v$process p
where l.object_id = o.object_id and l.session_id = s.sid and s.paddr = p.addr;

then

alter system kill session 'sid,serial#';

ORA-12516: TNS:listener could not find available handler with matching

Database was running low on (and eventually out of) processes.
Waited until the db would allow sysdba logons and increased the processes parameter.
* Increased processes from 300 to 600
sessions is automatically adjusted to (1.5 * processes) + 22 if not set
transactions is automatically adjusted to (1.1 * processes) if not set

Also statically registered the database with the listener in listener.ora

Unable to uninstall old version of oracle.ahf

echo "Y"|"${ORACLE_BASE}/oracle.ahf/bin/tfactl" uninstall

AHF Uninstallation Log : /tmp/ahf_uninstall_24317334_2024_06_28-15_09_44.log
AHF Home Directory not found. Exiting uninstall ..

The problem was that this is a PowerHA cluster and when AHF was installed, it was on the other node. Now, after a failover, the original data subdirectories no longer match the current hostname.

The solution is to either failback :-) or to rebuild what is missing by:

${ORACLE_BASE}/oracle.ahf/tfa/bin/tfactl -standalone

ORA-12518: TNS:listener could not hand off client connection

The database you are trying to connect to is probably on its knees. Check server memory is not exhausted.

ORA-12519: TNS:no appropriate service handler found" in listener log file

and its associated TNS-12519: TNS:no appropriate service handler found“ in listener log file in the listener log file.
Oh, this one took me days to find!
99% of the solutions point to increasing the processes on the instance but this was definitely not the case here. Average number of processes 120 with a max. of 900.
Even with the related story of pmon not updating the listener with terminated process count is not a good enough excuse to increase processes here.
The clue was that connections using service_name were succeeding but connections using sid were not.
The situation here is that we have a cluster of 2 nodes. The parent is called hn481 and the children are called hn5114 and hn5214.
All the entries in tnsnames.ora are setup with the parent node, hn481.
Checked the listener.ora file and looking at the listener definition it is showing a host connection to hn5114. This is actually the node where all the databsaes are running - but it does not resolve to the same address as the parent (virtual) node!
Change this entry to match the tns entries, hn481, restart the listener and all is working again!

ORA-12520: TNS:listener could not find available handler for requested type of server

Strangely this could be related to number of processes being exhausted.

show parameter processes
alter system set processes=350 scope=spfile;
shutdown immediate
startup

ORA-12541: TNS: no listener

Either very basic - start the listener!
or, as in our case - not so obvious.
We use virtual IP addresses so that the IP address stays the same after failover to standby.
Due to some confused configuration, we got the network adapter on two different servers to have the same IP address.
Stop the IP address on the bad server (assign another one) and all is fine again.

ORA-12514: TNS:listener does not currently know of service

lsnrctl status <listener_name>

Been altering tnsnames.ora or listener.ora?

  • Check the local_listener parameter

Try resetting it to itself. Strange but if you are not using port 1521, this can work wonders!
Assuming listener is called LISTENER_WM9T:

alter system set local_listener=LISTENER_WM9T scope=both;
  • Try and connect with the service name or directly with
sqlplus 'sys/*******'@<host>><port>/<SID> as sysdba

Excellent description of how Oracle TNS listeners work and a checklist on how to fix this error

ORA-12547: TNS lost contact

If

sqlplus <user>/<pass>

fails with above error, try

sqlplus <user>/<pass>@<db connection>

If this works, it is most probably a permissions error.
Re-run the

$ORACLE_HOME/root.sh

script that was run as part of the original installation. This will reset the permissions on some important files.

ORA-02374: conversion error loading table "BLENGADM"."ZZ_EVTCTA"

This is typical of importing data with Datapump when the tables in the source database were created with “byte” semantics and the destination is “char” semantics.

ORA-02374: conversion error loading table "BLENGADM"."ZZ_EVTCTA"
ORA-12899: value too large for column NOMCTA (actual: 257, maximum: 256)

ORA-02372: data for row: NOMCTA : 0X'4C6976726574206427E9706172676E65202020202020202020'

Problem

The root cause is the nls_length_semantics of the table columns being BYTE where one character is assigned one byte. But after conversion in a multi-byte database, one character is larger than one byte (could be 2, 3 or 4) and no longer fits.

Solution

  • import the metadata

Run the impdp command with content=metadata_only. This will create all the tables (still in their original form) but not the data.

  • alter the BYTE columns in the affected tables to CHAR semantics
select column_name
,      char_used
,      data_length
,      data_type
from   user_tab_columns
where  table_name = 'T'
and    char_used = 'B';
COLUMN_NAME  C DATA_LENGTH DATA_TYPE
------------ - ----------- ---------
X            B           1 VARCHAR2
SQL> alter table t modify x varchar2(1 char);
Table altered.
  • Import the data

Rerun the impdp ensuring table_exists_action is not REPLACE (use truncate or append). This now imports the data into the modified tables.

This script does the donkey work of altering table column semantics from byte to char

The author of this script is unknown but he/she deserves a medal. It saves countless hours of work and is so well written.

/*
  The script converts all the VARCHAR2 columns in the user's schema
  to CHAR length semantics. Known to work on 10.2.0.4 and later.

  Script must be executed against the database without any other client
  and/or application connections to the affected schema.

  Oracle does not support CHAR semantics for the built-in schemas,
  like SYS, SYSTEM or SYSMAN, so the script will throw an error,
  if attempt to run it against any one of them.

  Upon completion database objects that have dependencies on tables
  being modified will be invalidated. Oracle usually re-compiles invalidated
  objects on the first access. Alternatively, a DBA can execute UTLPRP script
  to recompile all invalid objects in the entire database.

  Upon completion, please make sure that NLS_LENGTH_SEMANTICS instance parameter
  is set to CHAR to ensure further upgradability of the schema.
  * /
set serveroutput on size unlimited format wrap
declare
  type sql_list_t is table of varchar2(32767) index by pls_integer;
  type idx_list_t is table of user_indexes.index_name%type index by pls_integer;
  type col_list_t is table of user_tab_columns%rowtype index by pls_integer;
  --
  lv_col_cnt   pls_integer := 0;
  lv_idx_cnt   pls_integer := 0;
  lv_char_set  pls_integer := 0;
  lv_user      user_users.username%type;
  lv_sql_stmt  varchar2(32767);
  lv_byte_cols col_list_t;
  lv_idx_names idx_list_t;
  lv_idx_ddls  sql_list_t;
  --
  procedure run_sql_stmt
  (
   p_sql_stmt in varchar2
  )
  as
  begin
    execute immediate p_sql_stmt;
  exception
    when others
    then
      raise_application_error(-20202, 'Failed statement [[' || p_sql_stmt || dbms_utility.format_error_backtrace() || ']]', true);
  end;
begin
  --
  lv_user := user();
  if lv_user in ('SYS', 'SYSTEM', 'SYSMAN')
  then
    raise_application_error(-20202, 'This script cannot be executed against Oracle built-in schema [[' || lv_user || ']].');
  end if;
  --
  select
         *
         bulk collect into lv_byte_cols
  from
         user_tab_columns uc
  where
         uc.char_used = 'B'
         and
         substr(uc.table_name, 1, 4) != 'BIN$'
         and
         not exists
         (
          select 1
          from   user_views uv
          where  uv.view_name = uc.table_name
         )
  ;
  --
  lv_col_cnt := lv_byte_cols.count();
  --
  dbms_output.enable();
  --
  if lv_col_cnt > 0
  then
    for idx_rw in
    (
     select index_name
     from   user_indexes
     where  index_type = 'FUNCTION-BASED NORMAL'
    )
    loop
      lv_idx_cnt := lv_idx_cnt + 1;
      lv_idx_names(lv_idx_cnt) := idx_rw.index_name;
      lv_idx_ddls(lv_idx_cnt) := replace
                                 (
                                  dbms_metadata.get_ddl
                                  (
                                   object_type => 'INDEX',
                                   name        => idx_rw.index_name
                                  )
                                  ,
                                  ';'
                                 );
      lv_sql_stmt := 'drop index ' || idx_rw.index_name;
      run_sql_stmt(lv_sql_stmt);
      dbms_output.put_line('Dropped function-based index: ' || idx_rw.index_name);
      dbms_output.put_line('In case of script failure, restore the index by running the DDL statement below:');
      dbms_output.put_line(lv_idx_ddls(lv_idx_cnt) || ';');
    end loop;
    --
    for i in 1..lv_col_cnt
    loop
      lv_sql_stmt :=  'alter table ' || lv_byte_cols(i).table_name || ' modify (' ||
                      lv_byte_cols(i).column_name || ' ' || lv_byte_cols(i).data_type ||
                      '(' || lv_byte_cols(i).char_length || ' char))';
      run_sql_stmt(lv_sql_stmt);
    end loop;
    --
    dbms_output.new_line();
    for i in 1..lv_idx_cnt
    loop
      run_sql_stmt(lv_idx_ddls(i));
      dbms_output.put_line('Recreated function-based index: ' || lv_idx_names(i));
    end loop;
    --
    dbms_output.new_line();
    dbms_output.put_line
    (
     'Updated length semantics to CHAR for ' || lv_col_cnt || ' column' ||
     case when lv_col_cnt > 1
          then 's'
     end ||
     ' in the schema [[' || lv_user || ']].'
    );
  else
    dbms_output.put_line('No columns with BYTE length semantics were found in the schema [[' || lv_user || ']].');
  end if;
  --
  select count(*) into lv_char_set
  from   nls_session_parameters
  where  parameter = 'NLS_LENGTH_SEMANTICS'
         and
         value = 'CHAR'
  ;
  --
  if lv_char_set = 0
  then
    dbms_output.put_line('WARNING: Do not forget to change instance parameter NLS_LENGTH_SEMANTICS to CHAR and restart the database.');
  end if;
end;
/

ORA-14097: column type or size mismatch in ALTER TABLE EXCHANGE PARTITION

Also can be <tt>ORA-54033: column to be modified is used in a virtual column expression</tt>
Nothing especially to do with partitions - just any ddl operation that affects the table.
Hidden columns do not normally show up in a desc unless colinvisible is on

set colinvisible on

But these sneaky system-generated ones don't show up even with that setting on! You need to show them with this:

set pages 50 lines 1000
col column_name for a40
col data_default for a40
select column_id
,      column_name
,      data_default
,      user_generated
,      hidden_column
,      virtual_column
,      identity_column
from   dba_tab_cols
where  owner      = upper('&owner.')
and    table_name = upper('&table_name.')
/

INTERNAL_COLUMN_ID COLUMN_NAME                                        DATA_DEFAULT                                       HIDDEN_COLUM VIRTUAL_COLU
------------------ -------------------------------------------------- -------------------------------------------------- ------------ ------------
                35 MONLOT_REC_CDR                                     '0'                                                NO           NO
                34 MONLOT_REC_DBT                                     '0'                                                NO           NO
                33 MONLOT_CAL_CDR                                     '0'                                                NO           NO
                32 MONLOT_CAL_DBT                                     '0'                                                NO           NO
                31 MONMVT_CPT                                         '0'                                                NO           NO
                30 SENNOT                                             ' '                                                NO           NO
                29 NUMSEQ                                                                                                NO           NO
                28 NOMFIC                                                                                                NO           NO
                27 TOTCPT_REC                                                                                            NO           NO
                26 TOTCPT_CAL                                                                                            NO           NO
                25 MONLOT_REC                                                                                            NO           NO
                24 MONLOT_CAL                                                                                            NO           NO
                23 NBRELE_REC                                                                                            NO           NO
                22 NBRELE_CAL                                                                                            NO           NO
                21 NUMCPT_GLO                                                                                            NO           NO
                20 DEVLOT                                                                                                NO           NO
                19 CODERR                                                                                                NO           NO
                18 CANLOT                                                                                                NO           NO
                17 REFTEX                                                                                                NO           NO
                16 REFEXN                                                                                                NO           NO
                15 ETTLOT                                                                                                NO           NO
                14 TYPLOT                                                                                                NO           NO
                13 DATEXC                                                                                                NO           NO
                12 STALOT                                                                                                NO           NO
                11 REFLOT                                                                                                NO           NO
                10 USRAUT                                                                                                NO           NO
                 9 HEUAUT                                                                                                NO           NO
                 8 DATAUT                                                                                                NO           NO
                 7 PGMMAJ                                                                                                NO           NO
                 6 USRMAJ                                                                                                NO           NO
                 5 HEUMAJ                                                                                                NO           NO
                 4 DATMAJ                                                                                                NO           NO
                 3 DATCRT                                                                                                NO           NO
                 2 REFMAJ                                                                                                NO           NO
                 1 NUMVER                                                                                                NO           NO
                36 SYS_STS#KR2WNV5L070XKV1L5H7REH                     SYS_OP_COMBINED_HASH("NOMFIC","NUMSEQ")            YES          YES

36 rows selected.

That last row means extended statistics have been generated for 2 columns in this table.
You can see this because the name begins with SYS_STS. If it begins with SYS_<something else> then it is not extended statistics.
It may be an unused column. Original here

create table t1 as select * from dba_roles;

Table created.

desc t1
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 ROLE                                      NOT NULL VARCHAR2(30)
 PASSWORD_REQUIRED                                  VARCHAR2(8)
 AUTHENTICATION_TYPE                                VARCHAR2(11)

alter table t1 set unused (AUTHENTICATION_TYPE);

Table altered.

desc t1
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 ROLE                                      NOT NULL VARCHAR2(30)
 PASSWORD_REQUIRED                                  VARCHAR2(8)

select column_name from dba_tab_cols where owner = '&owner.' and table_name = '&table_name.';

COLUMN_NAME
------------------------------
SYS_C00003_18012517:25:39$
PASSWORD_REQUIRED
ROLE

SQL> alter table t1 drop unused columns;

Table altered.

select column_name from dba_tab_cols where owner = '&owner.' and table_name = '&table_name.';

COLUMN_NAME
------------------------------
PASSWORD_REQUIRED
ROLE

Solution

Drop the extended stats, do what you need to do and recreate the extended stats.

PROCEDURE DROP_EXTENDED_STATS
 Argument Name                  Type                    In/Out Default?
 ------------------------------ ----------------------- ------ --------
 OWNNAME                        VARCHAR2                IN
 TABNAME                        VARCHAR2                IN
 EXTENSION                      VARCHAR2                IN

exec dbms_stats.drop_extended_stats ( 'KPK', 'XND40', '("NOMFIC","NUMSEQ")' );

create table kpk.xnd40_new as select * from kpk.xnd40 where 1=2;

Table created.

select dbms_stats.create_extended_stats ( 'KPK', 'XND40', '("NOMFIC","NUMSEQ")' ) from   dual;

The stats columns can also be seen in their own table

set lines 1000 pages 100
col owner for a6
col table_name for a20
col extension_name  for a40
col extension  for a50
select owner, table_name, extension_name, extension, creator, droppable from dba_stat_extensions where owner = upper('&&owner.') and table_name = upper('&&table_name.') and extension_name LIKE 'SYS_STS%';

OWNER TABLE_NAME           EXTENSION_NAME                           EXTENSION                                          CREATOR                  DROPPABLE
----- -------------------- ---------------------------------------- -------------------------------------------------- ------------------------ ------------
KPK   XMD01                SYS_STSOA4UXZDBW7MIV5OOR8VOHHK           ("DATCRT","CODJRN")                                SYSTEM                   YES
KPK   XDD02                SYS_STSFJCZYRZBCQL820ADIR0Y4RZ           ("REFMSG","CPTTIT","TYPMSG")                       SYSTEM                   YES
KPK   XCD09                SYS_STS2OIO647GN0_UV$XO583KKKJ           ("DATCRT","HEUMAJ","STAMOD")                       SYSTEM                   YES
KPK   XCD09                SYS_STS_BRDODC6DJG_HXK0#O9BOYF           ("STAMOD","CODMOD")                                SYSTEM                   YES
KPK   XCD09                SYS_STS2#DY5U$WQG6COVHB##H2ESK           ("DATMAJ","STAMOD","CODMOD")                       SYSTEM                   YES
KPK   XCD09                SYS_STSO7#D3DI5R8_VAF$WJ32D8MT           ("STAMOD","KEYREF_1")                              SYSTEM                   YES
KPK   XCD09                SYS_STS4FRY10M34S2L$0FDM1N4B18           ("STAMOD","IDTMOD")                                SYSTEM                   YES

ORA-00942: table or view does not exist

When performing DST upgrade, following errors occur. It's very confusing and misleading because the simple fact is that the temporary tablespace has probably not been created (properly).

Most often seen after a database duplication and so probably not checked the temp tablespace yet!

starting check

Session altered.

INFO: Starting with RDBMS DST update preparation.
INFO: NO actual RDBMS DST update will be done by this script.
INFO: If an ERROR occurs the script will EXIT sqlplus.
INFO: Doing checks for known issues ...
INFO: Database version is 19.0.0.0 .
INFO: Database RDBMS DST version is DSTv41 .
INFO: No known issues detected.
INFO: Now detecting new RDBMS DST version.
A prepare window has been successfully started.
INFO: Newest RDBMS DST version detected is DSTv42 .
INFO: Next step is checking all TSTZ data.
INFO: It might take a while before any further output is seen ...
ERROR: Something went wrong during DBMS_DST.FIND_AFFECTED_TABLES.
A prepare window has been successfully ended.
Error code -604: ORA-00604: error occurred at recursive SQL level 1
DECLARE
*
ERROR at line 1:
ORA-20091: Stopping script - see previous message ...
ORA-06512: at line 36


DECLARE
*
ERROR at line 1:
ORA-00942: table or view does not exist
ORA-06512: at line 4



Session altered.

ORA-14404: partitioned table contains partitions in a different tablespace

As part of an RMAN duplicate with a skip tablespace, this error is produced

Reenabling controlfile options for auxiliary database
Executing: alter database enable block change tracking using file '/oracle/acc/ora_data3/adsa1/bct_adsp_do_not_delete.f'

contents of Memory Script:
{
   Alter clone database open resetlogs;
}
executing Memory Script

database opened
Dropping offline and skipped tablespaces
Executing: drop tablespace "ADS_ARCHIVE" including contents cascade constraints
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 10/16/2017 23:46:12
RMAN-05501: aborting duplication of target database
RMAN-06136: ORACLE error from auxiliary database: ORA-14404: partitioned table contains partitions in a different tablespace

Recovery Manager complete.

and when attempting to backup the database, we get errors

RMAN-06169: could not read file header for datafile 188 error reason 1
RMAN-06169: could not read file header for datafile 189 error reason 1
RMAN-06169: could not read file header for datafile 190 error reason 1
RMAN-06169: could not read file header for datafile 191 error reason 1
RMAN-06169: could not read file header for datafile 14 error reason 1
released channel: t1
released channel: t2
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup plus archivelog command at 10/17/2017 15:08:40
RMAN-06056: could not access datafile 14

Recovery Manager complete.

Problem

Tables in the tablespace have partitions in another tablespace so this one cannot be dropped.
Check which table partitions are in which tablespaces

set lines 200
set pagesize 200
col table_name for a14
col table_owner for a14
col partition_name for a14
select table_owner
,      table_name
,      partition_name
,      tablespace_name
from   dba_tab_partitions
where  (table_owner, table_name) in
       (
       select table_owner
       ,      table_name
       from   dba_tab_partitions x
       where  x.tablespace_name = '&&TABLESPACE_TO_DROP'
       and    exists ( select *
                       from   dba_tab_partitions y
                       where  x.table_owner = y.table_owner
                       and    x.table_name  = y.table_name
                       and    y.tablespace_name not in ('&TABLESPACE_TO_DROP')
                       group  by table_owner
                       ,      table_name
                     )
        )
order by 1,2,partition_position
/
undef TABLESPACE_TO_DROP
TABLE_OWNER    TABLE_NAME     PARTITION_NAME TABLESPACE_NAME
-------------- -------------- -------------- ------------------------------
KPK            XND20          P0910          TS_THALER_PART_OLD
KPK            XND20          P1112          TS_THALER_PART_OLD
KPK            XND20          P13            TS_THALER_PART_OLD
KPK            XND20          P14            TS_THALER_PART_OLD
KPK            XND20          P15            TS_THALER_PART_OLD
KPK            XND20          P16            TS_THALER_DATA
KPK            XND20          P17            TS_THALER_DATA
KPK            XND20          P18            TS_THALER_DATA
KPK            XND20          PMAX           TS_THALER_DATA

Solution

If the intention is to keep all the tables then run this query to generate statements to move the relevant tables out of this tablespace

select 'alter table '||b.table_owner||'.'||b.table_name||' move partition '||b.partition_name||' tablespace &NEW_TABLESPACE;'
from   (
       select distinct table_name
       ,      partition_name
       from   dba_tab_partitions
       where  tablespace_name = '&&TABLESPACE_NAME'
       )                  a
,      dba_tab_partitions b
where  a.table_name       = b.table_name
and    b.tablespace_name != '&TABLESPACE_NAME'
/
undef TABLESPACE_NAME

If however, the intention is to drop the tablespace anyway, the tables need to be dropped before the tablespace can be dropped.
But …tables with partitions in different tablespaces cannot be dropped. The partitions need to be dropped first!
Run the following query to generate statements to drop all the 'problem' tables. When these have gone, the tablespace can be dropped.

  • specific script to generate drop commands for all partitions and tables for a customers tablespace…
SELECT exec_statement
FROM   (SELECT      'exec ADS.P_ROTATE_LIB.P_DROP_PARTITION('''
                 || table_owner
                 || ''''
                 || ','''
                 || table_name
                 || ''','''
                 || partition_name
                 || ''',1);'
                     AS exec_statement
        FROM     dba_tab_partitions
        WHERE    table_owner || table_name IN
                     (
                         SELECT table_owner || table_name
                         FROM   dba_tab_partitions
                         WHERE  table_owner = 'ADS' AND tablespace_name <> 'ADS'
                     )
        ORDER BY table_name, partition_name DESC)
UNION ALL
SELECT DISTINCT 'drop table ' || table_owner || '.' || table_name || ';' AS exec_statement
FROM   dba_tab_partitions
WHERE  table_owner = 'ADS' AND tablespace_name <> 'ADS'
/

or individually…

  • drop table partitions
spool /tmp/drop_table_partitions.sql
sqlplus / as sysdba<<EOSQL
set headi off newpa none feedb off trims on echo off
select 'alter table '||table_owner||'.'||table_name||' drop partition '||partition_name||';'
from   dba_tab_partitions
where  tablespace_name = '$TABLESPACE_NAME'
/
spool off
EOSQL
echo "@/tmp/drop_table_partitions.sql" | sqlplus / as sysdba
  • drop tables
sqlplus / as sysdba<<EOSQL
select 'drop table '||table_owner||'.'||table_name||';'
from   dba_tab_partitions
where  tablespace_name = '$TABLESPACE_NAME'
spool /tmp/drop_tables.sql
/
spool off
EOSQL
echo "@/tmp/drop_tables.sql" | sqlplus / as sysdba
  • drop tablespace
drop tablespace ads_archive including contents and datafiles
/

Find all table partitions in tablespaces with missing datafiles

set lines 1000 pages 100
col owner for a10
col segment_name for a40
col segment_type for a25
col partition_name for a20
col tablespace_name for a25
select owner
,      segment_name
,      segment_type
,      partition_name
,      tablespace_name
from   dba_segments
where  segment_type in ('TABLE PARTITION', 'TABLE SUBPARTITION')
and    tablespace_name in (
                          select tablespace_name
                          from   dba_data_files
                          where  file_name like '%MISSING%'
                          )
order  by 1, 2, decode (segment_type, 'TABLE SUBPARTITION', 1, 2),4

Use exchange partition to alter metadata of the tablespaces without moving the actual data

  • this is an explanation of what you are looking for!

This is a way of doing the exchange with a neat PL/SQL procedure. It might not do what you want though so understand it before running it!

set serveroutput on size unlimited
DECLARE
  dummy_table                   VARCHAR2 (128);
  cmd                           VARCHAR2 (2048);
  currowner                     dba_part_tables.owner%TYPE;
  currtable                     dba_part_tables.table_name%TYPE;
  l_subpartitioning_type        dba_part_tables.subpartitioning_type%TYPE;
  l_def_subpartition_count      dba_part_tables.def_subpartition_count%TYPE;
  l_subpartitioning_key_count   dba_part_tables.subpartitioning_key_count%TYPE;
  l_curr_qual_table             VARCHAR2 (128);

  PROCEDURE execsql (p_sql IN VARCHAR2)
  IS
  BEGIN
    DBMS_OUTPUT.put_line (p_sql);
    EXECUTE IMMEDIATE p_sql;
  END;

  PROCEDURE force_drop_table (p_table_name IN VARCHAR2)
  IS
  BEGIN
    execsql ('drop table ' || p_table_name || ' purge');
  EXCEPTION
    WHEN OTHERS
    THEN
      NULL;
  END;

  PROCEDURE exchange_partition (p_from_table       IN VARCHAR2,
                                p_from_partition   IN VARCHAR2,
                                p_to_table         IN VARCHAR2)
  IS
  BEGIN
    execsql (
         'alter table '
      || p_from_table
      || ' exchange partition '
      || p_from_partition
      || ' with table '
      || p_to_table
      || ' excluding indexes');
  END;

  PROCEDURE drop_partition (p_table IN VARCHAR2, p_partition IN VARCHAR2)
  IS
  BEGIN
    execsql ('alter table ' || p_table || ' drop partition ' || p_partition);
  END;
BEGIN
  currowner := '.';
  currtable := '.';

  FOR asegment
    IN (  SELECT owner,
                 segment_name,
                 segment_type,
                 partition_name
            FROM dba_segments
           WHERE     segment_type IN ('TABLE PARTITION', 'TABLE SUBPARTITION')
                 AND tablespace_name IN (SELECT tablespace_name
                                           FROM dba_data_files
                                          WHERE file_name LIKE '%MISSING%')
        ORDER BY 1,
                 2,
                 DECODE (segment_type, 'TABLE SUBPARTITION', 1, 2),
                 4)
  LOOP
    BEGIN
      IF currowner <> asegment.owner OR currtable <> asegment.segment_name
      THEN
        currowner := asegment.owner;
        currtable := asegment.segment_name;
        l_curr_qual_table := asegment.owner || '.' || asegment.segment_name;
        dummy_table := asegment.owner || '.TBR_EXCHANGE_DUMMY';

        force_drop_table (dummy_table);

        IF asegment.segment_type = 'TABLE SUBPARTITION'
        THEN
          cmd := 'create table ' || dummy_table || ' partition by ';

          SELECT subpartitioning_type,
                 def_subpartition_count,
                 subpartitioning_key_count
            INTO l_subpartitioning_type,
                 l_def_subpartition_count,
                 l_subpartitioning_key_count
            FROM dba_part_tables
           WHERE     owner = asegment.owner
                 AND table_name = asegment.segment_name;

          cmd := cmd || l_subpartitioning_type || '(';

          FOR asubpartkey
            IN (  SELECT column_position, column_name
                    FROM dba_subpart_key_columns
                   WHERE     owner = asegment.owner
                         AND name = asegment.segment_name
                         AND object_type = 'TABLE'
                ORDER BY column_position)
          LOOP
            IF asubpartkey.column_position > 1
            THEN
              cmd := cmd || ',';
            END IF;

            cmd := cmd || asubpartkey.column_name;
          END LOOP;

          cmd := cmd || ') partitions (';

          FOR partnr IN 1 .. l_def_subpartition_count
          LOOP
            IF partnr > 1
            THEN
              cmd := cmd || ',';
            END IF;

            cmd := cmd || 'partition p' || partnr;
          END LOOP;

          cmd : ======
            cmd || ') as select * from ' || l_curr_qual_table || ' where 1=0';
          execsql (cmd);
        ELSE
          execsql (
               'create table '
            || dummy_table
            || ' as select * from '
            || l_curr_qual_table
            || ' where 1=0');
        END IF;
      END IF;

      exchange_partition (l_curr_qual_table,
                          asegment.partition_name,
                          dummy_table);

      drop_partition (l_curr_qual_table, asegment.partition_name);
    EXCEPTION
      WHEN OTHERS
      THEN
        DBMS_OUTPUT.put_line (
          asegment.owner || '.' || asegment.segment_name || ' ' || SQLERRM);
    END;
  END LOOP;

  IF dummy_table IS NOT NULL
  THEN
    force_drop_table (dummy_table);
  END IF;

  FOR atablespace IN (  SELECT DISTINCT tablespace_name
                          FROM dba_data_files
                         WHERE file_name LIKE '%MISSING%'
                      ORDER BY 1)
  LOOP
    execsql (
         'drop tablespace '
      || atablespace.tablespace_name
      || ' including contents and datafiles');
  END LOOP;
END;
/

Workaround

While working on the solution, a backup can be made using the “skip inaccessible” option. Put this in an rman cmdfile…

connect catalog rmanusr/rmanpwd@rmancat
connect target sys/syspwd@adsa1
run {
allocate channel t1 type 'sbt_tape' parms 'ENV=(NSR_SERVER=hn6000.company.be,NSR_CLIENT=hn491,NSR_DATA_VOLUME_POOL=DD1DAILY,NSR_END_ERROR_IGNORE=TRUE)';
allocate channel t2 type 'sbt_tape' parms 'ENV=(NSR_SERVER=hn6000.company.be,NSR_CLIENT=hn491,NSR_DATA_VOLUME_POOL=DD1DAILY,NSR_END_ERROR_IGNORE=TRUE)';
configure retention policy to recovery window of 28 days;
configure controlfile autobackup on;
crosscheck archivelog all;
SQL 'ALTER SYSTEM SWITCH LOGFILE';
SQL 'CREATE PFILE FROM SPFILE';
backup filesperset 1 format 'dbfull_%d_%I_%t_%s_%p' full database plus archivelog skip inaccessible delete all input;
backup current controlfile;
release channel t1;
release channel t2;
}
exit

Another way of deleting the offending objects

Taken from Recover from a failed RMAN duplicate
Need to check it before running it blindly!

set echo off feed off termo off trims on pages 0 newpa none lines 2000 headi off long 32000
col val for a1000
spool destroy_offending_objects.sql

select to_clob ('alter table '|| table_name||' drop constraint '||constraint_name||';') Val
from user_constraints where constraint_type in ('R','P') and table_name in (select distinct table_name from user_tab_partitions)
union all
select to_clob ('drop index '||index_name||';') Val from user_indexes where table_name in (select distinct table_name from user_tab_partitions)
union all
select to_clob ('alter table '||table_name|| ' drop partition '||partition_name||';') from dba_tab_partitions
where tablespace_name in (select tablespace_name from dba_data_files where file_name like '%MISSING%')
union all
Select case
when instr (VAl, 'PARTITION') = 0 Then
substr (Val,1,InStr (Val,')')+1)||';'
else
substr (Val,1,InStr (Val,')')+1)||' local;'
End val
from
(select dbms_metadata.get_ddl ('INDEX', index_name,'TEST') Val from user_indexes where table_name in (select distinct table_name from user_tab_partitions))
union all
Select Val
from
(select dbms_metadata.get_dependent_ddl ('REF_CONSTRAINT', table_name,'TEST') Val
from user_tables where table_name in (select distinct table_name from user_tab_partitions join user_constraints using ( table_name)
where constraint_type='R'))
union all
select Val
from
(select dbms_metadata.get_ddl ('CONSTRAINT', constraint_name,'TEST') Val
from user_constraints
where constraint_type='P' and table_name in (select distinct table_name from user_tab_partitions)
)
union all
select to_clob (val)
from (select distinct 'drop tablespace '||tablespace_name|| ' including contents and datafiles;' val
from dba_tab_partitions
where tablespace_name in (select tablespace_name from dba_data_files where file_name like '%MISSING%')
);

spoo off

@destroy_offending_objects

ORA-28112: failed to execute policy function

when exporting or importing using Data Pump< /br> During expdp is accompanied by “ORA-31693: Table data object “SYSMAN”.”MGMT_IP_REPORT_DEF” failed to load/unload and is being skipped due to error:

Reason

This happens due to audit policies being defined on the table but the policy function is defined in another schema.

Solution

Either drop the policy after importing the table with:

begin
    for rec in (select * from dba_audit_policies where object_schema = 'SYSMAN') loop
        dbms_fga.drop_policy(object_schema => rec.object_schema,
                             object_name => rec.object_name,
                             policy_name => rec.policy_name);
    end loop;
end;
/

or exclude the policies during export by adding this to the .par file:

exclude=FGA_POLICY

or even better, give the necessary grants to the exporting user…

grant exempt access policy to impexpusr;

The sysdba role has this automatically.

ORA-17629: Cannot connect to the remote database server

Active duplication fails to connect even though dns connection exists in tnsnames.ora

Problem:

DUPLICATE TARGET DATABASE FROM ACTIVE DATABASE DORECOVER NOFILENAMECHECK;

RMAN-03002: failure of Duplicate Db command at 05/27/2015 12:52:24
RMAN-05501: aborting duplication of target database
RMAN-03015: error occurred in stored script Memory Script
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 05/27/2015 12:52:23
ORA-17629: Cannot connect to the remote database server
ORA-17627: ORA-12154: TNS:could not resolve the connect identifier specified

ORA-17629: Cannot connect to the remote database server

Solution:

Update the tnsnames.ora of both destination and source ORACLE_HOMEs!

ORA-01950: no privileges on tablespace 'SYSAUX'

26-JUN-15 03:12:27.545: >>> ORA-31642: the following SQL statement fails:
BEGIN "SYS"."DBMS_RULE_EXP_RULES".SCHEMA_CALLOUT(:1,0,1,'12.01.00.02.00'); END;
ORA-01950: no privileges on tablespace 'SYSAUX'

Cause:
In this case, it seems SYSMAN has no rights to create objects in the SYSAUX tablespace
Solution:

alter user SYSMAN quota unlimited on sysaux;

More information here

ORA-39080: failed to create queues "KUPC$C_1_20150616165037" and "KUPC$S_1_20150616165037" for Data Pump job

expdp /

Export: Release 11.2.0.4.0 - Production on Tue Jun 16 16:50:36 2015

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORA-31626: job does not exist
ORA-31637: cannot create job SYS_EXPORT_SCHEMA_01 for user OPS$ORAIBM
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
ORA-06512: at "SYS.KUPV$FT_INT", line 798
[[ORA-39080: failed to create queues "KUPC$C_1_20150616165037" and "KUPC$S_1_20150616165037" for Data Pump job]]
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
ORA-06512: at "SYS.KUPC$QUE_INT", line 1534
ORA-24002: QUEUE_TABLE SYS.AQ$KUPC$DATAPUMP_QUETAB_1 does not exist

Cause:

Possibly some or all of OLAP module has got itself deinstalled.

Solution:

Try:

  • Recompiling invalid objects. @?/rdbms/admin/utlrp
  • Reinstalling DBMS_CUBE packages by (re)running catproc.sql. @?/rdbms/admin/catproc followed by @?/rdbms/admin/utlrp
  • Reinstalling OLAP. @?/olap/admin/olap.sql SYSAUX TEMP; But see Metalink note ID 296187.1 for full instructions.
  • Check metalink for bugs. See ID 345198.1 and possibly ID 453796.1

ORA-14063: Unusable index exists on unique/primary constraint key

ORA-39083: Object type CONSTRAINT failed to create with error:
During an import datapump (impdp), import failed because indexes were in error before the tables were exported. This causes the import of rows to be skipped.
If the export cannot be done again (having compiled the indexes), then the metadata can be imported and the indexes compiled before importing the data.

  • Import the metadata
cat<<EOCAT >impdp_adst_ads_archive_metadata.par
userid='/ as sysdba'
dumpfile=adst_ads_archive.dmp
logfile=impdp_adst_ads_archive_metadata.log
content=metadata_only
EOCAT

impdp parfile=impdp_adst_ads_archive_metadata.par
  • Find the bad indexes and recompile them
select 'alter index '|| owner||'.'||index_name||' rebuild online parallel 8;'
from   dba_indexes
where  status = 'UNUSABLE'
/
  • Import the data
cat<<EOCAT >impdp_adst_ads_archive_data.par
userid='/ as sysdba'
dumpfile=adst_ads_archive.dmp
logfile=impdp_adst_ads_archive_data.log
table_exists_action=append
content=data_only
EOCAT

impdp parfile=impdp_adst_ads_archive_data.par

ORA-09925: Unable to create audit trail file

SQL> startup nomount pfile="/oracle/TRSCRP1/admin/initTRSCRP1.ora"
ORA-09925: Unable to create audit trail file
SVR4 Error: 2: No such file or directory
Additional information: 9925

or

connected to auxiliary database (not started)
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 08/29/2017 15:53:09
RMAN-05501: aborting duplication of target database
RMAN-03015: error occurred in stored script Memory Script
RMAN-04014: startup failed: ORA-09925: Unable to create audit trail file
IBM AIX RISC System/6000 Error: 2: No such file or directory
Additional information: 9925

Recovery Manager complete.

Problem

This will be almost certainly one of two issues. Either the directory is not writable by the id that started the instance or the directory just does not exist.

Solution

Note there can be a difference between what you see when you type:

show parameter audit

and when you type:

strings -a $ORACLE_HOME/dbs/spfile${ORACLE_SID}.ora | grep -i audit

due to someone doing an “alter system” without the “scope=spfile” or “scope=both”

SQL> host ls -al /oracle/TRSCRP1/admin/adump
SQL> host mkdir /oracle/TRSCRP1/admin/adump

ORA-03113: end-of-file on communication channel

Problem
After a shutdown abort and a startup, got nasty looking errors. Shutdown and restart, same error, different codes!

SQL*Plus: Release 12.2.0.1.0 Production on Thu Jun 20 19:26:32 2019

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup 
ORACLE instance started.

Total System Global Area 2097152000 bytes
Fixed Size                  8622624 bytes
Variable Size             788532704 bytes
Database Buffers         1291845632 bytes
Redo Buffers                8151040 bytes
Database mounted.
ORA-03113: end-of-file on communication channel
Process ID: 3250
Session ID: 9 Serial number: 63490

Solution
Clear any unarchived redo and try again

alter database clear unarchived logfile group 1;
alter database clear unarchived logfile group 2;
alter database clear unarchived logfile group 3;

shu immediate
startup 
ORACLE instance started.

Total System Global Area 2097152000 bytes
Fixed Size                  8622624 bytes
Variable Size             788532704 bytes
Database Buffers         1291845632 bytes
Redo Buffers                8151040 bytes
Database mounted.
Database Opened.
SQL>

ORA-09925: Unable to create audit trail file

When starting SQL*Plus with no db processes running (expecting to see “Connected to an idle instance”), we get this:

ERROR:
ORA-09925: Unable to create audit trail file
IBM AIX RISC System/6000 Error: 2: No such file or directory
Additional information: 9925
ORA-01075: you are currently logged on
  • Filesystem permissions are fine
  • 'strings spfile<SID>.ora | grep audit' shows the correct directory
  • Running on AIX

AIX is the clue here… need to check for semaphores and locked shared memory objects

(0) UCLID55D oraibm@solax082:/oracle/product/11.2.0.3/bin> sysresv

IPC Resources for ORACLE_SID "UCLID55D" :
Shared Memory:
ID              KEY
8388640         0xffffffff
579862561       0xffffffff
384827426       0x326f32e8

Semaphores:
ID              KEY
167772287       0xf09f4914
Oracle Instance alive for sid "UCLID55D"

(0) UCLID55D oraibm@solax082:/oracle/product/11.2.0.3/bin> ipcrm -m 8388640
(0) UCLID55D oraibm@solax082:/oracle/product/11.2.0.3/bin> ipcrm -m 579862561
(0) UCLID55D oraibm@solax082:/oracle/product/11.2.0.3/bin> ipcrm -m 384827426

(0) UCLID55D oraibm@solax082:/oracle/product/11.2.0.3/bin> ipcrm -s 167772287

(0) UCLID55D oraibm@solax082:/oracle/product/11.2.0.3/bin> sysresv

IPC Resources for ORACLE_SID "UCLID55D" :
Shared Memory
ID              KEY
No shared memory segments used
Semaphores:
ID              KEY
No semaphore resources used
Oracle Instance not alive for sid "UCLID55D"

(0) UCLID55D oraibm@solax082:/oracle/product/11.2.0.3/bin> ps -ef | grep UCLID55D
oraibm 3326 23776 0 14:12:05 pts/1 0:00 grep UCLID55D

RMAN-06457: UNTIL SCN (325670056508) is ahead of last SCN in archived logs (325670045001)

During RMAN duplicate this error meant that the clone could not go ahead. Even though all the logs had been archived and backed up with Commvault, the error still showed up.
It turns out Commvault was not setup to sync the catalog (in advanced options tab).
I found it when I went to RMAN via the command line and did a 'list archivelog all'. Before starting to list everything, it did a resync which took an age. This was the clue.

RMAN-06023: no backup or copy of datafile 1 found to restore

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 05/16/2018 16:08:13
RMAN-05501: aborting duplication of target database
RMAN-05556: not all datafiles have backups that can be recovered to SCN 278250901080
RMAN-03015: error occurred in stored script Memory Script
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 7 found to restore
RMAN-06023: no backup or copy of datafile 6 found to restore
RMAN-06023: no backup or copy of datafile 5 found to restore
RMAN-06023: no backup or copy of datafile 4 found to restore
RMAN-06023: no backup or copy of datafile 3 found to restore
RMAN-06023: no backup or copy of datafile 2 found to restore
RMAN-06023: no backup or copy of datafile 1 found to restore

Seems pretty straightforward? SCN was set too early for the retention period. But no, not this time.

RMAN> list backup of datafile 1;


List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
110170340 Incr 0  132.90G    SBT_TAPE    00:18:32     2018-05-14 01:19:40
        BP Key: 110170345   Status: AVAILABLE  Compressed: NO  Tag: WEEKLY_FULL
        Handle: 24639762_REPORTA_07t2r3uk_1_1   Media: V_17152809_77191330
  List of Datafiles in backup set 110170340
  File LV Type Ckp SCN    Ckp Time            Name
  ---- -- ---- ---------- ------------------- ----
  1    0  Incr 277998128991 2018-05-14 01:01:08 /cln/acc/ora_data3/reporta/system01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
110355808 Incr 1  204.00M    SBT_TAPE    00:05:13     2018-05-15 01:06:22
        BP Key: 110355813   Status: AVAILABLE  Compressed: NO  Tag: DAILY_INCREMENTAL
        Handle: 24661053_REPORTA_3ft2toal_1_1   Media: V_17173010_77253424
  List of Datafiles in backup set 110355808
  File LV Type Ckp SCN    Ckp Time            Name
  ---- -- ---- ---------- ------------------- ----
  1    1  Incr 278044267395 2018-05-15 01:01:09 /cln/acc/ora_data3/reporta/system01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
110543802 Incr 1  237.00M    SBT_TAPE    00:05:51     2018-05-16 01:07:40
        BP Key: 110543807   Status: AVAILABLE  Compressed: NO  Tag: DAILY_INCREMENTAL
        Handle: 24681602_REPORTA_6nt30cnt_1_1   Media: V_17133646_77315270
  List of Datafiles in backup set 110543802
  File LV Type Ckp SCN    Ckp Time            Name
  ---- -- ---- ---------- ------------------- ----
  1    1  Incr 278286445856 2018-05-16 01:01:50 /cln/acc/ora_data3/reporta/system01.dbf

SCN was only 12 hours ago with a retention of 28 days! The backup piece dated 2018-05-15 01:06:22 is clearly available and on the device type set_tape.
The trick here was to look back through the logs and look more closely at what the file restore message was saying…

channel t0: starting datafile backup set restore
channel t0: specifying datafile(s) to restore from backup set
channel t0: restoring datafile 00001 to /cln/acc/ora_data3/reporta/system01.dbf             < < < ==============
channel t0: reading from backup piece dbfull_REPORTA_738887052_967580186_116_1
channel t2: ORA-19870: error while restoring backup piece dbfull_REPORTA_738887052_967579750_113_1
ORA-19507: failed to retrieve sequential file, handle="dbfull_REPORTA_738887052_967579750_113_1", parms=""
ORA-27029: skgfrtrv: sbtrestore returned error
ORA-19511: non RMAN, but media manager or vendor specific failure, error text:
   CreateOraObject20: Job[[0]] thread[[55116090]]: Restore: GetBackupInfo() for Archive File[[dbfull_REPORTA_738887052_967579750_113_1]] failed.
ORA-0651

It was not the fact that it could not find the data on tape, it was that it could not save the file to the location indicated!! In the RMAN DUPLICATE script, I had all the file paths redirected (a mixture of convert parameters and spfile set) to a /restore filesystem.
But I forgot one!
A handy thing to do is to search out the file paths with this to see if something is still wrong:

cd $ORACLE_HOME/dbs
strings -a spfile${ORACLE_SID}.ora | grep dest

This should show any paths still not getting caught by the DUPLICATE script.

RMAN-06136: ORACLE error from auxiliary database: ORA-06502: PL/SQL: numeric or value error

When cloning a database, the duplicate fails with this error.

Problem

This duplicate had no target connection but did have a catalog and auxiliary connection. In the catalog (which was the catalog where the target was registerd), there was also an entry in that catalog with the same name as the auxiliary - left over from the days when these 2 instances were Primary and Standby in a Dataguard configuration.

...
Datafile 414 skipped by request
Datafile 415 skipped by request
Datafile 419 skipped by request
Datafile 420 skipped by request
Datafile 421 skipped by request

DBGSQL:     AUXILIARY> begin :ofname := sys.dbms_backup_restore.convertFileName( fname   =>   :ifname, ftype   =>   :iftype, osftype =>   TRUE); end;
DBGSQL:        sqlcode = 6502
DBGSQL:         B :ofname = NULL
DBGSQL:         B :ifname  ======
DBGSQL:         B :iftype = 2
restarting auxiliary database without server parameter file
Oracle instance started

Total System Global Area   32068440064 bytes

Fixed Size                     2262200 bytes
Variable Size              16978545480 bytes
Database Buffers           15032385536 bytes
Redo Buffers                  55246848 bytes
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 10/04/2017 14:50:29
RMAN-05501: aborting duplication of target database
RMAN-06136: ORACLE error from auxiliary database: ORA-06502: PL/SQL: numeric or value error

Recovery Manager complete.

Solution

Connect to the catalog and unregister the name of the auxiliary database. It shouldn't be there anyway.

rman catalog rmanusr/rmanpwd@rmancat

Recovery Manager: Release 11.2.0.4.0 - Production on Wed Oct 4 15:00:00 2017

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to recovery catalog database

RMAN> set dbid 4260753020;

executing command: SET DBID
database name is "LBK" and DBID is 4260753020

RMAN> list db_unique_name of database;


List of Databases
DB Key  DB Name  DB ID            Database Role    Db_unique_name
------- ------- ----------------- ---------------  ------------------
13301587 LBK      4260753020       PRIMARY          LBK
13301587 LBK      4260753020       STANDBY          ACC_PERF
13301587 LBK      4260753020       STANDBY          LBKRO

RMAN> unregister db_unique_name 'ACC_PERF';

database db_unique_name is "ACC_PERF", db_name is "LBK" and DBID is 4260753020

Want to unregister the database with target db_unique_name (enter YES or NO)? YES
database with db_unique_name ACC_PERF unregistered from the recovery catalog

RMAN> exit

ORA-39181: Only partial table data may be exported due to fine grain access control on "owner"."<table_name>"

Reason

This happens when applications are designed with fine-grained access.

Solution

Grant the necessary privileges to the exporting user…

grant exempt access policy to ops$oraibm;

ORA-40238: invalid linear algebra shared library

During installation of Oracle software 18c, errors are received. This is because the 18c installer uses Fortran Runtime libraries not always installed.

ORA-40238: invalid linear algebra shared library
/cln/acc/ora_bin1/app/oracle/product/18.4/dbhome_1/lib/libora_netlib.so

Check for the presence of the necessary libraries using

lslpp -L all | grep -i "Fortran Runtime"

ORA-04030: out of process memory when trying to allocate 2520 bytes

expdp problem (ORA-04030: out of process memory when trying to allocate 2520 bytes (pga heap,koh-kghu call heap))

select value from v$pgastat where name='maximum PGA allocated';

SHOW PARAMETER TARGET

ORA-04030: out of process memory when trying to allocate 2520 bytes (pga heap,koh-kghu call heap)

alter system reset pga_aggregate_target scope=spfile;

show sga

select * from v$pgastat;

show parameter process

select sum(value)/1024/1024 Mb
from   v$sesstat s, v$statname n
where  1=1
and    n.STATISTIC# = s.STATISTIC#
and    name = 'session pga memory'

show parameter WORKAREA

select value from v$pgastat where name='maximum PGA allocated';

alter system set memory_max_target=10G scope=spfile;

alter system set memory_target=3G scope=both;

select * from v$memory_target_advice order by memory_size;

ORA-445 Background Process "m000" Did Not Start After 60 Seconds

Extended the default timeout on the listener by adding

sqlnet.inbound_connection_timeout=180

to the sqlnet.ora

inbound_connection_timeout=120

and to the listener.ora

opidrv aborting process J002 ospid (1573990) as a result of ORA-1013

This means that a job has been automatically cancelled because it overran the maintenance window. Check what the values are at the moment.

col window_name     for a25
col resource_plan   for a30
col repeat_interval for a80
col duration        for a15

select window_name,resource_plan, repeat_interval, duration from dba_scheduler_windows;

This gives us something like this…

WINDOW_NAME                    RESOURCE_PLAN                  REPEAT_INTERVAL                                                                  DURATION
------------------------------ ------------------------------ -------------------------------------------------------------------------------- ------------------------------
MONDAY_WINDOW                  DEFAULT_MAINTENANCE_PLAN       freq=daily;byday=MON;byhour=22;byminute=0; bysecond=0                            +000 04:00:00
TUESDAY_WINDOW                 DEFAULT_MAINTENANCE_PLAN       freq=daily;byday=TUE;byhour=22;byminute=0; bysecond=0                            +000 04:00:00
WEDNESDAY_WINDOW               DEFAULT_MAINTENANCE_PLAN       freq=daily;byday=WED;byhour=22;byminute=0; bysecond=0                            +000 04:00:00
THURSDAY_WINDOW                DEFAULT_MAINTENANCE_PLAN       freq=daily;byday=THU;byhour=22;byminute=0; bysecond=0                            +000 04:00:00
FRIDAY_WINDOW                  DEFAULT_MAINTENANCE_PLAN       freq=daily;byday=FRI;byhour=22;byminute=0; bysecond=0                            +000 04:00:00
SATURDAY_WINDOW                DEFAULT_MAINTENANCE_PLAN       freq=daily;byday=SAT;byhour=6;byminute=0; bysecond=0                             +000 20:00:00
SUNDAY_WINDOW                  DEFAULT_MAINTENANCE_PLAN       freq=daily;byday=SUN;byhour=6;byminute=0; bysecond=0                             +000 20:00:00
WEEKNIGHT_WINDOW                                              freq=daily;byday=MON,TUE,WED,THU,FRI;byhour=22;byminute=0; bysecond=0            +000 08:00:00
WEEKEND_WINDOW                                                freq=daily;byday=SAT;byhour=0;byminute=0;bysecond=0                              +002 00:00:00

9 rows selected.

The values are set to the defaults. We can extend the night window from 4 hours to 6.

begin
    dbms_scheduler.disable(name => 'MONDAY_WINDOW');
    dbms_scheduler.disable(name => 'TUESDAY_WINDOW');
    dbms_scheduler.disable(name => 'WEDNESDAY_WINDOW');
    dbms_scheduler.disable(name => 'THURSDAY_WINDOW');
    dbms_scheduler.disable(name => 'FRIDAY_WINDOW');
    dbms_scheduler.set_attribute ( name      => 'MONDAY_WINDOW',
                                   attribute => 'DURATION',
                                   value     => numtodsinterval(6, 'hour')
                                 );
    dbms_scheduler.set_attribute ( name      => 'TUESDAY_WINDOW',
                                   attribute => 'DURATION',
                                   value     => numtodsinterval(6, 'hour')
                                 );
    dbms_scheduler.set_attribute ( name      => 'WEDNESDAY_WINDOW',
                                   attribute => 'DURATION',
                                   value     => numtodsinterval(6, 'hour')
                                 );
    dbms_scheduler.set_attribute ( name      => 'THURSDAY_WINDOW',
                                   attribute => 'DURATION',
                                   value     => numtodsinterval(6, 'hour')
                                 );
    dbms_scheduler.set_attribute ( name      => 'FRIDAY_WINDOW',
                                   attribute => 'DURATION',
                                   value     => numtodsinterval(6, 'hour')
                                 );
    dbms_scheduler.enable(name => 'MONDAY_WINDOW');
    dbms_scheduler.enable(name => 'TUESDAY_WINDOW');
    dbms_scheduler.enable(name => 'WEDNESDAY_WINDOW');
    dbms_scheduler.enable(name => 'THURSDAY_WINDOW');
    dbms_scheduler.enable(name => 'FRIDAY_WINDOW');
end;
/

And checking the results again shows…

WINDOW_NAME               RESOURCE_PLAN                  REPEAT_INTERVAL                                                                  DURATION
------------------------- ------------------------------ -------------------------------------------------------------------------------- ---------------
MONDAY_WINDOW             DEFAULT_MAINTENANCE_PLAN       freq=daily;byday=MON;byhour=22;byminute=0; bysecond=0                            +000 06:00:00
TUESDAY_WINDOW            DEFAULT_MAINTENANCE_PLAN       freq=daily;byday=TUE;byhour=22;byminute=0; bysecond=0                            +000 06:00:00
WEDNESDAY_WINDOW          DEFAULT_MAINTENANCE_PLAN       freq=daily;byday=WED;byhour=22;byminute=0; bysecond=0                            +000 06:00:00
THURSDAY_WINDOW           DEFAULT_MAINTENANCE_PLAN       freq=daily;byday=THU;byhour=22;byminute=0; bysecond=0                            +000 06:00:00
FRIDAY_WINDOW             DEFAULT_MAINTENANCE_PLAN       freq=daily;byday=FRI;byhour=22;byminute=0; bysecond=0                            +000 06:00:00
SATURDAY_WINDOW           DEFAULT_MAINTENANCE_PLAN       freq=daily;byday=SAT;byhour=6;byminute=0; bysecond=0                             +000 20:00:00
SUNDAY_WINDOW             DEFAULT_MAINTENANCE_PLAN       freq=daily;byday=SUN;byhour=6;byminute=0; bysecond=0                             +000 20:00:00
WEEKNIGHT_WINDOW                                         freq=daily;byday=MON,TUE,WED,THU,FRI;byhour=22;byminute=0; bysecond=0            +000 08:00:00
WEEKEND_WINDOW                                           freq=daily;byday=SAT;byhour=0;byminute=0;bysecond=0                              +002 00:00:00

9 rows selected.

ORA-04031: Unable To Allocate Bytes Of Shared Memory (“Large Pool”,”Unknown Object”,”Large Pool”,”CTWR Dba Buffer”)

This wait event occurs when block change tracking file reached its maximum size and unable to extend it.
There may be other errors reported in the alertlog

ORA-04031: unable to allocate 32 bytes of shared memory ("shared pool","select name,online$,contents...","KGLH0^e5705bfc","kglHeapInitialize:temp")

ORA-04031: unable to allocate  bytes of shared memory ("","","","")
ORA-04031: unable to allocate 32 bytes of shared memory ("shared pool","select name,online$,contents...","KGLH0^e5705bfc","kglHeapInitialize:temp")
Incident details in: /oracle/diag/rdbms/mape/MAPE/incident/incdir_86754/MAPE_dm00_14221536_i86754.trc
Wed Jul 31 20:42:50 2013
Dumping diagnostic data in directory=[[cdmp_20130731204250]], requested by (instance=1, osid=14221536 (DM00)), summary=[[incident=86753]].
Wed Jul 31 20:42:51 2013
Sweep [[inc]][[86754]]: completed
Sweep [[inc]][[86753]]: completed
Sweep [[inc2]][[86753]]: completed
Wed Jul 31 20:42:57 2013
Use ADRCI or Support Workbench to package the incident.
See Note 411.1 at My Oracle Support for error and packaging details.
Dumping diagnostic data in directory=[[cdmp_20130731204257]], requested by (instance=1, osid=14221536 (DM00)), summary=[[incident=86754]].
Wed Jul 31 20:43:35 2013
Errors in file /oracle/diag/rdbms/mape/MAPE/trace/MAPE_dw02_40567024.trc  (incident=82993):
ORA-04031: unable to allocate 32 bytes of shared memory ("shared pool","select order#,columns,types ...","KGLH0^470434f8","kglHeapInitialize:temp")

Database had already crashed so nothing to do but:

(0) MAPE ora@x025:/home/ora> sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Fri Aug 2 14:26:20 2013

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected.
SYS@MAPE> alter system flush shared_pool;
alter system flush shared_pool
  * 
ERROR at line 1:
ORA-01012: not logged on
Process ID: 0
Session ID: 0 Serial number: 0


SYS@MAPE> shutdown abort
ORACLE instance shut down.
SYS@MAPE> startup
ORACLE instance started.

Total System Global Area  734892032 bytes
Fixed Size                  2225128 bytes
Variable Size             398461976 bytes
Database Buffers          318767104 bytes
Redo Buffers               15437824 bytes
Database mounted.
Database opened.

SYS@MAPE> show parameter pool

NAME                                 TYPE                           VALUE
------------------------------------ ------------------------------ ------------------------------
buffer_pool_keep                     string
buffer_pool_recycle                  string
global_context_pool_size             string
java_pool_size                       big integer                    0
large_pool_size                      big integer                    0
olap_page_pool_size                  big integer                    0
shared_pool_reserved_size            big integer                    18M
shared_pool_size                     big integer                    208M
streams_pool_size                    big integer                    0
SYS@MAPE> show sga

Total System Global Area  734892032 bytes
Fixed Size                  2225128 bytes
Variable Size             385879064 bytes
Database Buffers          331350016 bytes
Redo Buffers               15437824 bytes
SYS@MAPE> exit

but for reference, the causes could well be the applications running on the database are not using bind variables…
From asktom.oracle.com

...
Just to give you a tiny idea of how huge of a difference this
can make performance wise, you only need to run a very small
test:

tkyte@TKYTE816> alter system flush shared_pool;
System altered.

tkyte@TKYTE816> declare
  2      type rc is ref cursor;
  3      l_rc rc;
  4      l_dummy all_objects.object_name%type;
  5      l_start number default dbms_utility.get_time;
  6  begin
  7      for i in 1 .. 1000
  8      loop
  9          open l_rc for
 10          'select object_name
 11             from all_objects
 12            where object_id = ' || i;
 13          fetch l_rc into l_dummy;
 14          close l_rc;
 15      end loop;
 16      dbms_output.put_line
 17      ( round( (dbms_utility.get_time-l_start)/100, 2 ) ||
 18        ' seconds...' );
 19  end;
 20  /
14.86 seconds...

PL/SQL procedure successfully completed.

tkyte@TKYTE816> declare
  2      type rc is ref cursor;
  3      l_rc rc;
  4      l_dummy all_objects.object_name%type;
  5      l_start number default dbms_utility.get_time;
  6  begin
  7      for i in 1 .. 1000
  8      loop
  9          open l_rc for
 10          'select object_name
 11             from all_objects
 12            where object_id = :x'
 13          using i;
 14          fetch l_rc into l_dummy;
 15          close l_rc;
 16      end loop;
 17      dbms_output.put_line
 18      ( round( (dbms_utility.get_time-l_start)/100, 2 ) ||
 19        ' seconds...' );
 20  end;
 21  /
1.27 seconds...

PL/SQL procedure successfully completed.

That is pretty dramatic.  The fact is that not only does this
execute much faster (we spent more time PARSING our queries then
actually EXECUTING them!) it will let more users use your system
simultaneously.
...

and from linked question

...
Lbrary cache latch contention is typically caused by NOT using bind variables.  It is due
to excessive parsing of statements.

One way to see if this might be the case in your situation is to run a script like:


create table t1 as select sql_text from v$sqlarea;

alter table t1 add sql_text_wo_constants varchar2(1000);

create or replace function
remove_constants( p_query in varchar2 ) return varchar2
as
    l_query long;
    l_char  varchar2(1);
    l_in_quotes boolean default FALSE;
begin
    for i in 1 .. length( p_query )
    loop
        l_char := substr(p_query,i,1);
        if ( l_char = **' and l_in_quotes )
        then
            l_in_quotes := FALSE;
        elsif ( l_char = **' and NOT l_in_quotes )
        then
            l_in_quotes := TRUE;
            l_query := l_query || **#';
        end if;
        if ( NOT l_in_quotes ) then
            l_query := l_query || l_char;
        end if;
    end loop;
    l_query := translate( l_query, '0123456789', '@@@@@@@@@@' );
    for i in 0 .. 8 loop
        l_query := replace( l_query, lpad('@',10-i,'@'), '@' );
        l_query := replace( l_query, lpad(' ',10-i,' '), ' ' );
    end loop;
    return upper(l_query);
end;
/
update t1 set sql_text_wo_constants = remove_constants(sql_text);

select sql_text_wo_constants, count(*)
  from t1
 group by sql_text_wo_constants
having count(*) > 100
 order by 2
/


The output of that last query will show you statements that are identical in the shared
pool after all numbers and character string constants have been removed.  These
statements -- and more importantly their counts -- are the potential bottlenecks.  In
addition to causing the contention, they will be HUGE cpu consumers.

If you discover your applications do not use bind variables -- you must have this
corrected.  You'll never have a good hit ratio if everyone submits "unique" sql.  Your
shared pool will never be used right and you'll be using excessive CPU (90% of the time
it takes to process "insert into t values ( 1 )" is parsing.  If you use "insert into t
values ( :x )", and bind the value of 1 -- then the next person that runs that insert
will benefit from your work and run that much faster.
...

Advice from Oracle concerning a concrete (12c) example of unable to allocate 52824 bytes of shared memory ("shared pool",...

This was from a ticket raised for a Data Pump export that consistently failed with:

Processing object type SCHEMA_EXPORT/TABLE/PROCACT_INSTANCE
Processing object type SCHEMA_EXPORT/TABLE/TABLE
ORA-39014: One or more workers have prematurely exited.
ORA-39029: worker 1 with process name "DW00" prematurely terminated
ORA-31671: Worker process DW00 had an unhandled exception.
ORA-04031: unable to allocate 52824 bytes of shared memory ("shared pool","unknown object","KTSL subheap","ktsl_load_disp-2")
ORA-06512: at "SYS.KUPW$WORKER", line 2122
ORA-06512: at line 2
The error ORA-4031 on the shared pool can indicate one of two things:
- insufficient space for the shared pool (so insufficient memory in SGA at that time)
OR
- although there is enough memory, it is fragmented and no contiguous chunk can be allocated to satisfy the latest memory request.

Each SGA has a little fragmentation of course because of the operations taking place, so in your case the fragmentation is represented by the 18M of free memory, which exists in uncontiguous chunks.
This means that the root cause of the error is insufficient contiguous memory to allocate 12312 bytes of shared memory.

ACTION PLAN
==============
1. We see memory_target=2000M. This is too little to support a 12c database, even when it has little activity.
As you may know 1.7G for the SGA was acceptable when speaking of 32bit OSs where it was hardly possible to make use of more than that.
Since you have a 64 bit system, the addressable memory is virtually unlimited.
Furthermore, by using AMM (memory_target>0) this memory is divided between the SGA and the PGA (the user processes) which in fact, depending on the number of connections, can limit the SGA even more.
So the first recommendation is to increase the value of memory_target to 4G for example. There is no ideal value, but this would be a reasonable starting value for tuning.

You can do further tuning of the memory using the view V$MEMORY_TARGET_ADVICE.
The view V$MEMORY_TARGET_ADVICE provides tuning advice for the MEMORY_TARGET initialization parameter:
SQL> SELECT * FROM v$memory_target_advice ORDER BY memory_size;

The dynamic performance view V$MEMORY_DYNAMIC_COMPONENTS shows the current sizes of all dynamically tuned memory components, including the total sizes of the SGA and instance PGA.

You can also use V$MEMORY_RESIZE_OPS which has a circular history buffer of the last 800 memory resize requests.

2. Since the AMM (you have memory_target>0) is used, then make sure to set:
 _shared_pool_reserved_pct to 10 or 15 to ensure that when the Shared Pool grows or shrinks automatically, the Reserved Area will change as well.

SQL> alter system set "_shared_pool_reserved_pct"=15 scope=spfile;
--restart the instance

FYI: By default, Oracle configures a small Reserved Pool (or Reserved Area) inside the Shared Pool.
This memory can be used for operations such as PL/SQL and trigger compilation or for temporary space while loading Java objects.
After the memory allocated from the Reserved Pool is freed, it returns to the Reserved Pool.
5% of the Shared Pool is set aside as the Reserved Pool to handle allocations of memory higher than defined by the hidden parameter _shared_pool_reserved_pct.
In some application environments, 5% is too small.

3. Set shared_pool_size=500M or even more. This will represent a minimum amount of memory that will always be available to the shared pool.
If more memory is needed at any moment, if it is available, it will be allocated to the shared pool over the 500M.

Implement the above steps, monitor the database and let us know the result,

ORA-01103: database name ‘LOANE’ in control file is not ‘LOANM’

This can happen after a cloning or duplicate database operation and then trying to nid the new database. The db_name in the controlfile does not match the one in the init.ora file.

Solution

Change the DB_NAME parameter in spfile and restart the database so that the db_name's match. Then use nid to do the rename again.

startup nomount;
alter system set db_name=<old db_name> scope=spfile;
shutdown immediate;
startup mount;
alter database open resetlogs;

NID-00135: There are 1 active threads : oracle

SQL> select name,open_mode from v$database;

NAME      OPEN_MODE
--------- --------------------
CLNE   MOUNTED

$ nid target=/ dbname=clnm

DBNEWID: Release 12.1.0.2.0 - Production on Fri Jul 27 06:01:10 2018

Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.

Connected to database CLNE (DBID=34933270)

NID-00135: There are 1 active threads


Change of database name failed during validation - database is intact.
DBNEWID - Completed with validation errors.

Cause

There are active redo threads open. The database was probably not shutdown cleanly before running nid.

Solution

  • Open the database cleanly
alter database open;

Database altered.
  • Shutdown the database
shut immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
  • Mount the database
startup mount
ORACLE instance started.

Total System Global Area 1.0737E+10 bytes
Fixed Size 4582144 bytes
Variable Size 5972690176 bytes
Database Buffers 4731174912 bytes
Redo Buffers 28971008 bytes
Database mounted.
  • Run nid again
nid target=sys/****** dbname=clnm

DBNEWID: Release 12.1.0.2.0 - Production on Fri Jul 27 06:13:53 2018

Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.

Connected to database clne (DBID=34933270)

Connected to server version 12.1.0

Control Files in database:
/u01/oradata/clne/data/control01.ctl
/u01/oradata/clne/idx/control02.ctl
/u01/oradata/clne/redo1/control03.ctl

Change database name of database clne to clnm? (Y/[N]) => y

Proceeding with operation
Changing database name from clne to clnm
Control File /u01/oradata/clne/data/control01.ctl - modified
Control File /u01/oradata/clne/idx/control02.ctl - modified
Control File /u01/oradata/clne/redo1/control03.ctl - modified
Datafile /u01/oradata/clne/data/system01.db - wrote new name
Datafile /u01/oradata/clne/data/sysaux01.db - wrote new name
.
.
.
Datafile /u01/oradata/clne/undo/temp02.db - wrote new name
Datafile /u01/oradata/clne/undo/temp03.db - wrote new name
Datafile /u01/oradata/clne/idx/psgtt01.db - wrote new name
Control File /u01/oradata/clne/data/control01.ctl - wrote new name
Control File /u01/oradata/clne/idx/control02.ctl - wrote new name
Control File /u01/oradata/clne/redo1/control03.ctl - wrote new name
Instance shut down

Database name changed to clnm.
Modify parameter file and generate a new password file before restarting.
Succesfully changed database name.
DBNEWID - Completed succesfully.

Here is a script to do everything

#!/usr/bin/ksh
# ==============================================================================
# Name         : rename_database_after_ORA-01103.ksh
# Description  : Renames a database after ORA-01103
#
# Parameters   : sid in the Controlfile
#                sid in the init / spfile
#
# Example      : ./rename_database_after_ORA-01103.ksh loane loanm
#
# Notes        : Script to save having to remember which way around to change
#                the names
#
# Modification History
# ====================
# When      Who               What
# ========= ================= ==================================================
# 02-MAY-20 Stuart Barkley    Created
# ==============================================================================

OLDSID=$1
NEWSID=$2
ORATAB="/etc/oratab"

if [[ $# -ne 2 ]]; then
    echo "Usage: $(basename $0): <sid in controlfile> <sid in spfile>"
    echo "If you get a message like this:"
    echo "ORA-01103: database name ‘LOANE’ in control file is not ‘LOANM’"
    echo "then run this:
    echo "./rename_database_after_ORA-01103.ksh loane loanm"
    exit 1
fi

grep "^${OLDSID}:" "${ORATAB}" >/dev/null 2>&1
[[ $? -ne 0 ]] && echo "${OLDSID} not in ${ORATAB}" && exit 1
grep "^${NEWSID}:" "${ORATAB}" >/dev/null 2>&1
[[ $? -ne 0 ]] && echo "${NEWSID} not in ${ORATAB}" && exit 1

unset ORACLE_HOME
ORAENV_ASK=NO
export ORACLE_SID="${NEWSID}"
. oraenv
[[ "${ORACLE_HOME}" == "" ]] && echo "Cannot set environment for ${NEWSID}" && exit 1

TIMESTAMP=`date +'%Y%m%d%H%M%S'`

cd $ORACLE_HOME/dbs
cp "init${NEWSID}.ora" "init${NEWSID}.ora.${TIMESTAMP}"
perl -p -i -e 'if (m/db_name=/ or m/service_names=/) {s/'${NEWSID}'/'${OLDSID}'/i}' "init${NEWSID}.ora"
perl -n -i -e 'print unless m/instance_name=/' "init${NEWSID}.ora"

$ORACLE_HOME/bin/sqlplus / as sysdba<<EOSQL
whenever sqlerror exit failure

prompt startup force nomount pfile='init${NEWSID}.ora';
startup force nomount pfile='init${NEWSID}.ora';

prompt create spfile from pfile;
create spfile from pfile;

prompt alter database mount;
alter database mount;

prompt alter database open;
alter database open;

prompt shutdown immediate;
shutdown immediate;

prompt startup mount;
startup mount;
EOSQL
[[ $? -ne 0 ]] && echo "Something went wrong" && exit 1

nid target=/ dbname=${NEWSID} logfile="/tmp/nid_${OLDSID}_${NEWSID}.log"
grep 'DBNEWID - Completed succesfully' "/tmp/nid_${OLDSID}_${NEWSID}.log" >/dev/null 2>&1
[[ $? -ne 0 ]] && echo "Something went wrong with nid" && exit 1

perl -p -i -e 'if (m/db_name=/ or m/service_names=/) {s/'${OLDSID}'/'${NEWSID}'/i}' "init${NEWSID}.ora"
[[ $? -ne 0 ]] && echo "Something went wrong with renaming ${OLDSID} to ${NEWSID}" && exit 1

$ORACLE_HOME/bin/sqlplus / as sysdba<<EOSQL
prompt create spfile from pfile;
create spfile from pfile;

prompt startup mount;
startup mount;

prompt alter database open resetlogs;
alter database open resetlogs;
EOSQL
[[ $? -ne 0 ]] && echo "Something went wrong with renaming ${OLDSID} to ${NEWSID}" && exit 1
echo "Success"

ORA-00392: log 1 of thread 1 is being cleared, operation not allowed

After performing an active duplication, this happened when trying to open the database.

SQL> alter database open resetlogs
alter database open resetlogs
  * 
ERROR at line 1:
ORA-00392: log 1 of thread 1 is being cleared, operation not allowed
ORA-00312: online log 1 thread 1: '/oracle/oradata/testdb/redo/redo01.log'
SQL> select group#,thread#,status from v$log;

GROUP#   THREAD#   STATUS
-------  --------- ----------------
1        1         CLEARING_CURRENT
2        1         STALE
3        1         STALE

Check the alert log! Always a good idea to get extra info. In here we find the answer

ORA-00344: unable to re-create online log
'/oracle/oradata/testdb/redo/redo01.log'
ORA-27040: file create error, unable to create file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 1

So the clue is that the file cannot be created at the operating system level.
Doing a

df -k /oracle/oradata/testdb/redo

shows us that the filesystem was created too small for the destination database.
In this case, we do not want the redolog directory to be as big as on the source db as there will be almost no movement on the destination.
I should have specified the LOGFILE parameter in the DUPLICATE clause to setup new, smaller redolog files.
As this duplicate takes over 12 hours, I didn't want to do it again so I created symbolic links in the redolog directory pointing out to a larger filesystem with more space.
This allowed the creation of the redolog files. They can then be resized once the database has been opened.

cd /oracle/oradata/testdb/redo
ln -s /tmp/redo01.log redo01.log
ln -s /tmp/redo02.log redo02.log
ln -s /tmp/redo03.log redo03.log

SQL> alter database open resetlogs
Database opened.

RMAN-06136: Oracle error from auxiliary database: ORA-00344: unable to re-create online log '/cln/exp/ora_data1/dwh/redolog/redo01.log'

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 11/26/2023 00:11:48
RMAN-05501: aborting duplication of target database
RMAN-03015: error occurred in stored script Memory Script
RMAN-06136: Oracle error from auxiliary database: ORA-00344: unable to re-create online log '/cln/exp/ora_data1/dwh/redolog/redo01.log'
ORA-27040: file create error, unable to create file
IBM AIX RISC System/6000 Error: 2: No such file or directory
Additional information: 1

After an RMAN duplicate, the open resetlogs fails with above message. Note the path shown is that of the source database.
This means that the db_logfile_convert parameter was setup incorrectly. To fix the issue, we rebuild the logfile groups while the database is still in mount mode.

set lines 200 pages 200
col member for a70
select vl.group#
,      bytes/1024/1024 mb
,      type
,      member
from   v$log     vl
,      v$logfile vlf
where  vl.group# = vlf.group#
order  by 1
/
    GROUP#         MB TYPE    MEMBER
---------- ---------- ------- ----------------------------------------------------------------------
         1       1000 ONLINE  /cln/exp/ora_data1/dwh/redolog/redo01.log
         2       1000 ONLINE  /cln/exp/ora_data1/dwh/redolog/redo02.log
         3       1000 ONLINE  /cln/exp/ora_data1/dwh/redolog/redo03.log
         4       1000 ONLINE  /cln/exp/ora_data1/dwh/redolog/redo04.log
         5       1000 ONLINE  /cln/exp/ora_data1/dwh/redolog/redo05.log
         6       1000 ONLINE  /cln/exp/ora_data1/dwh/redolog/redo06.log
         7       1000 ONLINE  /cln/exp/ora_data1/dwh/redolog/redo07.log
         8       1000 ONLINE  /cln/exp/ora_data1/dwh/redolog/redo08.log
         9       1000 ONLINE  /cln/exp/ora_data1/dwh/redolog/redo09.log
        10       1000 ONLINE  /cln/exp/ora_data1/dwh/redolog/redo10.log

10 rows selected.

The idea is to drop all these groups and re-create new ones with members is the correct (better) place.

alter database drop logfile group 2;
alter database drop logfile group 3;
alter database drop logfile group 4;
alter database drop logfile group 5;
alter database drop logfile group 6;
alter database drop logfile group 7;
alter database drop logfile group 8;
alter database drop logfile group 9;
alter database drop logfile group 10;
Database altered.

SQL>
Database altered.

SQL>
Database altered.

SQL>
Database altered.

SQL>
Database altered.

SQL>
Database altered.

SQL>
Database altered.

SQL>
Database altered.

SQL> alter database drop logfile group 9
*
ERROR at line 1:
ORA-01567: dropping log 9 would leave less than 2 log files for instance dwhaa2
(thread 1)
ORA-00312: online log 9 thread 1:
'/cln/exp/ora_data1/dwh/redolog/redo09.log'

Ok, so we cannot remve the last 2 just yet. Let's recreate the first 8

alter database add logfile group 2 ('/cln/acc/ora_data/dwhaa2/redo02.log' ) size 1G reuse;
alter database add logfile group 3 ('/cln/acc/ora_data/dwhaa2/redo03.log' ) size 1G reuse;
alter database add logfile group 4 ('/cln/acc/ora_data/dwhaa2/redo04.log' ) size 1G reuse;
alter database add logfile group 5 ('/cln/acc/ora_data/dwhaa2/redo05.log' ) size 1G reuse;
alter database add logfile group 6 ('/cln/acc/ora_data/dwhaa2/redo06.log' ) size 1G reuse;
alter database add logfile group 7 ('/cln/acc/ora_data/dwhaa2/redo07.log' ) size 1G reuse;
alter database add logfile group 8 ('/cln/acc/ora_data/dwhaa2/redo08.log' ) size 1G reuse;
Database altered.

SQL>
Database altered.

SQL>
Database altered.

SQL>
Database altered.

SQL>
Database altered.

SQL>
Database altered.

SQL>
Database altered.

SQL>
Database altered.

SQL>
SQL> select group#,thread#,status from v$log;

    GROUP#    THREAD# STATUS
---------- ---------- ----------------
         1          1 UNUSED
         2          1 UNUSED
         3          1 UNUSED
         4          1 UNUSED
         5          1 UNUSED
         6          1 UNUSED
         7          1 UNUSED
         8          1 UNUSED
         9          1 CLEARING
        10          1 CLEARING_CURRENT

10 rows selected.

As we have now created more groups, we should be able to drop the remaining 2 groups

SQL> alter database drop logfile group 9;
alter database drop logfile group 10;

Database altered.

SQL> alter database drop logfile group 10
*
ERROR at line 1:
ORA-01623: log 10 is current log for instance dwhaa2 (thread 1) - cannot drop
ORA-00312: online log 10 thread 1:
'/cln/exp/ora_data1/dwh/redolog/redo10.log'

One gone, but the last one won't go because it is current. And we can't switch logfiles because the database is not open!
What now?
The only way is to rename the logfile in the controlfile to an existing file. So let's duplicate on of the new members at o/s level and assign it.

SQL> !cp -p /cln/acc/ora_data/dwhaa2/redo07.log /cln/acc/ora_data/dwhaa2/redo10.log

SQL> alter database rename file '/cln/exp/ora_data1/dwh/redolog/redo10.log' to '/cln/acc/ora_data/dwhaa2/redo10.log';

Database altered.

Ok, good sign! Let's check

SQL> select group#,thread#,status from v$log;

    GROUP#    THREAD# STATUS
---------- ---------- ----------------
         1          1 UNUSED
         2          1 UNUSED
         3          1 UNUSED
         4          1 UNUSED
         5          1 UNUSED
         6          1 UNUSED
         7          1 UNUSED
         8          1 UNUSED
        10          1 CLEARING_CURRENT

9 rows selected.

SQL> alter database clear log group 10;
alter database clear log group 10
                     *
ERROR at line 1:
ORA-01900: LOGFILE keyword expected


SQL> alter database clear logfile group 10;

Database altered.

SQL>  select group#,thread#,status from v$log;

    GROUP#    THREAD# STATUS
---------- ---------- ----------------
         1          1 UNUSED
         2          1 UNUSED
         3          1 UNUSED
         4          1 UNUSED
         5          1 UNUSED
         6          1 UNUSED
         7          1 UNUSED
         8          1 UNUSED
        10          1 CURRENT

9 rows selected.
<code>
And finally, let's see if it opens
<code>
SQL> alter database open resetlogs;

Database altered.

SQL>

To tidy up, we could now re-create the dropped group 9.

ORA-01017: invalid username/password; logon denied when connecting using slash (sqlplus / as sysdba)

Trying to connect using ”/ as sysdba“, the ORA-01017 appears:

(0) upg oracle@hn5114:/home/oracle> sqlplus / as sysdba

SQL*Plus: Release 18.0.0.0.0 - Production on Fri Sep 20 10:16:22 2019
Version 18.4.0.0.0

Copyright (c) 1982, 2018, Oracle.  All rights reserved.

ERROR:
ORA-01017: invalid username/password; logon denied

but trying to connect using “sys as sysdba”, the connection is successfull

(0) upg oracle@hn5114:/home/oracle> sqlplus sys as sysdba

SQL*Plus: Release 18.0.0.0.0 - Production on Fri Sep 20 10:16:07 2019
Version 18.4.0.0.0

Copyright (c) 1982, 2018, Oracle.  All rights reserved.

Enter password:
Connected to an idle instance.

SQL> 

Things to check:

  • sqlplus / as sysdba means you use o/s authorisation so the o/s user must be a member of dba group otherwise the connection will fail.
  • sqlplus sys/pass@sid as sysdba means you use passwordfile authorisation. In this case you need to properly configure the orapw file and set REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE or SHARED.
  • Check the sqlnet.ora file. Operating system authentication will be disabled if you have SQLNET.AUTHENTICATION_SERVICES=NONE in there.

RMAN-04004: error from recovery catalog database: ORA-01017: invalid username/password; logon denied

oracle@host:/export/home/ora> rman target / catalog catowner/catpass@catdb

Recovery Manager: Release 11.2.0.2.0 - Production on Thu Jun 12 16:51:03 2014

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: XXXXRAP1 (DBID=3557010742)
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00554: initialization of internal recovery manager package failed
RMAN-04004: error from recovery catalog database: ORA-01017: invalid username/password; logon denied

This is normally very straight-forward and self-explanatory.
The puzzle here is that a connection from SQL*Plus works!

sqlplus catowner/catpass@catdb

SQL*Plus: Release 11.2.0.2.0 Production on Thu Jun 12 16:53:18 2014

Copyright (c) 1982, 2010, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL>

Eventually worked out that the rman binary in the databases ORACLE_HOME on the source machine needed relinking!

cd $ORACLE_HOME/rdbms/lib
make -f ins_rdbms.mk irman

ORA-00230: operation disallowed: snapshot control file enqueue unavailable

waiting for snapshot control file enqueue
waiting for snapshot control file enqueue
waiting for snapshot control file enqueue
waiting for snapshot control file enqueue
cannot make a snapshot control file
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03008: error while performing automatic resync of recovery catalog
ORA-00230: operation disallowed: snapshot control file enqueue unavailable

From the doc…

When RMAN needs to back up or resynchronize from the control file, it first creates a snapshot or consistent image of the control file.
If one RMAN job is already backing up the control file while another needs to create a new snapshot control file, then you may see the following message:

waiting for snapshot controlfile enqueue

Under normal circumstances, a job that must wait for the control file enqueue waits for a brief interval and then successfully obtains the enqueue.
RMAN makes up to five attempts to get the enqueue and then fails the job.
The conflict is usually caused when two jobs are both backing up the control file, and the job that first starts backing up the control file waits for service from the media manager.

To determine which job is holding the conflicting enqueue:

    After you see the first message stating "RMAN-08512: waiting for snapshot controlfile enqueue", start a new SQL*Plus session on the target database:

    % sqlplus 'SYS/oracle@trgt AS SYSDBA'

    Execute the following query to determine which job is causing the wait:

    SELECT s.SID, USERNAME AS "User", PROGRAM, MODULE,
           ACTION, LOGON_TIME "Logon", l.*
    FROM V$SESSION s, V$ENQUEUE_LOCK l
    WHERE l.SID = s.SID
    AND l.TYPE = 'CF'
    AND l.ID1 = 0
    AND l.ID2 = 2;

    You should see output similar to the following (the output in this example has been truncated):

    SID User Program              Module                    Action           Logon
    --- ---- -------------------- ------------------------- ---------------- ---------
      9 SYS  rman@h13 (TNS V1-V3) backup full datafile: c1  0000210 STARTED  21-JUN-01


After you have determined which job is creating the enqueue, you can do one of the following:

    Wait until the job creating the enqueue completes
    Cancel the current job and restart it after the job creating the enqueue completes
    Cancel the job creating the enqueue

Commonly, enqueue situations occur when a job is writing to a tape drive, but the tape drive is waiting for a new cassette to be inserted.
If you start a new job in this situation, then you will probably receive the enqueue message because the first job cannot complete until the new tape is loaded.

or more directly…

set lines 2000
col killer     for a70
col program    for a20
col module     for a20
col action     for a20
col logon_time for a20
select 'alter system disconnect session **||s.sid||','||s.serial#||** immediate;' killer
,      username
,      program
,      module
,      action
,      logon_time
from   v$session s
,      v$enqueue_lock l
where  l.sid  = s.sid
and    l.type = 'cf'
and    l.id1  = 0
and    l.id2  = 2
/

ORA-19511: non RMAN, but media manager or vendor specific failure, error text:

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 05/01/2018 14:23:09
RMAN-05501: aborting duplication of target database
RMAN-03015: error occurred in stored script Memory Script
ORA-27191: sbtinfo2 returned error
Additional information: 3586
ORA-19511: non RMAN, but media manager or vendor specific failure, error text:
   Unable to connect to NetWorker server 'hn6000.cln.be' because 'Authentication error; why = Invalid client credential'. (2:10:79)

Recovery Manager complete.

If this happens, check to see if the nsr daemon is running…
Good system:

/home/oracle> ps -ef | grep nsr
    root  5701836        1   0   Mar 16      - 13:18 /bin/nsrexecd
  oracle 18809292 22741502   0 15:03:58  pts/0  0:00 grep nsr

Bad system:

 /home/oracle> ps -ef | grep nsr
  oracle 14745986 15139292   0 15:03:29  pts/2  0:00 grep nsr

ORA-19554: error allocating device, device type: SBT_TAPE, device name:

If using Cygwin…

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 05/19/2015 12:25:47
ORA-19554: error allocating device, device type: SBT_TAPE, device name:
ORA-27000: skgfqsbi: failed to initialize storage subsystem (SBT) layer
OSD-02534: Message 2534 not found;  product=RDBMS; facility=SOSD
  • Check the tdpo.opt file is where you think it is!
  • Check the path to the opt file looks like this (needs to be Windows format):
CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' FORMAT   'LOG_%d_t%t_s%s_u%U' PARMS  'ENV=(TDPO_OPTFILE=E:\\oracle\\KITRYD\\admin\\tdpo.opt)';
  • Check the content of the opt file is Windows format paths!

RMAN-20033: control file SEQUENCE# too low

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03008: error while performing automatic resync of recovery catalog
==== RMAN-20033: control file SEQUENCE# too low ====

From forums.oracle.com
This error generally happens if an archivelog backup happens while the RMAN database backup is running and if controlfile autobackup is configured.
The database backup is usually successful and it is just the controlfile backup that fails.

ORA-27302: failure occurred at: slgpn

RMAN-03009: failure of Control File and SPFILE Autobackup command on c1 channel at 06/28/2011 18:59:38
ORA-19715: invalid format %b for generated name
ORA-27302: failure occurred at: slgpn

Problem

When doing a ”<tt>backup as copy database</tt>“, got these errors after 145 of 147 datafiles had been backed up!

Investigation

I had read elsewhere that this could be something to do with the format of the autobackup of the control file so I changed the format as suggested and reran the backup.
No luck. It ended exactly the same way after 145 files. I decided to compare the original list of datafiles with those that had been backed up in order to track down the 2 failures. Maybe I could see something odd with them.
Sure enough, these 2 files were different… there was a space at the end of the filenames :-)

select 'x'||file_name||'x'
from   dba_data_files
where  file_name like '% %'
/

Solution

Run the backup of the other 2 datafiles with a different format that did not rely on the filename.

run {
    allocate channel c1 device type disk format '/path/to/datafiles/%U';
    backup as copy datafile 170;
    backup as copy datafile 171;
    backup as copy current controlfile;
    release channel c1;
}

The other 145 datafiles were backed up with a format of '/path/to/datafiles/%b' which preserves the filenames so all that needs to be done is rename the other 2 after the backup finishes.
If they are going to be used in a restore scenario, they should be renamed in the controlfile also.

alter database rename file '/path/to/datafiles/filename_with_a_space_at_end ' to '/path/to/datafiles/filename_without_a_space';

RMAN errors after crosscheck backup and delete noprompt obsolete and delete noprompt expired backup

RMAN-06207: WARNING: 3921 objects could not be deleted for SBT_TAPE channel(s) due
RMAN-06208:          to mismatched status.  Use CROSSCHECK command to fix status
RMAN-06210: List of Mismatched objects
RMAN-06211: ==========================
RMAN-06212:   Object Type   Filename/Handle
RMAN-06213: --------------- ---------------------------------------------------
RMAN-06214: Backup Piece    DB_SID_t20140316_s263889_umhp3bpa7_1_1
...

Use the FORCE option with the DELETE command
The FORCE command tells RMAN to clean the information out of the catalog regardless of whether it can find it on the media or not.

delete force noprompt expired backup;
delete force noprompt obsolete;

RMAN-00600: internal error, arguments [8714] [] [] [] []

Internal error displayed when trying to restore a database

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 01/04/2022 16:16:24
RMAN-00600: internal error, arguments [8714] [] [] [] []

As Oracle mentions |here, it is normal bahaviour!

Due to the fact that an alter database open resetlogs seems to be have done without being connected to the catalog, the said catalog is now confused as to which incarnation to use as current. The solution is either:

  • Restore the database without a catalog connection
  • Tell the catalog which incarnation to use
RMAN> list incarnation of database;


List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
551048814 551050752 EBST     3456740606       PARENT  107183355928 07-OCT-12
551048814 551048815 EBST     3456740606       PARENT  331802566280 31-DEC-19
551048814 741634576 EBST     3456740606       CURRENT 390104839590 29-DEC-21

RMAN> reset database to incarnation 551048815;

database reset to incarnation 551048815

RMAN> list incarnation of database;


List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
551048814 551050752 EBST     3456740606       PARENT  107183355928 07-OCT-12
551048814 551048815 EBST     3456740606       CURRENT 331802566280 31-DEC-19
551048814 741634576 EBST     3456740606       ORPHAN  390104839590 29-DEC-21

RMAN> 

RMAN-06004: ORACLE error from recovery catalog database: RMAN-20242: specification does not match any archived log in the repository

After restoring archivelogs from log sequence, this error is shown.

RMAN> run {
2> allocate channel t0 type sbt_tape;
3> allocate channel t1 type sbt_tape;
4> allocate channel t2 type sbt_tape;
5> restore archivelog from logseq 40410 until logseq 45410;
6> }

released channel: ORA_DISK_1
allocated channel: t0
channel t0: SID=406 device type=SBT_TAPE
channel t0: CommVault Systems for Oracle: Version 11.0.0(BUILD80)

allocated channel: t1
channel t1: SID=421 device type=SBT_TAPE
channel t1: CommVault Systems for Oracle: Version 11.0.0(BUILD80)

allocated channel: t2
channel t2: SID=436 device type=SBT_TAPE
channel t2: CommVault Systems for Oracle: Version 11.0.0(BUILD80)

Starting restore at 2022-01-04 21:33:17
released channel: t0
released channel: t1
released channel: t2
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 01/04/2022 21:33:17
RMAN-06004: ORACLE error from recovery catalog database: RMAN-20242: specification does not match any archived log in the repository

Run a crosscheck of the archivelogs

RMAN> run {
allocate channel t0 type sbt_tape;
allocate channel t1 type sbt_tape;
allocate channel t2 type sbt_tape;
crosscheck archivelog all;
}
2> 3> 4> 5> 6>
allocated channel: t0
channel t0: SID=406 device type=SBT_TAPE
channel t0: CommVault Systems for Oracle: Version 11.0.0(BUILD80)

allocated channel: t1
channel t1: SID=421 device type=SBT_TAPE
channel t1: CommVault Systems for Oracle: Version 11.0.0(BUILD80)

allocated channel: t2
channel t2: SID=436 device type=SBT_TAPE
channel t2: CommVault Systems for Oracle: Version 11.0.0(BUILD80)

validation succeeded for archived log
archived log file name=/cln/tst/ora_ebst/db/apps_st/data/archive/1_40364_1028505496.dbf RECID=40396 STAMP=1093123225
validation succeeded for archived log
archived log file name=/cln/tst/ora_ebst/db/apps_st/data/archive/1_40365_1028505496.dbf RECID=40399 STAMP=1093123225
validation succeeded for archived log
archived log file name=/cln/tst/ora_ebst/db/apps_st/data/archive/1_40366_1028505496.dbf RECID=40413 STAMP=1093123225
validation succeeded for archived log
archived log file name=/cln/tst/ora_ebst/db/apps_st/data/archive/1_40367_1028505496.dbf RECID=40405 STAMP=1093123225
validation succeeded for archived log
archived log file name=/cln/tst/ora_ebst/db/apps_st/data/archive/1_40368_1028505496.dbf RECID=40409 STAMP=1093123225
validation succeeded for archived log
archived log file name=/cln/tst/ora_ebst/db/apps_st/data/archive/1_40369_1028505496.dbf RECID=40398 STAMP=1093123225
validation succeeded for archived log
archived log file name=/cln/tst/ora_ebst/db/apps_st/data/archive/1_40370_1028505496.dbf RECID=40401 STAMP=1093123225
...
archived log file name=/cln/tst/ora_ebst/db/apps_st/data/archive/1_40409_1028505496.dbf RECID=40440 STAMP=1093123251
Crosschecked 46 objects

released channel: t0
released channel: t1
released channel: t2

RMAN> exit

Recovery Manager complete.

Then attempt to open the database

sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Tue Jan 4 21:35:31 2022

Copyright (c) 1982, 2014, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> alter database open resetlogs;

Database altered.

SQL>

RMAN-06004: ORACLE error from recovery catalog database: RMAN-20003: target database incarnation not found in recovery catalog

Problem:

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 12/05/2017 11:11:15
RMAN-05501: aborting duplication of target database
RMAN-03015: error occurred in stored script Memory Script
RMAN-06004: ORACLE error from recovery catalog database: RMAN-20003: target database incarnation not found in recovery catalog

Solution:

Strangely, this means, in my particular case, that block change tracking is turned on in the target database and needs turning off in the auxiliary while the DUPLICATE is running.
It must be done while the auxiliary is in mount mode and restoring the datafiles (before recovery starts)
It is reported to be a bug fixed in 11.1 but somehow, we're still (sometimes) getting it in 12.1.0.2.

RMAN-06059: expected archived log not found, loss of archived log compromises recoverability

RMAN-06059: expected archived log not found, loss of archived log compromises recoverability
ORA-19625: error identifying file <filename>

This error can come from the fact that the database files (more likely archivelogs) are being deleted by the operating system so RMAN has no clue of their whereabouts.
Possibly result of a database duplication and the catalog has not updated properly?

Solution

crosscheck archivelog all;

And then maybe take a backup to be on the safe side.

RMAN-05537: DUPLICATE without TARGET connection when auxiliary instance is started with spfile cannot use SPFILE clause

Problem:

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 12/05/2017 14:17:49
RMAN-05501: aborting duplication of target database
RMAN-05537: DUPLICATE without TARGET connection when auxiliary instance is started with spfile cannot use SPFILE clause

Usually happens after restarting a failed RMAN DUPLICATE database. The spfile has been regenerated on the auxiliary to a level where it has too much detail in it.

Solution:

$ cd $ORACLE_HOME/dbs
$ ls -altr *dwh_perf*
-rw-r-----    1 oracle   oinstall   17645568 Aug  3 13:34 snapcf_dwh_perf.f
-rw-r-----    1 oracle   oinstall       7680 Nov  4 09:22 orapwdwh_perf
-rw-r--r--    1 oracle   oinstall        104 Dec  5 09:34 initdwh_perf.ora
-rw-r-----    1 oracle   oinstall       6656 Dec  5 11:11 spfiledwh_perf.ora
-rw-rw----    1 oracle   oinstall       1544 Dec  5 14:18 hc_dwh_perf.dat
$ mv hc_dwh_perf.dat hc_dwh_perf.dat.old
$ mv spfiledwh_perf.ora spfiledwh_perf.ora.old
$ cat initdwh_perf.ora
sga_max_size='6G'
sga_target='6G'
compatible='12.0.0'
db_files='500'

  -  Instance name
db_name=dwh_perf

Re-run the DUPLICATE. It should zoom past the already recovered datafiles.

RMAN-11003: failure during parse/execution of SQL statement: alter database recover logfile '/cln/acc/ora_ebso/db/apps_st/data/archive/1_138526_796044402.dbf'

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 11/07/2019 18:01:02
RMAN-05501: aborting duplication of target database
RMAN-03015: error occurred in stored script Memory Script
RMAN-11003: failure during parse/execution of SQL statement: alter database recover logfile '/cln/acc/ora_ebso/db/apps_st/data/archive/1_138526_796044402.dbf'
ORA-00308: cannot open archived log '/cln/acc/ora_ebso/db/apps_st/data/archive/1_138526_796044402.dbf'
ORA-27037: unable to obtain file status
IBM AIX RISC System/6000 Error: 2: No such file or directory
Additional information: 3

Recovery Manager complete.

or

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 12/06/2019 20:56:59
RMAN-05501: aborting duplication of target database
RMAN-03015: error occurred in stored script Memory Script
RMAN-11003: failure during parse/execution of SQL statement: alter database recover logfile '/cln/kap/ora_data1/common/archivelog/upgbench/log1_263667_815790039.arc'
ORA-10877: error signaled in parallel recovery slave

No real clues here but it is the block change tracking file that is active on the source and must be disabled on the destination before recovery starts. So as soon as the controlfile has been restored and the database mounted, login to another session, connect to the database and issue

SQL> alter database disable block change tracking;

Database altered.

SQL> exit

The DUPLICATE should then continue to recover correctly.

PSDRPC returns significant error 1013

archived log thread=1 sequence=195008
channel t2: reading from backup piece arclog_LBK_4260753020_946042770_479194_1
channel t0: piece handle=arclog_LBK_4260753020_946042770_479192_1 tag=TAG20170607T133757
channel t0: restored backup piece 1
channel t0: restore complete, elapsed time: 00:00:35
archived log file name=/xxxxxx/acc/ora_bin2/app/oracle/product/11.2.0.4/dbhome_1/dbs/arch1_195006_815790039.dbf thread=1 sequence=195006
PSDRPC returns significant error 1013.
PSDRPC returns significant error 1013.
released channel: t0
released channel: t1
released channel: t2
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 06/09/2017 15:15:04
RMAN-05501: aborting duplication of target database
RMAN-03015: error occurred in stored script Memory Script
RMAN-11003: failure during parse/execution of SQL statement: alter database recover logfile '/xxxxxx/acc/ora_bin2/app/oracle/product/11.2.0.4/dbhome_1/dbs/arch1_195006_815790039.dbf'
ORA-10877: error signaled in parallel recovery slave

Recovery Manager complete.

Action

Check the alert log on the auxiliary instance.

ORA-279 signalled during: alter database recover logfile '/xxxxxx/acc/ora_bin2/app/oracle/product/11.2.0.4/dbhome_1/dbs/arch1_195005_815790039.dbf'...
alter database recover logfile '/xxxxxx/acc/ora_bin2/app/oracle/product/11.2.0.4/dbhome_1/dbs/arch1_195006_815790039.dbf'
Media Recovery Log /xxxxxx/acc/ora_bin2/app/oracle/product/11.2.0.4/dbhome_1/dbs/arch1_195006_815790039.dbf
Fri Jun 09 07:30:30 2017
Errors with log /xxxxxx/acc/ora_bin2/app/oracle/product/11.2.0.4/dbhome_1/dbs/arch1_195006_815790039.dbf
Recovery interrupted!
Recovered data files to a consistent state at change 238029030495
Media Recovery failed with error 19755
Errors in file /xxxxxx/acc/ora_bin2/app/oracle/diag/rdbms/lbkro/lbkro/trace/lbkro_pr00_13108374.trc:
ORA-00283: recovery session canceled due to errors
==== >ORA-19755: could not open change tracking file
==== >ORA-19750: change tracking file: '/xxxxxx/exp/ora_data2/lbk/data/bct_lbk_do_not_delete.f
==== >ORA-27037: unable to obtain file status
==== >IBM AIX RISC System/6000 Error: 2: No such file or directory
Additional information: 3
Fri Jun 09 07:30:36 2017
ORA-10877 signalled during: alter database recover logfile '/xxxxxx/acc/ora_bin2/app/oracle/product/11.2.0.4/dbhome_1/dbs/arch1_195006_815790039.dbf'...
Fri Jun 09 14:04:57 2017
alter database recover logfile '/xxxxxx/acc/ora_bin2/app/oracle/product/11.2.0.4/dbhome_1/dbs/arch1_195006_815790039.dbf'
Media Recovery Log /xxxxxx/acc/ora_bin2/app/oracle/product/11.2.0.4/dbhome_1/dbs/arch1_195006_815790039.dbf
Media Recovery failed with error 1112
ORA-283 signalled during: alter database recover logfile '/xxxxxx/acc/ora_bin2/app/oracle/product/11.2.0.4/dbhome_1/dbs/arch1_195006_815790039.dbf'...
Fri Jun 09 14:31:20 2017
Shutting down instance (immediate)
Shutting down instance: further logons disabled
Stopping background process MMNL
Stopping background process MMON
License high water mark = 49
ALTER DATABASE CLOSE NORMAL
ORA-1109 signalled during: ALTER DATABASE CLOSE NORMAL...
ALTER DATABASE DISMOUNT
Shutting down archive processes
Archiving is disabled
Completed: ALTER DATABASE DISMOUNT
ARCH: Archival disabled due to shutdown: 1089
Shutting down archive processes
Archiving is disabled
ARCH: Archival disabled due to shutdown: 1089
Shutting down archive processes
Archiving is disabled
Fri Jun 09 14:31:24 2017

This is a known bug. it is fixed in 11.2.0.3 but… this customer does not apply patches!

Solution

While the DUPLICATE is running (and in MOUNT mode), log on to the auxiliary instance and disable block change tracking.

alter database disable block change tracking;

A documented workaround is to set db_filename_convert parameter in the DUPLICATE clause of the run block but I tried this and it failed again.
The obvious solution is to patch the database but…

Database trigger to capture ORA errors

From ora-ssn.blogspot.be

CREATE TABLE stats$error_log (
        err_dt          TIMESTAMP,
        db_user         VARCHAR2(30),
        msg_stack       VARCHAR2(2000),
        sqltxt          VARCHAR2(1000))
tablespace users;

Now, create a trigger on the database server.

CREATE OR REPLACE TRIGGER log_server_errors
  AFTER SERVERERROR
  ON DATABASE
DECLARE
          v_sqltext VARCHAR2(1000);
          nl_sqltext ora_name_list_t;
  BEGIN
          -- Capture entire error text
          FOR i IN 1 .. ora_sql_txt(nl_sqltext) LOOP
            v_sqltext := v_sqltext || nl_sqltext(i);
          END LOOP;
          INSERT INTO STATS$ERROR_LOG
          (err_dt, db_user, msg_stack, sqltxt)
          VALUES
          (systimestamp,
           sys.login_user,
           dbms_utility.format_error_stack, v_sqltext);
  END log_server_errors;
/

ORA-19809: limit exceeded for recovery files

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 07/15/2013 10:10:59
ORA-19809: limit exceeded for recovery files
ORA-19804: cannot reclaim 274716160 bytes disk space from 1468006400 limit
    ORA-19809: limit exceeded for recovery files
    Cause: The limit for recovery files specified by the db_recovery_file_dest_size was exceeded.

    Action: The error is accompanied by 19804. See message 19804 for further details

    ORA-19804: cannot reclaim string bytes disk space from string limit
    Cause: Oracle cannot reclaim disk space of specified bytes from the DB_RECOVERY_FILE_DEST_SIZE limit.

    Action: There are five possible solutions:
       1) Take frequent backup of recovery area using RMAN.
       2) Consider changing RMAN retention policy.
       3) Consider changing RMAN archivelog deletion policy.
       4) Add disk space and increase DB_RECOVERY_FILE_DEST_SIZE.
       5) Delete files from recovery area using RMAN.

The solution here is to increase the value of db_recovery_file_dest_size but it might also indicate a problem with tapes if the archivelogs are being backed up to tape via tdpo.

SYS@DN7> alter system set db_recovery_file_dest_size=4000M scope=both;

System altered.

Looking into int further, saw RMAN parameters missing…

CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 14 DAYS;
CONFIGURE BACKUP OPTIMIZATION OFF;
CONFIGURE DEFAULT DEVICE TYPE TO 'SBT_TAPE';
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE 'SBT_TAPE' TO 'LOG_%d_controlfile_%F.rman';
CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 1 BACKUP TYPE TO BACKUPSET;

RMAN-00554: initialization of internal recovery manager package failed

Getting this error after migrating a database from one machine to another and attaching to a nice new version 12c catalog on the new server

Recovery Manager: Release 11.2.0.2.0 - Production on Sat Jun 21 13:16:24 2014

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: SPMSUPP1 (DBID=3026014394)
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00554: initialization of internal recovery manager package failed
RMAN-04004: error from recovery catalog database: ORA-01017: invalid username/password; logon denied

We cannot connect to the catalog via rman but there is no problem if connecting via SQL*Plus!
Solution: relink the rman executable.

Using AIX commands genld, genkld and slibclean to avoid library file locking errors (libjox) (Doc ID 739963.1)

When installing interim (one-off) patches, CPU patches or patchsets, you may encounter some errors with regards to files being locked or oui/opatch being unable to copy files
even though the databases, listeners and all other Oracle processes associated with the ORACLE_HOME to be patched were stopped.
This could be as result of a process which requires termination or an additional file needing to be unloaded from the system cache.
Run following commands to clean up…

genld -l | grep <ORACLE_HOME>

If genld returns data then a currently executing process has something open in the ORACLE_HOME directory, therefore terminate the process as required/recommended.

genkld | grep <ORACLE_HOME>

If the genkld command returns a list of shared objects currently loaded onto the OS system cache then please remove the entries from the OS system cache by running the slibclean command as root user:

/usr/sbin/slibclean

ORA-1652: unable to extend temp segment by 512 in tablespace TEMP_SYSTEM

Noticed this after patching. datapatch was failing with these errors in the alertlog

ORA-1652: unable to extend temp segment by 512 in tablespace TEMP_SYSTEM
Unable to obtain current patch information due to error: 20001, ORA-20001: Latest xml inventory is not loaded into table
ORA-06512: at "SYS.DBMS_QOPATCH", line 2327
ORA-06512: at "SYS.DBMS_QOPATCH", line 854
ORA-06512: at "SYS.DBMS_QOPATCH", line 937
ORA-06510: PL/SQL: unhandled user-defined exception
ORA-06512: at "SYS.DBMS_QOPATCH", line 932
ORA-29913: error in executing ODCIEXTTABLEFETCH callout
ORA-01652: unable to extend temp segment by 512 in tablespace TEMP_SYSTEM
ORA-06512: at "SYS.DBMS_QOPATCH", line 919
ORA-06512: at "SYS.DBMS_QOPATCH", line 2286
ORA-06512: at "SYS.DBMS_QOPATCH", line 817
ORA-06512: at "SYS.DBMS_QOPATCH", line 2309

There were already 2 tempfiles in TEMP_SYSTEM so it was unlikely to need another. While attempting to rebuild the temp tablespaces, I noticed the 2 tempfiles in TEMP_SYSTEM were offline!!

select name,status from v$tempfile;

/cln/acc/ora_data/adsa/ts_precise_tmp.dbf              ONLINE
/cln/acc/ora_data/adsa/temp_app/temp_app_01.dbf        ONLINE
/cln/acc/ora_data/adsa/temp_app/temp_app_02.dbf        ONLINE
/cln/acc/ora_data/adsa/temp_app/temp_app_03.dbf        ONLINE
/cln/acc/ora_data/adsa/temp_app/temp_app_04.dbf        ONLINE
/cln/acc/ora_data/adsa/temp_app/temp_app_05.dbf        ONLINE
/cln/acc/ora_data/adsa/temp_app/temp_app_06.dbf        ONLINE
/cln/acc/ora_data/adsa/temp_system/temp_system_01.dbf  OFFLINE
/cln/acc/ora_data/adsa/temp_system/temp_system_02.dbf  OFFLINE
alter database tempfile '/cln/acc/ora_data/adsa/temp_system/temp_system_01.dbf' online;
alter database tempfile '/cln/acc/ora_data/adsa/temp_system/temp_system_02.dbf' online;

Retry the datapatch and we're all good again!

ORA-20011: Approximate NDV failed: ORA-29913: error in executing ODCIEXTTABLEOPEN callout

This seems to be related to orphaned dictionary tables (in this particular case, Datapump). Generally seems to be a problem when stats jobs are running during the night (dbms_stats)

  • Check no datapump jobs are running
select * from dba_datapump_jobs;
  • Find orphaned tables
set lines 2000
select owner
,      object_name
,      object_type
,      status
,      to_char(created,'dd-mon-yyyy hh24:mi:ss') created
,      to_char(last_ddl_time,'dd-mon-yyyy hh24:mi:ss') last_ddl_time
from   dba_objects
where  1=1
and    object_name like 'ET$%';

Check that any rows seen are actually external tables

select owner
,      table_name
,      default_directory_name
,      access_type
from   dba_external_tables
order  by 1,2
  • Drop the tables if they are not currently being used (no datapump jobs running)
drop table &&owner..&table_name;

Another case, in alertlog we see

Begin automatic SQL Tuning Advisor run for special tuning task  "SYS_AUTO_SQL_TUNING_TASK"
Wed Apr 15 23:00:09 2020
DBMS_STATS: GATHER_STATS_JOB encountered errors.  Check the trace file.
Errors in file /cln/exp/ora_bin2/app/oracle/diag/rdbms/grayp/grayp/trace/grayp_j001_20123338.trc:
ORA-20011: Approximate NDV failed: ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04040: file ODGRAYDON.txt in EXTSQL_GRAYDON not found
Wed Apr 15 23:23:02 2020
End automatic SQL Tuning Advisor run for special tuning task  "SYS_AUTO_SQL_TUNING_TASK"

In the mentioned tracefile, we see

*** 2020-04-15 23:00:09.829
DBMS_STATS: GATHER_STATS_JOB: GATHER_TABLE_STATS('"LBK"','"GRAYDON_BULK"','""', ...)
DBMS_STATS: ORA-20011: Approximate NDV failed: ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04040: file ODGRAYDON.txt in EXTSQL_GRAYDON not found

*** 2020-04-15 23:00:09.872
DBMS_STATS: GATHER_STATS_JOB: GATHER_TABLE_STATS('"LBK"','"GRAYDON_BULK_C"','""', ...)
DBMS_STATS: ORA-20011: Approximate NDV failed: ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04040: file ODGRAYDON_C.txt in EXTSQL_GRAYDON not found

We see in this example that the gather_stats job is trying to access lbk.graydon_bulk which we can also see is an external table referencing ODGRAYDON.txt in whatever directory EXTSQL_GRAYDON is pointing to.
Checking that directory on the filesystem, those files are indeed missing.
The solution would be to drop those dictionary tables that refer to the files.

drop table lbk.graydon_bulk;
drop table lbk.graydon_bulk_c;

Environment variable ORACLE_UNQNAME not defined. Please set ORACLE_UNQNAME to database unique name.

When trying to start the Grid agent with

emctl start agent

that error is seen. Try checking the PATH variable! IS the agent home at the beginning or is there some other home before it? Se tthe agent home at the beginning of the PATH and try again.

(0) agent oracle@hn5115:/home/oracle> emctl start agent
Oracle Enterprise Manager Cloud Control 13c Release 3
Copyright (c) 1996, 2018 Oracle Corporation.  All rights reserved.
Starting agent ............................................... started.

EM13c : Agent Causes High CPU And Hangs The Server (Doc ID 2213714.1)

No specific errors but alerts generated by O/S team showing high CPU usage and the java process for the agent consistently shows on top of topas listing.
Solution is to modify a value in emd.properties file, add a line to s_jvm_options.opt and restart the agent.

  • Set the environment to the agent
  • Find the name of the properties file
vi $(awk -F':' '{print $2 "/sysman/config/emd.properties"}' /etc/oragchomelist)
  • Back this file up
  • Modify agentJavaDefines=-Xmx128M to agentJavaDefines=-Xmx1024M
  • Find the name of the options file
vi $(awk -F':' '{print $2 "/sysman/config/s_jvm_options.opt"}' /etc/oragchomelist)
  • Back this file up
  • Add -XX:ParallelGCThreads=8
  • Restart the agent
emctl stop agent
emctl start agent

EM 13.4: OMS Java Process Consuming High CPU and Causing Console Slowness / OMS Hung Intermittently (Doc ID 2702019.1)

OMS java process uses high CPU due to java 1.8 using a lot higher codeCache than previous versions.
Solution os to increase the codeCacheSize from 100M to at least 512M and restart the oms.

  • Set the environment to the oms
  • Check the current value
emctl get property -name JAVA_EM_ARGS

can also be seen in a ps listing

ps -ef | grep EMGC_OMS | grep ReservedCodeCacheSize 
  • Set a higher value
emctl set property -name JAVA_EM_ARGS -value "-XX:ReservedCodeCacheSize=512M"
  • Restart the oms
emctl stop oms -all
emctl start oms

ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below

Database is restored and now we want to recover it but we see this…

Starting recover at 24-JUL-15 11:26:19

starting media recovery

unable to find archive log
archive log thread=1 sequence=69763
Oracle Error:
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/oracle/TRSCRP1/oradata2/system01.dbf'

released channel: c1

This means that although we have restored the database, we are still missing information to complete the recovery. This information is contained in the archived redo logs which must also be restored (from tape if they are no longer on disk)
We can see here that we need an archive log with sequence number 69763. But what is the file called and where should it be restored to?
For this we can go to SQL*Plus and get the database to tell us

recover database using backup controlfile until cancel;

and cancel straight away.

ORA-00279: change 13796376414661 generated at 07/14/2015 13:20:07 needed for
thread 1
ORA-00289: suggestion : /oracle/TRSCRP1/archive/arch_TRSCRP1_1_69763.arc
ORA-00280: change 13796376414661 for thread 1 is in sequence #69763


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
cancel
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/oracle/TRSCRP1/oradata2/system01.dbf'


ORA-01112: media recovery not started

Now we see that we need to find a file called arch_TRSCRP1_1_69763.arc and put it in the directory /oracle/TRSCRP1/archive.
This will continue up until the time specified for the recover so restore a whole bunch of them.
Repeat the “recover database using backup controlfile until cancel;” command and type AUTO or Enter until you've got to where you need to be.
Type CANCEL when point is reached and

alter database open resetlogs;

ORA-01194: file 1 needs more recovery to be consistent

Found another method online but I cannot see why it works…

SQL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.

SQL> startup mount
ORACLE instance started.

Total System Global Area  530288640 bytes
Fixed Size                  2131120 bytes
Variable Size             310381392 bytes
Database Buffers          209715200 bytes
Redo Buffers                8060928 bytes
Database mounted.

SQL> ALTER SYSTEM SET "_allow_resetlogs_corruption"= TRUE SCOPE = SPFILE;
SQL> ALTER SYSTEM SET undo_management=MANUAL SCOPE = SPFILE;

SQL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.

SQL> startup mount
ORACLE instance started.

Total System Global Area  530288640 bytes
Fixed Size                  2131120 bytes
Variable Size             310381392 bytes
Database Buffers          209715200 bytes
Redo Buffers                8060928 bytes
Database mounted.

SQL> alter database open resetlogs;

Database altered.

SQL> CREATE UNDO TABLESPACE undo1 datafile '<ora_data_path>undo1_1.dbf' size 200m autoextend on maxsize unlimited;

Tablespace created.

SQL> ALTER SYSTEM SET undo_tablespace = undo1 SCOPE=spfile;
System altered.

SQL> alter system set undo_management=auto scope=spfile;
System altered.

SQL> shutdown immediate

SQL> startup
oracle_errors.txt · Last modified: 2024/06/28 13:36 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki