说明:Oracle9i数据库的Data Guard 特性确保对数据进行完整的保护,是Oracle 9i的一个关键特性之一。Data Guard可以创建物理的Standby数据库,也可以创建逻辑的Standby数据库,还可以混合使用,灵活性比较强。
2.6 创建一个Windows服务:
WINNT> oradim -NEW -SID Pstandby -STARTMODE manual
2.7 Create a Server Parameter File for the Standby Database。
可参考执行如下操作:
C:\>set oracle_sid=pstandby
C:\>sqlplus /nolog
SQL> connect / as sysdba
SQL> CREATE SPFILE FROM PFILE='C:\DataGuard\Pstandby\DEMO\initPstandby.ora';; |
2.8 启动物理Standby数据库:
C:\>set oracle_sid=pstandby
C:\>sqlplus /nolog
SQL> connect / as sysdba
SQL> STARTUP NOMOUNT;
SQL> ALTER DATABASE MOUNT STANDBY DATABASE; |
2.9 在Standby数据库上,初始化Log Apply 服务:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
2.10 激活到物理Standby数据库的归档:
SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=Pstandby' SCOPE=BOTH;
SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE SCOPE=BOTH; |
2.11 启动远程归档:
SQL> ALTER SYSTEM ARCHIVE LOG CURRENT;
3.安装完的的验证:
3.1在database, 查询V$ARCHIVED_LOG(其实也可以直接到相关目录下查看Log是否创建):
SQL> SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME
2 FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;
SEQUENCE# FIRST_TIME NEXT_TIME
---------- ---------- ----------
38 23-7? -02 23-7? -02
39 23-7? -02 23-7? -02
40 23-7? -02 23-7? -02
41 23-7? -02 23-7? -02
42 23-7? -02 23-7? -02
|
3.2 在Primary数据库上,归档当前的Log
SQL> ALTER SYSTEM ARCHIVE LOG CURRENT;
3.3 验证是否收到:
SQL> SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME
2> FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;
SEQUENCE# FIRST_TIME NEXT_TIME
---------- ---------- ----------
38 23-7? -02 23-7? -02
39 23-7? -02 23-7? -02
40 23-7? -02 23-7? -02
41 23-7? -02 23-7? -02
42 23-7? -02 23-7? -02
43 23-7? -02 23-7? -02 |
3.4 验证是否新的归档Redo日志已经被应用:
SQL> select sequence#,applied from v$archived_log
2 order by sequence#;
SEQUENCE# APP
---------- ---
38 YES
39 YES
40 YES
41 YES
42 YES
43 YES |