How To Resolve Database Software Install To Incorrect Location

Tags:
Oracle,
Technical Track
We were recently required to install database software to /u01/app/oracle/12.2/db1. However, when using GUI to install database, software was installed to /u01/app/oracle/12.2.0.1/db1 by mistake. This post will demonstrate an incorrect method to resolve the issue, and then the correct method.
### Review inventory.xml
Oracle Restart was upgraded from 11.2.0.4 to 19.3.0.0 Database installed at incorrect home (12.2.0.1)HOME NAME="Ora11g_gridinfrahome1" LOC="/u01/app/oracle/11.2.0.4/grid" TYPE="O" IDX="1" HOME NAME="OraDb11g_home1" LOC="/u01/app/oracle/11.2.0.4/db1" TYPE="O" IDX="2" HOME NAME="OraGI19Home1" LOC="/u01/app/19.3.0.0/grid" TYPE="O" IDX="3" CRS="true" HOME NAME="OraDB12Home1" LOC="/u01/app/oracle/12.2.0.1/db1" TYPE="O" IDX="4"
### Review DB configuration
[oracle@db-asm-1 ContentsXML]$ srvctl config database -d hawk Database unique name: hawk Database name: hawk Oracle home: /u01/app/oracle/12.2.0.1/db1 Oracle user: oracle Spfile: /u01/app/oracle/12.2.0.1/db1/dbs/spfilehawk.ora Password file: Domain: Start options: open Stop options: immediate Database role: PRIMARY Management policy: AUTOMATIC Disk Groups: DATA,FRA Services: OSDBA group: OSOPER group: Database instance: hawk [oracle@db-asm-1 ContentsXML]$
### DetachHome for 12.2.0.1
[oracle@db-asm-1 ~]$ echo $ORACLE_HOME /u01/app/oracle/12.2.0.1/db1 [oracle@db-asm-1 ~]$ $ORACLE_HOME/oui/bin/runInstaller -detachHome -silent ORACLE_HOME=$ORACLE_HOME Starting Oracle Universal Installer... Checking swap space: must be greater than 500 MB. Actual 17407 MB Passed The inventory pointer is located at /etc/oraInst.loc 'DetachHome' was successful. [oracle@db-asm-1 ~]$
### Rename DB home directory from 12.2.0.1 to 12.2
[oracle@db-asm-1 oracle]$ ls -l total 60 drwxrwxr-x 4 grid oinstall 4096 Sep 19 00:52 11.2.0.4 drwxr-xr-x 3 oracle oinstall 4096 Oct 15 05:14 12.2.0.1 drwxrwxr-x 4 oracle oinstall 4096 Sep 19 00:57 admin drwxrwxr-x 2 oracle oinstall 4096 Sep 19 00:40 audit drwxr-xr-x 3 oracle oinstall 4096 Oct 15 16:21 autoupgrade drwxrwx--- 11 grid oinstall 4096 Oct 15 18:10 cfgtoollogs drwxr-xr-x 2 grid oinstall 4096 Sep 20 15:42 checkpoints drwxr-xr-x 2 grid oinstall 4096 Sep 19 00:49 Clusterware drwxrwx--- 6 grid oinstall 4096 Sep 20 15:28 crsdata drwxr-xr-x 3 grid oinstall 4096 Sep 19 00:49 db-asm-1 drwxrwxr-x 23 grid oinstall 4096 Sep 20 15:24 diag drwxr-x--- 3 oracle oinstall 4096 Sep 19 01:06 fast_recovery_area drwxr-x--- 3 oracle oinstall 4096 Sep 19 01:06 oradata drwxr-xr-x 3 grid oinstall 4096 Sep 20 16:57 oradiag_grid drwxr-xr-x 3 oracle oinstall 4096 Oct 15 05:23 stage [oracle@db-asm-1 oracle]$ mv 12.2.0.1 12.2 [oracle@db-asm-1 oracle]$ ll total 60 drwxrwxr-x 4 grid oinstall 4096 Sep 19 00:52 11.2.0.4 drwxr-xr-x 3 oracle oinstall 4096 Oct 15 05:14 12.2 drwxrwxr-x 4 oracle oinstall 4096 Sep 19 00:57 admin drwxrwxr-x 2 oracle oinstall 4096 Sep 19 00:40 audit drwxr-xr-x 3 oracle oinstall 4096 Oct 15 16:21 autoupgrade drwxrwx--- 11 grid oinstall 4096 Oct 15 18:10 cfgtoollogs drwxr-xr-x 2 grid oinstall 4096 Sep 20 15:42 checkpoints drwxr-xr-x 2 grid oinstall 4096 Sep 19 00:49 Clusterware drwxrwx--- 6 grid oinstall 4096 Sep 20 15:28 crsdata drwxr-xr-x 3 grid oinstall 4096 Sep 19 00:49 db-asm-1 drwxrwxr-x 23 grid oinstall 4096 Sep 20 15:24 diag drwxr-x--- 3 oracle oinstall 4096 Sep 19 01:06 fast_recovery_area drwxr-x--- 3 oracle oinstall 4096 Sep 19 01:06 oradata drwxr-xr-x 3 grid oinstall 4096 Sep 20 16:57 oradiag_grid drwxr-xr-x 3 oracle oinstall 4096 Oct 15 05:23 stage [oracle@db-asm-1 oracle]$
### Update oratab
[oracle@db-asm-1 ContentsXML]$ vi /etc/oratab [oracle@db-asm-1 ContentsXML]$ cat /etc/oratab #Backup file is /u01/app/oracle/crsdata/db-asm-1/output/oratab.bak.db-asm-1.grid line added by Agent db:/u01/app/oracle/12.2.0.1/db1:M +ASM:/u01/app/19.3.0.0/grid:N # line added by Agent #hawk:/u01/app/oracle/12.2.0.1/db1:N # line added by Agent hawk:/u01/app/oracle/12.2/db1:N [oracle@db-asm-1 ContentsXML]$
### attachHome for 12.2
[oracle@db-asm-1 db1]$ export ORACLE_HOME=/u01/app/oracle/12.2/db1 [oracle@db-asm-1 db1]$ ls -ld $ORACLE_HOME drwxr-xr-x 76 oracle oinstall 4096 Nov 5 20:40 /u01/app/oracle/12.2/db1 [oracle@db-asm-1 db1]$ $ORACLE_HOME/oui/bin/runInstaller -attachHome -silent ORACLE_HOME=$ORACLE_HOME ORACLE_HOME_NAME="OraDB12Home2" Starting Oracle Universal Installer... Checking swap space: must be greater than 500 MB. Actual 17407 MB Passed The inventory pointer is located at /etc/oraInst.loc 'AttachHome' was successful. [oracle@db-asm-1 db1]$
### Review inventory.xml
HOME NAME="Ora11g_gridinfrahome1" LOC="/u01/app/oracle/11.2.0.4/grid" TYPE="O" IDX="1" HOME NAME="OraDb11g_home1" LOC="/u01/app/oracle/11.2.0.4/db1" TYPE="O" IDX="2" HOME NAME="OraGI19Home1" LOC="/u01/app/19.3.0.0/grid" TYPE="O" IDX="3" CRS="true" HOME NAME="OraDB12Home2
" LOC="/u01/app/oracle/12.2/db1" TYPE="O" IDX="4"
### orabasetab not properly updated
[oracle@db-asm-1 ContentsXML]$ ll $ORACLE_HOME/install/orabasetab -rw-rw---- 1 oracle oinstall 135 Oct 15 05:42 /u01/app/oracle/12.2/db1/install/orabasetab [oracle@db-asm-1 ContentsXML]$ cat $ORACLE_HOME/install/orabasetab #orabasetab file is used to track Oracle Home associated with Oracle Base/u01/app/oracle/12.2.0.1/db1
:/u01/app/oracle:OraDB12Home1:N: [oracle@db-asm-1 ContentsXML]$
### srvctl config database failed
[oracle@db-asm-1 ~]$ srvctl config database /u01/app/oracle/12.2/db1/bin/srvctl: line 254: /u01/app/oracle/12.2.0.1/db1/srvm/admin/getcrshome: No such file or directory hawkUnfortunately, not able to determine where the reference to getcrshome is from. Method taken so far has not worked. Anoter method is to deinstall and reinstall but wanted to save time. Clone DB home worked.
### DetachHome for OraDB12Home2
[oracle@db-asm-1 bin]$ $ORACLE_HOME/oui/bin/runInstaller -detachHome -silent ORACLE_HOME=$ORACLE_HOME ORACLE_HOME_NAME="OraDB12Home2" Starting Oracle Universal Installer... Checking swap space: must be greater than 500 MB. Actual 17407 MB Passed The inventory pointer is located at /etc/oraInst.loc 'DetachHome' was successful. [oracle@db-asm-1 bin]$### Clone DB home
[oracle@db-asm-1 ~]$ cd $ORACLE_HOME/clone/bin [oracle@db-asm-1 bin]$ perl clone.pl -silent -defaultHomeName ORACLE_HOME="/u01/app/oracle/12.2/db1" ORACLE_BASE="/u01/app/oracle" Starting Oracle Universal Installer... Checking Temp space: must be greater than 500 MB. Actual 27237 MB Passed Checking swap space: must be greater than 500 MB. Actual 17407 MB Passed Preparing to launch Oracle Universal Installer from /tmp/OraInstall2019-11-06_01-04-05AM. Please wait ...You can find the log of this install session at: /u01/app/oraInventory/logs/cloneActions2019-11-06_01-04-05AM.log .................................................. 5% Done. .................................................. 85% Done. Copy files in progress. Copy files successful. Link binaries in progress. Link binaries successful. Setup files in progress. Setup files successful. Setup Inventory in progress. Setup Inventory successful. Finish Setup successful. The cloning of OraHome1 was successful. Please check '/u01/app/oraInventory/logs/cloneActions2019-11-06_01-04-05AM.log' for more details. Setup Oracle Base in progress. Setup Oracle Base successful. .................................................. 95% Done. As a root user, execute the following script(s): 1. /u01/app/oracle/12.2/db1/root.sh .................................................. 100% Done. [oracle@db-asm-1 bin]$ [root@db-asm-1 ~]# /u01/app/oracle/12.2/db1/root.sh Check /u01/app/oracle/12.2/db1/install/root_db-asm-1_2019-11-06_01-06-40-560220381.log for the output of root script [root@db-asm-1 ~]# cat /u01/app/oracle/12.2/db1/install/root_db-asm-1_2019-11-06_01-06-40-560220381.log Performing root user operation. The following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= /u01/app/oracle/12.2/db1 Copying dbhome to /usr/local/bin ... Copying oraenv to /usr/local/bin ... Copying coraenv to /usr/local/bin ... Entries will be added to the /etc/oratab file as needed by Database Configuration Assistant when a database is created Finished running generic part of root script. Now product-specific root actions will be performed. Oracle Trace File Analyzer (TFA) is available at : /u01/app/oracle/12.2/db1/suptools/tfa/release/tfa_home/bin/tfactl [root@db-asm-1 ~]#
### Add database to cluster resource
[oracle@db-asm-1 ~]$ srvctl remove database -d hawk Remove the database hawk? (y/[n]) y [oracle@db-asm-1 ~]$ [oracle@db-asm-1 dbs]$ srvctl add database -d hawk -o /u01/app/oracle/12.2/db1 -spfile /u01/app/oracle/12.2/db1/dbs/spfilehawk.ora [oracle@db-asm-1 dbs]$ srvctl config database -d hawk Database unique name: hawk Database name: Oracle home: /u01/app/oracle/12.2/db1 Oracle user: oracle Spfile: /u01/app/oracle/12.2/db1/dbs/spfilehawk.ora Password file: Domain: Start options: open Stop options: immediate Database role: PRIMARY Management policy: AUTOMATIC Disk Groups: Services: OSDBA group: OSOPER group: Database instance: hawk [oracle@db-asm-1 dbs]$ srvctl start database -d hawk [oracle@db-asm-1 dbs]$ srvctl status database -d hawk -v Database hawk is running. Instance status: Open. [oracle@db-asm-1 dbs]$
### Verify database using sqlplus
[oracle@db-asm-1 dbs]$ sqlplus / as sysdba SQL*Plus: Release 12.2.0.1.0 Production on Wed Nov 6 01:18:43 2019 Copyright (c) 1982, 2016, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production SQL> select open_mode from v$database; OPEN_MODE -------------------- READ WRITE SQL> exit Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
### Verify orabasetab
[oracle@db-asm-1 dbs]$ cat $ORACLE_HOME/install/orabasetab #orabasetab file is used to track Oracle Home associated with Oracle Base /u01/app/oracle/12.2/db1:/u01/app/oracle:OraHome1:N: [oracle@db-asm-1 dbs]$
### Verify inventory.xml
HOME NAME="Ora11g_gridinfrahome1" LOC="/u01/app/oracle/11.2.0.4/grid" TYPE="O" IDX="1" HOME NAME="OraDb11g_home1" LOC="/u01/app/oracle/11.2.0.4/db1" TYPE="O" IDX="2" HOME NAME="OraGI19Home1" LOC="/u01/app/19.3.0.0/grid" TYPE="O" IDX="3" CRS="true" HOME NAME="OraHome1" LOC="/u01/app/oracle/12.2/db1" TYPE="O" IDX="4"
### Verify Cluster Resource
[oracle@db-asm-1 ~]$ crsctl stat res -t -------------------------------------------------------------------------------- Name Target State Server State details -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.CRS.dg ONLINE ONLINE db-asm-1 STABLE ora.DATA.dg ONLINE ONLINE db-asm-1 STABLE ora.FRA.dg ONLINE ONLINE db-asm-1 STABLE ora.LISTENER.lsnr ONLINE ONLINE db-asm-1 STABLE ora.asm ONLINE ONLINE db-asm-1 Started,STABLE ora.ons OFFLINE OFFLINE db-asm-1 STABLE -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.cssd 1 ONLINE ONLINE db-asm-1 STABLE ora.diskmon 1 OFFLINE OFFLINE STABLE ora.evmd 1 ONLINE ONLINE db-asm-1 STABLE ora.hawk.db 1 ONLINE ONLINE db-asm-1 Open,HOME=/u01/app/o racle/12.2/db1,STABL E -------------------------------------------------------------------------------- [oracle@db-asm-1 ~]$Hopefully, you won't make the same mistake I did and if you do, the triage should help to resolve the error.