SQL> select force_logging from v$database; FORCE_LOGGING ------------------------------ YES
如果主库处于非归档模式,需要修改:
1
SQL> alterdatabase force logging;
配置DG所需参数(主库)
1 2 3 4 5 6 7 8
SQL> alter system setlog_archive_config='DG_CONFIG=(wwlc,wwlcdg)'scope=both sid='*'; SQL> alter system setlog_archive_dest_1='location=+ARCH/wwlc/archfile valid_for=(all_logfiles,all_roles) db_unique_name=wwlc'scope=both sid='*'; SQL> alter system setlog_archive_dest_2='service=wwlcdg LGWR ASYNC NOAFFIRM valid_for=(online_logfiles,primary_role) db_unique_name=wwlcdg'scope=both sid='*'; SQL> alter system setstandby_file_management=auto scope=both sid='*'; SQL> alter system setdb_file_name_convert='/home/s01/app/oracle/oradata/wwlcdg','+DATA/wwlc/datafile' scope=spfile sid='*'; SQL> alter system setlog_file_name_convert='/home/s01/app/oracle/oradata/wwlcdg/onlinelog','+DATA/wwlc/onlinelog' scope=spfile sid='*'; SQL> alter system setfal_client='wwlc'scope=both sid='*'; SQL> alter system setfal_server='wwlcdg'scope=both sid='*';
SQL> altersystemset log_archive_dest_state_2=defer; SQL> altersystemset log_archive_dest_state_2=enable; SQL> altersystem switch logfile; SQL> select process,status,thread#,sequence#,block#,blocks from v$managed_standby; SQL> selectsequence#,applied from v$archived_log orderbysequence#; SQL> select thread#, low_sequence#, high_sequence# from v$archive_gap;
踩坑
RMAN-06217: not connected to auxiliary database with a net service name duplicate target database for standby from active database需要使用net service name连接进行账号密码验证,如果使用操作系统验证会出现此错误。
RMAN-04006: error from auxiliary database、ORA-12528: TNS:listener: all appropriate instances are blocking new connections 备用数据库处于nomount状态,无法动态注册到监听,通过net service name连接auxiliary时无法找到服务,可通过在监听器中添加静态注册解决。
RMAN-05517: temporary file ***** conflicts with file used by target dat 备库pfile或者duplicate时添加 nofilenamecheck选项,配置正确的db_file_name_convert、log_file_name_convert参数。
MAN-04017: startup error description: ORA-00439: feature not enabled: Real Application Clusters 由于主库是 rac ,备库是单实例,所以备库pfile或者duplicate时,需要设置 cluster_database =’false’。
RMAN-05535: WARNING: All redo log files were not defined properly. log_file_name_convert参数必须配置,且为redo日志而不是archive log。
RMAN-05503: at least one auxiliary channel must be allocated to execute this command 手动分配复制通道时(allocate channel) 必须要加上allocate auxiliary channel。
RMAN-06024: no backup or copy of the control file found to restore 如果数据库没有做过全备,则duplicate命令必须带关键词” from active database”。
RMAN-06034: at least 1 channel must be allocated to execute this command 如果duplicate命令中使用关键词” from active database”,则必须为主库分配通道。
ORA-17628: Oracle error 19505 returned by remote Oracle server 相关路径必须存在,比如控制文件路径不存在。
ORA-16047: DGID mismatch between destination setting and standby log_archive_config参数未配置
ORA-16057: server not in Data Guard configuration log_archive_config参数错误,千万注意:dg_config 中必须是db_unique_name,而且主备库都必须配置正确。