Goal:-
Restore the Entire database including SPFILE, Controlfile from TAPE on Different Server.
Prerequisites :-
DBID of the database which needs to restore (without DBID we cannot restore the database from TAPE in few situations always better to have DBID of database Which needs to restore)
And the client name “NB_ORA_CLIENT” (client name with which backup has been taken)
My Environment Details :-
In My Case I have same ASM Disk Groups in Target Server. So in the last step while recovery completed I don't need to rename redo logs . if you have different disk groups or mount points where you are restored you need to rename the redo logs before open the database with resetlogs option.
Step 1 ) Now set the environment Variables on the new server- we will call the new server
export ORACLE_HOME=/u00/app/oracle/product/12.1.0.2/DB
export PATH=$PATH:/u00/app/oracle/product/12.1.0.2/DB
export NLS_DATE_FORMAT='MM/DD/YYYY HH24:MI:SS'
export ORACLE_SID=DEVA
Step 2 ) Start database in nomount state with temp init file.
I have Started DEVA instance with below initDEVA.ora with minimum parameters.
cat initDEVA.ora
db_name='DEVA'
processes = 150
audit_file_dest='/u00/app/oracle/admin/DEVA/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
diagnostic_dest=/u00/app/oracle
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
control_files = (ora_control1, ora_control2)
Create Required Directories according to above file contents like audit and diag_dest and so on
SQL> startup force nomount
ORACLE instance started.
Total System Global Area 247463936 bytes
Fixed Size 2923048 bytes
Variable Size 188745176 bytes
Database Buffers 50331648 bytes
Redo Buffers 5464064 bytes
Make sure database started with no errors on nomount state
Step 3 ) We are going to do the restore of SID=DEVA. Since We are restoring onto a new server our first goal is to restore the SPFILE and Controlfile.
As first Step Connect to rman & Catalog Database
rman target / catalog XXXX/XXXX@CATALOG
connected to target database: (not mounted)
RMAN> set dbid=3395405715
executing command: SET DBID
Step 4 ) Restore SPFILE from Tape backups
rman target / catalog rman/RMAN@DEVRCAT
set dbid=3395405715
run {
allocate channel c01 device type sbt PARMS "ENV=(NB_ORA_POLICY=RMAN_XXXX_XXXX,NB_ORA_SCHED=RMAN_XXXXX_XXXX)";
SEND 'NB_ORA_CLIENT= OLDSERVERNAME';
RESTORE SPFILE to pfile '/u00/app/oracle/product/12.1.0.2/DB/dbs/initDEVA.ora';
release channel c01;
}
OUTPUT:-
-- allocated channel: c01
-- channel c01: SID=66 device type=SBT_TAPE
-- channel c01: Veritas NetBackup for Oracle - Release 7.7.1 (2015091014)
--
-- sent command to channel: c01
--
-- Starting restore at 01/04/2017 16:09:14
--
-- channel c01: starting datafile backup set restore
-- channel c01: restoring SPFILE to PFILE
-- output file name=/u00/app/oracle/product/12.1.0.2/DB/dbs/initDEVA.ora
-- channel c01: reading from backup piece lbrp6ive_1_1
-- channel c01: piece handle=lbrp6ive_1_1 tag=TAG20170104T160150
-- channel c01: restored backup piece 1
-- channel c01: restore complete, elapsed time: 00:00:07
-- Finished restore at 01/04/2017 16:09:22
--
-- released channel: c01
if you cant able to restore SPFILE you can try to restore from Auto backup of SPFILE by using below commands
run {
allocate channel c01 device type sbt PARMS "ENV=(NB_ORA_POLICY=RMAN_XXXX_XXXX,NB_ORA_SCHED=RMAN_XXXXX_XXXX)";
SEND 'NB_ORA_CLIENT= NEWSERVERNAME';
RESTORE SPFILE to pfile '/u00/app/oracle/product/12.1.0.2/DB/dbs/initDEVA.ora' from autobackup maxdays 20;;
release channel c01;
}
Step 5 ) Shutdown the Instance and Start Database nomount with Newly restored pfile
Make sure Edit pfile as per your need and edit the directories if you have different directory structures when compare to original database. make sure there should not report any errors while starting
SQL> startup nomount
ORACLE instance started.
Total System Global Area 2684354560 bytes
Fixed Size 3714440 bytes
Variable Size 1342177912 bytes
Database Buffers 1325400064 bytes
Redo Buffers 13062144 bytes
Step 6 ) Restore Control Files From Tape
In My Case i have multiplexed controlfiles in two different Diskgroups. So i have restored to Two Diskgroups as like below.
rman target / catalog XXXX/XXXX@CATALOG
set dbid=3395405715
run {
allocate channel c01 device type sbt PARMS "ENV=(NB_ORA_POLICY=RMAN_XXXX_XXXX,NB_ORA_SCHED=RMAN_XXXX_XXXX)";
SEND 'NB_ORA_CLIENT= OLDSERVERNAME';
RESTORE CONTROLFILE TO '+DATA1';
RESTORE CONTROLFILE TO '+DATA2';
release channel c01;
}
********
OUTPUT:-
********
-- allocated channel: c01
-- channel c01: SID=394 device type=SBT_TAPE
-- channel c01: Veritas NetBackup for Oracle - Release 7.7.1 (2015091014)
--
-- sent command to channel: c01
--
-- Starting restore at 01/04/2017 16:32:46
--
-- channel c01: starting datafile backup set restore
-- channel c01: restoring control file
-- output file name=+DATA1
-- channel c01: reading from backup piece lcrp6j11_1_1
-- channel c01: piece handle=lcrp6j11_1_1 tag=TAG20170104T160241
-- channel c01: restored backup piece 1
-- channel c01: restore complete, elapsed time: 00:00:07
-- Finished restore at 01/04/2017 16:32:54
--
-- Starting restore at 01/04/2017 16:32:54
--
-- channel c01: starting datafile backup set restore
-- channel c01: restoring control file
-- output file name=+DATA2
-- channel c01: reading from backup piece lcrp6j11_1_1
-- channel c01: piece handle=lcrp6j11_1_1 tag=TAG20170104T160241
-- channel c01: restored backup piece 1
-- channel c01: restore complete, elapsed time: 00:00:07
-- Finished restore at 01/04/2017 16:33:02
--
-- released channel: c01
Now Login into ASM and find Full control file names.
ASMCMD> ls
current.265.932401971
ASMCMD> pwd
+DATA1/DEVA/CONTROLFILE
ASMCMD> ls
cu
ASMCrrent.264.932401981MD> pwd
ASMCrrent.264.932401981MD> pwd
+DATA2/DEVA/CONTROLFILE
Step 7 ) Now shutdown the database and mount it using the restored controlfile
Shutdown immediate
-- update initDEVA.ora file with new controlfile names and location
$ grep -i control initDEVA.ora
*.control_files='+DATA1/DEVA/CONTROLFILE/current.265.932401971','++DATA2/DEVA/CONTROLFILE/current.264.932401981'
SQL> startup mount
ORACLE instance started.
Total System Global Area 2684354560 bytes
Fixed Size 3714440 bytes
Variable Size 1342177912 bytes
Database Buffers 1325400064 bytes
Redo Buffers 13062144 bytes
Database mounted.
Step 8 ) Now Start The Database Restore
rman target / catalog XXXX/XXXX@CATALOG
Recovery Manager: Release 12.1.0.2.0 - Production on Wed Jan 4 18:04:18 2017
Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
connected to target database: DEVA (DBID=3395405715, not open)
connected to recovery catalog database
run {
allocate channel c01 device type sbt PARMS "ENV=(NB_ORA_POLICY=RMAN_XXXX_XXXX,NB_ORA_SCHED=RMAN_XXXX_XXXX)";
allocate channel c02 device type sbt PARMS "ENV=(NB_ORA_POLICY=RMAN_XXXX_XXXX,NB_ORA_SCHED=RMAN_XXXX_XXXX)";
allocate channel c03 device type sbt PARMS "ENV=(NB_ORA_POLICY=RMAN_XXXX_XXXX,NB_ORA_SCHED=RMAN_XXXX_XXXX)";
allocate channel c04 device type sbt PARMS "ENV=(NB_ORA_POLICY=RMAN_XXXX_XXXX,NB_ORA_SCHED=RMAN_XXXX_XXXX)";
SEND 'NB_ORA_CLIENT= OLDSERVERNAME';
restore database;
switch datafile all;
recover database;
release channel c01;
release channel c02;
release channel c03;
release channel c04;
}
Ouput:-
channel c01: starting datafile backup set restore
channel c01: specifying datafile(s) to restore from backup set
channel c01: restoring datafile 00010 to +DATA/DEVA/DATAFILE/XXXXXXx.151
channel c01: reading from backup piece l2rp6dgu_1_1
channel c01: piece handle=l2rp6dgu_1_1 tag=TAG20170104T142843
channel c01: restored backup piece 1
channel c01: restore complete, elapsed time: 00:00:07
channel c01: starting datafile backup set restore
channel c01: specifying datafile(s) to restore from backup set
channel c01: restoring datafile 00006 to +DATA/DEVADATAFILE/XXXXXXX929111327
channel c01: reading from backup piece l4rp6dho_1_1
------------
------------ Deleted output due length
------------
Starting recover at 01/04/2017 17:49:20
starting media recovery
channel c01: starting archived log restore to default destination
channel c01: restoring archived log
archived log thread=1 sequence=809
channel c01: reading from backup piece l6rp6esg_1_1
channel c01: piece handle=l6rp6esg_1_1 tag=TAG20170104T145159
channel c01: restored backup piece 1
channel c01: restore complete, elapsed time: 00:00:07
archived log file name=+XXXXX/DEVAARCHIVELOG/2017_01_04/thread_1_seq_809.302.932406567 thread=1 sequence=809
channel c01: reading from backup piece larp6iub_1_1
channel c01: piece handle=larp6iub_1_1 tag=TAG20170104T160115
channel c01: restored backup piece 1
channel c01: restore complete, elapsed time: 00:00:07
archived log file name=+XXXX/DEVAARCHIVELOG/2017_01_04/thread_1_seq_811.481.932406593 thread=1 sequence=811
unable to find archived log
archived log thread=1 sequence=812
released channel: c01
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 01/04/2017 17:49:55
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 812 and starting SCN of 86447354
Step 9 ) Open the Database with reset logs.
Note :- if you are restoring into different mount points / Diskgroups you need rename the redo logs according to new names after then only execute below command. To rename redo logs you can check my previous backup and recovery topics .
In My case I have same diskgroup names in ASM so I dont require to execute rename redo logs.
RMAN> sql 'alter database open resetlogs';
sql statement: alter database open resetlogs
new incarnation of database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
RMAN> exit
Step 10 ) login into database and verify few things .
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE
That's it you have restored complete database into another server .
No comments:
Post a Comment