热门标签 | HotTags
当前位置:  开发笔记 > 数据库 > 正文

Oracle11gR2创建物理DataGuard

11G版本对Dataguard上有了比较大的改进,就是在open备库的情况下,备库依然可以应用主库传过来的归档日志,记得在10g的时候,想打开备

11G版本对Dataguard上有了比较大的改进,就是在open备库的情况下,备库依然可以应用主库传过来的归档日志,记得在10g的时候,想打开备

环境:

OS:Red Hat Linux As 5

DB:11.2.0.1

11G版本对Dataguard上有了比较大的改进,就是在open备库的情况下,备库依然可以应用主库传过来的归档日志,记得在10g的时候,想打开备库查看数据数据是否已经传输过来,还必须先停掉日志应用.下面是介绍如何创建物理备库的过程,数据库采用的是普通文件管理的方式(主备库数据文件路径保持一致),过程是比较有点繁琐,呵呵.

--------------------------主库上的操作-------------------------------------------

SQL> alter database force logging;
Database altered.

2.编辑初始化参数
SQL> create pfile='/u01/export/home/Oracle/pfile.txt' from spfile;
File created.
Vi pfile.txt 添加红色部分的内容
[oracle@primary ~]$ more pfile.txt
oracl.__db_cache_size=272629760
oracl.__java_pool_size=4194304
oracl.__large_pool_size=4194304
oracl.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
oracl.__pga_aggregate_target=276824064
oracl.__sga_target=415236096
oracl.__shared_io_pool_size=0
oracl.__shared_pool_size=125829120
oracl.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/oracl/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u01/app/oracle/oradata/oracl/control01.ctl','/u02/app/oracle/oradata/oracl/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='oracl'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=oraclXDB)'
*.memory_target=692060160
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'

*.db_unique_name=oracl
*.log_archive_cOnfig='dg_cOnfig=(oracl,oraclbak)'
*.log_archive_dest_1=
'location=/u02/archive_log/
valid_for=(all_logfiles,all_roles)
db_unique_name=oracl'
*.log_archive_dest_2=
'service=dup_oracl async
valid_for=(online_logfiles,primary_role)
db_unique_name=oraclbak'
*.log_archive_dest_state_1=enable
*.log_archive_dest_state_2=enable
*.standby_file_management=auto
*.fal_server=dup_oracl
*.fal_client=tar_oracl
*.db_file_name_cOnvert='/u01/app/oracle/oradata/oracl/','/u01/app/oracle/oradata/oracl/'
*.log_file_name_cOnvert='/u01/app/oracle/oradata/oracl/','/u01/app/oracle/oradata/oracl/','/u02/app/oracle/oradata/oracl/','/u02/app/oracle/oradata/oracl/'

3.使用步骤2修改的参数启动主库

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> create spfile from pfile='/u01/export/home/oracle/pfile.txt';
File created.

SQL> startup
ORACLE instance started.
Total System Global Area 690503680 bytes
Fixed Size 1338756 bytes
Variable Size 411042428 bytes
Database Buffers 272629760 bytes
Redo Buffers 5492736 bytes
Database mounted.
Database opened.

4.添加standby日志文件,大小跟v$log中的日志文件大小保持一致,这里的日志组从4开始,因为主库已经创建了3组online日志组了.

alter database add standby logfile group 4 ('/u02/app/oracle/oradata/oracl/stdbyredo01.log') SIZE 512m;
alter database add standby logfile group 5 ('/u02/app/oracle/oradata/oracl/stdbyredo02.log') SIZE 512m;
alter database add standby logfile group 6 ('/u02/app/oracle/oradata/oracl/stdbyredo03.log') SIZE 512m;
alter database add standby logfile group 7 ('/u02/app/oracle/oradata/oracl/stdbyredo04.log') SIZE 512m;

5.创建standby控制文件

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area 690503680 bytes
Fixed Size 1338756 bytes
Variable Size 411042428 bytes
Database Buffers 272629760 bytes
Redo Buffers 5492736 bytes
Database mounted.
SQL> alter database create standby controlfile AS '/u01/export/home/oracle/standby.ctl';

Database altered.

SQL> alter database open;

Database altered.

6.配置tnsnames文件

使用netca配置tnsnames,文件内容如下:
[oracle@primary admin]$ more tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/n
etwork/admin/tnsnames.ora
# Generated by Oracle configuration tools.

推荐阅读
author-avatar
大西guoguo_120
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有