在前面的两章我们介绍了DG的概述和physical standby的配置过程。这一章我们进行DG的启动和关闭的操作。这一章没有太多的理论,按照命令来操作就可以了。这些命令需要经常使用以便能够熟练的记住。
一、启动和关闭顺序
关闭顺序——先primary 后 standby
启动顺序——先standby 后primary
二、启动操作
1、standby数据库
1)启动监听
[oracle@ocm1 ~]$ lsnrctl start
2)将数据库启动到mount状态
SYS@PROD>startup mount
检查数据库角色信息
SYS@PROD>select database_role,switchover_status,dataguard_broker from v$database;
DATABASE_ROLE SWITCHOVER_STATUS DATAGUAR
---------------- -------------------- --------
PHYSICAL STANDBY NOT ALLOWED DISABLED
3)启动standby,准备接受redolog
SYS@PROD>alter database recover managed standby database disconnect from session;
Database altered.
2、primary database数据库
1)启动监听
[oracle@ocm2 ~]$ lsnrctl start
2)启动数据库
SYS@OCM3>startup
ORACLE instance started.
Total System Global Area 524288000 bytes
Fixed Size 1220384 bytes
Variable Size 134217952 bytes
Database Buffers 385875968 bytes
Redo Buffers 2973696 bytes
Database mounted.
Database opened.
检查数据库角色
SYS@OCM3>select database_role,switchover_status,dataguard_broker from v$database;
DATABASE_ROLE SWITCHOVER_STATUS DATAGUAR
---------------- -------------------- --------
PRIMARY SESSIONS ACTIVE DISABLED
到这里,DG的启动过程已经完成了啦,接下来就需要确认状态了,可以从v$archived_log视图的applied列来判断,当sequence#对应的applied列为yes时,说明该归档日志已经被应用了。
SYS@PROD>select sequence#,first_time,next_time,applied from v$archived_log order by sequence#;
SEQUENCE# FIRST_TIM NEXT_TIME APP
---------- --------- --------- ---
2 13-JAN-14 20-JAN-14 NO
3 20-JAN-14 22-JAN-14 NO
4 22-JAN-14 24-JAN-14 NO
5 24-JAN-14 28-JAN-14 NO
6 28-JAN-14 03-MAR-14 NO
8 03-MAR-14 03-MAR-14 YES
11 04-MAR-14 04-MAR-14 YES
11 04-MAR-14 04-MAR-14 YES
12 04-MAR-14 06-MAR-14 YES
12 04-MAR-14 06-MAR-14 YES
13 06-MAR-14 10-MAR-14 YES
SEQUENCE# FIRST_TIM NEXT_TIME APP
---------- --------- --------- ---
13 06-MAR-14 10-MAR-14 YES
14 10-MAR-14 12-MAR-14 YES
14 10-MAR-14 12-MAR-14 YES
15 12-MAR-14 14-MAR-14 YES
15 12-MAR-14 14-MAR-14 YES
16 14-MAR-14 17-MAR-14 YES
16 14-MAR-14 17-MAR-14 YES
17 17-MAR-14 18-MAR-14 YES
17 17-MAR-14 18-MAR-14 YES
18 18-MAR-14 18-MAR-14 YES
18 18-MAR-14 18-MAR-14 NO
SEQUENCE# FIRST_TIM NEXT_TIME APP
---------- --------- --------- ---
19 18-MAR-14 18-MAR-14 YES
19 18-MAR-14 18-MAR-14 NO
20 18-MAR-14 18-MAR-14 YES
20 18-MAR-14 18-MAR-14 NO
21 18-MAR-14 18-MAR-14 YES
22 18-MAR-14 26-MAR-14 YES
28 rows selected.
其实关闭操作和启动操作整好是相反的。
1、primary database关闭
1)关闭数据库
SYS@OCM3>shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
2)关闭监听
[oracle@ocm2 ~]$ lsnrctl stop
2、standby database
1)取消接受redolog日志
SYS@PROD>alter database recover managed standby database cancel;
Database altered.
2)关闭数据库
SYS@PROD>shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
3)关闭监听
[oracle@ocm1 ~]$ lsnrctl stop
到这里DG的关闭操作完成了。是不是很简单呢!
**********************************
说明:转载请注明出处,谢谢
**********************************
--END--