Oracle 11G配置单实例DataGuard
Oracle 11G配置单实例DataGuard
ABOUT : Install Oracle 11.2.0.1 on Linux 5.5
uname : Linux node2 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:39 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
一、Primary端操作:
1.Primary设置归档模式
这个生产库都是这种模式。
SQL> archive log list;
SQL> shutdown immediate
SQL> startup mount
SQL> alter database archivelog;
SQL> archive log list;
2. Primary设置force logging
SQL> alter database force logging;
SQL> select force_logging from v$database;
FORCE_LOG
---------
YES
3.配置Oracle Net
在Primary库和Standby 都要修改。也可以使用netca和netmgr命令配置。
注意:修改完后记得重启listener。lsnrctl reload
Primary:
listener.ora::(静态配置LISTENER)
-------------------
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = orcl)
)
)
-------------------
tnsnames.ora::
-------------------
standby =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.99.92)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = standby)
)
)
-------------------
Standby:
listener.ora::
-------------------
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = standby)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = orcl)
)
)
-------------------
tnsnames.ora::
-------------------
orcl =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.99.91)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
-------------------
4.Primary添加data guard参数
主要添加以下参数
*.db_name='orcl'
*.db_unique_name='orcl'
*.log_archive_config='DG_CONFIG=(orcl,standby)'
*.log_archive_dest_1='LOCATION=/oradata/orcl/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=orcl'
*.log_archive_dest_2='SERVICE=standby ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=standby'
*.remote_login_passwordfile='EXCLUSIVE'
These parameters take effect when the primary database is transitioned to the standby role
------------------------------------------------------------------------------------------
*.fal_server='standby'
*.db_file_name_convert='/orcl/standby/','/orcl/'
*.log_file_name_convert='/orcl/standby/arch/','/orcl/arch/'
*.standby_file_management='AUTO'
二、Standby端设置:
1.创建相关目录结构
2.将参口令文件传到standby 端
3.创建standby的初始化参数,主要增加以下参数:
*.db_name='orcl'
*.db_unique_name='standby'
*.control_files='/oradata/orcl/standby/control01.ctl','/oradata/orcl/standby/control02.ctl'
*.LOG_ARCHIVE_CONFIG='DG_CONFIG=(orcl,standby)'
*.db_file_name_convert='/orcl/','/orcl/standby/'
*.log_file_name_convert='/orcl/','/orcl/standby/'
*.log_archive_dest_1='LOCATION=/oradata/orcl/standby/arch/ VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=standby'
*.LOG_ARCHIVE_DEST_2='SERVICE=orcl ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=orcl'
*.standby_file_management='AUTO'
*.remote_login_passwordfile='EXCLUSIVE'
*.FAL_SERVER='orcl'
4.用spfile将standby启动到nomount状态:
SQL> create spfile from pfile;
SQL> startup nomount
5.Primary开始duplicate
[oracle@rhel5 admin]$ rman target / auxiliary sys/oracle@standby
Recovery Manager: Release 11.2.0.1.0 - Production on Sun Oct 20 12:10:19 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1333198576)
connected to auxiliary database: ORCL (not mounted)
run {
allocate channel prmy1 type disk;
allocate channel prmy2 type disk;
allocate channel prmy3 type disk;
allocate channel prmy4 type disk;
allocate auxiliary channel stby1 type disk;
duplicate target database for standby from active database;
}
(2) 在执行duplicate的时候,如果源库和目标库目录相同,那么在duplicate 时,需要加上nofilenamecheck,如下:
RMAN> duplicate target database for standby from active database nofilenamecheck;
三、后续工作
1.主库已经使用了spfile,但是备库用的还是之前的pfile:
2.只要备库的监听不重启,重启备库后,主库还是能识别的。如果备库的监听重启了。那么主库也就需要重启。
3.复制结束后的Standby只启动到mount standby的状态。 并没有启动MRP的应用归档程序。所以这个时候查询主备库,归档是不同步的。需要手动的启动MRP进程。
Primary:
SQL> alter system archive log current;
Sun Oct 20 13:42:29 2013
Archived Log entry 4 added for thread 1 sequence 63 ID 0x50dddec2 dest 1:
Sun Oct 20 13:42:29 2013
RFS[4]: Selected log 4 for thread 1 sequence 64 dbid 1333198576 branch 808520212
Standby 非 Real-Time Apply::
SQL> alter database recover managed standby database disconnect from session;
Attempt to start background Managed Standby Recovery process (orcl)
Sun Oct 20 14:20:08 2013
MRP0 started with pid=26, OS id=8307
MRP0: Background Managed Standby Recovery process started (orcl)
Serial Media Recovery started
Managed Standby Recovery not using Real Time Apply
Waiting for all non-current ORLs to be archived...
All non-current ORLs have been archived.
Media Recovery Log /oradata/orcl/standby/arch/1_63_808520212.dbf
Media Recovery Log /oradata/orcl/standby/arch/1_64_808520212.dbf
Media Recovery Waiting for thread 1 sequence 65 (in transit)
Completed: alter database recover managed standby database disconnect from session
4.备库Real-Time Apply:
在duplicate结束后,备库没有添加standby redo log file。但是主库采用的是:lgwr async传送的日志。当备库的RFS 进程接收到日志后,发现
- 更多Oracle疑问解答:
- 运行exp备份oracle数据库提示oracle-12154错误
- 有没有,生产Oracle Rman 备份脚本的工具啊!
- 初学orcle,希望有大大帮忙解说一下详细步骤,从登录oracle到创建表的过程
- oracle语句问题:一张user表,三个字段,id,name,time,插入记录比如:张三2007,李四2008,张三2011
- 如何写一个ORACLE触发器同步两个表中的数据?
- oracle 如何查看一个服务器上有多少个数据库.
- oracle 创建包的时候错误 求解
- oracle 重复列的问题
- oracle 中如何查处2星期前的数据
- 请教oracle数据库安装中的问题
- 请问谁能提供给我标准的oracle ERP的数据库表结构并详细说明各表主要的作用?
- 安装oracle遇到的问题 invalid entry CRC (expected 0x3e12e795 but got 0x9db0e9fd)
- 我的是ORACLE 10G,在RMAN中如何按指定的时间恢复数据文件啊?
- oracle为什么没有自动增长列
- oracle快捷键都有哪些啊?