Showing posts with label rman. Show all posts
Showing posts with label rman. Show all posts

Aug 10, 2011

rman delete

I have the following scenario. I have database backups I want to delete as I am recreating a database tomorrow morning, long story, but we have found a bug when running a block size of 16k.

I don't want to run the "RMAN DROP DATABASE INCLUDING BACKUPS NOPROMPT" command as the business testers want this environment back reasonably quickly.

What I did was:

unix> rman target /
rman> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 1 DAYS;
rman > DELETE NOPROMPT ALL;

Then it listed all the backup to remove, and I said "YES".

Now when I run the RMAN DROP DATABASE command tomorrow, it will complete in good time, not 2-3 hours it took to delete all my backups.

Feb 22, 2011

Remove unwanted files from FLASH_RECOVERY_AREA

Move backups from the flash recovery area to tertiary storage such as tape.

RMAN> BACKUP RECOVERY AREA;

Note : Flashback logs cannot be backed up outside the recovery area and so are not backed up by BACKUP RECOVERY AREA.

NOTE: Removing these files with an operating system utility will physically remove these files, but the database will still think the files exist and the problem of archival error may still occur. Use the following commands to synchronize the files with the database and use rman to remove these files.


RMAN>CROSSCHECK BACKUP;
RMAN>CROSSCHECK ARCHIVELOG ALL;

RMAN>Delete expired backup;
RMAN>Delete expired archivelog all;
RMAN>Delete force obsolete;

4. Make sure that your guaranteed restore points are necessary. If not, delete them


SQL>Drop restore point restore_point_name

5. If flashback logs are enabled then make sure you have enough space for all the flashback logs. If its not required then you can turn off flashback.


SQL> Alter database FLASHBACK OFF;

6. Review your backup retention policy and if required change the RMAN RETENTION POLICY


RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;

Exceptions :


- If RMAN is not part of backup strategy and archivelogs are going to FRA then manual intervention required for deletion of archivelogs. Periodically purse old archivelogs


for example


RMAN> Delete archivelog all completed before 'SYSDATE-7';

- By default RMAN backup goes to FRA. While taking RMAN backup if backup location explictly specified to flash recovery area location then those backup pieces are not considered as part of FRA for auto managment.


- For Archivelogs backup to FRA use USE_DB_RECOVERY_FILE_DEST rather than giving explict path of FRA


SQL> alter system set log_archive_dest_10='LOCATION=USE_DB_RECOVERY_FILE_DEST' scope=both;


- Bug 4911954


Details:
V$RECOVERY_FILE_DEST SPACE_USED and NUMBER_OF_FILES values may be wrong.
eg: Number of files in V$FLASH_RECOVERY_AREA_USAGE and V$RECOVERY_FILE_DEST are different.
This problem can lead to recovery area files being deleted even though there is no space pressure.
Fixed in : 10.2.0.3 , 11.1.0.6

- Bug 5106952


Details:
Flashback logs are not reclaimed by flash recovery area when using guaranteed
restore point (after dropping guaranteed restore point) or when changing
db_flashback_retention_target to a lower value.


Oct 9, 2007

RMAN Recovery

connect target /

-- ensure database is in mount mode.

run {
SET UNTIL TIME "to_date('09-OCT-2007 15:00:00', 'DD-MON-YYYY HH24:MI:SS')";
RESTORE DATABASE;
RECOVER DATABASE;
}

-- startup database, must use resetlogs if recovery to point in time is used.
-- note: to_date function is used, so you can choose whatever date format you want can be used.