【原创】rman 全库备份脚本

rman 全库备份脚本

run {

allocate channel d1 type disk;

allocate channel d2 type disk;

backup full database format '$back_path/`date +%Y%m%d`_full_%d_%s_%p_%u.bak'

tag='full' include current controlfile;

sql 'alter system archive log current';

backup archivelog all format '$back_path/`date +%Y%m%d`_archivelog_%d_%s_%p_%u.bak' delete all input;

release channel d2;

release channel d1;

}

[root@localhost ~]# su - oracle
[oracle@localhost ~]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Sat Jan 7 10:47:18 2012

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORCL (DBID=1299576258)

RMAN> run {
2> 
3> allocate channel d1 type disk;
4> 
5> allocate channel d2 type disk;
6> 
7> backup full database format '$back_path/`date +%Y%m%d`_full_%d_%s_%p_%u.bak'
8> 
9> tag='full' include current controlfile;
10> 
11> sql 'alter system archive log current';
12> 
13> backup archivelog all format '$back_path/`date +%Y%m%d`_archivelog_%d_%s_%p_%u.bak' delete all input;
14> 
15> release channel d2;
16> 
17> release channel d1;
18> 
19> }

using target database control file instead of recovery catalog
allocated channel: d1
channel d1: SID=41 device type=DISK

allocated channel: d2
channel d2: SID=46 device type=DISK

Starting backup at 07-JAN-12
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/orcl/system01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/orcl/users01.dbf
channel d1: starting piece 1 at 07-JAN-12
channel d2: starting full datafile backup set
channel d2: specifying datafile(s) in backup set
input datafile file number=00002 name=/u01/app/oracle/oradata/orcl/sysaux01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/orcl/undotbs01.dbf
channel d2: starting piece 1 at 07-JAN-12
channel d2: finished piece 1 at 07-JAN-12
piece handle=/u02/oradata/`date +2012%mORCL`_full_ORCL_8_1_08n05k5t.bak tag=FULL comment=NONE
channel d2: backup set complete, elapsed time: 00:01:17
channel d2: starting full datafile backup set
channel d2: specifying datafile(s) in backup set
channel d1: finished piece 1 at 07-JAN-12
piece handle=/u02/oradata/`date +2012%mORCL`_full_ORCL_7_1_07n05k5t.bak tag=FULL comment=NONE
channel d1: backup set complete, elapsed time: 00:01:20
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel d1: starting piece 1 at 07-JAN-12
including current control file in backup set
channel d2: starting piece 1 at 07-JAN-12
channel d1: finished piece 1 at 07-JAN-12
piece handle=/u02/oradata/`date +2012%mORCL`_full_ORCL_10_1_0an05k8e.bak tag=FULL comment=NONE
channel d1: backup set complete, elapsed time: 00:00:02
channel d2: finished piece 1 at 07-JAN-12
piece handle=/u02/oradata/`date +2012%mORCL`_full_ORCL_9_1_09n05k8c.bak tag=FULL comment=NONE
channel d2: backup set complete, elapsed time: 00:00:02
Finished backup at 07-JAN-12

sql statement: alter system archive log current

Starting backup at 07-JAN-12
current log archived
channel d1: starting archived log backup set
channel d1: specifying archived log(s) in backup set
input archived log thread=1 sequence=4 RECID=2 STAMP=771935241
channel d1: starting piece 1 at 07-JAN-12
channel d2: starting archived log backup set
channel d2: specifying archived log(s) in backup set
input archived log thread=1 sequence=5 RECID=3 STAMP=771936534
input archived log thread=1 sequence=6 RECID=4 STAMP=771936534
channel d2: starting piece 1 at 07-JAN-12
channel d1: finished piece 1 at 07-JAN-12
piece handle=/u02/oradata/`date +2012%mORCL`_archivelog_ORCL_11_1_0bn05k8o.bak tag=TAG20120107T104855 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:04
channel d1: deleting archived log(s)
archived log file name=/u02/oradata/1_4_771795526.dbf RECID=2 STAMP=771935241
channel d2: finished piece 1 at 07-JAN-12
piece handle=/u02/oradata/`date +2012%mORCL`_archivelog_ORCL_12_1_0cn05k8p.bak tag=TAG20120107T104855 comment=NONE
channel d2: backup set complete, elapsed time: 00:00:05
channel d2: deleting archived log(s)
archived log file name=/u02/oradata/1_5_771795526.dbf RECID=3 STAMP=771936534
archived log file name=/u02/oradata/1_6_771795526.dbf RECID=4 STAMP=771936534
Finished backup at 07-JAN-12

released channel: d2

released channel: d1

上一篇:Vulnhub-XXE靶机


下一篇:Java并发 两个线程交替执行和死锁