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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: switch logfile vs. archive log current

RE: switch logfile vs. archive log current

From: Hemant K Chitale <hkchital_at_singnet.com.sg>
Date: Thu, 20 Mar 2003 22:14:19 +0800
Message-Id: <24726.322531@fatcity.com>


My script does an
SWITCH LOGFILE
ARCHIVE LOG CURRENT
SWITCH LOGFILE
SWITCH LOGFILE
sleep 180seconds

The script has been built up over the years -- it initially started off with SWITCH LOGFILEs and therefore I put in the sleep to ensure that the archive logs were written. As I only actually need the first archive generated after the last END BACKUP and I do not need the next two, I can exclude the next two.
With 8i, the instance spawns multiple archiver processes. Sometimes it can so happen that the logfile with the higher sequence number may have completed archiving before one with a lower sequence number. The script sorts all the archive logs by sequence [as I must back them up in sequence] and since I cannot be very sure that the last one archive is written completely, I ignore the last one. I know this sounds at conflict with the usage of the ARCHIVE LOG but, as I said, the script has built up over the years so I have the SWITCH LOGFILE, ARCHIVE LOG and sleep together with the complication of multiple archivers.

How do I know which is the last archive ? I have them ordered by log_sequence_number
[as the Unix file system may not guarantee that I get them in the right sequence when I do a "find" or "ls"]. And I backup every archive log generated since the last [ie, previous night's] backup, not just the archives generated while today's backup is running. The backup script actually copies the archive logs to another server in addition to writing them to tape. Suppose there is a system and media failure while tonight's backup is running and the backup didn't get completed and cannot be resumed as the archives on disk are lost [media failure]. Well, I restore yesterday's database backup and as many of today's archive logs [ie from the point of time of the end of yesterday's backup] from tape/remote server and roll-forward. Were I to just be backing up only the archives generated while the database backup is running, in such a case I would have lost all my archive logs since yesterday. Again, to build more resilience, I could be backing up the archives every half-hour instead of at the end of the day -- if the failure occurs during the day before I begin tonight's backup I would still have lost the archives from the end of yesterday's backup unless I had them copied every half hour to another server --- this is what Oracle calls the Standby Database.

Hemant
At 12:24 PM 19-03-03 -0800, you wrote:
>At what point do you insert the sleep command and how many seconds
>do you specify?
>
>Why exclude the last archive log?
>
>Thanks,
>Peter Schauss
>Northrop Grumman Corporation
>
>-----Original Message-----
>Sent: Wednesday, March 19, 2003 11:49 AM
>To: Multiple recipients of list ORACLE-L
>
>
>
>A "switch logfile" isn't mandatory and an "archive log current" is highly
>recommended.
>The "switch logfile" command would return immdiately and would not
>wait for the archiver to complete archiving the log. The "archive log
>current"
>would return only after the archiver has completed it's job.
>You must backup the archivelogs from the first one generated
>after the first "alter tablespace begin backup" to the first one
>after the last "alter tablespace end backup". You are also
>backing up the controlfile which is also highly recommended.
>
>I normally use a combination of multiple "switch logfile", "archive log"
>commands and
>a Unix "sleep" command and then exclude the last archivelog from the backup
>just to be safe.
>Hemant
>At 06:14 AM 19-03-03 -0800, you wrote:
> >In my hot backup script, should I be using "alter system archive log
> >current;"
> >instead of "alter system switch logfile;"?
> >
> >At present this is what I am doing:
> >
> >For each tablespace:
> >
> >sqlplus internal << EOF
> >alter tablespace ERGO_USR begin backup;
> >exit
> >EOF
> >#
> >cp $DIR3/ERGO_USR.dbf $BACKUP_DIR$DIR3
> >#
> >sqlplus internal << EOF
> >alter tablespace ERGO_USR end backup;
> >alter system switch logfile;
> >exit
> >EOF
> >
> >For the last tablespace:
> >
> >sqlplus internal << EOF
> >alter tablespace USERS begin backup;
> >exit
> >EOF
> >#
> >cp $DIR1/users01.dbf $BACKUP_DIR$DIR1
> >#
> >sqlplus internal << EOF
> >alter tablespace USERS end backup;
> >alter database backup controlfile to '$BACKUP_DIR$DIR1/control01.bak';
> >alter system switch logfile;
> >exit
> >EOF
> >#
> >
> >Thanks,
> >Peter Schauss
> >Northrop Grumman Corporation
> >--
> >Please see the official ORACLE-L FAQ: http://www.orafaq.net
> >--
> >Author: Schauss, Peter
> > INET: pschauss_at_northropgrumman.com
> >
> >Fat City Network Services -- 858-538-5051 http://www.fatcity.com
> >San Diego, California -- Mailing list and web hosting services
> >---------------------------------------------------------------------
> >To REMOVE yourself from this mailing list, send an E-Mail message
> >to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> >the message BODY, include a line containing: UNSUB ORACLE-L
> >(or the name of mailing list you want to be removed from). You may
> >also send the HELP command for other information (like subscribing).
>
>Hemant K Chitale
>My personal web site is : http://hkchital.tripod.com
>
>
>--
>Please see the official ORACLE-L FAQ: http://www.orafaq.net
>--
>Author: Hemant K Chitale
> INET: hkchital_at_singnet.com.sg
>
>Fat City Network Services -- 858-538-5051 http://www.fatcity.com
>San Diego, California -- Mailing list and web hosting services
>---------------------------------------------------------------------
>To REMOVE yourself from this mailing list, send an E-Mail message
>to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
>the message BODY, include a line containing: UNSUB ORACLE-L
>(or the name of mailing list you want to be removed from). You may
>also send the HELP command for other information (like subscribing).
>--
>Please see the official ORACLE-L FAQ: http://www.orafaq.net
>--
>Author: Schauss, Peter
> INET: pschauss_at_northropgrumman.com
>
>Fat City Network Services -- 858-538-5051 http://www.fatcity.com
>San Diego, California -- Mailing list and web hosting services
>---------------------------------------------------------------------
>To REMOVE yourself from this mailing list, send an E-Mail message
>to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
>the message BODY, include a line containing: UNSUB ORACLE-L
>(or the name of mailing list you want to be removed from). You may
Received on Thu Mar 20 2003 - 08:14:19 CST

Original text of this message

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