oracle 11g dataguard主备转换

摘要: 1.查验主备的自然环境dg1连接点:SQL archive log list;Database log mode Archive ModeAutomatic archival EnabledArchive destination /u01/oradata/tong/archiveOldest online log sequence 59Next log s...

1.查验主备的自然环境

dg1连接点:

SQL archive log list;

Database log mode            Archive Mode

Automatic archival            Enabled

Archive destination           /u01/oradata/tong/archive

Oldest online log sequence      59

Next log sequence to archive     61

Current log sequence           61

SQL  


dg2连接点:

SQL archive log list;

Database log mode            Archive Mode

Automatic archival            Enabled

Archive destination           /u01/oradata/tong/archive

Oldest online log sequence      60

Next log sequence to archive     0

Current log sequence          61

SQL  


2.查询主备的人物角色

dg1连接点(primary人物角色):

SQL select switchover_status,database_role from v$database;

SWITCHOVER_STATUS    DATABASE_ROLE

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

TO STANDBY           PRIMARY

SQL  


dg2连接点(standby人物角色):

SQL select switchover_status,database_role from v$database;

SWITCHOVER_STATUS    DATABASE_ROLE

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

NOT ALLOWED          PHYSICAL STANDBY

SQL  


3.在主库上实行转换指令(primary连接点)

SQL mit to switchover to physical standby; --将primary人物角色变换为standby人物角色

Database altered.

SQL shutdown immediate              --关掉数据信息库,起动到mount情况

ORA-01507: database not mounted


ORACLE instance shut down.

SQL startup mount


Total System Global Area   bytes

Fixed Size                  2217912 bytes

Variable Size             bytes

Database Buffers           bytes

Redo Buffers                2433024 bytes

Database mounted.

SQL select switchover_status,database_role from v$database;     --查询现阶段primary人物角色的情况

SWITCHOVER_STATUS    DATABASE_ROLE

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

TO PRIMARY           PHYSICAL STANDBY

SQL  


4.在备库上实行(standby连接点)

SQL select switchover_status,database_role from v$database;     --查询standby备库人物角色的情况

SWITCHOVER_STATUS    DATABASE_ROLE

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

TO PRIMARY           PHYSICAL STANDBY

SQL mit to switchover to primary;       --将备库的人物角色改动为primary

Database altered.

SQL select switchover_status,database_role from v$database;

SWITCHOVER_STATUS    DATABASE_ROLE

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

NOT ALLOWED          PRIMARY

SQL alter database open;          --开启数据信息库

Database altered.

SQL  


5.在备库上实行(standby连接点)

SQL select switchover_status,database_role from v$database;

SWITCHOVER_STATUS    DATABASE_ROLE

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

RECOVERY NEEDED      PHYSICAL STANDBY

SQL ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;      --改动之前主库为系统日志运用

Database altered. 

SQL  


6.检测主备连接点是不是转换取得成功

dg2连接点(primary人物角色):

SQL select * from tt;

  A

----------

  1

  3

  4

  5

  6

  7

6 rows selected.

SQL insert into tt values(8);

1 row created.

SQL select * from tt where a=8;

  A

----------

  8

SQL alter system switch logfile;

System altered.

SQL /

System altered.

SQL archive log list;

Database log mode         Archive Mode

Automatic archival         Enabled

Archive destination        /u01/oradata/tong/archive

Oldest online log sequence    78

Next log sequence to archive   80

Current log sequence         80

SQL  


dg1连接点(standby人物角色):

SQL archive log list;

Database log mode         Archive Mode

Automatic archival         Enabled

Archive destination        /u01/oradata/tong/archive

Oldest online log sequence    79

Next log sequence to archive   0

Current log sequence         80

SQL alter database  recover managed standby database cancel;  

Database altered.

SQL alter database open read only;

Database altered.

SQL select * from tt;

   A

----------

    1

    3

    4

    5

    6

    7

    8

7 rows selected.

SQL  




联系我们

全国服务热线:4000-399-000 公司邮箱:343111187@qq.com

  工作日 9:00-18:00

关注我们

官网公众号

官网公众号

Copyright?2020 广州凡科互联网科技股份有限公司 版权所有 粤ICP备10235580号 客服热线 18720358503

技术支持:一键抠图