Monday, 9 May 2016

Oracle Database Decommsion Steps

Sometimes once the standalone database moved to EXADATA box or when the respective database no need required in the project, as per the business requirement,DBA need to decommission of the database.


Below are the steps to decommission of the database.



Predecommisison Steps: - 


1) Take a level-0 backup for the database which is to be decommissioned.


 RMAN> backup incremental level 0 database plus archivelog;



2) Comment or backup  all the crontab entries for all the scripts related to the databases to be decommissioned.


$ crontab -l > /path/to/your/backup/cronatab_DATE.file   <<this is for total crontab backup)

(replace the path with a valid one)


-- only related to the database which going to be decommissioned.


crontab -l |grep databasename > /pathwheretostore/filename.backup


3) Get a list of all datafiles,online redo logfiles&controlfiles as below :-


SQL>select * from dba_data_files;

SQL>select * from v$logfile;

SQL>select * from v$controlfile;


4) Validate whether there is any database link for the database as below:-

SQL>select * from dba_db_links;


If there is existing db-links for the database, drop them as below:-


DROP <<PUBLIC>> DATABASE LINK <<link_name>>;


5) Take a backup of parameter file for the database as below and rename it with date

SQL>create pfile from spfile;


mv initp023.ora initp02305082016.ora



Decommission Steps:-


If the version of Oracle is 10g or above


1) Shutdown the database


SQL>shu immediate;


2) Startup the database and mount it in exclusive mode as below and drop the database as below:-


SQL>startup mount exclusive restrict;  


---> It will restrict to mount or use the DB in any paralle server


SQL>drop database;



3) Validate that no files are physically present by going to all relevant mountpoints.


If the version of Oracle is 9i or below:-


1)Shutdown the database


SQL>shut immediate;


2) Go to all the relevant mountpoints and remove all datafiles, parameter files,controlfiles,onlineredolog files from O/S level by below command:-

$rm *.dbf

$rm *.ctl

$rm *.arc


Post decommission steps:-



1) Remove the profile of the decommissioned databases.


2)Edit the oratab file and remove the decommissioned databases.





 

No comments:

Post a Comment