scenario:
i have two database servers, 1 is my production db server and other
one is backup testing db server. in backup testing server i have
installed only oracle binaries.(server) haven't configured
any databases using dbca. ;)
connect to rman of production db and take the backup of controlfile/datafile/archivelogs.
oracle$ rman target /
take control file backup
rman> configure controlfile autobackup on;
now check it
rman > show all
rman > backup as copy current controlfile
now backup database full
rman>backup database plus archivelog;
or
rman> backup as compressed backupset database;
rman> backup as compressed backupset archivelog all;
--------------------------------------------------------------------
now get the paths of backup files taken
oracle$ sqlplus / as sysdba
sql>select name from v$datafile;
sql>select member from v$logfile;
sql>select name from v$controlfile;
sql>show parameter dump_dest
copy them to a textpad bcz we want to create same directories in
other server.
----------------------------------------------------------------------
now connect to the backup testing server
create directories for files like backupset and dumpset
oracle$ cd $oracle_home
oracle$ mkdir oradata
oracle$ cd oradata
oracle$ mkdir .....
......
......
dump destination
oracle$ cd /u01/oracle/product/10.2.0/db_1/admin
oracle$ mkdir DR
oracle$ cd DR
oracle$ mkdir adump bdump cdump udump
oracle$ cd /tmp
to store rman backup
oracle$ mkdir backup
----------------------------------------------
now connect to the prod db and copy all the backup files to
relevant location.
archivelogs,controlfile,datafile to /tmp/backup using scp command
----------------------------
now connect to backup server
first step is to restore spfile
oracle$ export oracle_sid=dr
oracle$ rman target /
start the database in nomount mode using dumy parameter file
rman> startup nomount
rman> restore spfile from '/tmp/backup/filename.bkp';
now restore control file
oracle$ rman target /
rman> startup nomount
rman> restore controlfile from '/tmp/backup/spfilename ekamai.nkp';
--------------------------------------------------------------
open database
rman> startup force mount
if this fails, then login sqlplus as sysdba
then create PFILE from SPFILE manually
sql> CREATE PFILE = '/u01/myinit.ora' FROM SPFILE = '/u01/app/oracle/product/11.2.0/db_1/dbs/hnbstg_spfile.ora';
then edit pfile as below------
+++++++++++++++++++++++++++++++++++++++++++++++
comment belows using # sign
#hnbstg.__db_cache_size=230686720
#hnbstg.__java_pool_size=4194304
#hnbstg.__large_pool_size=4194304
#hnbstg.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
#hnbstg.__pga_aggregate_target=327155712
#hnbstg.__sga_target=616562688
#hnbstg.__shared_io_pool_size=0
#hnbstg.__shared_pool_size=360710144
#hnbstg.__streams_pool_size=4194304
*.audit_file_dest='/u01/app/oracle/admin/hnbstg/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u01/app/oracle/product/11.2.0/db_1/dbs/cntrlhnbstg.dbf'
*.db_block_size=8192
*.db_domain=''
*.db_name='hnbstg'
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=12884901888
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=hnbstgXDB)'
*.job_queue_processes=1000
*.memory_target=943718400
*.open_cursors=300
++++create audit_file_dest as mentioned (ex:-/u01/app/oracle/admin/hnbstg/adump)
++++change control_files as mentioned (ex:- /u01/app/oracle/product/11.2.0/db_1/dbs/cntrlhnbstg.dbf)
after the recovery of controlfile it will be available in above directory
+++++create db_recovery_file_dest as mentioned (ex:-/u01/app/oracle/flash_recovery_area)
note:- all the paths and files should be replaced using oracle user.
+++++++++++++++++++++++++++++++++++++++++++++++
now startup the database using newly created PFILE
sql>startup force mount PFILE=/u01/myinit.ora;
now copy the backup datafiles and archivelog files to /u01/app/oracle/flash_recovery_area
now login to rman and restore the database
rman target /
restore database
rman> restore database;
if this fails catalog datafiles
rman> catalog start with '/u01/app/oracle/flash_recovery_area/backupset/2011-02-02';
rman> restore database;
recover database using logfiles
rman> recover database
it fails, so issue below
rman> alter database open resetlogs;
rman> exit
Issue above same command if you can't open the database
now create a spfile from pfile
oracle$sqlplus / as sysdba
sql>create spfile from pfile='/u01/myinit.ora';
sql> now down the db serve and start it again...
sql> check table whatever u want ;)