Sometimes we are working on test database and database is curropted or we want to refresh the database.
In that case we can use cold backup to restore the database to previous state.
Click here to see How to take cold backup
To restore the database follow the below instructions.
Login to Oracle with Sys as sysdba
[oracle@arzaidi Desktop]$ sqlplus sys/oracle as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Tue Mar 19 20:12:04 2013
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
-- Shutdown database.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
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
[oracle@arzaidi Desktop]$
First delete existing files to clean the database.
remove all datafiles from the ../oradata/database folder in my case it is /oracle/flash_recovery_area/ardb.
Remove all control files. Usually second control file is found in flash_recovery_are/database folder in my case it is /oracle/flash_recovery_area/ardb.
Now copy all files from the backup and put them in the apporipate folders as /oracle/oradata/database in my case it is /oracle/flash_recovery_area/ardb.
Copy second control file in flash_recovery_area/database in my case it is /oracle/flash_recovery_area/ardb.
Go to Shell Prompt and login to Oracle with sys user as sysdba and start database.
[oracle@arzaidi Desktop]$ sqlplus sys/oracle as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Tue Mar 19 20:04:33 2013
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup;
ORACLE instance started.
Total System Global Area 1590267904 bytes
Fixed Size 1336792 bytes
Variable Size 1040189992 bytes
Database Buffers 536870912 bytes
Redo Buffers 11870208 bytes
Database mounted.
Database opened.
SQL> exit
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
[oracle@arzaidi Desktop]$
your database has been restored to previous point.
Good and helpful post.
ReplyDelete