- 最后登录
- 2015-1-23
- 在线时间
- 16 小时
- 威望
- 18
- 金钱
- 190
- 注册时间
- 2013-7-26
- 阅读权限
- 10
- 帖子
- 25
- 精华
- 2
- 积分
- 18
- UID
- 1170
|
1#
发表于 2014-3-22 11:44:14
|
查看: 5343 |
回复: 4
该文档是hunter生产环境实施成功版本,按该文档搭建物理DG高可用环境,没有任何问题!原创文档,禁止转载!
DG架构图:
http://b237.photo.store.qq.com/psb?/V12rSpsx4VU3RK/0iDucMz*ZSn7SZmhSfeIlQ90lwQLtCuTWwXo7kJ2IlE!/b/dH*2So0pEgAA&bo=LgIGAQAAAAABAAw!&su=0138647089&rf=2-9
Standby端:
1、建立相应目录:
mkdir /opt/oracle/oradata/qg_st -p
mkdir /opt/oracle/admin/qg_st –p
mkdir {a,b,c,u,dp}dump
mkdir pfile
mkdir /opt/oracle/flash_recovery_area/QG_ST –p
2、备库端的密码文件:
拷贝主库端的密码文件,修改SID。
scp orapwqg_st root@192.168.1.182: /opt/oracle/product/10g/dbs
3、配置listener和tns:
listener配置:
(SID_DESC =
(GLOBAL_DBNAME = qg_st)
(ORACLE_HOME = /opt/oracle/product/10g)
(SID_NAME = qg_st)
)
tns配置(主备库两端都要配):
qgresearch =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.102)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = research.country)
)
)
qg_st =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.182)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = qg_st)
)
)
4、准备备库端参数文件(由于目录不一致,需要指定db_file_name_convert、log_file_name_convert和standby_file_management三个初始化参数):
qg_st.__db_cache_size=1509949440
qg_st.__java_pool_size=33554432
qg_st.__large_pool_size=16777216
qg_st.__shared_pool_size=536870912
qg_st.__streams_pool_size=33554432
*.audit_file_dest='/opt/oracle/admin/qg_st/adump'
*.background_dump_dest='/opt/oracle/admin/qg_st/bdump'
*.compatible='10.2.0.1.0'
*.control_files='/opt/oracle/oradata/qg_st/control01.ctl','/opt/oracle/oradata/qg_st/control02.ctl','/opt/oracle/oradata/qg_st/control03.ctl'#Restore Controlfile
*.core_dump_dest='/opt/oracle/admin/qg_st/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_file_name_convert='/u01/oracle/oradata/research/','/opt/oracle/oradata/qg_st/'
*.db_name='research'
*.db_recovery_file_dest='/opt/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=21474836480
*.DB_UNIQUE_NAME='qg_st'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=qg_stXDB)'
*.fal_client='qg_st'
*.fal_server='qgresearch'
*.job_queue_processes=10
*.log_archive_config='DG_CONFIG=(qg_st,research)'
*.log_archive_dest_1='LOCATION=/rman/arch/qg_st/ VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=qg_st'
*.log_archive_dest_2='SERVICE=qgresearch LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=reserach'
*.log_archive_dest_state_1='ENABLE'
*.log_archive_dest_state_2='DEFER'
*.log_file_name_convert='/u01/oracle/oradata/research/','/opt/oracle/oradata/qg_st/'
*.open_cursors=300
*.pga_aggregate_target=1671430144
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=2147483648
*.standby_file_management='AUTO'
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/opt/oracle/admin/qg_st/udump'
5、将备库端启动到nomount状态:
startup nomount
Primary 端:
1、检查主库开启归档和force logging
2、配置主库端的参数文件
alter system set LOG_ARCHIVE_CONFIG='DG_CONFIG=(research,qg_st)';
alter system set LOG_ARCHIVE_DEST_1='LOCATION= /rman/archivelog/ VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=research';
alter system set LOG_ARCHIVE_DEST_2='SERVICE=qg_st LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=qg_st';
alter system set LOG_ARCHIVE_DEST_STATE_1=ENABLE;
alter system set LOG_ARCHIVE_DEST_STATE_2=defer;
alter system set FAL_SERVER='qg_st';
alter system set FAL_CLIENT='qgresearch';
alter system set STANDBY_FILE_MANAGEMENT='AUTO';
3、配置主库的TNS,使primary和standby能相互ping通
qgresearch =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.102)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = research.country)
)
)
qg_st =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.182)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = qg_st)
)
)
4、主库进行全库的备份,将备份集拷贝到备库相同的目录下
RUN {
allocate channel c1 type disk;
allocate channel c2 type disk;
sql 'alter system archive log current';
backup current controlfile for standby format='/rman/backup/dgbackup_control_%U';
BACKUP FORMAT '/rman/backup/dgbackup_%U_%T' skip inaccessible filesperset 5 DATABASE ;
sql 'alter system archive log current';
BACKUP FORMAT '/rman/backup/dgbackup_arch_%U_%T' skip inaccessible filesperset 5 ARCHIVELOG ALL ;
release channel c2;
release channel c1;
}
过程省略,然后把备份文件SCP 到 standby相同的目录下,如果不同会出现ORA-19505
5、Rman下duplicate数据库,恢复备库
rman target / auxiliary sys/mycosoracle@qg_st
duplicate target database for standby nofilenamecheck dorecover;
select open_mode,database_role from v$database;
6、创建standby redo,打开主库的日志传输,备库端接收应用redo.
ALTER DATABASE ADD STANDBY LOGFILE GROUP 4 ('/opt/oracle/oradata/qg_st/redo04.log') size 50M;
ALTER DATABASE ADD STANDBY LOGFILE GROUP 5 ('/opt/oracle/oradata/qg_st/redo05.log') size 50M;
ALTER DATABASE ADD STANDBY LOGFILE GROUP 6 ('/opt/oracle/oradata/qg_st/redo06.log') size 50M;
ALTER DATABASE ADD STANDBY LOGFILE GROUP 7 ('/opt/oracle/oradata/qg_st/redo07.log') size 50M;
alter system set log_archive_dest_state_2=enable;
alter database recover managed standby database disconnect from session;
7、检查DG搭建成功后的状态
select max(sequence#), APPLIED from v$archived_log;
注:我们的192.168.1.182上面已经部署了133协议库的物理备库,ORACLE_SID也是research,所以在全国库和协议库主库上增加数据文件时,如果standby_file_management设置为自动,并且没有配置db_file_name_convert时,则都将备库端在与主库相同的目录/u01/oracle/oradata/research下增加数据文件,这将产生数据文件名重名的冲突。
|
|