RMAN學習筆記_ Duplicate重做DataGuard

gdutllf2006發表於2010-02-03

利用Duplicate重做DataGuard

參考文件<>

ENV:
Oracle9i + Suse9 + DataGuard + 預設的最大效能模式

Primary: 192.168.1.101
standby: 192.168.1.102


Primary 到 standby的 DataGuard出現Gap,且Primary 上的歸檔已刪除,沒備份:
SQL> select * from v$archive_gap;

   THREAD# LOW_SEQUENCE# HIGH_SEQUENCE#
---------- ------------- --------------
         1            18             21

之前的Dataguard是用冷備形式建立的.現在要重建
唯一的解決方法,重做DataGuard,利用Duplicate 來重做

 

解決過程:

1 在Primary生成全備(Primary)

CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT   '/u01/backup/backup_%d_%T_%s_%p';
BACKUP DATABASE
INCLUDE CURRENT CONTROLFILE FOR STANDBY
PLUS ARCHIVELOG;

2 將備份檔案傳到備端(Primary)
或透過NFS不用手動傳,實質一樣,在應用的時候傳
參考<>

scp oracle@192.168.1.101:/u01/backup/backup_MYDB_20100203_19_1 /u01/backup/

scp oracle@192.168.1.101:/u01/backup/backup_MYDB_20100203_20_1 /u01/backup/

scp oracle@192.168.1.101:/u01/backup/backup_MYDB_20100203_21_1 /u01/backup/

注意:在將備份檔案複製到Standby上時,存放備份檔案的目錄必須與Primary備份檔案所在的目錄結構一樣,
這樣控制檔案才能找到備份檔案

3 啟動備端例項到Standby形式的nomount狀態

先關閉再重啟

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
shutdown immediate
startup nomount;

4 在Primary 重新Duplicate 應用備份

rman target / auxiliary

RUN
{
# If desired, issue a SET command to terminate recovery at a specified point.
# SET UNTIL SCN 143508;
DUPLICATE TARGET DATABASE FOR STANDBY NOFILENAMECHECK
DORECOVER;
}

> rman target / auxiliary

Recovery Manager: Release 9.2.0.4.0 - 64bit Production

Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.

connected to target database: MYDB (DBID=2621354619)
connected to auxiliary database: mydb (not mounted)

RMAN> RUN
2> {
3> # If desired, issue a SET command to terminate recovery at a specified point.
4> # SET UNTIL SCN 143508;
5> DUPLICATE TARGET DATABASE FOR STANDBY NOFILENAMECHECK
6> DORECOVER;
7> }
............
............
Recovery Manager complete.

順利完成


5 Duplicate 完成後Standby只處於正常的Mount狀態.應開啟Recover
 ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

 

6 在Standby端查詢Gap
SQL> select * from v$archive_gap;

no rows selected

成功解決


7 碰到的問題:
rman target / auxiliary

報錯:
> rman target / auxiliary

Recovery Manager: Release 9.2.0.4.0 - 64bit Production

Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.

connected to target database: MYDB (DBID=2621354619)
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00554: initialization of internal recovery manager package failed
RMAN-04006: error from auxiliary database: ORA-12519: TNS:no appropriate service handler found


靜態監聽器的問題
確保你能在Primary 上 sqlplus " as sysdba"可以連通


在我的環境裡,因為在192.168.1.102上已有了另一套DataGuard的Standby.已註冊了名為LISTENER,埠為1521的靜態監聽器.

解決方案:註冊兩個監聽器.

更改後的Listener.ora檔案.
#$ORACLE_HOME/network/admin/listener.ora
SID_LIST_LISTENER_MYDB =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME =/opt/oracle/product/9ir2)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = mydb)
      (ORACLE_HOME =/opt/oracle/product/9ir2)
      (SID_NAME = mydb)
    )
  )

LISTENER_MYDB =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.102)(PORT = 1521))
      )
    )
  )


SID_LIST_LISTENER_DUPDB =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /opt/oracle/product/9ir2)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = dupdb)
      (ORACLE_HOME = /opt/oracle/product/9ir2)
      (SID_NAME = dupdb)
    )
  )

LISTENER_DUPDB =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.102)(PORT = 1522))
      )
    )

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10248702/viewspace-626766/,如需轉載,請註明出處,否則將追究法律責任。

相關文章