How to Unregister a Database from RMAN Repository

Target Database is Still Available

You connect to the target database TEST and then unregister it:

rman TARGET SYS/Passwd@TEST CATALOG rman/rman@catdb

RMAN> UNREGISTER DATABASE NOPROMPT;

Unregistering a Database That is Not Unique in Catalog or Target Database is Unvailable

The following UNIX shell script unregisters database testdb from the recovery catalog. Because multiple databases called testdb are registered in the recovery catalog, and because RMAN is not connected to the target database (which has already been deleted from the file system), you must run SET DBID:

Show DBID of a database:

RMAN >  list incarnation of database testdb;
rman CATALOG rman/rman@catdb
RMAN> RUN
{  
  SET DBID 1334531173;   # specifies test database by DBID
  UNREGISTER DATABASE testdb NOPROMPT;
}

List all Registered Database

RMAN > LIST DB_UNIQUE_NAME ALL;

RMAN-06004: Oracle error from recovery catalog database: RMAN-20020: database incarnation not set

The following errors occur when RMAN backup took place:

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 08/06/2025 12:38:27
RMAN-03014: implicit resync of recovery catalog failed
RMAN-06004: Oracle error from recovery catalog database: RMAN-20020: database incarnation not set

RESOLUTION

RMAN> reset database;
reset database;
database incarnation already registered

ASM Instance ORA-04031: unable to allocate 232 bytes of shared memory (“shared pool”,”select ks.inst_id,ksuxsins,k…”,”KKSSP^2431″,”kglpn”)

One of the +ASM instance alert log has ORA-04031 errors:

2025-07-17T23:00:48.475567+10:00
Errors in file /u01/app/grid/diag/asm/+asm/+ASM1/trace/+ASM1_ppa7_64031.trc (incident=160513):
ORA-04031: unable to allocate 2072 bytes of shared memory ("shared pool","unknown object","sga heap(1,0)","parameter table block")
Incident details in: /u01/app/grid/diag/asm/+asm/+ASM1/incident/incdir_160513/+ASM1_ppa7_64031_i160513.trc
Use ADRCI or Support Workbench to package the incident.
See Note 411.1 at My Oracle Support for error and packaging details.
2025-07-17T23:00:48.550908+10:00
ORA-04031 heap dump being written to trace file /u01/app/grid/diag/asm/+asm/+ASM1/incident/incdir_160513/+ASM1_ppa7_64031_i160513.trc

CAUSES

The SGA_TARGET or MEMORY_TARGET parameter setting is too small.


SQL> SELECT INST_ID, POOL, NAME, BYTES/1024/1024 "SPACE MB"
FROM gv$sgastat
WHERE name = 'free memory'
AND POOL = 'shared pool'
ORDER BY INST_ID;


INST_ID POOL NAME SPACE MB
---------- -------------- ------------------------------ ----------
1 shared pool free memory 195.44057
2 shared pool free memory 115.6167
3 shared pool free memory 92.235062

RESOLUTION

Increase size of parameter SGA_TARGET or MEMORY_TARGET.

Clean Grid Infrastructure Environment

The purpose of this document is to describe steps to clean clusterware (GI) environment where deinstall fails to work or cannot complete.

Cleaning Steps

1. Remove the current GI home from central inventory
As grid home owner:

$ORACLE_HOME/oui/bin/runInstaller -detachHome -silent -local ORACLE_HOME=$ORACLE_HOME


2. Disable oracle ohasd service on Linux as root user

# /usr/bin/systemctl stop oracle-ohasd.service
# /usr/bin/systemctl disable oracle-ohasd.service


If following appears just ignore and go ahead

# /usr/bin/systemctl stop oracle-ohasd.service
Failed to stop oracle-ohasd.service: Unit oracle-ohasd.service not loaded.
# /usr/bin/systemctl disable oracle-ohasd.service
Failed to disable unit: Unit file oracle-ohasd.service does not exist.


3. Stop ohasd service as super user (‘root’)

# systemctl stop ohasd.service

  
4. Remove files under ‘/etc/oracle’ as root user:

# rm -Rf /etc/oracle


5. Remove daemon configuration files

# rm /etc/init.d/init.evmd  /etc/init.d/init.crsd \
 /etc/init.d/init.cssd /etc/init.d/init.crs /etc/init.d/init.ohasd


6. Remove ‘ohas’ related files from /etc

# find /etc -name ‘*ohas*’

Example   

# find /etc -name ‘*ohas*’
/etc/systemd/system/oracle-ohasd.service.d
/etc/rc.d/init.d/ohasd

Remove found files related to Grid Infrastructure by ‘rm’ command.

Note: Do not remove OS files。


7. Check any ‘crs’ related file under /etc and remove

# find /etc -name ‘*crs*’

If confirmed to be relevant you can remove by

# find /etc -name ‘*crs*’  |xargs rm -rf


8. [Optional] Remove TFA service files

# systemctl stop oracle-tfa.service

# systemctl disable oracle-tfa.service

Example output

# systemctl disable oracle-tfa.service
Removed /etc/systemd/system/multi-user.target.wants/oracle-tfa.service.
Removed /etc/systemd/system/graphical.target.wants/oracle-tfa.service.


9. [Optional] Remove other TFA related file

# find  /etc -name ‘*tfa*’

Remove the found file(s) accordingly.

10. Remove files under grid home

# rm -Rf $ORACLE_HOME/*
# rm -Rf $ORACLE_HOME/.opatchauto_storage
# rm -Rf $ORACLE_HOME/.patch_storage


11. Remove grid base

# rm -Rf <Oracle Base>


12. Remove socket files

# rm -rf /var/tmp/.oracle
# rm -rf /tmp/.oracle


13. Remove temporary files

cd /tmp
rm -rf CVU_xxxx_grid logs Logs OraInstall* deinstall*


14.  Remove central inventory directory and /etc/oraInst.loc if there is no need to reserve them.

15. Unset ORACLE_HOME and other environmental variables.

16. Modify /etc/passwd and /etc/group to remove GI related user(s) and group(s).

17. remove all data on OCR disk header.

# dd if=/dev/zero of=/dev/mapper/ocr_disk1 bs=1024k count=1

“runcluvfy.sh Stage -pre crsinst -n node1,node2” Hangs

The following command hangs :

$cd /u01/app/19.0.0/grid/
$./runcluvfy.sh Stage -pre crsinst -n node1,node2 -verbose

SOLUTION

$ cat /etc/redhat-release
Red Hat Enterprise Linux release 8.6 (Ootpa)
As workaround:
$export CV_ASSUME_DISTID=OEL7.8

$./runcluvfy.sh stage -pre crsinst -n node1,node2 -verbose

Or

Use the latest Cluster Verification Utility (CVU) (Doc ID 2731675.1)

Patch 30839369