ITPub博客

首页 > Linux操作系统 > Linux操作系统 > DataGuard:Physical Standby Switchover

DataGuard:Physical Standby Switchover

原创 Linux操作系统 作者:oracle_kai 时间:2009-05-14 12:26:04 0 删除 编辑

DataGuard:Physical Standby Switchover

 

基本步骤:

1.对待转换的primary,standby数据库的初始化作相应的调整

2.主库转换,shutdown后启动到mount状态,应用redo recover

3.standby库转换,并open

4.测试验证

 

<1> primary库参数调整

    增加standby redo logfile ,因为我们现在是在maximize protection

       alter database add standby logfile group 4 ('C:\ORACLE\PRODUCT\10.2.0\ORADATA\DB1\STANDBY_REDO04.LOG') SIZE 50M

       alter database add standby logfile group 5 ('C:\ORACLE\PRODUCT\10.2.0\ORADATA\DB1\STANDBY_REDO05.LOG') SIZE 50M

       alter database add standby logfile group 6 ('C:\ORACLE\PRODUCT\10.2.0\ORADATA\DB1\STANDBY_REDO06.LOG') SIZE 50M

       alter database add standby logfile group 7 ('C:\ORACLE\PRODUCT\10.2.0\ORADATA\DB1\STANDBY_REDO07.LOG') SIZE 50M

 

增加参数fal_serverfal_clientdb_file_name_convertlog_file_name_convertstandby_file_managementlog_archive_dest_3

        log_archive_dest_state_3(用于作为备库时存放主库的archive log)

        db1>alter system set fal_client='db1';

        db1>alter system set fal_server='db2';

        db1>alter system set db_file_name_convert='C:\oracle\product\10.2.0\oradata\db2','C:\oracle\product\10.2.0\oradata\db1' scope=spfile;

        db1>alter system set db_file_name_convert='C:\oracle\product\10.2.0\oradata\db2','C:\oracle\product\10.2.0\oradata\db1' scope=spfile;

        db1>alter system set log_archive_dest_3='location=c:\arch\db1\standby valid_for=(standby_logfiles,standby_roles)';

        db1>alter system set log_archive_dest_state_3='enable';

 

<2> standby 库参数调整

 

        db2>alter system set log_archive_dest_3='service=db1 lgwr sync affirm valid_for=(online_logfiles,primary_roles) db_unique_name=db1';

    

        db2>alter system set log_archive_dest_state_3='enable';

 

         检查standby库的归档设置,确保处于force logging 归档模式

 

         db2>select NAME,LOG_MODE,FORCE_LOGGING,DB_UNIQUE_NAME from v$database;

 

                             NAME      LOG_MODE     FOR DB_UNIQUE_NAME

                             --------- ------------ --- ------------------------------

                              DB1       ARCHIVELOG      YES      db2

 

<3> primary库端切换动作

 

       select database_role,switchover_status from v$database;

       如果是to standby 表可以正常切换.

  直接执行 ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY;

  否则执行: ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITH SESSION SHUTDOWN;

 

       db1>select DB_UNIQUE_NAME,PROTECTION_MODE,PROTECTION_LEVEL,SWITCHOVER_STATUS from v$database;

 

                           DB_UN PROTECTION_MODE      PROTECTION_LEVEL     SWITCHOVER_STATUS

                           ----- -------------------- -------------------- --------------------

                         db1   MAXIMUM PROTECTION   MAXIMUM PROTECTION   SESSIONS ACTIVE

 

        db1>alter database  commit to switchover to physical standby with session shutdown ;

       

        该语句会把当前的redo归档,并在standby库上recover后,原primary角色转换为standby

 

<4> standby端切换动作

如果是SWITCHOVER_STATUS TO PRIMARY 表可以正常切换. 否则,检查之前的操作及参数设置。

        DB_UNIQUE_NAME  PROTECTION_MODE      PROTECTION_LEVEL     SWITCHOVER_STATUS

        --------------- -------------------- -------------------- --------------------

            db2             MAXIMUM PROTECTION   MAXIMUM PROTECTION   TO PRIMARY

db1>alter database  commit to switchover to physical standby with session shutdown ;

 

switchover切换结束

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

请登录后发表评论 登录
全部评论

注册时间:2007-12-20

  • 博文量
    48
  • 访问量
    174273