Sunday, February 6, 2011

rman duplicate data base script


hi

i managed to get a small backup script from another colleague and would like to clear a few things up with you.

here is the script:

CONNECT TARGET /
-----(this just connects to the DB :-) )

configure channel device type disk format 'C:\oracle\oracle_backup';
-----(i have created this to point the backup in the correct place. Do i need to register this every time i run the backup? will it ----------affect an incremental backup if i register it everytime?)

-----(what I have noticed as well is that it creates a file called 'SNC<SID_NAME>.ORA' of about 10MB in -----'C:\oracle\product\10.2.0\db_1\database\' folder still.... what is this file? )

BACKUP CHECK LOGICAL VALIDATE DATABASE;
-----(what does this do?)

BACKUP INCREMENTAL LEVEL 0 TAG weekly_backup DATABASE;
-----(will this backup all data? in the event of a drive failure, could it restore everything? this will be weekly and a level 1 backup -----tagged as monday_backup, tuesady_backup, etc. etc.)

SQL 'ALTER SYSTEM ARCHIVE LOG CURRENT';
-----(what does this do?)

CROSSCHECK ARCHIVELOG ALL;
-----(what does this do?)

CROSSCHECK BACKUP;
-----(what does this do?)

DELETE OBSOLETE;
-----(what does this do? i noticed when I ran a level 1 backup for monday, tuesday to test and then ran the level 0 again, it ---------------deleted all the level 1 backups.. is this basically what this command does?)


ANS::::::::::::::::::::::::::::::;;;
 First, a configure command will sore the configuration in the controlfile (and catalog if it's being used) so there is no need to execute it again.

However, your configuration:

configure channel device type disk format 'C:\oracle\oracle_backup';

Is not correct.  You need to add more to the file name so RMAN creates a unique name each time.  Look at the 'formatSpec' options in Oracle® Database Backup and Recovery Reference 10 g Release 2 (10.2).  Assuming  oracle_backup is a directory, your configuration would be something like:

configure channel device type disk format 'C:\oracle\oracle_backup\%U';

Next, the 'SNC<SID_NAME>.ORA' file.  By default Oracle will always create files in the $ORACLE_HOME/dbs unless another location is specified.

Hard to say what this file is without looking at the backup output.  Post the full 'show all' output and we will be able to tell if this is a controlfile (either autobackup or snapshot).

>will it ----------affect an incremental backup if i register it everytime?)
I suppose you could without impact; but unless you're changing the setup, there's no need.


>BACKUP CHECK LOGICAL VALIDATE DATABASE; -----(what does this do?)
This checks for logical (and physical) corruption.


>BACKUP INCREMENTAL LEVEL 0 TAG weekly_backup DATABASE; -----(will this backup all data? in the event of a drive failure, could it restore everything? this will be weekly and a level 1 backup -----tagged as monday_backup, tuesady_backup, etc. etc.)

Assuming you have all of the archive logs in between, then yes.
Level 0...arch logs...level 1....arch logs....level 1....arch logs...point of restore


>SQL 'ALTER SYSTEM ARCHIVE LOG CURRENT';-----(what does this do?)
This logs into sqlplus and performs a log switch. (Writing the current redo logs onto an archive log).


>CROSSCHECK ARCHIVELOG ALL;-----(what does this do?)
>CROSSCHECK BACKUP;-----(what does this do?)
Crosschecks go through RMANs records of backups according to the policies you set. If for instance you said you only want to retain 1 week's worth, it will mark all backups no longer needed according to that criteria as obsolete. Additionally, it will mark all backups it can no longer find as expired.


>DELETE OBSOLETE;-----(what does this do? i noticed when I ran a level 1 backup for monday, tuesday to test and then ran the >level 0 again, it ---------------deleted all the level 1 backups.. is this basically what this command does?)
This fits in to the above question. What it comes up with as obsolete is exclusively based on the retention policy you set. Based on this setting, it will mark the files as obsolete (during the crosscheck) and then delete them (during this step).

No comments:

Post a Comment