Drop an Oracle Database using SQLPlus - Drop Database

DBCA is one of the most popular method of dropping an Oracle database. I personally use SQLPlus method. It is simple, fast and removes the files from the storage as well. SQLPlus also doesn't verify the inventory information for the drop.

Please set the environment variables like $ORACLE_SID, $ORACLE_HOME, $PATH. If the database is already up and running, issue a shutdown first. Following are the order of commands:

$ sqlplus / as sysdba
SQL> shutdown immediate;
SQL> startup mount exclusive restrict;
SQL> drop database;
SQL> exit
Please wait for few minutes and you can see the database files are removed.

OPatch Error after copying Oracle Home : Inventory load failed... OPatch cannot load inventory for the given Oracle Home.

In order to save time, I copied Oracle Database Home from one server to another including the inventory. When I tried to do a 'lsinventory' I got the following error:

$opatch lsinventory -invPtrLoc /r01/app/oracle/oradb/oraInventory/oraInst.loc

Oracle Interim Patch Installer version 12.1.0.1.6
Copyright (c) 2015, Oracle Corporation.  All rights reserved.


Oracle Home       : /r01/app/oracle/oradb/12.1.0
Central Inventory : /r01/app/oracle/oradb/oraInventory
   from           : /r01/app/oracle/oradb/oraInventory/oraInst.loc
OPatch version    : 12.1.0.1.6
OUI version       : 12.1.0.2.0
Log file location : /r01/app/oracle/oradb/12.1.0/cfgtoollogs/opatch/opatch2015-06-02_10-31-39AM_1.log

List of Homes on this system:

  Home name= OraDB12Home1, Location= "/u01/app/oracle/oradb/12.1.0"
Inventory load failed... OPatch cannot load inventory for the given Oracle Home.
Possible causes are:
   Oracle Home dir. path does not exist in Central Inventory
   Oracle Home is a symbolic link
   Oracle Home inventory is corrupted
LsInventorySession failed: OracleHomeInventory gets null oracleHomeInfo

OPatch failed with error code 73

Solution:

Go to the Inventory location (in my case /r01/app/oracle/oradb/oraInventory/ContentsXML) and search for inventory.xml. Replace

HOME NAME="OraDB12Home1" LOC="/u01/app/oracle/oradb/12.1.0" TYPE="O" IDX="1"
with
HOME NAME="OraDB12Home1" LOC="/r01/app/oracle/oradb/12.1.0" TYPE="O" IDX="1" 

in the inventory.xml and save it.