Home » RDBMS Server » Backup & Recovery » Rman and delete obsolete files.. (RedHat ES5, Oracle 10g, both 64bit)
Rman and delete obsolete files.. [message #313783] Mon, 14 April 2008 09:37 Go to next message
romann000
Messages: 8
Registered: April 2008
Junior Member
Hi DBA's,

I have a little problem by understanding the rman-tool and his configuration-switches.
I' like to use rman to delete not needed Files in a timespace of 7 days.
I'll use the retention policy in a window of 7 days.

But if I use the command: report all
then I see also files only 3 days old.

can i use the retention policy only if I use the Flash_Recovery_Area, or what's my problem?

Please have a look of my configuration:

RMAN> show all;

using target database control file instead of recovery catalog
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/backup/RMAN/%d_%I_%s_%T';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/10.2.0/db_1/dbs/snapcf_DATAFILE.f'; # default

RMAN> report obsolete(I have not all views listed because of a short thread:-))

Backup Piece 159 06-APR-08 /u01/backup/rman/arch_161_DATAFILE_20080406.arc
Backup Set 160 06-APR-08
Backup Piece 160 06-APR-08 /u01/backup/rman/arch_162_DATAFILE_20080406.arc
Backup Set 161 06-APR-08
Backup Piece 161 06-APR-08 /u01/backup/rman/arch_163_DATAFILE_20080406.arc
Backup Set 165 07-APR-08
Backup Piece 165 07-APR-08 /u01/backup/rman/arch_167_DATAFILE_20080407.arc
Backup Set 166 07-APR-08
Backup Piece 166 07-APR-08 /u01/backup/rman/arch_168_DATAFILE_20080407.arc
Backup Set 171 08-APR-08
Backup Piece 171 08-APR-08 /backup/RMAN/DATAFILE_499394454_173_20080408
Backup Set 176 08-APR-08
Backup Piece 176 08-APR-08 /u01/backup/rman/arch_178_DATAFILE_20080408.arc
Backup Set 181 09-APR-08
Backup Piece 181 09-APR-08 /u01/backup/rman/arch_183_DATAFILE_20080409.arc
Backup Set 186 10-APR-08
Backup Piece 186 10-APR-08 /u01/backup/rman/arch_188_DATAFILE_20080410.arc
Backup Set 191 11-APR-08
Backup Piece 191 11-APR-08 /u01/backup/rman/arch_193_DATAFILE_20080411.arc


Thank you for help in advance.

BR
Roland
Re: Rman and delete obsolete files.. [message #313785 is a reply to message #313783] Mon, 14 April 2008 09:52 Go to previous messageGo to next message
vkulkarni
Messages: 1
Registered: March 2008
Location: Alpharetta, GA
Junior Member
See - http://oradbatips.blogspot.com/2006/11/tip-4-rman-recovery-window.html

Hope this helps.!
Re: Rman and delete obsolete files.. [message #313821 is a reply to message #313783] Mon, 14 April 2008 13:56 Go to previous messageGo to next message
romann000
Messages: 8
Registered: April 2008
Junior Member
hi vkulkarni,

thanks for your help!

it's a little bit better:-)

I'm understand why rman would like older files than 7 days for recovery and why a retention window of 7 days isn't the same as an backupset for 7 day's, but I'm understand, why rman will delete files they are only 3 days old?

And I don't know if i can use a retention policy only if i use the FRA..

If you have an answer again, please let me know:-)

BR
Roland

PS: I have now changed my policy to
CONFIGURE RETENTION POLICY TO REDUNDANCY 7;
I have backuped my DB today evening at 10 o'clock, with the new Retention.
If I use report obsolete, I get now also files from today marked as obsolete... Is this a bug in the rman of 10g?
I only need a mechanism to delete all Files older as 7 days, not more:-(


[Updated on: Mon, 14 April 2008 15:25]

Report message to a moderator

Re: Rman and delete obsolete files.. [message #313832 is a reply to message #313821] Mon, 14 April 2008 15:29 Go to previous messageGo to next message
ebrian
Messages: 2794
Registered: April 2006
Senior Member
What is the output of:

list backup summary;
Re: Rman and delete obsolete files.. [message #313835 is a reply to message #313783] Mon, 14 April 2008 16:08 Go to previous messageGo to next message
romann000
Messages: 8
Registered: April 2008
Junior Member
Hi ebrian,

a lots of points:-) 210 entries.

by the backup today i've activate the compression of rman.

TAG20080413T220353
205 B F A DISK 13-APR-08 1 1 NO TAG20080413T220355
206 B A A DISK 14-APR-08 1 1 YES TAG20080414T220003
207 B A A DISK 14-APR-08 1 1 YES TAG20080414T220003
208 B F A DISK 14-APR-08 1 1 YES TAG20080414T220256
209 B A A DISK 14-APR-08 1 1 YES TAG20080414T220752
210 B F A DISK 14-APR-08 1 1 NO TAG20080414T220756

Thanks for help

BR
Roland
Re: Rman and delete obsolete files.. [message #313842 is a reply to message #313835] Mon, 14 April 2008 20:11 Go to previous messageGo to next message
ebrian
Messages: 2794
Registered: April 2006
Senior Member
It's hard to determine your problem from the information you provided.

Are you doing incremental backups?
Are you backing up sporadically?
Are you constantly changing the retention policy?
Re: Rman and delete obsolete files.. [message #313896 is a reply to message #313783] Tue, 15 April 2008 01:45 Go to previous messageGo to next message
romann000
Messages: 8
Registered: April 2008
Junior Member
Hi ebrian,

sorry for this mistake:

I have a daily full-backup includes arch-files per rman.


run {
allocate channel ch0 type disk;
backup as compressed backupset database format
'/u01/backup/rman/rman_%s_%d_%T.bus'
plus archivelog format '/u01/backup/rman/arch_%s_%d_%T.arc';
}
exit



I don't make an incremental backup, this is a litte DB and i can backup it in 7 minutes, i think there is no incremental backup needed.

Yesterday, I have changed the retention policy from window 7 days to redundancy 7.

I need only a fallback of 7 days and the automatic deletion of not need files older as 7 days.

Thanks for help

BR
Roland
Re: Rman and delete obsolete files.. [message #313920 is a reply to message #313842] Tue, 15 April 2008 03:16 Go to previous messageGo to next message
Shahzad_Khan
Messages: 8
Registered: September 2005
Location: Karachi
Junior Member

run {
  allocate channel ch0 type disk;
  backup as compressed backupset database format
  'c:\rman_%s_%d_%T.bus'
  plus archivelog format 'c:\arch_%s_%d_%T.arc';
  release channel ch0;
  allocate channel ch1 device type disk format 'c:\arch_%s_%d_%T.arc';
  release channel ch1;
  delete force noprompt obsolete;
  allocate channel ch2 device type disk format 'c:\rman_%s_%d_%T.bus';
  release channel ch2;
  delete force noprompt obsolete;
}


Khurram
Re: Rman and delete obsolete files.. [message #313926 is a reply to message #313920] Tue, 15 April 2008 03:31 Go to previous messageGo to next message
romann000
Messages: 8
Registered: April 2008
Junior Member
Hi Khurram,

thanks for your script, i'll use it for my backup.

But I have problems with the files they are marked as obsolete.

I have Files by report obsolete, they are only 3 days old. But I need a fallback of 7 days.

BR
Roland
Re: Rman and delete obsolete files.. [message #313929 is a reply to message #313920] Tue, 15 April 2008 04:04 Go to previous messageGo to next message
Shahzad_Khan
Messages: 8
Registered: September 2005
Location: Karachi
Junior Member

as you have retention policy to redundancy 7 ,what was before that?You might check the backup date from RMAN

RMAN>list backup summary

Khurram
Re: Rman and delete obsolete files.. [message #313930 is a reply to message #313929] Tue, 15 April 2008 04:12 Go to previous messageGo to next message
romann000
Messages: 8
Registered: April 2008
Junior Member
I have set a window of 7 days before.

a general question: can i use the retention policy without using the Recovery area?

I have posted the backup summary litte bit above.

there are 210 entries. I don't listed all, only the latest.


BR
Roland

[Updated on: Tue, 15 April 2008 04:23]

Report message to a moderator

Re: Rman and delete obsolete files.. [message #313937 is a reply to message #313929] Tue, 15 April 2008 04:32 Go to previous messageGo to next message
Shahzad_Khan
Messages: 8
Registered: September 2005
Location: Karachi
Junior Member

what do you mean by recovery area is it FRA (flash recovery area)?

Khurram
Re: Rman and delete obsolete files.. [message #313941 is a reply to message #313937] Tue, 15 April 2008 04:39 Go to previous messageGo to next message
romann000
Messages: 8
Registered: April 2008
Junior Member
HI,

yes, i mean the flash_recovery_area.

BR
Roland

Re: Rman and delete obsolete files.. [message #313943 is a reply to message #313941] Tue, 15 April 2008 04:44 Go to previous messageGo to next message
Shahzad_Khan
Messages: 8
Registered: September 2005
Location: Karachi
Junior Member

>can i use the retention policy without using the Recovery area?

yes , see here


RMAN>list backup summary

C:\>dir *.bus
 Volume in drive C is khurram
 Volume Serial Number is F49D-FF2B

 Directory of C:\

File Not Found

C:\>dir *.arc
 Volume in drive C is khurram
 Volume Serial Number is F49D-FF2B

 Directory of C:\

File Not Found


RMAN> crosscheck backup
2> ;

using channel ORA_DISK_1

RMAN> list backup summary
2> ;


RMAN> show retention policy
2> ;

RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default

RMAN> run {
2>   allocate channel ch0 type disk;
3>   backup as compressed backupset database format
4>   'c:\rman_%s_%d_%T.bus'
5>   plus archivelog format 'c:\arch_%s_%d_%T.arc';
6>   release channel ch0;
7>   allocate channel ch1 device type disk format 'c:\arch_%s_%d_%T.arc';
8>   release channel ch1;
9>   delete force noprompt obsolete;
10>   allocate channel ch2 device type disk format 'c:\rman_%s_%d_%T.bus';
11>   release channel ch2;
12>   delete force noprompt obsolete;
13> }

released channel: ORA_DISK_1
allocated channel: ch0
channel ch0: sid=146 devtype=DISK


Starting backup at 15-APR-08
current log archived
channel ch0: starting compressed archive log backupset
channel ch0: specifying archive log(s) in backup set
input archive log thread=1 sequence=24 recid=79 stamp=652108461
input archive log thread=1 sequence=25 recid=80 stamp=652112650
channel ch0: starting piece 1 at 15-APR-08
channel ch0: finished piece 1 at 15-APR-08
piece handle=C:\ARCH_130_ORCL1_20080415.ARC comment=NONE
channel ch0: backup set complete, elapsed time: 00:00:05
Finished backup at 15-APR-08

Starting backup at 15-APR-08
channel ch0: starting compressed full datafile backupset
channel ch0: specifying datafile(s) in backupset
input datafile fno=00001 name=C:\ORACLE\PRODUCT\10.1.0\ORADATA\ORCL1\SYSTEM01.DB
F
input datafile fno=00003 name=C:\ORACLE\PRODUCT\10.1.0\ORADATA\ORCL1\SYSAUX01.DB
F
input datafile fno=00004 name=C:\ORACLE\PRODUCT\10.1.0\ORADATA\ORCL1\USERS01.DBF

input datafile fno=00002 name=C:\ORACLE\PRODUCT\10.1.0\ORADATA\ORCL1\UNDOTBS01.D
BF
channel ch0: starting piece 1 at 15-APR-08
channel ch0: finished piece 1 at 15-APR-08
piece handle=C:\RMAN_131_ORCL1_20080415.BUS comment=NONE
channel ch0: backup set complete, elapsed time: 00:00:45
Finished backup at 15-APR-08

Starting backup at 15-APR-08
current log archived
channel ch0: starting compressed archive log backupset
channel ch0: specifying archive log(s) in backup set
input archive log thread=1 sequence=26 recid=81 stamp=652112703
channel ch0: starting piece 1 at 15-APR-08
channel ch0: finished piece 1 at 15-APR-08
piece handle=C:\ARCH_132_ORCL1_20080415.ARC comment=NONE
channel ch0: backup set complete, elapsed time: 00:00:02
Finished backup at 15-APR-08

Starting Control File and SPFILE Autobackup at 15-APR-08
piece handle=C:\ORACLE\PRODUCT\10.1.0\FLASH_RECOVERY_AREA\ORCL1\AUTOBACKUP\2008_
04_15\O1_MF_S_652112718_408X3ZVJ_.BKP comment=NONE
Finished Control File and SPFILE Autobackup at 15-APR-08

released channel: ch0

allocated channel: ch1
channel ch1: sid=146 devtype=DISK

released channel: ch1

RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=146 devtype=DISK
Deleting the following obsolete backups and copies:
Type                 Key    Completion Time    Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set           128    15-APR-08
  Backup Piece       128    15-APR-08          C:\ARCH_130_ORCL1_20080415.ARC
Archive Log          79     15-APR-08          C:\ORACLE\PRODUCT\10.1.0\FLASH_RE
COVERY_AREA\ORCL1\ARCHIVELOG\2008_04_15\O1_MF_1_24_408RYXDF_.ARC
Archive Log          80     15-APR-08          C:\ORACLE\PRODUCT\10.1.0\FLASH_RE
COVERY_AREA\ORCL1\ARCHIVELOG\2008_04_15\O1_MF_1_25_408X1SCR_.ARC
deleted backup piece
backup piece handle=C:\ARCH_130_ORCL1_20080415.ARC recid=128 stamp=652112652
deleted archive log
archive log filename=C:\ORACLE\PRODUCT\10.1.0\FLASH_RECOVERY_AREA\ORCL1\ARCHIVEL
OG\2008_04_15\O1_MF_1_24_408RYXDF_.ARC recid=79 stamp=652108461
deleted archive log
archive log filename=C:\ORACLE\PRODUCT\10.1.0\FLASH_RECOVERY_AREA\ORCL1\ARCHIVEL
OG\2008_04_15\O1_MF_1_25_408X1SCR_.ARC recid=80 stamp=652112650
Deleted 3 objects


released channel: ORA_DISK_1
allocated channel: ch2
channel ch2: sid=146 devtype=DISK

released channel: ch2

RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=146 devtype=DISK
no obsolete backups found

RMAN>

C:\>dir *.bus
 Volume in drive C is khurram
 Volume Serial Number is F49D-FF2B

 Directory of C:\

04/15/2008  02:24 PM        96,813,056 RMAN_131_ORCL1_20080415.BUS
               1 File(s)     96,813,056 bytes
               0 Dir(s)  61,960,724,480 bytes free

C:\>dir *.arc
 Volume in drive C is khurram
 Volume Serial Number is F49D-FF2B

 Directory of C:\

04/15/2008  02:25 PM            56,832 ARCH_132_ORCL1_20080415.ARC
               1 File(s)         56,832 bytes
               0 Dir(s)  61,960,724,480 bytes free

C:\>


RMAN> run {
2>   allocate channel ch0 type disk;
3>   backup as compressed backupset database format
4>   'c:\rman_%s_%d_%T.bus'
5>   plus archivelog format 'c:\arch_%s_%d_%T.arc';
6>   release channel ch0;
7>  }

released channel: ORA_DISK_1
allocated channel: ch0
channel ch0: sid=146 devtype=DISK


Starting backup at 15-APR-08
current log archived
channel ch0: starting compressed archive log backupset
channel ch0: specifying archive log(s) in backup set
input archive log thread=1 sequence=26 recid=81 stamp=652112703
input archive log thread=1 sequence=27 recid=82 stamp=652112873
channel ch0: starting piece 1 at 15-APR-08
channel ch0: finished piece 1 at 15-APR-08
piece handle=C:\ARCH_134_ORCL1_20080415.ARC comment=NONE
channel ch0: backup set complete, elapsed time: 00:00:02
Finished backup at 15-APR-08

Starting backup at 15-APR-08
channel ch0: starting compressed full datafile backupset
channel ch0: specifying datafile(s) in backupset
input datafile fno=00001 name=C:\ORACLE\PRODUCT\10.1.0\ORADATA\ORCL1\SYSTEM01.DB
F
input datafile fno=00003 name=C:\ORACLE\PRODUCT\10.1.0\ORADATA\ORCL1\SYSAUX01.DB
F
input datafile fno=00004 name=C:\ORACLE\PRODUCT\10.1.0\ORADATA\ORCL1\USERS01.DBF

input datafile fno=00002 name=C:\ORACLE\PRODUCT\10.1.0\ORADATA\ORCL1\UNDOTBS01.D
BF
channel ch0: starting piece 1 at 15-APR-08
channel ch0: finished piece 1 at 15-APR-08
piece handle=C:\RMAN_135_ORCL1_20080415.BUS comment=NONE
channel ch0: backup set complete, elapsed time: 00:00:45
Finished backup at 15-APR-08

Starting backup at 15-APR-08
current log archived
channel ch0: starting compressed archive log backupset
channel ch0: specifying archive log(s) in backup set
input archive log thread=1 sequence=28 recid=83 stamp=652112925
channel ch0: starting piece 1 at 15-APR-08
channel ch0: finished piece 1 at 15-APR-08
piece handle=C:\ARCH_136_ORCL1_20080415.ARC comment=NONE
channel ch0: backup set complete, elapsed time: 00:00:02
Finished backup at 15-APR-08

Starting Control File and SPFILE Autobackup at 15-APR-08
piece handle=C:\ORACLE\PRODUCT\10.1.0\FLASH_RECOVERY_AREA\ORCL1\AUTOBACKUP\2008_
04_15\O1_MF_S_652112928_408XBKCZ_.BKP comment=NONE
Finished Control File and SPFILE Autobackup at 15-APR-08

released channel: ch0

RMAN> report obsolete
2> ;

RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
Report of obsolete backups and copies
Type                 Key    Completion Time    Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set           129    15-APR-08
  Backup Piece       129    15-APR-08          C:\RMAN_131_ORCL1_20080415.BUS
Backup Set           130    15-APR-08
  Backup Piece       130    15-APR-08          C:\ARCH_132_ORCL1_20080415.ARC
Backup Set           131    15-APR-08
  Backup Piece       131    15-APR-08          C:\ORACLE\PRODUCT\10.1.0\FLASH_RE
COVERY_AREA\ORCL1\AUTOBACKUP\2008_04_15\O1_MF_S_652112718_408X3ZVJ_.BKP
Backup Set           132    15-APR-08
  Backup Piece       132    15-APR-08          C:\ARCH_134_ORCL1_20080415.ARC
Archive Log          81     15-APR-08          C:\ORACLE\PRODUCT\10.1.0\FLASH_RE
COVERY_AREA\ORCL1\ARCHIVELOG\2008_04_15\O1_MF_1_26_408X3HRP_.ARC
Archive Log          82     15-APR-08          C:\ORACLE\PRODUCT\10.1.0\FLASH_RE
COVERY_AREA\ORCL1\ARCHIVELOG\2008_04_15\O1_MF_1_27_408X8RXN_.ARC

RMAN>

Note : i have archivelog which is at FRA ,it also apply there and as well yours own defined backupsets path.



Khurram
Re: Rman and delete obsolete files.. [message #313953 is a reply to message #313943] Tue, 15 April 2008 05:49 Go to previous message
romann000
Messages: 8
Registered: April 2008
Junior Member
Hi Khurram,

thank you for this detailed explantation.

I think I don't understand rman and his switches, i'll make me a little bit smarter and then i'll be back:-)

I'll try what you wrote.

BR
Roland
Previous Topic: DB recovery from crash
Next Topic: Dual backup strategy, backup to FRA and tape
Goto Forum:
  


Current Time: Fri Nov 22 18:10:06 CST 2024