Thursday, August 10, 2017

How to restore oracle database with no errors:


Note: please take great care before you do backup and restore as incorrect executions are catastrophic. You are responsible for your own actions and no one else.


We all like to restore database when it is required to restore however at times we found difficult to restore due to non availability of backup files, or missing backups etc.

how can we ensure that the taken backup is perfect for restore  or how can we ensure the database is in correct state to take backup.

In my view, we need to ensure database is in consistent state and has no physical , logical corruptions. It is not for later checks but very next after creation of database.

As soon as we created a database, we need to check if db is free from physical and logical corruptions and we need to put this check in practice all the time.

It is always a good idea to check database before taking backup to see if there any corruptions , if there are any we can restore those corrupted database blocks from valid backups.

How do I check if taken backups are valid and can be restored without actually performing actual restore to be sure restore can be done if needed successfully.

no valid backup no valid restore, it is as simple as that.

Create/upgrade  database -> check db if any corruptions .. if any fix there itself

Assume we have valid database

Take backup
-- as it is first time, there will not be any corruptions
-- from second time on wards
         -- check db for any corruptions, if any fix them from valid backup we took recently
         -- take the backup
         -- validate taken backup

Check if restore can done successfully before actually attempting to restore.

following commands can be used to validate database, backup sets, to see if restore can be done successfully.



--validate the database
BACKUP VALIDATE DATABASE ;
BACKUP VALIDATE DATABASE ARCHIVELOG ALL;

BACKUP VALIDATE CHECK LOGICAL DATABASE ;
BACKUP VALIDATE CHECK LOGICAL DATABASE ARCHIVELOG ALL;

Any block corruptions are visible in the V$DATABASE_BLOCK_CORRUPTION view, as well as in the RMAN output.

-- validate the contents of backup files
RESTORE DATABASE VALIDATE;
RESTORE ARCHIVELOG ALL VALIDATE;

-- Check if restore can be successfull
RESTORE DATABASE PREVIEW;
RESTORE DATABASE PREVIEW SUMMARY;
RESTORE ARCHIVELOG ALL PREVIEW;
-- List backups
LIST BACKUP;       # lists backup sets, image copies, and proxy copies
LIST COPY;         # lists only disk copies

--  To determine which database files need backup under a specific retention policy.
REPORT NEED BACKUP ;



BACKUP VALIDATE  ,   RESTORE VALIDATE command mimics the process of a backup, restore, without actually performing the backup, restore.

No comments:

Post a Comment