1.备份源库
RMAN>
run {
allocate channel t1 type disk;
allocate channel t2 type disk;
allocate channel t3 type disk;
allocate channel t4 type disk;
backup as compressed backupset database format '+data/obak/db_%T_%U.bak' plus archivelog
format '+data/obak/arch_%T_%U.bak';
backup current controlfile format '+data/obak/ctl_%T_%U.bak';
release channel t1;
release channel t2;
release channel t3;
release channel t4;
}
------------------------------------------
2.恢复
----恢复控制文件
RMAN> RESTORE STANDBY CONTROLFILE FROM '/oradata/backup/control.bak';
------启动数据库到mount状态
RMAN> alter database mount;
--------恢复
RMAN> catalog start with '/oradata/backup/';
run{
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
set newname for database to '+DATA/orcl/datafile/%b';
restore database;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
}
switch database to copy;
recover database;
-----------------------------------------
添加standby log
alter database add standby logfile thread 1 group 11('+data') size 1G;
alter database add standby logfile thread 1 group 12('+data') size 1G;
alter database add standby logfile thread 2 group 13('+data') size 1G;
alter database add standby logfile thread 2 group 14('+data') size 1G;
------------------应用日志
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;
------ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
---------open
alter database open;
--------------------------------------------------------------------------------------------------
create spfile='+DATA/orcl/spfileorcl.ora' from pfile='/home/oracle/pfileorcl';
vi initorcl1.ora
spfile='+DATA/orcl/spfileorcl.ora'
srvctl add database -d orcl-o /data/oracle/product/11g/db -p +DATA/orcl/spfileorcl.ora -r physical_standby
srvctl add instance -d orcl-i orcl1 -n node_rac1
srvctl add instance -d orcl-i orcl2 -n node_rac2
---------------------
col DEST_NAME for a20
col DESTINATION for a30
col error for a30
select dest_name,destination,status,error from v$archive_dest where status='VALID';
select dest_name,destination,status,error from v$archive_dest where dest_name='LOG_ARCHIVE_DEST_3';
select DEST_NAME , STATUS , RECOVERY_MODE from v$archive_dest_status;
set line 2000
select process,status,thread#,sequence#,block# from gv$managed_standby
where sequence#>0;
set line 2000
col name for a25
col VALUE for a20
col UNIT for a30
col TIME_COMPUTED for a20
col DATUM_TIME for a20
col SOURCE_DB_UNIQUE_NAME for a20
select * from v$dataguard_stats;




