异地迁移Rman脚本
]主库备份:
]run
{
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 1 DAYS;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
backup full tag 'dbfull' format '备份地址‘
include current controlfile;
sql 'alter system archive log current';
release channel c1;
release channel c2;
release channel c3;
}
ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE DISK;
CROSSCHECK BACKUPSET;
DELETE NOPROMPT OBSOLETE;
导地恢复:
rman target /
RMSN>]set dbid xx; (select dbid from v$database)
RMAN> startup nomount pfile='xx';
RMAN> restore controlfile from 'xx';(最小的备份集)
RMAN> alter database mount;
RMAN> catalog start with 'xx';
RMAN> restore database;
这一步完成之后就停止旧库的监听器
]RMAN>recover database until sequence 8503;(alter system archive log current +1)
RMAN>alter database open resetlogs;
V$ARCHIVED_LOG
RMAN> sql 'alter session set nls_date_format="yyyy-mm-dd hh24:mi:ss"';