Thursday 14 April 2016

How to drop Database manually without using DBCA?

First of all check all the physical paths of your database contents by doing,
  •  Login using SYSDBA privilege and check for you diagnostic location by looking into v$diag_info view.
  •  SQL> select name,value from v$diag_info;  
    
  • Get structure of your database from v$controlfile, v$datafile, v$logfile, v$tempfile & v$archived_dest.
  •  SQL>select name from v$controlfile  
           union  
           select name from v$datafile  
           union  
           select member from v$logfile  
           union  
           select name from v$tempfile  
           union  
           select destination from v$archived_dest where destination is not null;  
    
  •  After having all the physical paths of files which belongs to your database just note down them or create dynamic commands from them. (To know how to create dynamic unix/linux command click here.)
  • Now login to you database which you want to drop, and if its open, shut it down. After shutting down the database just mount the database with STARTUP RESTRICT MOUNT command so no will allow to connect to database rather than those who has RESTRICT SESSION privilege.
  •  [oracle@oracleasm2 ~]$ . oraenv  
     ORACLE_SID = [dr01] ? dr01  
     The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 is /u01/app/oracle  
     [oracle@oracleasm2 ~]$ rlwrap sqlplus / as sysdba  
     SQL*Plus: Release 11.2.0.1.0 Production on Thu Apr 14 13:07:42 2016  
     Copyright (c) 1982, 2009, Oracle. All rights reserved.  
     Connected to an idle instance.  
     SQL> STARTUP RESTRICT MOUNT  
     ORACLE instance started.  
     Total System Global Area 523108352 bytes  
     Fixed Size         1337632 bytes  
     Variable Size       192939744 bytes  
     Database Buffers     322961408 bytes  
     Redo Buffers        5869568 bytes  
     Database mounted.  
    
  • Now with DROP DATABASE command drop the database.
  •  SQL> drop database;  
     Database dropped.  
     Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production  
     With the Partitioning, OLAP, Data Mining and Real Application Testing options  
    
  • After dropping the database you can fire those commands to delete its physical evidence. Use the information about folders you find in first two steps.

No comments :

Post a Comment