Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Help with hot backups

Re: Help with hot backups

From: Howard J. Rogers <hjr_at_dizwell.com>
Date: Tue, 18 May 2004 07:31:31 +1000
Message-ID: <40a92f25$0$3035$afc38c87@news.optusnet.com.au>


Chuck Lucas wrote:

> I've been charged with taking hot backups of our database. It's Oracle
> 8.1.7 on Solaris 8 (sparc).
>
> I've come up with a RMAN script, but I'm not sure where to tell Oracle to
> "archive log current".

Well, why are you asking it to produce a new archive in the first place?

If you know *why* something is done, it will help you determine when/where how best to do it, won't it?

> Below is the current script.
>
> run {
> allocate channel tape1 type 'sbt_tape';
> backup
> format '%d_%u_%s_%p_%t'
> (database);
> sql 'alter system archive log current';
> backup
> format '%d_%u_%s_%p_%t'
> (archivelog all delete input);
> release channel tape1;
> }
>
> After reading the documentation, it stated placing the "archive log current"
> after the database backup, to ensure the "backup information" is included in
> the redo (archive) logs. But, I'm thinking placing it there, won't give
> enough time for the archive process to archive the log before RMAN actually
> starts working on the archive logs. I thought about moving the "archive log
> current" statement to BEFORE the database backup (which should give it
> enough time to archive), but then I'm afraid I won't get everything in the
> current redo log. Or maybe I should put the statement in BOTH places, to
> make sure I get everything?
>
> Really appreciate any assistance anyone could offer on this.

You're backing up your data files and as you do so, users are performing new transactions, thus generating new redo into the current redo log.

In a recovery scenario, you would restore the data files from the backup you've just taken, and roll it forward using redo from your archives and from the current online log.

The current redo log thus contains redo which is needed to completely recover the data file backups you've just taken. That is why it is suggested to throw in an extra log switch so that the redo is 'decanted' into an archive which can be backed up.

Knowing that, it is therefore obvious that the log switch must come after the data files are backed up, and before the archives are backed up. So your script is correct. And please don't just throw in duplicate commands just because you're not sure. You did the right thing by asking here.

You ask a legitimate question about 'what happens if the archiving isn't finished before it comes time to back it up'. Good question. The answer is buried in the fact that the command is 'archive log current' and not just 'switch log file'. RMAN processes commands sequentially, and doesn't start the next one until it has confirmation that the original one has completed. Had you asked for a log switch, that's merely a quick change in the control file, and LGWR now writes to a different log (and yes, ARCn starts archiving). Confirmation would have been recieved by RMAN very quickly. But you didn't do that. You asked for ARCn to do its job (which happens to require a log switch first), and the next backup command will not be processed until ARCn confirms it's finished.

Regards
HJR Received on Mon May 17 2004 - 16:31:31 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US