将上图中的admin,flash_recovery_area,pfile,arch目录结构拷贝到备份相应位置上。其它路径中的文件覆盖到备库相应位置即可。
3.8 通过pfile启动主库
sqlplus / as sysdba startup pfile='C:\\app\\mafei\\pfile\\initdg1.ora'; 四、主库配置
4.1 参数文件
(1)spfile生成pfile
sqlplus / as sysdba create pfile='C:\\app\\mafei\\pfile\\initdg1.ora'from spfile;
创建目录说明详见5.5节。
(2)修改pfile
db_name='dg1' db_unique_name='dg1' log_archive_config='DG_CONFIG=(dg1,dg2)' control_files='C:\\app\\mafei\\oradata\\dg1\\control01.ctl', 'C:\\app\\mafei\\oradata\\dg1\\control02.ctl' log_archive_dest_1='LOCATION=C:\\app\\mafei\\arch\\dg1 valid_for=(all_logfiles,all_roles) db_unique_name=dg1' log_archive_dest_2='service=dg2 ASYNC valid_for=(online_logfiles,primary_role) db_unique_name=dg2' LOG_ARCHIVE_DEST_STATE_1=ENABLE LOG_ARCHIVE_DEST_STATE_2=ENABLE REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE LOG_ARCHIVE_FORMAT=%t_%s_%r.arc LOG_ARCHIVE_MAX_PROCESSES=30 FAL_SERVER=dg2 DB_FILE_NAME_CONVERT='dg2','dg1' LOG_FILE_NAME_CONVERT='dg2','dg1' STANDBY_FILE_MANAGEMENT=AUTO 说明:需要在mount状态下将C:\\app\\mafei\\oradata\\dg1\\control01.ctl文件再覆盖一下,并且改名为control02.ctl
(3)拷贝pfile
将修改好的initdg1.ora文件拷贝至共享目录中
(4)归档目录
主库上需要创建以下归档目录
4.2 监听文件
%ORACLE_HOME%/network/admin/listener.ora SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = dg1) (ORACLE_HOME =C:\\app\\mafei\\product\\11.2.0\\db_1) (GLOBAL_DBNAME=dg1) ) ) LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.100)(PORT = 1521)) ) ) ADR_BASE_LISTENER = D:\\app\\Administrator
4.3 网络连接
%ORACLE_HOME%/network/admin/tnsnames.ora
DG1 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.100)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = dg1) ) ) DG2 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.101)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = dg2) ) )
五、从库配置
5.1 参数文件
db_name='dg1' db_unique_name='dg2' audit_file_dest='C:\\app\\mafei\\admin\\dg2\\adump' log_archive_config='DG_CONFIG=(dg1,dg2)' control_files='C:\\app\\mafei\\oradata\\dg2\\control01.ctl', 'C:\\app\\mafei\\oradata\\dg2\\control02.ctl' log_archive_dest_1='LOCATION=C:\\app\\mafei\\arch\\dg2 valid_for=(all_logfiles,all_roles) db_unique_name=dg2' log_archive_dest_2='service=dg1 ASYNC valid_for=(online_logfiles,primary_role) db_unique_name=dg1' LOG_ARCHIVE_DEST_STATE_1=ENABLE LOG_ARCHIVE_DEST_STATE_2=ENABLE REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE LOG_ARCHIVE_FORMAT=%t_%s_%r.arc LOG_ARCHIVE_MAX_PROCESSES=30 FAL_SERVER=dg1 DB_FILE_NAME_CONVERT='dg1','dg2' LOG_FILE_NAME_CONVERT='dg1','dg2' STANDBY_FILE_MANAGEMENT=AUTO
5.2 监听文件
%ORACLE_HOME%/network/admin/listener.ora
SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = dg2) (ORACLE_HOME =C:\\app\\mafei\\product\\11.2.0\\db_1) (GLOBAL_DBNAME=dg2) ) ) LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.101)(PORT = 1521)) ) ) ADR_BASE_LISTENER = D:\\app\\Administrator
5.3 网络连接
%ORACLE_HOME%/network/admin/tnsnames.ora(同主库一样) DG1 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.100)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = dg1) ) ) DG2 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.101)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = dg2) ) )