Tuesday 11 June 2013


Dropping Database 

Remove Oracle Database with DBCA from command line
The following procedure shows how to remove an Oracle database with dbca utility from the command line.
1. Logon as the oracle software owner.

[root@mylinux2 root]# su - oracle
[oracle@mylinux2 ~]$
2. Change directories to $ORACLE_HOME/bin

[oracle@mylinux2 ~]$ cd $ORACLE_HOME/bin
[oracle@mylinux2 bin]$
3. Obtain the ORACLE_SID of the database you wish to delete.

[oracle@mylinux2 bin]$ ps -ef|grep smon
oracle 4746 1 0 Feb09 ? 00:00:00 ora_smon_orcl
oracle 7839 7796 0 00:39 pts/1 00:00:00 grep smon
[oracle@mylinux2 bin]$
4. Obtain the userid and password of a user with sysdba privileges, normally this would be sys.
5. Logon to the database if open with the immediate option and exit.

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@mylinux2 bin]$

6. Ensure that no oracle database processes are running for the ORACLE_SID you wish to delete

[oracle@mylinux2 bin]$ ps -ef|grep orcl
oracle 11485 7796 0 01:46 pts/1 00:00:00 grep orcl
[oracle@mylinux2 bin]$
7. Execute the command dbca -deleteDatabase -sourceDB -sysDBAUserName -sysDBAPassword

[oracle@mylinux2 bin]$ dbca -silent -deleteDatabase -sourceDB sr12 - sysDBAUserName sys -sysDBAPassword sys
Connecting to database
4% complete
9% complete
14% complete
19% complete
23% complete
28% complete
47% complete
Updating network configuration files
48% complete
52% complete
Deleting instance and datafiles
76% complete
100% complete
Look at the log file “/u01/app/oracle/cfgtoollogs/dbca/orcl.log” for
further details.
[oracle@mylinux2 bin]$


Finally drop the database oracle home
rm -rf 11.1.0

No comments:

Post a Comment