在测试环境上进行了rman备份。先写好备份脚本放在DBA专用目录下,使用rman命令检查脚本语法,最后进行备份。
#whole-backup.rman
run
{
allocate channel ch1 type disk;
allocate channel ch2 type disk;
backup as backupset format '/home/oracle/whole-%d_%s.dbf'
tag 'decemeber-whole-backup' incremental level 0 database;
sql 'alter system archive log current';
backup as backupset format '/home/oracle/archivelog-%d-%s.dbf'
tag 'all-log-file' archivelog all delete all input;
backup as backupset format '/home/oracle/contr-%d-%s.dbf'
tag 'control-file' current controlfile;
backup as backupset format '/home/oracle/spfile-%d%s.dbf'
tag 'spfile-backup' spfile;
crosscheck backupset;
delete noprompt obsolete ;
release channel ch1;
release channel ch2;
}
#检查语法
[oracle@andrew1 ~]$ rman checksyntax @/home/oracle/dbascript/whole-backup.rman
Recovery Manager: Release 11.2.0.4.0 - Production on Fri Dec 6 10:53:42 2013
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
RMAN> run
2> {
3> allocate channel ch1 type disk;
4> allocate channel ch2 type disk;
5> backup as backupset format '/home/oracle/whole-%d_%s.dbf'
6> tag 'decemeber-whole-backup' incremental level 0 database;
7> sql 'alter system archive log current';
8> backup as backupset format '/home/oracle/archivelog-%d-%s.dbf'
9> tag 'all-log-file' archivelog all delete all input;
10> backup as backupset format '/home/oracle/contr-%d-%s.dbf'
11> tag 'control-file' current controlfile;
12> backup as backupset format '/home/oracle/spfile-%d%s.dbf'
13> tag 'spfile-backup' spfile;
14> crosscheck backupset;
15> delete noprompt obsolete ;
16> release channel ch1;
17> release channel ch2;
18> }
19>
The cmdfile has no syntax errors
Recovery Manager complete
#进行备份
[oracle@andrew1 ~]$ rman target sys/password@tns_name catalog rman/rmanpwd @/home/oracle/dbascript/whole-backup.rman
Recovery Manager: Release 11.2.0.4.0 - Production on Fri Dec 6 10:55:57 2013
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: ANDREA (DBID=1538202652)
connected to recovery catalog database
RMAN> run
2> {
3> allocate channel ch1 type disk;
4> allocate channel ch2 type disk;
5> backup as backupset format '/home/oracle/whole-%d_%s.dbf'
6> tag 'decemeber-whole-backup' incremental level 0 database;
7> sql 'alter system archive log current';
8> backup as backupset format '/home/oracle/archivelog-%d-%s.dbf'
9> tag 'all-log-file' archivelog all delete all input;
10> backup as backupset format '/home/oracle/contr-%d-%s.dbf'
11> tag 'control-file' current controlfile;
12> backup as backupset format '/home/oracle/spfile-%d%s.dbf'
13> tag 'spfile-backup' spfile;
14> crosscheck backupset;
15> delete noprompt obsolete ;
16> release channel ch1;
17> release channel ch2;
18> }
19>
starting full resync of recovery catalog
full resync complete
allocated channel: ch1
channel ch1: SID=140 device type=DISK
allocated channel: ch2
channel ch2: SID=23 device type=DISK
Starting backup at 06-DEC-13
channel ch1: starting incremental level 0 datafile backup set
channel ch1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/ANDREA/system01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/ANDREA/users01.dbf
channel ch1: starting piece 1 at 06-DEC-13
channel ch2: starting incremental level 0 datafile backup set
channel ch2: specifying datafile(s) in backup set
input datafile file number=00002 name=/u01/app/oracle/oradata/ANDREA/sysaux01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/ANDREA/rman.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/ANDREA/undotbs01.dbf
channel ch2: starting piece 1 at 06-DEC-13
channel ch2: finished piece 1 at 06-DEC-13
piece handle=/home/oracle/whole-ANDREA_15.dbf tag=DECEMEBER-WHOLE-BACKUP comment=NONE
channel ch2: backup set complete, elapsed time: 00:01:26
channel ch2: starting incremental level 0 datafile backup set
channel ch2: specifying datafile(s) in backup set
channel ch1: finished piece 1 at 06-DEC-13
piece handle=/home/oracle/whole-ANDREA_14.dbf tag=DECEMEBER-WHOLE-BACKUP comment=NONE
channel ch1: backup set complete, elapsed time: 00:01:26
channel ch1: starting incremental level 0 datafile backup set
channel ch1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ch1: starting piece 1 at 06-DEC-13
channel ch1: finished piece 1 at 06-DEC-13
piece handle=/home/oracle/whole-ANDREA_17.dbf tag=DECEMEBER-WHOLE-BACKUP comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:02
including current control file in backup set
channel ch2: starting piece 1 at 06-DEC-13
channel ch2: finished piece 1 at 06-DEC-13
piece handle=/home/oracle/whole-ANDREA_16.dbf tag=DECEMEBER-WHOLE-BACKUP comment=NONE
channel ch2: backup set complete, elapsed time: 00:00:01
Finished backup at 06-DEC-13
sql statement: alter system archive log current
Starting backup at 06-DEC-13
current log archived
channel ch1: starting archived log backup set
channel ch1: specifying archived log(s) in backup set
input archived log thread=1 sequence=2 RECID=1 STAMP=829773374
input archived log thread=1 sequence=3 RECID=2 STAMP=829773413
input archived log thread=1 sequence=4 RECID=3 STAMP=830026857
input archived log thread=1 sequence=5 RECID=4 STAMP=830691696
input archived log thread=1 sequence=6 RECID=5 STAMP=830876016
input archived log thread=1 sequence=7 RECID=6 STAMP=831501511
input archived log thread=1 sequence=8 RECID=7 STAMP=831501601
input archived log thread=1 sequence=9 RECID=8 STAMP=831654227
channel ch1: starting piece 1 at 06-DEC-13
channel ch2: starting archived log backup set
channel ch2: specifying archived log(s) in backup set
input archived log thread=1 sequence=10 RECID=9 STAMP=831681326
input archived log thread=1 sequence=11 RECID=10 STAMP=832108640
input archived log thread=1 sequence=12 RECID=11 STAMP=832109619
input archived log thread=1 sequence=13 RECID=12 STAMP=832111231
input archived log thread=1 sequence=14 RECID=13 STAMP=832695665
input archived log thread=1 sequence=15 RECID=14 STAMP=833453752
input archived log thread=1 sequence=16 RECID=15 STAMP=833453866
channel ch2: starting piece 1 at 06-DEC-13
channel ch1: finished piece 1 at 06-DEC-13
piece handle=/home/oracle/archivelog-ANDREA-18.dbf tag=ALL-LOG-FILE comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:46
channel ch1: deleting archived log(s)
archived log file name=/u01/app/oracle/fast_recovery_area/ANDREA/archivelog/2013_10_25/o1_mf_1_2_96nsfx0p_.arc RECID=1 STAMP=829773374
archived log file name=/u01/app/oracle/fast_recovery_area/ANDREA/archivelog/2013_10_25/o1_mf_1_3_96nsh5dv_.arc RECID=2 STAMP=829773413
archived log file name=/u01/app/oracle/fast_recovery_area/ANDREA/archivelog/2013_10_28/o1_mf_1_4_96wjz7xo_.arc RECID=3 STAMP=830026857
archived log file name=/u01/app/oracle/fast_recovery_area/ANDREA/archivelog/2013_11_05/o1_mf_1_5_97jt7dvy_.arc RECID=4 STAMP=830691696
archived log file name=/u01/app/oracle/fast_recovery_area/ANDREA/archivelog/2013_11_07/o1_mf_1_6_97pg7h1l_.arc RECID=5 STAMP=830876016
archived log file name=/u01/app/oracle/fast_recovery_area/ANDREA/archivelog/2013_11_14/o1_mf_1_7_989k259r_.arc RECID=6 STAMP=831501511
archived log file name=/u01/app/oracle/fast_recovery_area/ANDREA/archivelog/2013_11_14/o1_mf_1_8_989k51tv_.arc RECID=7 STAMP=831501601
archived log file name=/u01/app/oracle/fast_recovery_area/ANDREA/archivelog/2013_11_16/o1_mf_1_9_98g66k3q_.arc RECID=8 STAMP=831654227
channel ch1: starting archived log backup set
channel ch1: specifying archived log(s) in backup set
input archived log thread=1 sequence=17 RECID=16 STAMP=833453867
channel ch1: starting piece 1 at 06-DEC-13
channel ch2: finished piece 1 at 06-DEC-13
piece handle=/home/oracle/archivelog-ANDREA-19.dbf tag=ALL-LOG-FILE comment=NONE
channel ch2: backup set complete, elapsed time: 00:00:47
channel ch2: deleting archived log(s)
archived log file name=/u01/app/oracle/fast_recovery_area/ANDREA/archivelog/2013_11_16/o1_mf_1_10_98h0of0s_.arc RECID=9 STAMP=831681326
archived log file name=/u01/app/oracle/fast_recovery_area/ANDREA/archivelog/2013_11_21/o1_mf_1_11_98w1yvsr_.arc RECID=10 STAMP=832108640
archived log file name=/u01/app/oracle/fast_recovery_area/ANDREA/archivelog/2013_11_21/o1_mf_1_12_98w2xl47_.arc RECID=11 STAMP=832109619
archived log file name=/u01/app/oracle/fast_recovery_area/ANDREA/archivelog/2013_11_21/o1_mf_1_13_98w4hy0q_.arc RECID=12 STAMP=832111231
archived log file name=/u01/app/oracle/fast_recovery_area/ANDREA/archivelog/2013_11_28/o1_mf_1_14_99fz7h9r_.arc RECID=13 STAMP=832695665
archived log file name=/u01/app/oracle/fast_recovery_area/ANDREA/archivelog/2013_12_06/o1_mf_1_15_9b2h5lom_.arc RECID=14 STAMP=833453752
archived log file name=/u01/app/oracle/fast_recovery_area/ANDREA/archivelog/2013_12_06/o1_mf_1_16_9b2h99xb_.arc RECID=15 STAMP=833453866
channel ch1: finished piece 1 at 06-DEC-13
piece handle=/home/oracle/archivelog-ANDREA-20.dbf tag=ALL-LOG-FILE comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:00
channel ch1: deleting archived log(s)
archived log file name=/u01/app/oracle/fast_recovery_area/ANDREA/archivelog/2013_12_06/o1_mf_1_17_9b2h9cnb_.arc RECID=16 STAMP=833453867
Finished backup at 06-DEC-13
Starting backup at 06-DEC-13
channel ch1: starting full datafile backup set
channel ch1: specifying datafile(s) in backup set
including current control file in backup set
channel ch1: starting piece 1 at 06-DEC-13
channel ch1: finished piece 1 at 06-DEC-13
piece handle=/home/oracle/contr-ANDREA-21.dbf tag=CONTROL-FILE comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:01
Finished backup at 06-DEC-13
Starting backup at 06-DEC-13
channel ch1: starting full datafile backup set
channel ch1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ch1: starting piece 1 at 06-DEC-13
channel ch1: finished piece 1 at 06-DEC-13
piece handle=/home/oracle/spfile-ANDREA22.dbf tag=SPFILE-BACKUP comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:02
Finished backup at 06-DEC-13
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/app/oracle/fast_recovery_area/ANDREA/backupset/2013_11_14/o1_mf_nnndf_FULL_BK_20131114_989k2y5m_.bkp RECID=2 STAMP=831501534
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/app/oracle/fast_recovery_area/ANDREA/backupset/2013_11_14/o1_mf_ncsnf_FULL_BK_20131114_989k507n_.bkp RECID=3 STAMP=831501600
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/app/oracle/fast_recovery_area/ANDREA/backupset/2013_11_14/o1_mf_annnn_TAG20131114T204003_989k53wz_.bkp RECID=4 STAMP=831501603
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/app/oracle/fast_recovery_area/ANDREA/backupset/2013_11_14/o1_mf_ncnnf_TAG20131114T204351_989kd8gs_.bkp RECID=5 STAMP=831501832
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/home/oracle/whole-ANDREA_15.dbf RECID=6 STAMP=833453777
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/home/oracle/whole-ANDREA_14.dbf RECID=7 STAMP=833453773
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/home/oracle/whole-ANDREA_17.dbf RECID=8 STAMP=833453858
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/home/oracle/whole-ANDREA_16.dbf RECID=9 STAMP=833453860
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/home/oracle/archivelog-ANDREA-18.dbf RECID=10 STAMP=833453869
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/home/oracle/archivelog-ANDREA-19.dbf RECID=11 STAMP=833453869
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/home/oracle/archivelog-ANDREA-20.dbf RECID=12 STAMP=833453916
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/home/oracle/contr-ANDREA-21.dbf RECID=13 STAMP=833453920
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/home/oracle/spfile-ANDREA22.dbf RECID=14 STAMP=833453923
Crosschecked 13 objects
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 7
no obsolete backups found
released channel: ch1
released channel: ch2
Recovery Manager complete.