荣耀彩票代理

IT技术互动交流平台

oracle 11g dataguard主备切换

作者:一起走过的日子  来源:IT165收集  发布日期:2016-11-24 21:07:55

1.JIANCHAZHUBEIDEHUANJING

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> 


dg2JIEDIAN:

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.CHAKANZHUBEIDEJIAOSE

dg1节点(primary角色):

SQL> select switchover_status,database_role from v$database;

荣耀彩票代理SWITCHOVER_STATUS    DATABASE_ROLE

荣耀彩票代理-------------------- ----------------

TO STANDBY           PRIMARY

荣耀彩票代理SQL> 


dg2JIEDIAN(standbyJIAOSE):

荣耀彩票代理SQL> select switchover_status,database_role from v$database;

SWITCHOVER_STATUS    DATABASE_ROLE

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

荣耀彩票代理NOT ALLOWED          PHYSICAL STANDBY

荣耀彩票代理SQL> 


3.ZAIZHUKUSHANGZHIXINGQIEHUANMINGLING(primaryJIEDIAN)

荣耀彩票代理SQL> alter database commit to switchover to physical standby; --JIANGprimaryJIAOSEZHUANHUANWEIstandbyJIAOSE

Database altered.

SQL> shutdown immediate              --GUANBISHUJUKU,QIDONGDAOmountZHUANGTAI

ORA-01507: database not mounted


荣耀彩票代理ORACLE instance shut down.

荣耀彩票代理SQL> startup mount


荣耀彩票代理Total System Global Area  830930944 bytes

荣耀彩票代理Fixed Size                  2217912 bytes

Variable Size             545261640 bytes

Database Buffers          281018368 bytes

Redo Buffers                2433024 bytes

Database mounted.

荣耀彩票代理SQL> select switchover_status,database_role from v$database;     --CHAKANMUQIANprimaryJIAOSEDEZHUANGTAI

SWITCHOVER_STATUS    DATABASE_ROLE

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

荣耀彩票代理TO PRIMARY           PHYSICAL STANDBY

SQL> 


4.ZAIBEIKUSHANGZHIXING(standbyJIEDIAN)

荣耀彩票代理SQL> select switchover_status,database_role from v$database;     --CHAKANstandbyBEIKUJIAOSEDEZHUANGTAI

荣耀彩票代理SWITCHOVER_STATUS    DATABASE_ROLE

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

荣耀彩票代理TO PRIMARY           PHYSICAL STANDBY

SQL> alter database commit to switchover to primary;       --JIANGBEIKUDEJIAOSEXIUGAIWEIprimary

Database altered.

荣耀彩票代理SQL> select switchover_status,database_role from v$database;

SWITCHOVER_STATUS    DATABASE_ROLE

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

荣耀彩票代理NOT ALLOWED          PRIMARY

SQL> alter database open;          --DAKAISHUJUKU

Database altered.

荣耀彩票代理SQL> 


5.ZAIBEIKUSHANGZHIXING(standbyJIEDIAN)

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;      --XIUGAIYIQIANZHUKUWEIRIZHIYINGYONG

Database altered. 

SQL> 


6.CESHIZHUBEIJIEDIANSHIFOUQIEHUANCHENGGONG

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> commit;

Commit complete.

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> 


Tag标签:         
  • 专题推荐

About IT165 - 广告服务 - 隐私声明 - 版权申明 - 免责条款 - 网站地图 - 网友投稿 - 联系方式
本站内容来自于互联网,仅供用于网络技术学习,学习中请遵循相关法律法规