19.3 管理逻辑备用数据库

1. 开始 SQL Apply

C:\>sqlplus sys/orcl@standby1 as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 2月 19 16:05:21 2009

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

连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> alter database start logical standby apply;

数据库已更改。

SQL> alter database stop logical standby apply;

数据库已更改。

SQL> alter database start logical standby apply;

数据库已更改。

2. 显示已经注册的归档日志

SQL> select sequence#,applied from dba_logstdby_log;

SEQUENCE# APPLIED
---------- --------
       145 CURRENT
       146 CURRENT
       147 NO
       148 NO

3. 检查是否正在应用重做数据

SQL> select * from v$logstdby_stats where name='coordinator state';

NAME                           VALUE
------------------------------ ------------------------------
coordinator state              IDLE

4. 查询 SQL Apply 进度

SQL> select applied_scn,newest_scn from dba_logstdby_progress;

APPLIED_SCN NEWEST_SCN
----------- ----------
    1974603    1974603

5. 验证数据变化

SQL> conn sys/orcl@demo as sysdba
已连接。
SQL> update scott.emp set sal=1111 where empno=7788;

已更新 1 行。

SQL> commit;

提交完成。

SQL> alter system archive log current;

系统已更改。

SQL> conn sys/orcl@standby1 as sysdba
已连接。
SQL> select sal from scott.emp where empno=7788;

       SAL
----------
      1111

6. 转变逻辑备用数据库为主数据库

SQL> alter database stop logical standby apply;

数据库已更改。

SQL> alter database activate logical standby database;

数据库已更改。

原文地址:https://www.cnblogs.com/yiwuya/p/1394080.html