Rman Catalog Database’ i Kullanarak, Kartuşa Alınan Backupı Farklı bir Sunucuya Dönme -2

kaldığımız yerden devam ediyoruz ;

  • Sıra datafile’ leri restore/recover etmeye geldi ;

 

Pathler backupı alınan database’ deki pathler ile aynı olmadığından öncelikle bu değişikliği yapmamız gerekiyor.

Aşağıdaki script ile datafile’ leri bizim belirttiğimiz yeni lokasyonlarına restore ediyoruz.

Bundan sonraki kısım aslında iki aşamalı olarak düşünebiliriz, birinci aşamamız restore, sonraki aşamamız ise recover aşamasıdır.  Datafile’ ler restore edilirken farklı seuence numaralarına sahip olarak restore edilir, yani db içerisindeki tün datafile’ lerin sequence değerleri biririnden farklılık gösterecektir. Bu farklılığı ortadan kaldırıp max sequence değeri altında datafile’ lerin hepsini aynı noktaya çeken işlem ise recover aşamasıdır. Bu konuyla  ilgili olarak aşağıdaki iki script ve arasındaki fark aslında konuyu açıklamak için yeterli diye düşünüyorum.

Aşağıdaki scripti çalıştırdığımda restore işleminin en sonunda  “RMAN-06054: media recovery requesting unknown log: thread 1 seq 686 lowscn 2858652“  böyle bir hata verdi. Almış olduğumuz backup full backupdı ve backuplanan son archive log numarası 684 idi. Recover işlemini hangi sequence değerine kadar yapılmasını belirtmediğim için aşağıdaki hatayı aldım.

RMAN> run {

2> allocate channel ‘dev_0’ type ‘sbt_tape’;

3> allocate channel ‘dev_1’ type ‘sbt_tape’;

4> allocate channel ‘dev_2’ type ‘sbt_tape’;

5> allocate channel ‘dev_3’ type ‘sbt_tape’;

6> set NEWNAME for datafile 1 to ‘/data/oracle/oradata/prdtest/system01.dbf’;

7> set NEWNAME for datafile 2 to ‘/data/oracle/oradata/prdtest/undotbs01.dbf’;

8> set NEWNAME for datafile 3 to ‘/data/oracle/oradata/prdtest/sysaux01.dbf’;

9> set NEWNAME for datafile 4 to ‘/data/oracle/oradata/prdtest/users01.dbf’;

10> set NEWNAME for datafile 5 to ‘/data/oracle/oradata/prdtest/example01.dbf’;

11> set NEWNAME for datafile 6 to ‘/data/oracle/oradata/prdtest/kamil_deneme1_01.dbf’;

12> set NEWNAME for datafile 7 to ‘/data/oracle/oradata/prdtest/kamil_deneme1_02.dbf’;

13> set NEWNAME for datafile 8 to ‘/data/oracle/oradata/prdtest/kamil_deneme2_01.dbf’;

14> set NEWNAME for datafile 9 to ‘/data/oracle/oradata/prdtest/kamil_deneme2_02.dbf’;

15> restore database;

16> switch datafile all;

17> recover database;

18> }

allocated channel: dev_0

channel dev_0: sid=161 devtype=SBT_TAPE

channel dev_0: Data Protector A.06.00/PHSS_37147/PHSS_37148/DPSOL_00306/DPLNX_

allocated channel: dev_1

channel dev_1: sid=160 devtype=SBT_TAPE

channel dev_1: Data Protector A.06.00/PHSS_37147/PHSS_37148/DPSOL_00306/DPLNX_

allocated channel: dev_2

channel dev_2: sid=159 devtype=SBT_TAPE

channel dev_2: Data Protector A.06.00/PHSS_37147/PHSS_37148/DPSOL_00306/DPLNX_

allocated channel: dev_3

channel dev_3: sid=156 devtype=SBT_TAPE

channel dev_3: Data Protector A.06.00/PHSS_37147/PHSS_37148/DPSOL_00306/DPLNX_

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 01-DEC-10

channel dev_0: starting datafile backupset restore

channel dev_0: specifying datafile(s) to restore from backup set

restoring datafile 00005 to /data/oracle/oradata/prdtest/example01.dbf

restoring datafile 00006 to /data/oracle/oradata/prdtest/kamil_deneme1_01.dbf

restoring datafile 00007 to /data/oracle/oradata/prdtest/kamil_deneme1_02.dbf

channel dev_1: starting datafile backupset restore

channel dev_1: specifying datafile(s) to restore from backup set

restoring datafile 00002 to /data/oracle/oradata/prdtest/undotbs01.dbf

restoring datafile 00003 to /data/oracle/oradata/prdtest/sysaux01.dbf

restoring datafile 00004 to /data/oracle/oradata/prdtest/users01.dbf

channel dev_2: starting datafile backupset restore

channel dev_2: specifying datafile(s) to restore from backup set

restoring datafile 00001 to /data/oracle/oradata/prdtest/system01.dbf

restoring datafile 00008 to /data/oracle/oradata/prdtest/kamil_deneme2_01.dbf

restoring datafile 00009 to /data/oracle/oradata/prdtest/kamil_deneme2_02.dbf

[Normal] From: OB2BAR_Oracle8@betasetapp2 “”  Time: 12/01/10 09:55:10

        Starting OB2BAR Restore:

Finished restore at 01-DEC-10

Starting recover at 01-DEC-10

starting media recovery

channel dev_0: starting archive log restore to default destination

channel dev_0: restoring archive log

archive log thread=1 sequence=685

[Normal] From: OB2BAR_Oracle8@betasetapp2 “”  Time: 12/01/10 09:57:35

        Starting OB2BAR Restore: …

channel dev_0: restore complete

archive log filename=/data/oracle/flash_recovery_area/PRDTEST/archivelog/2010_12_01/o1_mf_1_685_6hczzhn4_.arc thread=1 sequence=685

channel default: deleting archive log(s)

archive log filename=/data/oracle/flash_recovery_area/PRDTEST/archivelog/2010_12_01/o1_mf_1_685_6hczzhn4_.arc recid=681 stamp=736595856

unable to find archive log

archive log thread=1 sequence=686

released channel: dev_0

released channel: dev_1

released channel: dev_2

released channel: dev_3

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of recover command at 12/01/2010 09:57:43

RMAN-06054: media recovery requesting unknown log: thread 1 seq 686 lowscn 2858652

Until seq vererek çalıştırdığım zaman ;

RMAN> run {

2> allocate channel ‘dev_0’ type ‘sbt_tape’;

3> allocate channel ‘dev_1’ type ‘sbt_tape’;

4> allocate channel ‘dev_2’ type ‘sbt_tape’;

5> allocate channel ‘dev_3’ type ‘sbt_tape’;

6> set NEWNAME for datafile 1 to ‘/data/oracle/oradata/prdtest/system01.dbf’;

7> set NEWNAME for datafile 2 to ‘/data/oracle/oradata/prdtest/undotbs01.dbf’;

8> set NEWNAME for datafile 3 to ‘/data/oracle/oradata/prdtest/sysaux01.dbf’;

9> set NEWNAME for datafile 4 to ‘/data/oracle/oradata/prdtest/users01.dbf’;

10> set NEWNAME for datafile 5 to ‘/data/oracle/oradata/prdtest/example01.dbf’;

11> set NEWNAME for datafile 6 to ‘/data/oracle/oradata/prdtest/kamil_deneme1_01.dbf’;

12> set NEWNAME for datafile 7 to ‘/data/oracle/oradata/prdtest/kamil_deneme1_02.dbf’;

13> set NEWNAME for datafile 8 to ‘/data/oracle/oradata/prdtest/kamil_deneme2_01.dbf’;

14> set NEWNAME for datafile 9 to ‘/data/oracle/oradata/prdtest/kamil_deneme2_02.dbf’;

15> set until sequence 686 thread 1;

16> restore database;

17> switch datafile all;

18> recover database;

19> }

allocated channel: dev_0

channel dev_0: sid=161 devtype=SBT_TAPE

channel dev_0: Data Protector A.06.00/PHSS_37147/PHSS_37148/DPSOL_00306/DPLNX_

allocated channel: dev_1

channel dev_1: sid=160 devtype=SBT_TAPE

channel dev_1: Data Protector A.06.00/PHSS_37147/PHSS_37148/DPSOL_00306/DPLNX_

allocated channel: dev_2

channel dev_2: sid=159 devtype=SBT_TAPE

channel dev_2: Data Protector A.06.00/PHSS_37147/PHSS_37148/DPSOL_00306/DPLNX_

allocated channel: dev_3

channel dev_3: sid=156 devtype=SBT_TAPE

channel dev_3: Data Protector A.06.00/PHSS_37147/PHSS_37148/DPSOL_00306/DPLNX_

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET until clause

Starting restore at 01-DEC-10

channel dev_0: starting datafile backupset restore

channel dev_0: specifying datafile(s) to restore from backup set

restoring datafile 00005 to /data/oracle/oradata/prdtest/example01.dbf

restoring datafile 00006 to /data/oracle/oradata/prdtest/kamil_deneme1_01.dbf

restoring datafile 00007 to /data/oracle/oradata/prdtest/kamil_deneme1_02.dbf

channel dev_1: starting datafile backupset restore

channel dev_1: specifying datafile(s) to restore from backup set

restoring datafile 00002 to /data/oracle/oradata/prdtest/undotbs01.dbf

restoring datafile 00003 to /data/oracle/oradata/prdtest/sysaux01.dbf

restoring datafile 00004 to /data/oracle/oradata/prdtest/users01.dbf

channel dev_2: starting datafile backupset restore

channel dev_2: specifying datafile(s) to restore from backup set

restoring datafile 00001 to /data/oracle/oradata/prdtest/system01.dbf

restoring datafile 00008 to /data/oracle/oradata/prdtest/kamil_deneme2_01.dbf

restoring datafile 00009 to /data/oracle/oradata/prdtest/kamil_deneme2_02.dbf

[Normal] From: OB2BAR_Oracle8@betasetapp2 “”  Time: 12/01/10 10:06:54

        Starting OB2BAR Restore: …

media recovery complete

Finished recover at 01-DEC-10

released channel: dev_0

released channel: dev_1

released channel: dev_2

released channel: dev_3

RMAN>

  • Redologların path’ ini düzeltiyoruz.

 

Recover işlemi başarı ile bittikden redologların yeni pathlerini set etmemiz gerekiyor. Yeni pathleri vermeden açmaya çalışırsak aşağıdaki hatayı alırız.

SQL> alter database open resetlogs;

alter database open resetlogs

*

ERROR at line 1:

ORA-00344: unable to re-create online log ‘/data2/prdtest/redo01.log’

ORA-27040: file create error, unable to create file

IBM AIX RISC System/6000 Error: 2: No such file or directory

Redologların pathlerini düzeltmek için ;

SQL> alter database rename file ‘/data2/prdtest/redo03.log’ to ‘/data/oracle/oradata/prdtest/redo03.log’;

Database altered.

SQL> alter database rename file ‘/data2/prdtest/redo02.log’ to ‘/data/oracle/oradata/prdtest/redo02.log’;

Database altered.

SQL> alter database rename file ‘/data2/prdtest/redo01.log’ to ‘/data/oracle/oradata/prdtest/redo01.log’;

Database altered.

Kontol etmek için ;
SQL> select member from v$logfile ;

MEMBER

—————————————————–

/data/oracle/oradata/prdtest/redo03.log

/data/oracle/oradata/prdtest/redo02.log

/data/oracle/oradata/prdtest/redo01.log

  • Sıra en son ve zevkli kısmına geldi , database’ i açıyoruz

 

SQL> alter database open resetlogs ;

Database altered.

Kartuşa alınan bir database’ in backupını, farklı bir sunucu üzerine farklı pathler de olacak şekilde restore etmiş olduk. Backup – restore testleri bir dba için oldukça önemli konular diye düşünüyorum. Zira esas önemli olan herhangi bir disaster durumunda paniklemeden soğukkanlılıkla ve benzer senaryoları daha önceden  test etmiş olmanın rahatlığı içerisinde soruna çözüm üretmekde yatıyor.  Umarım faydalı olur.

Be Sociable, Share!

Bir cevap yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir


× yedi = 14