DataGuard搭建物理StandBy
實驗使用DataGuard搭建一套物理StandBy環境
主庫Primary:192.168.1.1
備庫StandBy:192.168.1.2
主要步驟
1.主庫設定歸檔模式,並且設定強制日誌
SQL> select log_mode from v$database;
LOG_MODE
------------
ARCHIVELOG
SQL> alter database force logging;
Database altered.
2.主庫,備庫設定tns和監聽器
主庫和備庫的tnsnames.ora設定相同
PRIMARY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
STANDBY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.2)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
主庫Primary:192.168.1.1
備庫StandBy:192.168.1.2
主要步驟
1.主庫設定歸檔模式,並且設定強制日誌
SQL> select log_mode from v$database;
LOG_MODE
------------
ARCHIVELOG
Database altered.
2.主庫,備庫設定tns和監聽器
主庫和備庫的tnsnames.ora設定相同
PRIMARY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
STANDBY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.2)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
主庫和備庫的監聽器IP地址不同
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = /home/oracle/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = orcl)
)
)
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.1)(PORT = 1521))
)
ADR_BASE_LISTENER = /home/oracle/app/oracle
3.備份主庫
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = /home/oracle/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = orcl)
)
)
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.1)(PORT = 1521))
)
ADR_BASE_LISTENER = /home/oracle/app/oracle
3.備份主庫
rman target /
backup database;
backup current controlfile for standby;
4.主庫建立密碼檔案
在$ORACLE_HOME/dbs目錄下建立密碼檔案
[oracle@master dbs]$ pwd
/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs
[oracle@master dbs]$ orapwd file=orapworcl password=123456
5.將主庫的備份,spfile和密碼檔案傳輸到備庫相同的位置(若備庫不存在該位置則建立)
6.修改主庫spfile,重啟資料庫使設定生效
alter system set db_unique_name=orcl scope=spfile;
alter system set log_archive_dest_2='service=standby valid_for=(online_logfiles,primary_role) db_unique_name=orcl' scope=spfile;
alter system set fal_client=primary;
alter system set fal_server=standby;
alter system set standby_file_management=auto scope=spfile;
7.啟動備庫至nomount,修改備庫spfile
(spfile中的目錄在備庫必須存在,可以先匯出pfile,然後建立相關的目錄)
alter system set db_unique_name=orcl scope=spfile;
alter system set log_archive_dest_2='service=primary valid_for=(online_logfiles,standby_role) db_unique_name=orcl' scope=spfile;
alter system set fal_client=standby;
alter system set fal_server=primary;
alter system set standby_file_management=auto scope=spfile;
8.主庫執行duplicate
rman target / auxiliary sys/123456@standby
duplicate target database for standby nofilenamecheck;
如果主庫備份包括歸檔日誌,
backup database;
backup current controlfile for standby;
sql "alter system archive log current";
backup filesperset 10 archivelog all;
則使用如下命令,直接在備庫應用歸檔
duplicate target database for standby dorecover nofilenamecheck;
9.啟用物理standby
startup nomount;
ALTER DATABASE MOUNT STANDBY DATABASE;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
如果需要停止物理standby,則執行如下命令
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
搭建過程需要注意兩點
1.密碼檔案必須從主庫傳輸到備庫,不能使用相同的密碼在備庫建立密碼檔案
2.如果備份中有歸檔執行
duplicate target database for standby dorecover nofilenamecheck;
如果備份中沒有歸檔日誌,則執行
duplicate target database for standby nofilenamecheck;
dorecover
從目標資料庫用歸檔日誌備份恢復備用資料庫。一旦備用資料庫的建立完成,RMAN將對備用資料庫應用主資料庫中的所有歸檔日誌,一直到RMAN中註冊的最新的歸檔日誌。
backup database;
backup current controlfile for standby;
4.主庫建立密碼檔案
在$ORACLE_HOME/dbs目錄下建立密碼檔案
[oracle@master dbs]$ pwd
/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs
[oracle@master dbs]$ orapwd file=orapworcl password=123456
5.將主庫的備份,spfile和密碼檔案傳輸到備庫相同的位置(若備庫不存在該位置則建立)
alter system set db_unique_name=orcl scope=spfile;
alter system set log_archive_dest_2='service=standby valid_for=(online_logfiles,primary_role) db_unique_name=orcl' scope=spfile;
alter system set fal_client=primary;
alter system set fal_server=standby;
alter system set standby_file_management=auto scope=spfile;
7.啟動備庫至nomount,修改備庫spfile
(spfile中的目錄在備庫必須存在,可以先匯出pfile,然後建立相關的目錄)
alter system set db_unique_name=orcl scope=spfile;
alter system set log_archive_dest_2='service=primary valid_for=(online_logfiles,standby_role) db_unique_name=orcl' scope=spfile;
alter system set fal_client=standby;
alter system set fal_server=primary;
alter system set standby_file_management=auto scope=spfile;
8.主庫執行duplicate
rman target / auxiliary sys/123456@standby
duplicate target database for standby nofilenamecheck;
如果主庫備份包括歸檔日誌,
backup database;
backup current controlfile for standby;
sql "alter system archive log current";
backup filesperset 10 archivelog all;
則使用如下命令,直接在備庫應用歸檔
duplicate target database for standby dorecover nofilenamecheck;
startup nomount;
ALTER DATABASE MOUNT STANDBY DATABASE;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
如果需要停止物理standby,則執行如下命令
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
搭建過程需要注意兩點
1.密碼檔案必須從主庫傳輸到備庫,不能使用相同的密碼在備庫建立密碼檔案
2.如果備份中有歸檔執行
duplicate target database for standby dorecover nofilenamecheck;
如果備份中沒有歸檔日誌,則執行
duplicate target database for standby nofilenamecheck;
否則報錯如下:
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 03/28/2012 12:20:16
RMAN-03015: error occurred in stored script. Memory Script
RMAN-06026: some targets not found - aborting restore
RMAN-06024: no backup or copy of the control file found to restore
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 03/28/2012 12:20:16
RMAN-03015: error occurred in stored script. Memory Script
RMAN-06026: some targets not found - aborting restore
RMAN-06024: no backup or copy of the control file found to restore
dorecover
從目標資料庫用歸檔日誌備份恢復備用資料庫。一旦備用資料庫的建立完成,RMAN將對備用資料庫應用主資料庫中的所有歸檔日誌,一直到RMAN中註冊的最新的歸檔日誌。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29254281/viewspace-1315088/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Dataguard物理Standby Switchover 角色轉換
- Oracle11g R2之Dataguard搭建物理standbyOracle
- DataGuard搭建邏輯StandBy
- dataguard之物理standby 日誌切換
- dataguard之物理standby庫failover 切換AI
- DataGuard---->物理StandBy的角色切換之switchover
- oracle10g 物理standby dataguard 建立過程Oracle
- 【DATAGUARD 學習】使用duplicate 建立物理standby 資料庫資料庫
- 【DataGuard】手工冷備搭建 Oracle 11g DataGuard 物理備庫Oracle
- 附錄A Oracle Dataguard 物理Standby跨平臺組合支援列表Oracle
- 【DATAGUARD】 將11g物理備庫轉換為Snapshot Standby
- 配置 Oracle 10g 單例項物理dataguard和邏輯standbyOracle 10g單例
- 一步一步學DataGuard(5)物理standby之建立示例
- 【DataGuard】10g物理standby主備switchover方式切換詳述
- 【DATAGUARD】DG系列之RACtoONE物理備庫的搭建
- Oracle11g的Dataguard測試,建立物理備庫(Physical Standby Database)OracleDatabase
- Oracle DataGuard環境failover後通過舊備份建立物理StandbyOracleAI
- DataGuard:Physical Standby Switchover
- Data Guard 之RMAN備份線上搭建物理standby
- Dataguard 物理安裝
- 【DataGuard】Oracle 11g物理Data Guard之Snapshot Standby資料庫功能Oracle資料庫
- 配置Oracle11g的Dataguard測試,建立物理備庫(Physical Standby Database)OracleDatabase
- cp資料檔案方式搭建 11g 物理standby
- 【DATAGUARD】DG系列之11g物理備庫的搭建
- Dataguard(Standby) 後臺程式
- DataGuard:Physical Standby FailoverAI
- DataGuard:Logical Standby Switchover
- dataguard 搭建 oracle_sid不同 2節點 primary+standbyOracle
- dataguard 搭建 oracle_sid相同 2節點 primary+standbyOracle
- 【轉】【DataGuard】Oracle 11g物理Data Guard之Snapshot Standby資料庫功能Oracle資料庫
- 物理standby和邏輯standby的區別
- oracle 之dataguard standby 切換Oracle
- Oracle 9I dataguard(standby)Oracle
- DataGuard:Logical Standby FailoverAI
- DG物理standby,switchover步驟
- DataGuard搭建
- ORACLE10G 物理standby轉為邏輯standbyOracle
- 物理Standby資料庫及邏輯Standby資料庫(Physical Standby & Logical Standby)資料庫