欢迎投稿

今日深度:

Oracle 11g Data Guard Broker操作笔记

Oracle 11g Data Guard Broker操作笔记


一、设置

1、设置broker

2、在主库上操作

DGMGRL> help

DGMGRL> help create

DGMGRL> CREATE CONFIGURATION c1 AS PRIMARY DATABASE IS PROD1 CONNECT IDENTIFIER IS PROD1;

DGMGRL> help add

DGMGRL> ADD DATABASE DG AS CONNECT IDENTIFIER IS DG;

DGMGRL> help enable

DGMGRL> ENABLE CONFIGURATION;

DGMGRL> help show

DGMGRL> SHOW CONFIGURATION;

 

SQL> startup open read only;

最好加一下read only,因为有时broker有时会把它拉回到mount状态!!!

SQL> select open_mode from v$database;

OPEN_MODE

SQL> select flashback_on from v$database;

FLASHBACK_ON

SQL> show parameter recovery

NAME TYPE VALUE

SQL> shutdown immediate;

SQL> startup mount;

SQL> alter database flashback on;

 


二、snapshot


1、主库

DGMGRL> help convert

DGMGRL> CONVERT DATABASE DG TO SNAPSHOT STANDBY; ---如果这里有失败可能是监听DG_DGMGRL没设

DGMGRL> SHOW CONFIGURATION;

2、备库

Table created.

SQL> insert into t1 values(1,'AAAA');

1 row created.

SQL> commit;

Commit complete.

 

 


三、还原到物理备库


1、主库

DGMGRL> CONVERT DATABASE DG TO PHYSICAL STANDBY; ---如果这里有失败可能是监听DG_DGMGRL没设

 

 

四、来回切换库


1、在主库PROD1上操作

Configuration

Fast-Start Failover: DISABLED

Current status for "c1":

DGMGRL> help switch

Switch roles between the primary database and a standby database

Syntax:

SWITCHOVER TO <standby database name>;

DGMGRL> SWITCHOVER TO DG;

Database dismounted.

DGMGRL> SHOW CONFIGURATION

Configuration

Fast-Start Failover: DISABLED

Current status for "c1":

DGMGRL> SWITCHOVER TO PROD1

Database dismounted.

 

 

五、修改传输模式

 

DGMGRL> SHOW DATABASE VERBOSE PROD1

DGMGRL> help edit

DGMGRL> EDIT DATABASE PROD1 SET PROPERTY LogXptMode=SYNC; ---主库

Failed.

DGMGRL> EDIT DATABASE PROD1 SET PROPERTY LogXptMode=SYNC; ---主库

DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS MaxAvailability; ---主库

以上Error: ORA-16627: 错误马上消失。。。。

++++备库的一些基本命令可以记下:

Database altered.

SQL> alter database recover managed standby database cancel;

Database altered.

SQL> alter database open;

Database altered.

 

 

 

六、故障切换


1、主库

DGMGRL> ENABLE FAST_START FAILOVER;

2、备库

DGMGRL> help start

DGMGRL> START OBSERVER

3、主库

4、备库

17:05:29.04 Friday, November 21, 2014

(2)stop observer(观察到上面的信息就停止掉,以防来回切换)

5、主库

SQL*Plus: Release 11.1.0.7.0 - Production on Fri Nov 21 17:10:14 2014

Copyright (c) 1982, 2008, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup mount;

Total System Global Area 418484224 bytes

6、切回去

Configuration

Fast-Start Failover: ENABLED

Current status for "c1":

DGMGRL> SWITCHOVER TO PROD1

Failed.

DGMGRL> DISABLE FAST_START FAILOVER;

Failed.

DGMGRL> SHOW CONFIGURATION;

Configuration

Fast-Start Failover: DISABLED

Current status for "c1":

 

DGMGRL> switchover to prod1; ----------------------------------->这个错误的一般出现在VM中。。。
Performing switchover NOW, please wait...

Failed.

 

Current status for "prod1":

 

Database dismounted.

Configuration

Fast-Start Failover: DISABLED

Current status for "c1":

 

Database dismounted.

DGMGRL> show configuration;

Configuration

Fast-Start Failover: DISABLED

Current status for "c1":

www.htsjk.Com true http://www.htsjk.com/oracle/22663.html NewsArticle Oracle 11g Data Guard Broker操作笔记 一、设置 1、设置broker 2、在主库上操作 DGMGRL help DGMGRL help create DGMGRL CREATE CONFIGURATION c1 AS PRIMARY DATABASE IS PROD1 CONNECT IDENTIFIER IS PROD1; DGMGRL help add DGMGRL ADD...
评论暂时关闭