Quantcast
Channel: Thinking Out Loud
Viewing all articles
Browse latest Browse all 666

Easy Way To Remove Oracle Database Home

$
0
0
-- Previously renamed all ORACLE_HOME to be deleted (just my preference and you can ask if curious).

[oracle@host]/u01/oracle/product>ls -l
total 28
drwxr-xr-x. 3 oracle oinstall 4096 Apr 10  2019 11.2.0_old/
drwxr-xr-x. 3 oracle oinstall 4096 Apr 11  2019 12.1.0_old_agent/
drwxr-xr-x. 3 oracle oinstall 4096 May 27  2021 13.4/
drwxr-xr-x. 3 oracle oinstall 4096 Apr 10  2019 18.5/
drwxr-xr-x. 3 oracle oinstall 4096 Jul 28  2021 18c_old/
drwxr-xr-x. 3 oracle oinstall 4096 Sep 14 06:57 19.16/
drwxr-xr-x. 4 oracle oinstall 4096 Mar  1  2022 19c/
[oracle@host]/u01/oracle/product>

-- Remove OLD ORACLE_HOME

[oracle@host]/u01/oracle/product>rm -rf 11.2.0_old 12.1.0_old_agent 18c_old
[oracle@host]/u01/oracle/product>ls -l
total 16
drwxr-xr-x. 3 oracle oinstall 4096 May 27  2021 13.4/
drwxr-xr-x. 3 oracle oinstall 4096 Apr 10  2019 18.5/
drwxr-xr-x. 3 oracle oinstall 4096 Sep 14 06:57 19.16/
drwxr-xr-x. 4 oracle oinstall 4096 Mar  1  2022 19c/
[oracle@host]/u01/oracle/product>

-- Databases are still in inventory.xml
-- Need to update inventory.xml
-- Some has edit inventory.xml manually but it's not supported by Oracle.

-- Example is for 18c/db_1 (OraDB18Home1)
[oracle@host]/u01/oracle/product>grep "HOME NAME" /u01/oracle/oraInventory/ContentsXML/inventory.xml|grep db|grep 18c
<HOME NAME="OraDB18Home1" LOC="/u01/oracle/product/18c/db_1" TYPE="O" IDX="12"/>
[oracle@host]/u01/oracle/product>

-- Use runInstaller -silent -detachHome to remove ORACLE_HOME from inventory.xml

[oracle@host]/u01/oracle/product>ls $ORACLE_HOME/oui/bin/runInstaller
/u01/oracle/product/19.16/db_1/oui/bin/runInstaller*
[oracle@host]/u01/oracle/product>

[oracle@host]/u01/oracle/product>$ORACLE_HOME/oui/bin/runInstaller -silent -detachHome ORACLE_HOME="/u01/oracle/product/18c/db_1" ORACLE_HOME_NAME="OraDB18Home1"
Starting Oracle Universal Installer...

Checking swap space: must be greater than 500 MB.   Actual 16397 MB    Passed
The inventory pointer is located at /etc/oraInst.loc
You can find the log of this install session at:
 /u01/oracle/oraInventory/logs/DetachHome2022-10-20_07-10-38AM.log
'DetachHome' was successful.
[oracle@host]/u01/oracle/product>

-- detachHome was successful but 18c home was recreated.

[oracle@host]/u01/oracle/product>ls -alrt
total 36
drwxr-xr-x.  3 oracle oinstall  4096 Apr 10  2019 18.5/
drwxr-xr-x.  3 oracle oinstall  4096 May 27  2021 13.4/
drwxr-xr-x.  4 oracle oinstall  4096 Mar  1  2022 19c/
drwxr-xr-x.  3 oracle oinstall  4096 Sep 14 06:57 19.16/
drwxr-xr-x. 13 oracle oinstall 12288 Sep 18 14:14 ../
drwxrwx---.  3 oracle oinstall  4096 Oct 20 07:10 18c/
drwxr-xr-x.  7 oracle oinstall  4096 Oct 20 07:10 ./

-- Check 18c home

[oracle@host]/u01/oracle/product>ls -l 18c/*/*
-rw-r-----. 1 oracle oinstall   59 Apr 10  2019 18c/db_1/oraInst.loc

18c/db_1/cfgtoollogs:
total 4
drwxrwx---. 2 oracle oinstall 4096 Oct 20 07:10 oui/

18c/db_1/inventory:
total 8
drwxr-x---. 2 oracle oinstall 4096 Oct 20 07:10 ContentsXML/
drwxrwx---. 2 oracle oinstall 4096 Oct 20 07:10 checkpoints/
[oracle@host]/u01/oracle/product>

-- Remove 18c home again

[oracle@host]/u01/oracle/product>rm -rfv 18c/
removed '18c/db_1/oraInst.loc'
removed '18c/db_1/inventory/ContentsXML/config.xml'
removed '18c/db_1/inventory/ContentsXML/oraclehomeproperties.xml'
removed directory: '18c/db_1/inventory/ContentsXML'
removed directory: '18c/db_1/inventory/checkpoints'
removed directory: '18c/db_1/inventory'
removed '18c/db_1/cfgtoollogs/oui/oraInstall2022-10-20_07-10-38AM.out'
removed '18c/db_1/cfgtoollogs/oui/DetachHome2022-10-20_07-10-38AM.log'
removed '18c/db_1/cfgtoollogs/oui/oraInstall2022-10-20_07-10-38AM.err'
removed directory: '18c/db_1/cfgtoollogs/oui'
removed directory: '18c/db_1/cfgtoollogs'
removed directory: '18c/db_1'
removed directory: '18c/'
[oracle@host]/u01/oracle/product>

In hindsight, remove ORACLE_HOME from inventory.xml first using runInstaller and then remove ORACLE_HOME directory.

Viewing all articles
Browse latest Browse all 666

Trending Articles