dataguard日常操作

停止redo应用
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
开启redo应用
alter database recover managed standby database disconnect from session;
alter database recover managed standby database using current logfile disconnect;
查看日志传输状态
select dest_name,error from v$archive_dest;
select message from v$dataguard_status;
select PROCESS,STATUS,THREAD#,SEQUENCE#,BLOCK#,BLOCKS,DELAY_MINS from v$managed_standby
order by PROCESS,THREAD#;

alter system set log_archive_dest_state_3='defer' sid='*' scope=both;
alter system set log_archive_dest_state_3='enable' sid='*' scope=both;

备库日常操作处理:
1:重建备库上的redo
alter database drop logfile group 4;
ORA-01275: Operation DROP LOGFILE is not allowed if standby file management is automatic.
alter system set standby_file_management=manual;
再执行!

2:在备库上注册从主库上手动copy过来的归档日志
alter database register physical logfile '/oraarch/t2posb/arch/1_15572_905091365.dbf';
alter database register physical logfile '/oraarch/t2pay/arch/1_10706_905081609.dbf';
cstc_1_114913_925489757.arc
使用duplicate方式搭建备库
rman target sys/Aa123456@nstg2_pay auxiliary sys/Aa123456@adg_nstg2_pay;
duplicate target database for standby from active database nofilenamecheck
scp oracle@192.168.36.39:/home/oracle/awrrpt_1_4042_4046.html /tmp/
rman target sys/Aa123456@stg3_pay auxiliary sys/Aa123456@adg_stg3_pay;


主库参数设置
ALTER DATABASE FORCE LOGGING;
alter system set log_archive_dest_2='SERVICE=adg_stg3_omsrpt lgwr async noaffirm reopen=60 valid_for=(online_logfiles,primary_role)';
alter system set log_archive_dest_state_2='enable';
alter system set standby_file_management=auto;
alter system set fal_server='nstg2_pay' SCOPE=SPFILE;
alter system set fal_client='adg_nstg2_pay' SCOPE=both;
alter system set log_file_name_convert='/paf/oradata/t3omsrpt/','/paf/oradata/t3omsrpt/' scope=spfile;

备库上日志操作
alter database add standby logfile group 16 ('/oradata/t2pay/redo16_01.log','/oradata/t2pay/redo16_02.log') size 1024m;
alter database drop standby logfile group 16;
alter database clear unarchived logfile group 15;

使用rman搭建备库的备份还原步骤
#!/bin/bash  

echo "---------------------------------" >>/data/backup/cstc/cstc.log
echo "   " >>cstc.log
echo "Rman Begin  to Working ........." >>/data/backup/cstc/cstc.log
echo "Begin time at:" `date` --`date +%Y%m%d%H%M` >>/data/backup/cstc/cstc.log

$ORACLE_HOME/bin/rman log=/data/backup/cstc/rman.log <<EOF
connect target /
run{
allocate channel dev1 type disk;
allocate channel dev2 type disk;
allocate channel dev3 type disk;
allocate channel dev4 type disk;
allocate channel dev5 type disk;
allocate channel dev6 type disk;
allocate channel dev7 type disk;
allocate channel dev8 type disk;
backup FILESPERSET 16 full database FORMAT '/data/backup/cstc/orcl_%U_%T';
backup current controlfile for standby FORMAT '/data/backup/cstc/c_orcl_%U_%T';
}
exit;    
EOF



restore standby controlfile from '/paf/backup/t3pay/t3pay/orcl_4mroop37_1_1_20161230';
#!/bin/bash  

echo "---------------------------------" >>/data/backup/utpp/utpp_res.log
echo "   " >>utpp_res.log
echo "Rman Begin  to Working ........." >>/data/backup/utpp/utpp_res.log
echo "Begin time at:" `date` --`date +%Y%m%d%H%M` >>/data/backup/utpp/utpp_res.log

$ORACLE_HOME/bin/rman log=/data/backup/utpp/restore.log <<EOF
connect target /
run
{
set newname for database to '+DATA/bx_utpp/datafile/%b';
allocate channel dev1 type disk;
allocate channel dev2 type disk;
allocate channel dev3 type disk;
allocate channel dev4 type disk;
allocate channel dev5 type disk;
allocate channel dev6 type disk;
allocate channel dev7 type disk;
allocate channel dev8 type disk;
restore database;
switch datafile all;
recover database;
}
exit;    
EOF



将备库激活为read write模式
SQL> alter database recover managed standby database cancel;
SQL>  create restore point restore_point_dg guarantee flashback database;
SQL> alter system set log_archive_dest_state_2=defer;
SQL> alter database activate standby database;   -----将备库激活为read/wirte

Database altered.

SQL> alter database open;

Database altered.


alter database open upgrade;
@$ORACLE_HOME/rdbms/admin/catupgrd.sql;



Zhangyao840601




  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值