oracle9i(9204)data guard(dg)_logical standby_failover操作指南
1,複製,註冊任何missing的歸檔日誌(對於於主庫)
在將要用於轉化為(failover為新主庫的邏輯備庫上),為簡略以下皆稱為
column file_name format a55
SQL> SELECT THREAD#, SEQUENCE#, FILE_NAME FROM DBA_LOGSTDBY_LOG L
2> WHERE NEXT_CHANGE# NOT IN
3> (SELECT FIRST_CHANGE# FROM DBA_LOGSTDBY_LOG WHERE L.THREAD# = THREAD#)
4> ORDER BY THREAD#,SEQUENCE#;
THREAD# SEQUENCE# FILE_NAME
---------- ---------- -----------------------------------------------
1 6 /disk1/oracle/dbs/log-1292880008_6.arc
1 10 /disk1/oracle/dbs/log-1292880008_10.arc
根據以上查詢到的記錄(如正常,每個thread只有一條記錄),僅複製及註冊以上大於每條記錄的資料(也就是7,11)
SQL> ALTER DATABASE REGISTER LOGICAL LOGFILE
2> '/disk1/oracle/dbs/log-1292880008_7.arc';
Database altered.
SQL> ALTER DATABASE REGISTER LOGICAL LOGFILE
2> '/disk1/oracle/dbs/log-1292880008_11.arc';
Database altered.
2,複製,註冊源於主庫(此時主庫已經玩完了,沒用了)的線上日誌online redo logs
SQL> ALTER DATABASE REGISTER LOGICAL LOGFILE --提示ora-01289,說明已在邏輯備庫上面應用或者註冊了
2> '/disk1/oracle/dbs/online_log1.log';
ALTER DATABASE REGISTER LOGICAL LOGFILE '/disk1/oracle/dbs/online_log1.log'
*
ERROR at line 1:
ORA-01289: cannot add duplicate logfile
SQL> ALTER DATABASE REGISTER LOGICAL LOGFILE
2> '/disk1/oracle/dbs/online_log2.log';
Database altered.
3,註冊部分已經歸檔的重作日誌(如果存在的話)---說實話,沒太理解
Depending on the nature of the emergency, you might not have access to any files on the primary database.
To look for a partially filled archived redo log, query the DBA_LOGSTDBY_LOG view on the logical standby database in the same directory where the other
archived redo logs are located.
If a partially filled archived redo log exists, its sequence number will be one greater than the last registered archived redo log. For example:
SQL> COLUMN FILE_NAME FORMAT a55
SQL> SELECT THREAD#, SEQUENCE#, FILE_NAME FROM DBA_LOGSTDBY_LOG L
2> ORDER BY THREAD#,SEQUENCE#;
THREAD# SEQUENCE# FILE_NAME
---------- ---------- -----------------------------------------------------
1 3 /disk1/oracle/dbs/db1loga-1292880008_3.arc
1 4 /disk1/oracle/dbs/archlogb-1292880008_4.arc
1 5 /disk1/oracle/dbs/archlogb-1292880008_5.arc
1 6 /disk1/oracle/dbs/archlogb-1292880008_6.arc
1 7 /disk1/oracle/dbs/archlogb-1292880008_7.arc
1 8 /disk1/oracle/dbs/archlogb-1292880008_8.arc
1 9 /disk1/oracle/dbs/archlogb-1292880008_9.arc
1 10 /disk1/oracle/dbs/archlogb-1292880008_10.arc
8 rows selected.
If a partially filled archived log exists, register it. For example:
SQL> ALTER DATABASE REGISTER LOGICAL LOGFILE
2> '/disk1/oracle/dbs/log-1292880008_11.arc';
Database altered.
4,關閉應用延遲間隔(因主庫不能用,以上相關操作皆在備庫進行)
SQL> ALTER DATABASE STOP LOGICAL STANDBY APPLY;
Database altered.
SQL> EXECUTE DBMS_LOGSTDBY.APPLY_UNSET('APPLY_DELAY');
PL/SQL procedure successfully completed.
SQL> ALTER DATABASE START LOGICAL STANDBY APPLY;
Database altered.
5,確保所有日誌應用
SQL> SELECT APPLIED_SCN, NEWEST_SCN FROM DBA_LOGSTDBY_PROGRESS;--兩列資料相同就好
APPLIED_SCN NEWEST_SCN
----------- ----------
190725 190725
6,啟用新的主庫
SQL> ALTER DATABASE STOP LOGICAL STANDBY APPLY;
SQL> ALTER DATABASE ACTIVATE LOGICAL STANDBY DATABASE;
7,如dg配置比較複雜,有多個邏輯備庫存在,進行完第6步,你想把以前的多個邏輯備庫加入到新的dg環境中,操作如下
Follow these steps to define a database link to the new primary database that will be used during future switchover operations:
1. Create a database link on each logical standby database.---在每個邏輯備庫上(failover後)
Use the DBMS_LOGSTDBY.GUARD_BYPASS_ON procedure to bypass the database guard and allow modifications to the tables in the logical standby database. For example:
SQL> EXECUTE DBMS_LOGSTDBY.GUARD_BYPASS_ON;
SQL> CREATE DATABASE LINK location1
2> CONNECT TO IDENTIFIED BY USING 'location1';
SQL> EXECUTE DBMS_LOGSTDBY.GUARD_BYPASS_OFF;
The database user account specified in the CREATE DATABASE LINK statement must have the SELECT_CATALOG_ROLE role granted to it on the primary database.
See Also:
Oracle9i Supplied PL/SQL Packages and Types Reference for more information about the DBMS_LOGSTDBY package and Oracle9i Database Administrator's Guide for more information about creating database links.
2. Verify the database link.
On the logical standby database, verify that the database link was configured correctly by executing the following query using the database link:
SQL> SELECT * FROM DBA_LOGSTDBY_PARAMETERS@location1;
If the query succeeds, then you have verified that the database link created in step 1 can be used to perform. a switchover.
On the new primary database
Enable archiving redo logs to all remote logical standby destinations. For example:
SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE SCOPE=BOTH;
To ensure that this change will persist if the new primary database is later restarted, update the appropriate initialization parameter file or server parameter file. In general, when the database operates in the primary role, you must enable archiving redo logs to remote destinations, and when the database operates in the standby role, you must disable archiving redo logs to remote destinations.
On all logical standby databases
Begin log apply services by issuing this SQL statement on all logical standby databases:
SQL> ALTER DATABASE START LOGICAL STANDBY APPLY NEW PRIMARY location1;
When this statement completes, all remaining archived redo logs will have been applied. Depending on the work to be done, this operation can take some time to complete.
If the ORA-16109 error is returned, you must re-create the logical standby database from a backup copy of the new primary database, and then add it to the Data Guard configuration.
The following example shows a failed attempt to start log apply services on a logical standby database in the new configuration where location1 points to the new primary database:
SQL> ALTER DATABASE START LOGICAL STANDBY APPLY NEW PRIMARY location1;
ALTER DATABASE START LOGICAL STANDBY APPLY NEW PRIMARY location1
*
ERROR at line 1:
ORA-16109: failed to apply log data from previous primary
在將要用於轉化為(failover為新主庫的邏輯備庫上),為簡略以下皆稱為
column file_name format a55
SQL> SELECT THREAD#, SEQUENCE#, FILE_NAME FROM DBA_LOGSTDBY_LOG L
2> WHERE NEXT_CHANGE# NOT IN
3> (SELECT FIRST_CHANGE# FROM DBA_LOGSTDBY_LOG WHERE L.THREAD# = THREAD#)
4> ORDER BY THREAD#,SEQUENCE#;
THREAD# SEQUENCE# FILE_NAME
---------- ---------- -----------------------------------------------
1 6 /disk1/oracle/dbs/log-1292880008_6.arc
1 10 /disk1/oracle/dbs/log-1292880008_10.arc
根據以上查詢到的記錄(如正常,每個thread只有一條記錄),僅複製及註冊以上大於每條記錄的資料(也就是7,11)
SQL> ALTER DATABASE REGISTER LOGICAL LOGFILE
2> '/disk1/oracle/dbs/log-1292880008_7.arc';
Database altered.
SQL> ALTER DATABASE REGISTER LOGICAL LOGFILE
2> '/disk1/oracle/dbs/log-1292880008_11.arc';
Database altered.
2,複製,註冊源於主庫(此時主庫已經玩完了,沒用了)的線上日誌online redo logs
SQL> ALTER DATABASE REGISTER LOGICAL LOGFILE --提示ora-01289,說明已在邏輯備庫上面應用或者註冊了
2> '/disk1/oracle/dbs/online_log1.log';
ALTER DATABASE REGISTER LOGICAL LOGFILE '/disk1/oracle/dbs/online_log1.log'
*
ERROR at line 1:
ORA-01289: cannot add duplicate logfile
SQL> ALTER DATABASE REGISTER LOGICAL LOGFILE
2> '/disk1/oracle/dbs/online_log2.log';
Database altered.
3,註冊部分已經歸檔的重作日誌(如果存在的話)---說實話,沒太理解
Depending on the nature of the emergency, you might not have access to any files on the primary database.
To look for a partially filled archived redo log, query the DBA_LOGSTDBY_LOG view on the logical standby database in the same directory where the other
archived redo logs are located.
If a partially filled archived redo log exists, its sequence number will be one greater than the last registered archived redo log. For example:
SQL> COLUMN FILE_NAME FORMAT a55
SQL> SELECT THREAD#, SEQUENCE#, FILE_NAME FROM DBA_LOGSTDBY_LOG L
2> ORDER BY THREAD#,SEQUENCE#;
THREAD# SEQUENCE# FILE_NAME
---------- ---------- -----------------------------------------------------
1 3 /disk1/oracle/dbs/db1loga-1292880008_3.arc
1 4 /disk1/oracle/dbs/archlogb-1292880008_4.arc
1 5 /disk1/oracle/dbs/archlogb-1292880008_5.arc
1 6 /disk1/oracle/dbs/archlogb-1292880008_6.arc
1 7 /disk1/oracle/dbs/archlogb-1292880008_7.arc
1 8 /disk1/oracle/dbs/archlogb-1292880008_8.arc
1 9 /disk1/oracle/dbs/archlogb-1292880008_9.arc
1 10 /disk1/oracle/dbs/archlogb-1292880008_10.arc
8 rows selected.
If a partially filled archived log exists, register it. For example:
SQL> ALTER DATABASE REGISTER LOGICAL LOGFILE
2> '/disk1/oracle/dbs/log-1292880008_11.arc';
Database altered.
4,關閉應用延遲間隔(因主庫不能用,以上相關操作皆在備庫進行)
SQL> ALTER DATABASE STOP LOGICAL STANDBY APPLY;
Database altered.
SQL> EXECUTE DBMS_LOGSTDBY.APPLY_UNSET('APPLY_DELAY');
PL/SQL procedure successfully completed.
SQL> ALTER DATABASE START LOGICAL STANDBY APPLY;
Database altered.
5,確保所有日誌應用
SQL> SELECT APPLIED_SCN, NEWEST_SCN FROM DBA_LOGSTDBY_PROGRESS;--兩列資料相同就好
APPLIED_SCN NEWEST_SCN
----------- ----------
190725 190725
6,啟用新的主庫
SQL> ALTER DATABASE STOP LOGICAL STANDBY APPLY;
SQL> ALTER DATABASE ACTIVATE LOGICAL STANDBY DATABASE;
7,如dg配置比較複雜,有多個邏輯備庫存在,進行完第6步,你想把以前的多個邏輯備庫加入到新的dg環境中,操作如下
Follow these steps to define a database link to the new primary database that will be used during future switchover operations:
1. Create a database link on each logical standby database.---在每個邏輯備庫上(failover後)
Use the DBMS_LOGSTDBY.GUARD_BYPASS_ON procedure to bypass the database guard and allow modifications to the tables in the logical standby database. For example:
SQL> EXECUTE DBMS_LOGSTDBY.GUARD_BYPASS_ON;
SQL> CREATE DATABASE LINK location1
2> CONNECT TO
SQL> EXECUTE DBMS_LOGSTDBY.GUARD_BYPASS_OFF;
The database user account specified in the CREATE DATABASE LINK statement must have the SELECT_CATALOG_ROLE role granted to it on the primary database.
See Also:
Oracle9i Supplied PL/SQL Packages and Types Reference for more information about the DBMS_LOGSTDBY package and Oracle9i Database Administrator's Guide for more information about creating database links.
2. Verify the database link.
On the logical standby database, verify that the database link was configured correctly by executing the following query using the database link:
SQL> SELECT * FROM DBA_LOGSTDBY_PARAMETERS@location1;
If the query succeeds, then you have verified that the database link created in step 1 can be used to perform. a switchover.
On the new primary database
Enable archiving redo logs to all remote logical standby destinations. For example:
SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE SCOPE=BOTH;
To ensure that this change will persist if the new primary database is later restarted, update the appropriate initialization parameter file or server parameter file. In general, when the database operates in the primary role, you must enable archiving redo logs to remote destinations, and when the database operates in the standby role, you must disable archiving redo logs to remote destinations.
On all logical standby databases
Begin log apply services by issuing this SQL statement on all logical standby databases:
SQL> ALTER DATABASE START LOGICAL STANDBY APPLY NEW PRIMARY location1;
When this statement completes, all remaining archived redo logs will have been applied. Depending on the work to be done, this operation can take some time to complete.
If the ORA-16109 error is returned, you must re-create the logical standby database from a backup copy of the new primary database, and then add it to the Data Guard configuration.
The following example shows a failed attempt to start log apply services on a logical standby database in the new configuration where location1 points to the new primary database:
SQL> ALTER DATABASE START LOGICAL STANDBY APPLY NEW PRIMARY location1;
ALTER DATABASE START LOGICAL STANDBY APPLY NEW PRIMARY location1
*
ERROR at line 1:
ORA-16109: failed to apply log data from previous primary
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-628040/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle9i(9204)data guard(dg)_logical standby_adding_recreating tableOracle
- oracle9i(9204)dg(data guard)_ place the standby database in manual recovery modeOracleDatabase
- oracle9204(9i)_dg(data guard)__Tuning Logical Standby DatabasesOracleDatabase
- oracle9i(9204)dg(data guard)_adding and dropping online redo logs_物理_physicalOracle
- oracle9204(9i)_dg(data guard)_archive gap_query_apply_transmitOracleHiveAPPMIT
- 【DG】Data Guard搭建(physical standby)
- oracle9204(9i)_dg(data guard)_重新命名主庫資料檔案_指南_轉摘官檔Oracle
- oracle9204(physical dg)配置_指南Oracle
- 【DG】Oracle Data Guard官方直譯Oracle
- 建立Data guard logical standby database須知Database
- oracle9204(9i)_linux_logical standby_switchover操作指南OracleLinux
- 【DG】Data Guard主備庫Switchover切換
- 物理DG!Oracle 10G Data Guard DemoOracle 10g
- 【DG】Data Guard主備庫Failove切換AI
- 【ASK_ORACLE】Oracle Data Guard(一)DG架構Oracle架構
- 利用RMAN 建立Oracle9i RAC Data GuardOracle
- Oracle DG(Data Guard)支援異構平臺說明Oracle
- oracle10g data guard(dg)__flashback_physical databaseOracleDatabase
- 邏輯Data Guard的物件操作物件
- Linux下的Oracle9i data guard配置過程LinuxOracle
- Implementing Oracle9i Data Guard for Higher AvailabilityOracleAI
- 利用RMAN 建立Oracle9i RAC Data Guard (updated)Oracle
- oracle9204(9i)_linux_logical db構建指南OracleLinux
- oracle 10g物理data guard 操作Oracle 10g
- 利用RMAN 建立Oracle9i RAC Data Guard(完善版)Oracle
- oracle10g data guard role transition_physical_logical_switchover_failoverOracleAI
- Oracle data guard常用維護操作命令(轉)Oracle
- 基於同一主機配置Oracle 11g Data Guard(logical standby)Oracle
- Oracle Data Guard 快速啟動故障切換指南Oracle
- DATA GUARD部署模式——DATA GUARD概念和管理模式
- Oracle DG建立Logical Standby DatabaseOracleDatabase
- 介紹ORACLE DATA GUARD——DATA GUARD概念和管理Oracle
- 12c DG新特性 - Active Data Guard Far Sync (Doc ID 2179719.1)
- G008-ORACLE-DG ORACLE 19C Active Data Guard DML RedirectionOracle
- Data guard搭建
- oracle data guard!!Oracle
- Data Guard Broker系列之二:Data Guard Broker配置實戰
- DATA GUARD 簡介