买口罩股票能赚多少

IT技术互动交流平台

oracle 11g dataguard主备切换

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

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> alter database commit 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  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;     --查看目前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> alter database commit 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> 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 - 广告服务 - 隐私声明 - 版权申明 - 免责条款 - 网站地图 - 网友投稿 - 配资开户 方式
本站内容来自于互联网,仅供用于网络技术学习,学习中请遵循相关法律法规