Chinaunix首页 | 论坛 | 博客
  • 博客访问: 11590676
  • 博文数量: 8065
  • 博客积分: 10002
  • 博客等级: 中将
  • 技术积分: 96708
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-16 17:06
文章分类

全部博文(8065)

文章存档

2008年(8065)

分类: 服务器与存储

2008-07-16 10:24:44

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 GUARD的REAL 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 APPLY和REAL TIME QUERY状态。

阅读(279) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~