RMAN> delete backup;
using channel ORA_DISK_1
using channel ORA_DISK_2
List of Backup Pieces
BP Key BS Key Pc# Cp# Status Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
2 2 1 1 AVAILABLE DISK /u01/oracle/11G/dbs/02pu9uns_1_1
3 3 1 1 AVAILABLE DISK /u01/oracle/11G/dbs/03pu9up7_1_1
4 4 1 1 AVAILABLE DISK /u01/oracle/11G/dbs/04pu9vfk_1_1
5 5 1 1 AVAILABLE DISK /u01/oracle/11G/dbs/05pu9vgg_1_1
6 6 1 1 AVAILABLE DISK /u01/oracle/11G/dbs/06pu9vhe_1_1
Do you really want to delete the above objects (enter YES or NO)? y
deleted backup piece
backup piece handle=/u01/oracle/11G/dbs/02pu9uns_1_1 recid=2 stamp=870644476
deleted backup piece
backup piece handle=/u01/oracle/11G/dbs/03pu9up7_1_1 recid=3 stamp=870644519
deleted backup piece
backup piece handle=/u01/oracle/11G/dbs/04pu9vfk_1_1 recid=4 stamp=870645236
deleted backup piece
backup piece handle=/u01/oracle/11G/dbs/05pu9vgg_1_1 recid=5 stamp=870645264
deleted backup piece
backup piece handle=/u01/oracle/11G/dbs/06pu9vhe_1_1 recid=6 stamp=870645294
Deleted 5 objects
RMAN> list backup;
RMAN> report need backup;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
Report of files with less than 1 redundant backups
File #bkps Name
---- ----- -----------------------------------------------------
1 0 /u01/oracle/oradata/db01/system01.dbf
2 0 /u01/oracle/oradata/db01/undotbs01.dbf
3 0 /u01/oracle/oradata/db01/sysaux01.dbf
4 0 /u01/oracle/oradata/db01/users01.dbf
5 0 /u01/oracle/oradata/db01/ts_move/ts_DTFILETS01.dbf
6 0 /u01/oracle/oradata/db01/ts_test_me/frankts01.dbf
7 0 /u01/oracle/oradata/db01/ts_test_me/demots01.dbf
8 0 /u01/oracle/oradata/db01/ts_test_me/undots01.dbf
9 0 /u01/oracle/oradata/db01/ts_test_me/frankts2.dbf
10 0 /u01/oracle/oradata/db01/ts_test_me/bigts01.dbf
11 0 /u01/oracle/oradata/db01/ts_test_me/new.dbf
12 0 /u01/oracle/oradata/db01/ts_test_me/append.dbf
18 0 /u01/test.dbf
20 0 /u01/oracle/11G/dbs/f:test.dbf
RMAN> backup tablespace users;
Starting backup at 02-FEB-15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=126 devtype=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: sid=125 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00004 name=/u01/oracle/oradata/db01/users01.dbf
channel ORA_DISK_1: starting piece 1 at 02-FEB-15
channel ORA_DISK_1: finished piece 1 at 02-FEB-15
piece handle=/u01/oracle/11G/dbs/07pua01e_1_1 tag=TAG20150202T220326 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 02-FEB-15
RMAN> 再查看需要备份的没有4号文件了。
RMAN> report need backup;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
Report of files with less than 1 redundant backups
File #bkps Name
---- ----- -----------------------------------------------------
1 0 /u01/oracle/oradata/db01/system01.dbf
2 0 /u01/oracle/oradata/db01/undotbs01.dbf
3 0 /u01/oracle/oradata/db01/sysaux01.dbf
5 0 /u01/oracle/oradata/db01/ts_move/ts_DTFILETS01.dbf
6 0 /u01/oracle/oradata/db01/ts_test_me/frankts01.dbf
7 0 /u01/oracle/oradata/db01/ts_test_me/demots01.dbf
8 0 /u01/oracle/oradata/db01/ts_test_me/undots01.dbf
9 0 /u01/oracle/oradata/db01/ts_test_me/frankts2.dbf
10 0 /u01/oracle/oradata/db01/ts_test_me/bigts01.dbf
11 0 /u01/oracle/oradata/db01/ts_test_me/new.dbf
12 0 /u01/oracle/oradata/db01/ts_test_me/append.dbf
18 0 /u01/test.dbf
20 0 /u01/oracle/11G/dbs/f:test.dbf
RMAN>
看更改了备份冗余度即备份个数之后的结果;
RMAN> configure retention policy to redundancy 2;
new RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
new RMAN configuration parameters are successfully stored
RMAN> report need backup;--users 表空间又出现了,因为仅仅备份了一个。
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 2
Report of files with less than 2 redundant backups
File #bkps Name
---- ----- -----------------------------------------------------
1 0 /u01/oracle/oradata/db01/system01.dbf
2 0 /u01/oracle/oradata/db01/undotbs01.dbf
3 0 /u01/oracle/oradata/db01/sysaux01.dbf
4 1 /u01/oracle/oradata/db01/users01.dbf
5 0 /u01/oracle/oradata/db01/ts_move/ts_DTFILETS01.dbf
6 0 /u01/oracle/oradata/db01/ts_test_me/frankts01.dbf
7 0 /u01/oracle/oradata/db01/ts_test_me/demots01.dbf
8 0 /u01/oracle/oradata/db01/ts_test_me/undots01.dbf
9 0 /u01/oracle/oradata/db01/ts_test_me/frankts2.dbf
10 0 /u01/oracle/oradata/db01/ts_test_me/bigts01.dbf
11 0 /u01/oracle/oradata/db01/ts_test_me/new.dbf
12 0 /u01/oracle/oradata/db01/ts_test_me/append.dbf
18 0 /u01/test.dbf
20 0 /u01/oracle/11G/dbs/f:test.dbf
RMAN> backup tablespace users;
Starting backup at 02-FEB-15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=140 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00004 name=/u01/oracle/oradata/db01/users01.dbf
channel ORA_DISK_1: starting piece 1 at 02-FEB-15
channel ORA_DISK_1: finished piece 1 at 02-FEB-15
piece handle=/u01/oracle/11G/dbs/08pua0jr_1_1 tag=TAG20150202T221314 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 02-FEB-15
RMAN> report need backup;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 2
Report of files with less than 2 redundant backups
File #bkps Name
---- ----- -----------------------------------------------------
1 0 /u01/oracle/oradata/db01/system01.dbf
2 0 /u01/oracle/oradata/db01/undotbs01.dbf
3 0 /u01/oracle/oradata/db01/sysaux01.dbf
5 0 /u01/oracle/oradata/db01/ts_move/ts_DTFILETS01.dbf
6 0 /u01/oracle/oradata/db01/ts_test_me/frankts01.dbf
7 0 /u01/oracle/oradata/db01/ts_test_me/demots01.dbf
8 0 /u01/oracle/oradata/db01/ts_test_me/undots01.dbf
9 0 /u01/oracle/oradata/db01/ts_test_me/frankts2.dbf
10 0 /u01/oracle/oradata/db01/ts_test_me/bigts01.dbf
11 0 /u01/oracle/oradata/db01/ts_test_me/new.dbf
12 0 /u01/oracle/oradata/db01/ts_test_me/append.dbf
18 0 /u01/test.dbf
20 0 /u01/oracle/11G/dbs/f:test.dbf
RMAN>
看看有没有过期的备份,答:没有。
RMAN> report obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 2
no obsolete backups found
RMAN> list backup;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
7 Full 7.46M DISK 00:00:00 02-FEB-15
BP Key: 7 Status: AVAILABLE Compressed: NO Tag: TAG20150202T220326
Piece Name: /u01/oracle/11G/dbs/07pua01e_1_1
List of Datafiles in backup set 7
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
4 Full 1350387 02-FEB-15 /u01/oracle/oradata/db01/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
8 Full 7.46M DISK 00:00:00 02-FEB-15
BP Key: 8 Status: AVAILABLE Compressed: NO Tag: TAG20150202T221314
Piece Name: /u01/oracle/11G/dbs/08pua0jr_1_1
List of Datafiles in backup set 8
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
4 Full 1350651 02-FEB-15 /u01/oracle/oradata/db01/users01.dbf
RMAN> backup tablespace users;
Starting backup at 02-FEB-15
using channel ORA_DISK_1
using channel ORA_DISK_2
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00004 name=/u01/oracle/oradata/db01/users01.dbf
channel ORA_DISK_1: starting piece 1 at 02-FEB-15
channel ORA_DISK_1: finished piece 1 at 02-FEB-15
piece handle=/u01/oracle/11G/dbs/09pua1a5_1_1 tag=TAG20150202T222509 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 02-FEB-15
--看看有没有过期的备份,答:有了,是第一次备份的文件名,也是最早的。
RMAN> report obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 2
Report of obsolete backups and copies
Type Key Completion Time Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set 7 02-FEB-15
Backup Piece 7 02-FEB-15 /u01/oracle/11G/dbs/07pua01e_1_1
RMAN>
[oracle@Slave1Hadoop51 dbs]$ pwd
/u01/oracle/11G/dbs
[oracle@Slave1Hadoop51 dbs]$ ls -ltr
total 112616
-rw-r----- 1 oracle dba 12920 May 3 2001 initdw.ora
-rw-rw---- 1 oracle dba 24 Jan 3 2014 lkDB01
-rw-r----- 1 oracle dba 2195 Jan 3 2014 init.ora
-rw-r----- 1 oracle dba 2560 Jan 3 2014 spfilethink.ora
-rw-rw---- 1 oracle dba 1552 Jan 3 2014 hc_think.dat
-rw-r--r-- 1 oracle dba 932 Feb 8 2014 initdb01.ora
-rw-r--r-- 1 oracle dba 112 Feb 10 2014 alert_db01.log
-rw-r----- 1 oracle dba 1536 Apr 16 2014 orapwdb01
-rw-r----- 1 oracle dba 7061504 Aug 31 12:52 snapcf_db01.f
-rw-r----- 1 oracle dba 2560 Feb 2 21:01 spfiledb01.ora
-rw-rw---- 1 oracle dba 1552 Feb 2 21:01 hc_db01.dat
-rw-r----- 1 oracle dba 10484224 Feb 2 22:00 arch1_5_857057445.dbf
-rw-r----- 1 oracle dba 7831552 Feb 2 22:03 07pua01e_1_1
-rw-r----- 1 oracle dba 7831552 Feb 2 22:13 08pua0jr_1_1
-rw-r----- 1 oracle dba 6957056 Feb 2 22:19 arch1_6_857057445.dbf
-rw-r----- 1 oracle dba 7831552 Feb 2 22:25 09pua1a5_1_1
-rw-r----- 1 oracle dba 67117056 Feb 2 22:26 f:test.dbf
[oracle@Slave1Hadoop51 dbs]$
删除备份也可以指定通道:
RMAN> report obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 2
Report of obsolete backups and copies
Type Key Completion Time Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set 7 02-FEB-15
Backup Piece 7 02-FEB-15 /u01/oracle/11G/dbs/07pua01e_1_1
Backup Set 8 02-FEB-15
Backup Piece 8 02-FEB-15 /u01/oracle/11G/dbs/08pua0jr_1_1
Backup Set 9 02-FEB-15
Backup Piece 9 02-FEB-15 /u01/oracle/11G/dbs/09pua1a5_1_1
RMAN> delete obsolete channel c78 device type disk;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "channel": expecting one of: "device, high, orphan, redundancy, recovery, ;, until"
RMAN-01007: at line 1 column 17 file: standard input
RMAN> delete obsolete channel c8 device type disk;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "channel": expecting one of: "device, high, orphan, redundancy, recovery, ;, until"
RMAN-01007: at line 1 column 17 file: standard input
RMAN> run {allocate channel c78 device type disk;
2> delete obsolete;}
released channel: ORA_DISK_1
released channel: ORA_DISK_2
allocated channel: c78
channel c78: sid=126 devtype=DISK
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 2
Deleting the following obsolete backups and copies:
Type Key Completion Time Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set 7 02-FEB-15
Backup Piece 7 02-FEB-15 /u01/oracle/11G/dbs/07pua01e_1_1
Backup Set 8 02-FEB-15
Backup Piece 8 02-FEB-15 /u01/oracle/11G/dbs/08pua0jr_1_1
Backup Set 9 02-FEB-15
Backup Piece 9 02-FEB-15 /u01/oracle/11G/dbs/09pua1a5_1_1
Do you really want to delete the above objects (enter YES or NO)? yes
deleted backup piece
backup piece handle=/u01/oracle/11G/dbs/07pua01e_1_1 recid=7 stamp=870645806
deleted backup piece
backup piece handle=/u01/oracle/11G/dbs/08pua0jr_1_1 recid=8 stamp=870646395
deleted backup piece
backup piece handle=/u01/oracle/11G/dbs/09pua1a5_1_1 recid=9 stamp=870647109
Deleted 3 objects
released channel: c78
RMAN>
指定通道device type disk:
RMAN> report need backup;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 2
Report of files with less than 2 redundant backups
File #bkps Name
---- ----- -----------------------------------------------------
1 0 /u01/oracle/oradata/db01/system01.dbf
2 0 /u01/oracle/oradata/db01/undotbs01.dbf
3 0 /u01/oracle/oradata/db01/sysaux01.dbf
5 0 /u01/oracle/oradata/db01/ts_move/ts_DTFILETS01.dbf
6 0 /u01/oracle/oradata/db01/ts_test_me/frankts01.dbf
7 0 /u01/oracle/oradata/db01/ts_test_me/demots01.dbf
8 0 /u01/oracle/oradata/db01/ts_test_me/undots01.dbf
9 0 /u01/oracle/oradata/db01/ts_test_me/frankts2.dbf
10 0 /u01/oracle/oradata/db01/ts_test_me/bigts01.dbf
11 0 /u01/oracle/oradata/db01/ts_test_me/new.dbf
12 0 /u01/oracle/oradata/db01/ts_test_me/append.dbf
18 0 /u01/test.dbf
20 0 /u01/oracle/11G/dbs/f:test.dbf
RMAN> list backup;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
10 Full 7.46M DISK 00:00:00 02-FEB-15
BP Key: 10 Status: AVAILABLE Compressed: NO Tag: TAG20150202T223105
Piece Name: /u01/oracle/11G/dbs/0apua1la_1_1
List of Datafiles in backup set 10
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
4 Full 1351372 02-FEB-15 /u01/oracle/oradata/db01/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
11 Full 7.46M DISK 00:00:01 02-FEB-15
BP Key: 11 Status: AVAILABLE Compressed: NO Tag: TAG20150202T223138
Piece Name: /u01/oracle/11G/dbs/0bpua1ma_1_1
List of Datafiles in backup set 11
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
4 Full 1351404 02-FEB-15 /u01/oracle/oradata/db01/users01.dbf
RMAN> backup tablespace users;
Starting backup at 02-FEB-15
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00004 name=/u01/oracle/oradata/db01/users01.dbf
channel ORA_DISK_1: starting piece 1 at 02-FEB-15
channel ORA_DISK_1: finished piece 1 at 02-FEB-15
piece handle=/u01/oracle/11G/dbs/0cpua34n_1_1 tag=TAG20150202T225623 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 02-FEB-15
RMAN> list backup;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
10 Full 7.46M DISK 00:00:00 02-FEB-15
BP Key: 10 Status: AVAILABLE Compressed: NO Tag: TAG20150202T223105
Piece Name: /u01/oracle/11G/dbs/0apua1la_1_1
List of Datafiles in backup set 10
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
4 Full 1351372 02-FEB-15 /u01/oracle/oradata/db01/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
11 Full 7.46M DISK 00:00:01 02-FEB-15
BP Key: 11 Status: AVAILABLE Compressed: NO Tag: TAG20150202T223138
Piece Name: /u01/oracle/11G/dbs/0bpua1ma_1_1
List of Datafiles in backup set 11
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
4 Full 1351404 02-FEB-15 /u01/oracle/oradata/db01/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
12 Full 7.46M DISK 00:00:01 02-FEB-15
BP Key: 12 Status: AVAILABLE Compressed: NO Tag: TAG20150202T225623
Piece Name: /u01/oracle/11G/dbs/0cpua34n_1_1
List of Datafiles in backup set 12
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
4 Full 1351974 02-FEB-15 /u01/oracle/oradata/db01/users01.dbf
RMAN> report obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 2
Report of obsolete backups and copies
Type Key Completion Time Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set 10 02-FEB-15
Backup Piece 10 02-FEB-15 /u01/oracle/11G/dbs/0apua1la_1_1
RMAN> delete obsolete device type disk;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 2
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=140 devtype=DISK
Deleting the following obsolete backups and copies:
Type Key Completion Time Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set 10 02-FEB-15
Backup Piece 10 02-FEB-15 /u01/oracle/11G/dbs/0apua1la_1_1
Do you really want to delete the above objects (enter YES or NO)? yes
deleted backup piece
backup piece handle=/u01/oracle/11G/dbs/0apua1la_1_1 recid=10 stamp=870647466
Deleted 1 objects
RMAN> report obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 2
no obsolete backups found
RMAN>
和上一种分配通道的方式相比,可以看看
released channel: ORA_DISK_1
released channel: ORA_DISK_2
allocated channel: c78
channel c78: sid=126 devtype=DISK
..................之前的........................
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 2
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=140 devtype=DISK
...................之后的.......................