3.2.10 启动数据库到mount状态
3.2.11 在备库进行数据库的恢复
rman target sys/qwe123@testbak run
{
allocate channel c1 type disk; allocate channel c2 type disk; restore database; };
3.2.12 备库启动介质恢复进程mrp
3.3 功能性配置
配置定期删除备库归档日志的脚本
cd /home/oracle vi archived.sql
select name from v\\$archived_log where applied='YES' and deleted='NO';
vi rmandelarch.sh
export ORACLE_SID=testbak
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1 export NLS_LANG=AMERICAN_AMERICA.AL32UTF8 export
PATH=$ORACLE_HOME/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:$PATH cd /home/oracle/
cat /dev/null > archived.txt
sqlplus sys/qwe123@testbak as sysdba < set lines 50 spool /home/oracle/archived.txt @archived.sql spool off EOF cat archived.txt |xargs rm -rf - rman target sys/qwe123@testbak < crosscheck copy; delete noprompt expired copy; } EOF exit 赋予rmandelarch.sh脚本执行的权限并加入到crontab 中 Oracle 用户下 chmod u+x rmandelarch.sh 4.检查项 备库:检查归档日志接收和日志应用的具体情况 select process,status,sequence#,blocks,block# from v$managed_standby; PROCESS STATUS SEQUENCE# BLOCKS ------------------ ------------------------ ---------- ---------- ---------- MRP0 WAIT_FOR_LOG 568 0 RFS RECEIVING 0 0 RFS ATTACHED 567 17963 BLOCK# 0 0 17963 注:如果sequenc#与主数据库归档日志号一致则Dataguard工作正常 如果status状态为WAIT_FOR_GAP则dataguard与主数据库不同步, Dataguard工作不正常 备库:检查备库备库应用日志跟接受日志的差距 Select,dest_name,database_mode ,archived_thread#,archived_seq#,applied_thread#,applied_seq#,db_unique_name from v$archive_dest_status; 主库:检查主库正在正在传送那个日志 select process,status,thread#,sequence# ,group# from v$managed_standby; 5. 测试方法 无论oracle dataguard, stream replication还是advanced replication 只是复制ddl,dml的操作 主库: 备库: 6.日常维护命令 6.1启动备库至mount状态,并启动mrp进程