ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Oracle11DATA GUARD实时应用加实时查询功能

Oracle11DATA GUARD实时应用加实时查询功能

原创 Linux操作系统 作者:yangtingkun 时间:2007-09-30 00:00:00 0 删除 编辑

Oracle10g增加了DATA GUARD的日志实时应用功能,11g添加了实时查询功能。这两个功能可以同时应用。

DATA GUARD的建立:http://yangtingkun.itpub.net/post/468/388465

Oracle11新特性——DATA GUARD打开模式下应用归档:http://yangtingkun.itpub.net/post/468/388599


对于PRIMARY数据,只需要将对应的LOG_ARCHIVE_DEST改为同步方式。为了更好的说明问题,首先将归档日志切换一下:

SQL> alter system set log_archive_dest_2 =
2 'SERVICE=ora11g_s SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=ora11g_s';

系统已更改。

SQL> alter system switch logfile;

系统已更改。

下面登陆STANDBY数据库,添加STANDBY LOGFILE,并修改初始化参数,使得STANDBY数据库可以处理STANDBY LOGFILE

$ sqlplus "/ as sysdba"

SQL*Plus: Release 11.1.0.6.0 - Production on Thu Sep 27 18:52:10 2007

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

Connected to an idle instance.

SQL> startup mount ORACLE instance started.

Total System Global Area 267825152 bytes
Fixed Size 1299316 bytes
Variable Size 150998156 bytes
Database Buffers 113246208 bytes
Redo Buffers 2281472 bytes
Database mounted.
SQL> set pages 100 lines 120
SQL> col member format a80
SQL> select group#, member from v$logfile;

GROUP# MEMBER
---------- --------------------------------------------------------------------
1 /data/oracle/oradata/ora11g/ORA11G_S/onlinelog/o1_mf_1_3f5dsz0v_.log
1 /data/oracle/flash_recovery_area/ORA11G_S/onlinelog/o1_mf_1_3f5dszg1_.log
2 /data/oracle/oradata/ora11g/ORA11G_S/onlinelog/o1_mf_2_3f5dt1vl_.log
2 /data/oracle/flash_recovery_area/ORA11G_S/onlinelog/o1_mf_2_3f5dt26o_.log
3 /data/oracle/oradata/ora11g/ORA11G_S/onlinelog/o1_mf_3_3f5dt3gn_.log
3 /data/oracle/flash_recovery_area/ORA11G_S/onlinelog/o1_mf_3_3f5dt3yj_.log

6 rows selected.

SQL> select group#, bytes from v$log;

GROUP# BYTES
---------- ----------
1 52428800
3 52428800
2 52428800

SQL> alter database add standby logfile
2 ('/data/oracle/oradata/ora11g/ORA11G_S/onlinelog/sredo1.log') size 50m;

Database altered.

SQL> alter database add standby logfile
2 ('/data/oracle/oradata/ora11g/ORA11G_S/onlinelog/sredo2.log') size 50m;

Database altered.

SQL> alter database add standby logfile
2 ('/data/oracle/oradata/ora11g/ORA11G_S/onlinelog/sredo3.log') size 50m;

Database altered.

SQL> alter database add standby logfile
2 ('/data/oracle/oradata/ora11g/ORA11G_S/onlinelog/sredo4.log') size 50m;

Database altered.

SQL> alter system set log_archive_dest_3 =
2 'LOCATION=/data/oracle/oradata/ora11g/archivelogstand
3 VALID_FOR=(STANDBY_LOGFILES,STANDBY_ROLES) DB_UNIQUE_NAME=ora11g_s';

System altered.

SQL> alter database open;

Database altered.

SQL> alter database recover managed standby database
2 using current logfile disconnect from session;

Database altered.

至此,DATA GUARDREAL TIME APPLY已经配置完成。下面检查一下DATA GUARD是否正常工作。登陆PRIMARY KEY进行数据修改,并提交:

SQL> select * from t_standby;

no rows selected

SQL> insert into t_standby select * from tab;

4 rows created.

SQL> commit;

Commit complete.

登陆STANDBY数据库,检查修改是否已经同步过来:

SQL> conn yangtk/yangtk
SQL> select * from t_standby;

TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
T TABLE
T_SESSION TABLE
T_SESSION_STAT TABLE
T_STANDBY TABLE

现在数据库同时处于REAL TIME APPLYREAL TIME QUERY状态。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/4227/viewspace-69442/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
暂无介绍

注册时间:2007-12-29

  • 博文量
    1955
  • 访问量
    10455335