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

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9240380/viewspace-628040/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/9240380/viewspace-628040/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值