|
今天抽空建设了一套Windows XP和Linux x86平台上的一套DG的环境,下面的配置的详细过程. 环境说明 环境准备 一台已经装好Windows XP的PC 预装好的Oracle 11gR1(11.1.0.6)企业版数据库 一台已经装好Linux x86的VM 预先装好Oracle 11gR1(11.1.0.6)企业版数据库软件,不建库,但要准备要相应的环境变量和文件系统及目录结构并授予相应的权限(略) 在接下来的测试中,我对一个主库配置了2个physical dataguard,一个是在同平台的windows下,一个是在Linux下. 预备搭建的场景 | 数据库 | DB_NAME | DB_UNIQUE_NAME | INSTANCE_NAME | IP | 网络服务名 | ORACLE_HOME | | 主数据库 | ora11g | Prim_11g | ora11g | 192.168.100.1 | Prim_11g | d:oracle11g | | 物理备用数据库1 | ora11g | Std_11g | sora11g | 192.168.100.1 | Std_11g | d:oracle11g | | 物理备用数据库2 | ora11g | vstd_11g | vora11g | 192.168.100.60 | vstd_11g | /oracle/product/11.1/db_1 |
前期的相关工作就不多罗嗦了,大家都很熟悉了,主要show一下11g中通过rman脚本轻松完成dg配置的过程. 在11g中,通过rman配置dg,只需要备库具备一个db_name的初始化参数,并启动到nomount阶段即可 注:当然了,前提是你已经安装好了相应的Oracle 软件,并规划好了文件系统和目录结构. 接下来,你只需要配置好listener.ora和tnsnames.ora,让rman可以同时连接到primary db和这个备库的实例即可 下面是通过rman构件异够(windows xp + linux x86)平台下物理备用库的过程 [oracle@vm11g] /oracle> rman Recovery Manager: Release 11.1.0.6.0 - Production on Thu Apr 2 16:50:12 2009 Copyright (c) 1982, 2007, Oracle. All rights reserved. RMAN> connect target sys/admin@prim_11g connected to target database: ORA11G (DBID=4074416935) RMAN> connect auxiliary sys/admin@vstd_11g connected to auxiliary database: ORA11G (not mounted) RMAN> run 2> { 3> allocate channel c1 type disk; 4> allocate auxiliary channel s1 type disk; 5> allocate auxiliary channel s2 type disk; 6> duplicate target database for standby dorecover nofilenamecheck 7> from active database 8> spfile 9> parameter_value_convert 'ora11g','vora11g' 10> set db_unique_name='vstd_11g' 11> set db_file_name_convert='D:ORACLE11GORADATAORA11G','/oracle/oradata/vora11g/' 12> set log_file_name_convert='D:ORACLE11GORADATAORA11G','/oracle/oradata/vora11g/' 13> set control_files='/oracle/oradata/vora11g/control01.ctl' 14> set fal_client='vstd_11g' 15> set fal_server='prim_11g' 16> set standby_file_management='AUTO' 17> set log_archive_config='dg_config=(prim_11g,vstd_11g)' 18> set log_archive_dest_1='LOCATION=/oracle/oradata/arch valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=vstd_11g' 19> set log_archive_dest_2='service=prim_11g LGWR ASYNC valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE) db_unique_name=prim_11g' 20> set log_archive_dest_3='LOCATION=/oracle/oradata/arc_std valid_for=(STANDBY_LOGFILE,STANDBY_ROLE) DB_UNIQUE_NAME=vstd_11g' 21> set log_archive_format='vora11g_%t_%s_%r.arc' 22> set diagnostic_dest='/oracle/product/11.1/db_1' 23> set db_recovery_file_dest='/oracle/oradata/flash_area' 24> set db_recovery_file_dest_size='536870912' 25> set audit_file_dest='/oracle/admin/vora11g/adump' 26> ; 27> sql channel c1 "alter system archive log current"; 28> } using target database control file instead of recovery catalog allocated channel: c1 channel c1: SID=145 device type=DISK allocated channel: s1 channel s1: SID=97 device type=DISK allocated channel: s2 channel s2: SID=96 device type=DISK Starting Duplicate Db at 02-APR-09 contents of Memory Script: { backup as copy reuse file 'd:oracle11gDATABASEPWDora11g.ORA' auxiliary format '/oracle/product/11.1/db_1/dbs/orapwvora11g' file 'D:ORACLE11GDATABASESPFILEORA11G.ORA' auxiliary format '/oracle/product/11.1/db_1/dbs/spfilevora11g.ora' ; sql clone "alter system set spfile= ''/oracle/product/11.1/db_1/dbs/spfilevora11g.ora''"; } executing Memory Script Starting backup at 02-APR-09 Finished backup at 02-APR-09 sql statement: alter system set spfile= ''/oracle/product/11.1/db_1/dbs/spfilevora11g.ora'' contents of Memory Script: { sql clone "alter system set dispatchers = ''(PROTOCOL=TCP) (SERVICE=vora11gXDB)'' comment= '''' scope=spfile"; sql clone "alter system set db_unique_name = ''vstd_11g'' comment= '''' scope=spfile"; sql clone "alter system set db_file_name_convert = ''D:ORACLE11GORADATAORA11G'', ''/oracle/oradata/vora11g/'' comment= '''' scope=spfile"; sql clone "alter system set log_file_name_convert = ''D:ORACLE11GORADATAORA11G'', ''/oracle/oradata/vora11g/'' comment= '''' scope=spfile"; sql clone "alter system set control_files = ''/oracle/oradata/vora11g/control01.ctl'' comment= '''' scope=spfile"; sql clone "alter system set fal_client = ''vstd_11g'' comment= '''' scope=spfile"; sql clone "alter system set fal_server = ''prim_11g'' comment= '''' scope=spfile"; sql clone "alter system set standby_file_management = ''AUTO'' comment= '''' scope=spfile"; sql clone "alter system set log_archive_config = ''dg_config=(prim_11g,vstd_11g)'' comment= '''' scope=spfile"; sql clone "alter system set log_archive_dest_1 = ''LOCATION=/oracle/oradata/arch valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=vstd_11g'' comment= '''' scope=spfile"; sql clone "alter system set log_archive_dest_2 = ''service=prim_11g LGWR ASYNC valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE) db_unique_name=prim_11g'' comment= '''' scope=spfile"; sql clone "alter system set log_archive_dest_3 = ''LOCATION=/oracle/oradata/arc_std valid_for=(STANDBY_LOGFILE,STANDBY_ROLE) DB_UNIQUE_NAME=vstd_11g'' comment= '''' scope=spfile"; sql clone "alter system set log_archive_format = ''vora11g_%t_%s_%r.arc'' comment= '''' scope=spfile"; sql clone "alter system set diagnostic_dest = ''/oracle/product/11.1/db_1'' comment= '''' scope=spfile"; sql clone "alter system set db_recovery_file_dest = ''/oracle/oradata/flash_area'' comment= '''' scope=spfile"; sql clone "alter system set db_recovery_file_dest_size = 536870912 comment= '''' scope=spfile"; sql clone "alter system set audit_file_dest = ''/oracle/admin/vora11g/adump'' comment= '''' scope=spfile"; shutdown clone immediate; startup clone nomount ; } executing Memory Script sql statement: alter system set dispatchers = ''(PROTOCOL=TCP) (SERVICE=vora11gXDB)'' comment= '''' scope=spfile sql statement: alter system set db_unique_name = ''vstd_11g'' comment= '''' scope=spfile sql statement: alter system set db_file_name_convert = ''D:ORACLE11GORADATAORA11G'', ''/oracle/oradata/vora11g/'' comment= '''' scope=spfile sql statement: alter system set log_file_name_convert = ''D:ORACLE11GORADATAORA11G'', ''/oracle/oradata/vora11g/'' comment= '''' scope=spfile sql statement: alter system set control_files = ''/oracle/oradata/vora11g/control01.ctl'' comment= '''' scope=spfile sql statement: alter system set fal_client = ''vstd_11g'' comment= '''' scope=spfile sql statement: alter system set fal_server = ''prim_11g'' comment= '''' scope=spfile sql statement: alter system set standby_file_management = ''AUTO'' comment= '''' scope=spfile sql statement: alter system set log_archive_config = ''dg_config=(prim_11g,vstd_11g)'' comment= '''' scope=spfile sql statement: alter system set log_archive_dest_1 = ''LOCATION=/oracle/oradata/arch valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=vstd_11g'' comment= '''' scope=spfile sql statement: alter system set log_archive_dest_2 = ''service=prim_11g LGWR ASYNC valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE) db_unique_name=prim_11g'' comment= '''' scope=spfile sql statement: alter system set log_archive_dest_3 = ''LOCATION=/oracle/oradata/arc_std valid_for=(STANDBY_LOGFILE,STANDBY_ROLE) DB_UNIQUE_NAME=vstd_11g'' comment= '''' scope=spfile sql statement: alter system set log_archive_format = ''vora11g_%t_%s_%r.arc'' comment= '''' scope=spfile sql statement: alter system set diagnostic_dest = ''/oracle/product/11.1/db_1'' comment= '''' scope=spfile sql statement: alter system set db_recovery_file_dest = ''/oracle/oradata/flash_area'' comment= '''' scope=spfile sql statement: alter system set db_recovery_file_dest_size = 536870912 comment= '''' scope=spfile sql statement: alter system set audit_file_dest = ''/oracle/admin/vora11g/adump'' comment= '''' scope=spfile Oracle instance shut down connected to auxiliary database (not started) Oracle instance started Total System Global Area 318054400 bytes Fixed Size 1299624 bytes Variable Size 96471896 bytes Database Buffers 213909504 bytes Redo Buffers 6373376 bytes contents of Memory Script: { backup as copy current controlfile for standby auxiliary format '/oracle/oradata/vora11g/control01.ctl'; sql clone 'alter database mount standby database'; } executing Memory Script Starting backup at 02-APR-09 channel c1: starting datafile copy copying standby control file output file name=D:ORACLE11GDATABASESNCFORA11G.ORA tag=TAG20090402T194705 RECID=24 STAMP=683149633 channel c1: datafile copy complete, elapsed time: 00:00:04 Finished backup at 02-APR-09 sql statement: alter database mount standby database contents of Memory Script: { set newname for tempfile 1 to "/oracle/oradata/vora11g/TEMP01.DBF"; switch clone tempfile all; set newname for datafile 1 to "/oracle/oradata/vora11g/SYSTEM01.DBF"; set newname for datafile 2 to "/oracle/oradata/vora11g/SYSAUX01.DBF"; set newname for datafile 3 to "/oracle/oradata/vora11g/UNDOTBS01.DBF"; set newname for datafile 4 to "/oracle/oradata/vora11g/USERS01.DBF"; set newname for datafile 5 to "/oracle/oradata/vora11g/DATA_01.DBF"; backup as copy reuse datafile 1 auxiliary format "/oracle/oradata/vora11g/SYSTEM01.DBF" datafile 2 auxiliary format "/oracle/oradata/vora11g/SYSAUX01.DBF" datafile 3 auxiliary format "/oracle/oradata/vora11g/UNDOTBS01.DBF" datafile 4 auxiliary format "/oracle/oradata/vora11g/USERS01.DBF" datafile 5 auxiliary format "/oracle/oradata/vora11g/DATA_01.DBF" ; sql 'alter system archive log current'; } executing Memory Script executing command: SET NEWNAME renamed tempfile 1 to /oracle/oradata/vora11g/TEMP01.DBF in control file executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME Starting backup at 02-APR-09 channel c1: starting datafile copy input datafile file number=00001 name=D:ORACLE11GORADATAORA11GSYSTEM01.DBF output file name=/oracle/oradata/vora11g/SYSTEM01.DBF tag=TAG20090402T194723 RECID=0 STAMP=0 channel c1: datafile copy complete, elapsed time: 00:00:44 channel c1: starting datafile copy input datafile file number=00002 name=D:ORACLE11GORADATAORA11GSYSAUX01.DBF output file name=/oracle/oradata/vora11g/SYSAUX01.DBF tag=TAG20090402T194723 RECID=0 STAMP=0 channel c1: datafile copy complete, elapsed time: 00:00:49 channel c1: starting datafile copy input datafile file number=00005 name=D:ORACLE11GORADATAORA11GDATA_01.DBF output file name=/oracle/oradata/vora11g/DATA_01.DBF tag=TAG20090402T194723 RECID=0 STAMP=0 channel c1: datafile copy complete, elapsed time: 00:00:27 channel c1: starting datafile copy input datafile file number=00003 name=D:ORACLE11GORADATAORA11GUNDOTBS01.DBF output file name=/oracle/oradata/vora11g/UNDOTBS01.DBF tag=TAG20090402T194723 RECID=0 STAMP=0 channel c1: datafile copy complete, elapsed time: 00:00:16 channel c1: starting datafile copy input datafile file number=00004 name=D:ORACLE11GORADATAORA11GUSERS01.DBF output file name=/oracle/oradata/vora11g/USERS01.DBF tag=TAG20090402T194723 RECID=0 STAMP=0 channel c1: datafile copy complete, elapsed time: 00:00:01 Finished backup at 02-APR-09 sql statement: alter system archive log current contents of Memory Script: { backup as copy reuse archivelog like "D:ORACLE11GORADATAARCHORA11G_1_48_678216811.ARC" auxiliary format "/oracle/oradata/arc_stdvora11g_1_48_678216811.arc" ; catalog clone archivelog "/oracle/oradata/arc_stdvora11g_1_48_678216811.arc"; switch clone datafile all; } executing Memory Script Starting backup at 02-APR-09 channel c1: starting archived log copy input archived log thread=1 sequence=48 RECID=71 STAMP=683149809 output file name=/oracle/oradata/arc_stdvora11g_1_48_678216811.arc RECID=0 STAMP=0 channel c1: archived log copy complete, elapsed time: 00:00:01 Finished backup at 02-APR-09 cataloged archived log archived log file name=/oracle/oradata/arc_stdvora11g_1_48_678216811.arc RECID=1 STAMP=683139230 datafile 1 switched to datafile copy input datafile copy RECID=24 STAMP=683139230 file name=/oracle/oradata/vora11g/SYSTEM01.DBF datafile 2 switched to datafile copy input datafile copy RECID=25 STAMP=683139230 file name=/oracle/oradata/vora11g/SYSAUX01.DBF datafile 3 switched to datafile copy input datafile copy RECID=26 STAMP=683139231 file name=/oracle/oradata/vora11g/UNDOTBS01.DBF datafile 4 switched to datafile copy input datafile copy RECID=27 STAMP=683139231 file name=/oracle/oradata/vora11g/USERS01.DBF datafile 5 switched to datafile copy input datafile copy RECID=28 STAMP=683139231 file name=/oracle/oradata/vora11g/DATA_01.DBF contents of Memory Script: { set until scn 1104554; recover standby clone database delete archivelog ; } executing Memory Script executing command: SET until clause Starting recover at 02-APR-09 starting media recovery archived log for thread 1 with sequence 48 is already on disk as file /oracle/oradata/arc_stdvora11g_1_48_678216811.arc archived log file name=/oracle/oradata/arc_stdvora11g_1_48_678216811.arc thread=1 sequence=48 media recovery complete, elapsed time: 00:00:01 Finished recover at 02-APR-09 Finished Duplicate Db at 02-APR-09 sql statement: alter system archive log current released channel: c1 OK,到这里就配置成功了. OK,到这里linux下那个physical dataguard就建好了.进入到恢复模式 SQL> recover managed standby database disconnect; Media recovery complete. SQL> 看一下日志: Primary database is in MAXIMUM PERFORMANCE mode RFS[3]: Successfully opened standby log 11: '/oracle/oradata/vora11g/STDREDO01.LOG' Thu Apr 02 16:57:24 2009 kcrrvslf: active RFS archival for log 11 thread 1 sequence 51 RFS[2]: Successfully opened standby log 12: '/oracle/oradata/vora11g/STDREDO02.LOG' Thu Apr 02 16:57:50 2009 Media Recovery Log /oracle/oradata/arc_stdvora11g_1_50_678216811.arc Media Recovery Waiting for thread 1 sequence 51 (in transit)
OK了.
|