首先登陆实例,检查数据库状态:
bash-3.00$ sqlplus "/ as sysdba"
SQL*Plus: Release 11.1.0.6.0 - Production on Wed Sep 10 13:56:13 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to:
Oracle Database11gEnterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL> select instance_name, status from v$instance;
INSTANCE_NAME STATUS
---------------- ------------
rac11g1 MOUNTED
SQL> select name,
2 open_mode,
3 database_role,
4 guard_status,
5 db_unique_name,
6 primary_db_unique_name
7 from v$database;
NAME OPEN_MODE DATABASE_ROLE GUARD_S DB_UNIQUE_NAME PRIMARY_DB_UNIQUE_NAME
--------- ---------- ---------------- ------- --------------- -----------------------
RAC11G MOUNTED PHYSICAL STANDBY NONE rac11g_s
下面可以将数据库至于应用归档的状态:
SQL> alter database recover managed standby database
2 disconnect from session;
Database altered.
下面检查归档的是否可以正常发送到STANDBY数据库:
SQL> select sequence#, thread# from v$archived_log order by first_time;
no rows selected
SQL> conn sys/test@rac11gas sysdba
Connected.
SQL> alter system archive log current;
System altered.
SQL> conn / as sysdba
Connected.
SQL> select sequence#, thread# from v$archived_log order by first_time;
SEQUENCE# THREAD#
---------- ----------
533 1
198 2
SQL> select sequence#, thread#, applied from v$archived_log order by first_time;
SEQUENCE# THREAD# APP
---------- ---------- ---
532 1 YES
533 1 NO
198 2 YES
可以看到,两个数据库实例的归档日志文件已经发送到本地节点,而且LGWR进程已经将正在写的当前日志文件533写到了本地。
数据库的STANTDBY机制已经正常运行,下面看看能否将STANDBY数据库的两个实例以只读方式打开:
SQL> alter database recover managed standby database cancel;
Database altered.
SQL> alter database open;
Database altered.
SQL> select instance_name, status from v$instance;
INSTANCE_NAME STATUS
---------------- ------------
rac11g1 OPEN
SQL> select name,
2 open_mode,
3 database_role,
4 guard_status,
5 db_unique_name,
6 primary_db_unique_name
7 from v$database;
NAME OPEN_MODE DATABASE_ROLE GUARD_S DB_UNIQUE_NAME PRIMARY_DB_UNIQUE_NAME