管理部分
如果没有启用database force logging,则备库对/*+ append */操作,nologging操作,会报坏块;
建议表空间force logging或者database force logging;
--force logging /nologging 测试
- alterdatabaseforcelogging;
- selectforce_loggingfromdba_tablespaces;
- selectforce_loggingfromv$database;
- altertablespacetestforcelogging;
- selectlogging,table_name,tablespace_namefromuser_tableswheretable_name='TEST';
- altertablespacetestnoforcelogging;
- selecttablespace_name,logging,force_loggingfromdba_tablespaces;
##配置主库的归档删除策略
- CONFIGUREARCHIVELOGDELETIONPOLICYTOAPPLIEDONSTANDBY;
--传过去就删除
- CONFIGUREARCHIVELOGDELETIONPOLICYTOSHIPPEDTOSTANDBY;
备库删除脚本
vi delete_archive.sh
- #!/bin/sh
- source/home/oracle/.bash_profile
- exportORACLE_SID=standby
- TABLE='v$archived_log'
- $ORACLE_HOME/bin/sqlplus-silent"/assysdba"<<EOF
- setheadingoff;
- setpagesize0;
- settermoff;
- setFeedbackoff;
- setlinesize199;
- settrimson;
- setverifoff;
- spool/home/oracle/scripts/del_arch.sh;
- select'rm-rf'||namefromv\$archived_logwhereDELETED='NO'andAPPLIED='YES';
- spooloff;
- exit;
- EOF
- chmod+x/home/oracle/scripts/del_arch.sh
- sh/home/oracle/scripts/del_arch.sh
- rmantarget/<<EOF
- crosscheckarchivelogall;
- deletenopromptexpiredarchivelogall;
- exit;
- EOF
增加定时任务:crontab -e
- 01***su-oracle-c/home/oracle/scripts/delete_archive.sh1
备库自启动脚本:
vi /etc/rc.local
- su-oracle-c/home/oracle/scripts/start_db.sh
- vistart_db.sh
- source/home/oracle/.bash_profile
- lsnrctlstart
- exportORACLE_SID=standby
- sqlplus/assysdba<<EOF
- startup;
- recovermanagedstandbydatabaseusingcurrentlogfiledisconnectfromsession;
- exit