Enviorment : Windows 2008 R2 with Oracle 11g RAC
- We are restoring from RAC database incremental level-0 backup to standalone server.
- On server we have data on ASM Disk-groups at Target we have Normal file-system.
- I want database should be restored by same name.
- Source and Target both servers are on Windows 2008 R2.
***********
- First prepare your Target Server by installing Oracle Binaries.
- Create required directory structure. Like Diag, Archives & Any-name directory like prod to store data-files.
Ø Create P-file
at target with Some Parameters.
control_files='E:\ieclive\control.ctl'
db_block_size=8192
db_name='IECLIVE'
diagnostic_dest='E:\diag'
undo_tablespace='UNDOTBS1'
undo_management=auto
db_block_size=8192
db_name='IECLIVE'
diagnostic_dest='E:\diag'
undo_tablespace='UNDOTBS1'
undo_management=auto
Ø Set Environment By Creating New-Sid
C:\Windows\system32> oradim -delete -SID ieclive
C:\Windows\system32> oradim -new -SID ieclive
C:\Windows\system32> set oracle_sid=ieclive
C:\Windows\system32> sqlplus / as sysdba
Ø Start your
instance in No-mount state because we don’t have Control-file.
SQL> startup nomount pfile='E:\initieclive.ora';
Ø Connect to RMAN & set DB-id of Source database
RMAN> set dbid=1115555633
Ø Restore control-file and mount the database.
RMAN> restore controlfile from 'E:\BKPS\CONTROL_6SS1TVUL_1_1.BKP';
RMAN> alter database mount;
Ø Now Register
Backup Pieces because we Changed the Backup location from FRA to Non-FRA location in New Server to update the information in control-file and to restore all the files with set 'New-Name'.
RMAN> catalog start with 'E:\rmanbkps';
Ø Delete Expired Backups.
RMAN> crosscheck backup;
RMAN> delete expired backup;
Ø From your production database take the File-Ids to mention in RMAN block.
SQL> select tablespace_name,file_id,file_name from dba_data_files;
Ø Now Start Restore & Recover Process.
>> Restore will bring back whole database from backup.
>> Recover is the process of applying the changes to the database till point of failure these changes are recorded in online redolog and archivelogs.
RMAN>run
{
set newname for datafile 1 to 'E:\IECLIVE\system.dbf';
set newname for datafile 2 to 'E:\IECLIVE\sysaux.dbf';
set newname for datafile 3 to 'E:\IECLIVE\undotbs1.dbf';
set newname for datafile 4 to 'E:\IECLIVE\users.dbf';
set newname for datafile 5 to 'E:\IECLIVE\undotbs2.dbf';
set newname for datafile 6 to 'E:\IECLIVE\users1.dbf';
set newname for datafile 7 to 'E:\IECLIVE\users2.dbf';
set newname for datafile 8 to 'E:\IECLIVE\sysaux1.dbf';
set newname for datafile 9 to 'E:\IECLIVE\users3.dbf';
set newname for datafile 10 to 'E:\IECLIVE\system1.dbf';
set newname for datafile 11 to 'E:\IECLIVE\system2.dbf';
set newname for datafile 14 to 'E:\IECLIVE\users4.dbf';
set newname for datafile 15 to 'E:\IECLIVE\undotbs3.dbf';
set newname for datafile 16 to 'E:\IECLIVE\undotbs4.dbf';
set newname for datafile 17 to 'E:\IECLIVE\undotbs5.dbf';
set newname for datafile 18 to 'E:\IECLIVE\undotbs6.dbf';
restore database;
switch datafile all;
sql "alter database rename file ''+DATA/ieclive/onlinelog/group_1.266.860629021'' to ''E:\ieclive\log1a'' ";
sql "alter database rename file ''+DATA/ieclive/onlinelog/group_2.268.860629023'' to ''E:\ieclive\log2a'' ";
sql "alter database rename file ''+DATA/ieclive/onlinelog/group_3.261.860629087'' to ''E:\ieclive\log3a'' ";
sql "alter database rename file ''+DATA/ieclive/onlinelog/group_4.270.860629089'' to ''E:\ieclive\log4a'' ";
sql "alter database rename file ''+DATA/ieclive/onlinelog/group_5.272.860629023'' to ''E:\ieclive\log5a'' ";
sql "alter database rename file ''+DATA/ieclive/onlinelog/group_6.265.860629089'' to ''E:\ieclive\log6a'' ";
sql "alter database rename file ''+DATA/ieclive/onlinelog/group_7.273.860629025'' to ''E:\ieclive\log7a'' ";
sql "alter database rename file ''+DATA/ieclive/onlinelog/group_8.260.860629091'' to ''E:\ieclive\log8a'' ";
sql "alter database rename file ''+RECO/ieclive/onlinelog/group_1.257.860629021'' to ''E:\ieclive\log1b'' ";
sql "alter database rename file ''+RECO/ieclive/onlinelog/group_2.259.860629023'' to ''E:\ieclive\log2b'' ";
sql "alter database rename file ''+RECO/ieclive/onlinelog/group_3.261.860629087'' to ''E:\ieclive\log3b'' ";
sql "alter database rename file ''+RECO/ieclive/onlinelog/group_4.262.860629089'' to ''E:\ieclive\log4b'' ";
sql "alter database rename file ''+RECO/ieclive/onlinelog/group_5.258.860629023'' to ''E:\ieclive\log5b'' ";
sql "alter database rename file ''+RECO/ieclive/onlinelog/group_6.260.860629089'' to ''E:\ieclive\log6b'' ";
sql "alter database rename file ''+RECO/ieclive/onlinelog/group_7.263.860629025'' to ''E:\ieclive\log7b'' ";
sql "alter database rename file ''+RECO/ieclive/onlinelog/group_8.264.860629091'' to ''E:\ieclive\log8b'' ";
}
RMAN> recover database;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 04/20/2017 11:30:33
RMAN-06054: media recovery requesting unknown archived log for thread 2 with sequence 1098 and starting SCN of 1941517335
Ø After this Media-Recovery error, Open database with Reset-logs
>> Opening database with resetlogs because database will not apply an archivedlog to a datafile unless the RESETLOGS SCN and Timestamp matches.
* Oracle creates new redologs after resetlogs issued and also it reset logsequence number to '1'.
* After resetlogs Oracle updates all current datafiles,redologs and all archivelogs with NEW-SCN and Time-stamp.
RMAN> Alter database open resetlogs;
>> Opening database with resetlogs because database will not apply an archivedlog to a datafile unless the RESETLOGS SCN and Timestamp matches.
* Oracle creates new redologs after resetlogs issued and also it reset logsequence number to '1'.
* After resetlogs Oracle updates all current datafiles,redologs and all archivelogs with NEW-SCN and Time-stamp.
RMAN> Alter database open resetlogs;
Ø Now as per the requirement configure this database to work smoothly by resizing SGA,Temp tablespace, redolog sizes, process parameter, FRA etc...
> Check the redologs and tempfile locations.
SQL> select instance_name,status from v$instance;
SQL> select group#,thread#,status,members,bytes/1024/1024 from v$log;
SQL> select name from v$tempfile;
> Now convert pfile to spfile.
SQL> show parameter spfile
NAME TYPE VALUE
------------------------------------ ----------- ----------
spfile string
SQL> create spfile from pfile='E:\initieclive.ora';
SQL> shutdown
SQL> startup
SQL> show parameter spfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string E:\APP\MOIN\PRODUCT\11.2.0\DBHOME_1\DATABASE\SPFILEIECLIVE.ORA
SQL> select sum(value)/1024/1024/1024 "TOTAL SGA (GB)" from v$sga;
SQL> alter system set sga_max_size=5g scope=spfile;
SQL> alter system set memory_max_target=6g scope=spfile;
SQL> alter system set memory_target=6g scope=spfile;
SQL> Shut immediate
SQL> startup
SQL> select sum(value)/1024/1024/1024 "TOTAL SGA (GB)" from v$sga;
TOTAL SGA (GB)
--------------
4.97766876
>> Now change the tempfile locations which are pointing to cluster datbase diskgroups.
SQL> select name from v$tempfile;
SQL> select name from v$tablespace;
NAME
---------------
SYSTEM
SYSAUX
UNDOTBS1
USERS
TEMP
UNDOTBS2
6 rows selected.
SQL> create temporary tablespace temp1 tempfile 'E:\IECLIVE\temp01.dbf' size 5g;
Tablespace created.
SQL> drop tablespace temp including contents and datafiles;
ERROR at line 1:
ORA-12906: cannot drop default temporary tablespace
SQL> alter database default temporary tablespace temp1;
Database altered.
SQL> drop tablespace temp including contents and datafiles;
Tablespace dropped.
SQL> select name from v$tempfile;
NAME
-----------------------------
E:\IECLIVE\TEMP01.DBF
Enjoy Reading…….
> Check the redologs and tempfile locations.
SQL> select instance_name,status from v$instance;
SQL> select group#,thread#,status,members,bytes/1024/1024 from v$log;
SQL> select name from v$tempfile;
> Now convert pfile to spfile.
SQL> show parameter spfile
NAME TYPE VALUE
------------------------------------ ----------- ----------
spfile string
SQL> create spfile from pfile='E:\initieclive.ora';
SQL> shutdown
SQL> startup
SQL> show parameter spfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string E:\APP\MOIN\PRODUCT\11.2.0\DBHOME_1\DATABASE\SPFILEIECLIVE.ORA
SQL> select sum(value)/1024/1024/1024 "TOTAL SGA (GB)" from v$sga;
SQL> alter system set sga_max_size=5g scope=spfile;
SQL> alter system set memory_max_target=6g scope=spfile;
SQL> alter system set memory_target=6g scope=spfile;
SQL> Shut immediate
SQL> startup
SQL> select sum(value)/1024/1024/1024 "TOTAL SGA (GB)" from v$sga;
TOTAL SGA (GB)
--------------
4.97766876
>> Now change the tempfile locations which are pointing to cluster datbase diskgroups.
SQL> select name from v$tempfile;
SQL> select name from v$tablespace;
NAME
---------------
SYSTEM
SYSAUX
UNDOTBS1
USERS
TEMP
UNDOTBS2
6 rows selected.
SQL> create temporary tablespace temp1 tempfile 'E:\IECLIVE\temp01.dbf' size 5g;
Tablespace created.
SQL> drop tablespace temp including contents and datafiles;
ERROR at line 1:
ORA-12906: cannot drop default temporary tablespace
SQL> alter database default temporary tablespace temp1;
Database altered.
SQL> drop tablespace temp including contents and datafiles;
Tablespace dropped.
SQL> select name from v$tempfile;
NAME
-----------------------------
E:\IECLIVE\TEMP01.DBF
Enjoy Reading…….
No comments:
Post a Comment