本次实验为相同平台的两台数据库服务器,目标端只安装oracle软件,且目标端与源端数据文件等目录保持一致。
1. 源端进行全备
--全备脚本
[oracle@orcl scripts]$ cat rman_full_backup.sh
source /home/oracle/.bash_profile
rman target / log=/home/oracle/backup/logs/backupall_rman.log<<EOF
run
{
allocate channel ch1 device type disk; #分配通道
allocate channel ch2 device type disk;
sql 'alter system archive log current'; #归档当前日志
backup database format '/home/oracle/backup/bak/db_%d_%T_%U';
sql 'alter system archive log current';
backup archivelog all format '/home/oracle/backup//bak/arch_%t_%s' delete all input;
backup format '/home/oracle/backup/bak/con_%s_%p' current controlfile;
crosscheck backup;
crosscheck archivelog all;
delete noprompt expired backup;
delete noprompt obsolete;
delete noprompt backup of database completed before 'sysdate -15';
delete noprompt archivelog all;
delete noprompt backup of archivelog all completed before 'sysdate -15';
release channel ch1;
release channel ch2;
}
EOF
2. 将备份文件传输到目标端
[oracle@orcl bak]$ scp * oracle@orcl_adg:/home/oracle/backup
arch_958157782_41 100% 12KB 12.0KB/s 00:00
arch_958157783_42 100% 2560 2.5KB/s 00:00
con_43_1 100% 9568KB 9.3MB/s 00:00
db_ORCL_20171023_14shokse_1_1 100% 636MB 31.8MB/s 00:20
db_ORCL_20171023_15shokse_1_1 100% 400MB 25.0MB/s 00:16
db_ORCL_20171023_17shokuj_1_1 100% 96KB 96.0KB/s 00:00
3. 在目标端设置DBID,启动到nomount阶段
注:在rman下即使没有参数文件,默认也会启动一个DUMMY实例,以便能够恢复参数文件
[oracle@orcl_adg ~]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Thu Nov 2 08:30:55 2017
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database (not started)
RMAN> set dbid 1485808053
executing command: SET DBID
RMAN> startup nomount;
Oracle instance started
Total System Global Area 776646656 bytes
Fixed Size 2257272 bytes
Variable Size 507514504 bytes
Database Buffers 264241152 by