Come modificare la retention di default di un backup di database

Vedremo qui un esempio dove la policy di retention di rman è di un giorno
RMAN> show all;
Per usare il control file del database di target al posto del catalogo di recovery di RMAN, i parametri di configurazione con db_unique_name TESTDB sono:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
Creare un backup del database senza opzione KEEP
RMAN> backup database plus archivelog;
Starting backup at 12-11-2014 14:36:13
current log archived
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=41 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=29 RECID=181 STAMP=850474188
input archived log thread=1 sequence=30 RECID=182 STAMP=850474191
………….
……………..
handle=/app/oracle/admin/ARCHIVE/TESTDB/backupset/2014_11_12/
o1_mf_annnn_TAG20141112T143616_b66rlnkr_.bkp tag=TAG20141112T143616 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 12-11-2014 14:36:23
Starting backup at 12-11-2014 14:36:23
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00003 name=/app/oracle/admin/TESTDB/data/undo/undo01.dbf
input datafile file number=00001 name=/app/oracle/admin/TESTDB/data/system/system01.dbf
input datafile file number=00002 name=/app/oracle/admin/TESTDB/data/sysaux/sysaux01.dbf
input datafile file number=00004 name=/app/oracle/admin/TESTDB/data/data/xdb01.dbf
input datafile file number=00005 name=/app/oracle/admin/TESTDB/data/data/users01.dbf
channel ORA_DISK_1: starting piece 1 at 12-11-2014 14:36:23
channel ORA_DISK_1: finished piece 1 at 12-11-2014 14:37:38
piece handle=/app/oracle/admin/ARCHIVE/TESTDB/backupset/2014_11_12/
o1_mf_nnndf_TAG20141112T143623_b66rlqwp_.bkp tag=TAG20141112T143623 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:15
Finished backup at 12-11-2014 14:37:38
handle=/app/oracle/admin/ARCHIVE/TESTDB/backupset/2014_11_12/
o1_mf_annnn_TAG20141112T143739_b66ro33z_.bkp tag=TAG20141112T143739 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 12-11-2014 14:37:40
Facciamo un backup con opzione keep di 4 giorni
RMAN> backup database tag ‘BCK_FULL_KEEP’ plus archivelog delete input keep until
time ‘sysdate +4′ format ‘/app/oracle/KEEP_BACKUP/%U’;
Starting backup at 12-11-2014 14:44:40
current log archived
usiamo il control file del database di target anziché il recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1 device type=DISK
backup will be obsolete on date 16-11-2014 14:44:40
archived logs required to recover from this backup will be backed up
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=29 RECID=181 STAMP=850474188
input archived log thread=1 sequence=30 RECID=182 STAMP=850474191
input archived log thread=1 sequence=31 RECID=183 STAMP=850474668
input archived log thread=1 sequence=32 RECID=184 STAMP=850474671
input archived log thread=1 sequence=33 RECID=185 STAMP=850474948
channel ORA_DISK_1: starting piece 1 at 12-11-2014 14:44:40
channel ORA_DISK_1: finished piece 1 at 12-11-2014 14:44:41
…………
……………..
piece handle=/app/oracle/KEEP_BACKUP/3kpneb6r_1_1 tag=TAG20141112T144440 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: deleting archived log(s)
……….
……………….
piece handle=/app/oracle/KEEP_BACKUP/3lpneb6s_1_1 tag=TAG20141112T144440 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
channel ORA_DISK_1: deleting archived log(s)
Finished backup at 12-11-2014 14:44:47
Starting backup at 12-11-2014 14:44:47
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00003 name=/app/oracle/admin/TESTDB/data/undo/undo01.dbf
input datafile file number=00001 name=/app/oracle/admin/TESTDB/data/system/system01.dbf
input datafile file number=00002 name=/app/oracle/admin/TESTDB/data/sysaux/sysaux01.dbf
input datafile file number=00004 name=/app/oracle/admin/TESTDB/data/data/xdb01.dbf
input datafile file number=00005 name=/app/oracle/admin/TESTDB/data/data/users01.dbf
channel ORA_DISK_1: starting piece 1 at 12-11-2014 14:44:47
channel ORA_DISK_1: finished piece 1 at 12-11-2014 14:45:52
piece handle=/app/oracle/admin/ARCHIVE/TESTDB/backupset/2014_11_12/
o1_mf_nnndf_BCK_FULL_KEEP_b66s2j07_.bkp tag=BCK_FULL_KEEP comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:05
Finished backup at 12-11-2014 14:45:52
Controllo delle differenze nel backup rman (in questo caso usando il controlfile)
RMAN> list backup summary;
List of Backups
===============
Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
——- — — – ———– ——————- ——- ——- ———- —
71 B A A DISK 12-11-2014 14:36:18 1 1 NO TAG20141112T143616
73 B A A DISK 12-11-2014 14:36:21 1 1 NO TAG20141112T143616
74 B F A DISK 12-11-2014 14:37:35 1 1 NO TAG20141112T143623
75 B A A DISK 12-11-2014 14:37:39 1 1 NO TAG20141112T143739
76 B F A DISK 12-11-2014 14:37:41 1 1 NO TAG20141112T143740
78 B A A DISK 12-11-2014 14:44:42 1 1 NO TAG20141112T144440
80 B A A DISK 12-11-2014 14:44:45 1 1 NO TAG20141112T144440
81 B F A DISK 12-11-2014 14:45:45 1 1 NO BCK_FULL_KEEP
82 B A A DISK 12-11-2014 14:45:52 1 1 NO TAG20141112T144552
83 B F A DISK 12-11-2014 14:45:54 1 1 NO TAG20141112T144554
Nel primo backupset notiamo che non è specificata l’opzione keep
RMAN> list backup;
List of Backup Sets
===================

……
BS Key Type LV Size Device Type Elapsed Time Completion Time
——- —- — ———- ———– ———— ——————-
74 Full 594.77M DISK 00:01:12 12-11-2014 14:37:35
BP Key: 74 Status: AVAILABLE Compressed: NO Tag: TAG20141112T143623
Piece Name: /app/oracle/admin/ARCHIVE/TESTDB/backupset/2014_11_12/
o1_mf_nnndf_TAG20141112T143623_b66rlqwp_.bkp
List of Datafiles in backup set 74
File LV Type Ckp SCN Ckp Time Name
—- — —- ———- ——————- —-
1 Full 67346932 12-11-2014 14:36:23 /app/oracle/admin/TESTDB/data/system/
system01.dbf
2 Full 67346932 12-11-2014 14:36:23 /app/oracle/admin/TESTDB/data/sysaux/
sysaux01.dbf
3 Full 67346932 12-11-2014 14:36:23 /app/oracle/admin/TESTDB/data/undo/
undo01.dbf
4 Full 67346932 12-11-2014 14:36:23 /app/oracle/admin/TESTDB/data/data/
xdb01.dbf
5 Full 67346932 12-11-2014 14:36:23 /app/oracle/admin/TESTDB/data/data/
users01.dbf
mentre il secondo backupset è presente la clausola keep
BS Key Size Device Type Elapsed Time Completion Time
——- ———- ———– ———— ——————-
78 305.50K DISK 00:00:00 12-11-2014 14:44:42
BP Key: 78 Status: AVAILABLE Compressed: NO Tag: TAG20141112T144440
Piece Name: /app/oracle/KEEP_BACKUP/3jpneb6q_1_1
Keep: BACKUP_LOGS Until: 16-11-2014 14:44:40
List of Archived Logs in backup set 78
Thrd Seq Low SCN Low Time Next SCN Next Time
—- ——- ———- ——————- ———- ———
1 1 67309368 17-06-2014 11:04:10 67309371 17-06-2014 11:04:15
1 2 67309371 17-06-2014 11:04:15 67309513 17-06-2014 11:04:18
1 3 67309513 17-06-2014 11:04:18 67310025 17-06-2014 11:12:37
BS Key Size Device Type Elapsed Time Completion Time
——- ———- ———– ———— ——————-
80 28.89M DISK 00:00:01 12-11-2014 14:44:45
BP Key: 80 Status: AVAILABLE Compressed: NO Tag: TAG20141112T144440
Piece Name: /app/oracle/KEEP_BACKUP/3lpneb6s_1_1
Keep: BACKUP_LOGS Until: 16-11-2014 14:44:40
List of Archived Logs in backup set 80
Thrd Seq Low SCN Low Time Next SCN Next Time
—- ——- ———- ——————- ———- ———
1 4 67310025 17-06-2014 11:12:37 67310104 17-06-2014 11:13:14
1 5 67310104 17-06-2014 11:13:14 67310212 17-06-2014 11:14:56
1 6 67310212 17-06-2014 11:14:56 67311333 18-06-2014 16:12:09
1 7 67311333 18-06-2014 16:12:09 67311339 18-06-2014 16:12:11
1 8 67311339 18-06-2014 16:12:11 67311753 06-08-2014 11:07:33
1 9 67311753 06-08-2014 11:07:33 67311790 06-08-2014 11:07:35
BS Key Type LV Size Device Type Elapsed Time Completion Time
——- —- — ———- ———– ———— ——————-
81 Full 595.13M DISK 00:00:58 12-11-2014 14:45:45
BP Key: 81 Status: AVAILABLE Compressed: NO Tag: BCK_FULL_KEEP
Piece Name: /app/oracle/admin/ARCHIVE/TESTDB/backupset/2014_11_12/
o1_mf_nnndf_BCK_FULL_KEEP_b66s2j07_.bkp
List of Datafiles in backup set 81
File LV Type Ckp SCN Ckp Time Name
—- — —- ———- ——————- —-
1 Full 67347604 12-11-2014 14:44:47 /app/oracle/admin/TESTDB/data/system/
system01.dbf
2 Full 67347604 12-11-2014 14:44:47 /app/oracle/admin/TESTDB/data/sysaux/
sysaux01.dbf
3 Full 67347604 12-11-2014 14:44:47 /app/oracle/admin/TESTDB/data/undo/
undo01.dbf
4 Full 67347604 12-11-2014 14:44:47 /app/oracle/admin/TESTDB/data/data/
xdb01.dbf
5 Full 67347604 12-11-2014 14:44:47 /app/oracle/admin/TESTDB/data/data/
users01.dbf
BS Key Size Device Type Elapsed Time Completion Time
——- ———- ———– ———— ——————-
82 37.50K DISK 00:00:00 12-11-2014 14:45:52
BP Key: 82 Status: AVAILABLE Compressed: NO Tag: TAG20141112T144552
Piece Name: /app/oracle/KEEP_BACKUP/3npneb90_1_1
Keep: BACKUP_LOGS Until: 16-11-2014 14:45:52

Potrebbero interessarti anche...