探索Oracle 11gR2 DataGuard_02配置
配置步骤:
一、开启强制日志
二、配置pri端传输参数
三、备份pri端数据库
四、拷贝文件到sty端
五、配置sty端传输参数
六、将sty端启动到mount状态并恢复数据
七、在pri端应用发送归档日志文件
八、在sty端开启强制redo应用
九、配置standby日志
十、在pri端启动强制日志应用
11gR2DG传输架构
图:
DBName
Role
DB_UNIQUE_NAME
Oracle Net Service Name
Woo
Primary
Pri
PRI
Physical standby
Sty
STY
一、两节点分别输入如下命令开启强制日志模式:
[sql]
SQL> startup mount;
SQL> alter database archivelog;
SQL> alter database open;
SQL> alter database force logging;
二、修改Pri端参数文件:
[sql]
SQL> alter system set db_unique_name =pri scope=spfile;
SQL> alter system set log_archive_config= 'DG_CONFIG=(pri,sty)' scope=spfile;
SQL>alter system set log_archive_dest_1= 'LOCATION=/DBBackup/Archive VALID_FOR=(ALL_LOGFILES,ALL_ROLES)DB_UNIQUE_NAME=pri' scope=spfile;
SQL> alter system set log_archive_dest_2= 'SERVICE=sty LGWR SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)DB_UNIQUE_NAME=sty' scope=spfile;
SQL> alter system setlog_archive_dest_state_2 = DEFER;
alter system set fal_server=styscope=spfile;
SQL> alter system set fal_client=priscope=spfile;
SQL> alter system setstandby_file_management=AUTO scope=spfile;
三、在Pri端输入如下命令,创建standby控制文件
[sql]
SQL> alter database create standbycontrolfile as '/DBBackup/Phycal/stycontrol.ctl';
四、通过rman备份pri端数据库
[sql]
Rman>backup database format'/DBBackup/Phycal/full_db_%U';
#copy file to standby
监听文件:listener.oratnsnames.ora
参数文件:initWoo.ora
密码文件:orapwWoo
sty控制文件:stycontrol.ctl
全库备份文件:full_db_*
日志输出目录:$ORACLE_BASE/admin$ORACLE_BASE/diag
五、拷贝监听文件,参数文件,密码文件,sty端控制文件,rman备份文件,admin/目录,diag诊断目录,flash_recovery_area目录,归档目录 到sty端用于恢复及起库
[sql]
[oracle@pri ~]$ cd$ORACLE_HOME/network/admin --拷贝监听文件
[oracle@pri admin]$ ls
listener.ora samples shrept.lst tnsnames.ora
[oracle@pri admin]$ scp *.orasty:$ORACLE_HOME/network/admin
oracle@sty's password:
listener.ora 100% 294 0.3KB/s 00:00
tnsnames.ora 100% 669 0.7KB/s 00:00
[oracle@pri admin]$ cd $ORACLE_HOME/dbs --拷贝密码文件及pfile参数文件
[oracle@pri dbs]$ ls
hc_DBUA0.dat hc_Woo.dat init.ora initWoo.ora lkPRI lkWOO orapwWoo snapcf_Woo.f spfileWoo.ora
[oracle@pri dbs]$ scp initWoo.ora orapwWoosty:$ORACLE_HOME/dbs
oracle@sty's password:
initWoo.ora 100% 999 1.0KB/s 00:00
orapwWoo 100% 1536 1.5KB/s 00:00
[oracle@pri dbs]$ cd /DBBackup/Phycal/ --拷贝备份文件
[oracle@pri Phycal]$ ls
full_db_01o9j16h_1_1 full_db_02o9j17b_1_1 stycontrol.ctl
[oracle@pri Phycal]$ scp full_db_0*stycontrol.ctl sty:/DBBackup/Phycal/
oracle@sty's password:
full_db_01o9j16h_1_1 100% 943MB 20.1MB/s 00:47
full_db_02o9j17b_1_1 100% 9600KB 9.4MB/s 00:01
stycontrol.ctl 100% 9520KB 9.3MB/s 00:00
[oracle@pri ~]$ cd $ORACLE_BASE --拷贝admin/,diag/,flash_recovery_area三目录
[oracle@pri DBSoft]$ ls
admin cfgtoollogs checkpoints diag flash_recovery_area oraInventory Product
[oracle@pri DBSoft]$ scp -r admin/ diag/admin/ flash_recovery_area/ sty:$ORACLE_BASE
六、修改sty端pfile参数文件,添加和修改如下内容
[plain]
vi /DBSoft/Product/11.2.0/db_1/dbs/initWoo.ora
*.db_unique_name=sty
*.log_archive_config='DG_CONFIG=(pri,dg)'
*.log_archive_dest_1='LOCATION=/DBBackup/ArchiveVALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=sty'
*.log_archive_dest_2='SERVICE=pri LGWR SYNCVALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=pri'
*.fal_server=pri
*.fal_client=sty
*.standby_file_management=AUTO
#*.db_file_name_convert='pri','pri'
#*.log_file_name_convert='pri','pri'
*.control_files='/DBBackup/Phycal/control01.ctl'
七、启动sty端数据库到mount状态,并恢复pri端数据库到sty端
[plain]
SQL> startup mountpfile='/DBSoft/Product/11.2.0/db_1/dbs/initWoo.ora';
ORACLE instance started.
Total System Global Area 839282688 bytes
Fixed Size