Oracle: Begin backup/End backup - a knol by Franck Pachot

Ceci est le cache Google de /17uabcrki6uux/3. Il s'agit d'un instantané de la page telle qu'elle était affichée le 31 jan 2009 08:57:58 GMT. La page actuelle peut avoir changé depuis cette date. En savoir plus Les termes de recherche suivants sont mis en surbrillance : backup cold begin Ces termes apparaissent uniquement dans les liens pointant sur cette page : backup Version en texte seul

How-to contestNew! | Help Knol: a unit of knowledge Search Toolkit

Manage Revisions Edit View

Oracle: Begin backup/End backup
Description of Begin backup/End backup behaviour What happens when tablespace is in hot backup mode.
Introduction Description Frequent questions References Print Print Favorite Favorite

This document tries to explain exactly what happens when using ALTER TABLESPACE ... BEGIN BACKUP and ALTER TABLESPACE ... END BACKUP, and why it is mandatory to use it when the online backup is done with a tool that is external to Oracle ( such as OS backups using cp, tar, BCV, etc. ) It also gives an answer to those frequent questions: Does Oracle write to data files while in hot backup mode ? What about ALTER DATABASE BEGIN BACKUP ? Why it is not used with RMAN backups What if you do an online backup without setting tablespaces in backup mode ? What if the instance crashes while the tablespaces is in backup mode ? How to check which datafiles are in backup mode What are the minimal archive logs to keep with the hot backup ?
1 sur 8

02/02/2009 10:40

it can be restored entirely and the database can be opened without the need to recover. Oracle copies the datafile blocks to backupset so that it will be able to restore them and recover them. thus the recovery of the copy must be recovered at least up to the SCN that was at the end of the copy. consistency within datafiles and consistency within data blocks.132/search?q=cache:jwwrEh5d6hUJ:knol. but cannot deal with blocks from the future. So it is all about consistency in the copy: consistency between datafiles. Why use OS backups instead of RMAN ? Why BEGIN BACKUP takes a long time ? Description Offline backup (Cold backup) A cold OS backup is simple: the database has been cleanly shut down (not crashed. several issues come up: Header inconsistency: Nothing guaranties the order in which the files are When the copy is done from the OS (i.. Online backup (Hot backup) An hot backup does the copy while the database is running.Oracle: Begin backup/End backup . it reads blocks at different point in time.e with a tool that is not aware of the Oracle file structure). That means that the copy is inconsistent and will need redo applied to be usable. When the copy is done with Oracle (RMAN). Backup consistency:As the copy is running while the datafile is updated. not shutdown abort) so that: all datafiles are consistent (same SCN) and no redo is needed in case of restore the datafiles are closed: they will not be updated during the copy operation Thus..77. The recovery is able to roll forward blocks from the past. Fractured blocks: Nothing guaranties that an Oracle block is read in one single i/o so that two halves of a block may reflect its state at two different points in time.125. Recovery is the process of applying redo log information in order to roll-forward file modifications as they were done in the original files.a knol by Franck Pachot http://74. and keep this consistency in the current files (obviously) as well as in the copy (as it will be needed for a restore/recovery) 2 sur 8 02/02/2009 10:40 .com/k. thus the header of the file may reflect its state at the beginning or at the end of the copy.

132/search?q=cache:jwwrEh5d6hUJ:knol. so that the copy is identified to be a hot backup knol by Franck Pachot http://74.. and with the minimal impact on the current database. Then. This is all about having a copy that can be recovered.. This is to manage the backup consistency issue when the copy will be used for a recovery. Nothing needs to be changed in the current datafiles..When BEGIN BACKUP is issued: The hot backup flag in the datafile headers is set.. for each datafile in the tablespace.. without affecting the current operations. and revert it back at the end. END BACKUP is to set special actions in the current database files in order to make their copy usable. but.77. This is to avoid the fractured block issue. when the copy will be with no control on the program that does the copy. and up to which SCN it has to be recovered at least enough information to fix fractured blocks During backup mode. here is what happens: 1. so that in case of recovery. There may be a fractured block in the copy. Begin backup command completes only when checkpoint is done. but it will be overwritten during the recovery with the full block image. That means that any further checkpoints do not update the datafile header SCN (but they do update a 'backup' SCN) Each first modification to a block in buffer cache will write the full block into the redo thread (in addition to the default behaviour that writes only the change vector). A checkpoint is done for the tablespace. 2. the instance that will do the recovery of the restored datafiles has to know: that the files need recovery from which SCN.During backup mode: The datafile header is frozen so that whenever it is copied. In order to deal with the 3 previous issues. as the copy is done by an external tool. BEGIN BACKUP and ALTER TABLESPACE . This is to avoid the header inconsistency issue.125. Oracle knows that it needs to start recovery at that SCN to apply the archived redo logs. 3 sur 8 02/02/2009 10:40 . no redo generated before that point will be applied.Oracle: Begin backup/End backup . Backup mode The goal of ALTER TABLESPACE . the only way to have something set in the copy is to do it in the current datafiles before the copy. it reflects the checkpoint SCN that was at the beginning of the backup.

3. it cannot be recovered earlier than that point. Consequence on the copy (the backup) When the copy has been done between begin backup and end backup. The header SCN is written with the current checkpoint the datafile header SCN is not updated . Oracle sees that the SCN is older than the current one and says that the database needs recovery. With the checkpoint at the beginning. as the datafile header is frozen with a non current SCN. Remarks: 1.When END BACKUP is issued: A record that marks the end of backup is written to the redo thread so that if the copy is restored and recovered. And for the same reason. This is to avoid the backup consistency issue. In path writes do not go through the buffer cache.. The hot backup flag in the datafile headers is unset.g backup done with dd bs=1M).Oracle: Begin backup/End backup . The supplemental logging occurs when accessing the block for the first time in the buffer cache. After the files have been restored. the first time it is updated since it came in the buffer as more logging is written. The recovery must be done up to a point in time ulterior to the end backup point in time so that we are sure that there is no blocks in the datafile that comes from the future. but a testcase doing a 'flush buffer_cache' proves that. it is not possible to shutdown the database while a tablespace is in hot backup. it is sure that no change vector preceding the begin backup has to be applied be applied. Consequence on the current database All operations can be done during the backup mode. But the only mean to avoid the problem is to do that full logging of block for each block. If the same block is reloaded again in the buffer cache.132/search?q=cache:jwwrEh5d6hUJ:knol. 2. the fractured block is not frequent as it happens only if the i/o for the copy is done at the same time on the same block as the i/o for the update. that supplemental logging is not useful as fractured blocks cannot happen. 4. it is better to do the tablespaces one after one instead of putting all the database tablespaces in backup mode.125. That means that everything goes as normal except for two operations: .a knol by Franck Pachot http://74. the whole before image of the block is recorded in redo . the begin backup checkpoint is mandatory to manage the fractured block issue: as Oracle writes the whole before image of the block. This is because. 4 sur 8 02/02/2009 10:40 . just in case. I haven't seen that point documented.77. the datafile would be seen as if it requires recovery.. it needs to ensure that it does not overwrite a change done previously. supplemental logging will occur again. but they always write full blocks and then full block is written to redo log (if not in nologging) 3. it should be done during a low activity period. the copy is fully available to be restored and recovered using the archive log files that where generated since the begin backup. if the OS i/o size is multiple of the Oracle block size (e.when updating a block.

but it may have inconsistencies.. then the datafile header should reflect the right SCN Fractured blocks: If the copy does i/o with a size that is multiple of the Oracle block we can't be sure that the copy is recoverable. then you should not have fractured blocks Backup consistency:If you take care to recover later than the point in time of the end of the copy. We can suppose that the copy is consistent if we make the copy with the following conditions Header inconsistency: If the file copy is done from beginning to end. and check head and tail of the block to see if block is fractured (in that case. Oracle introduces this 'shortcut' for one reason only: when doing backup with a mirror split (BCV. that is totally aware of the datafile structure..132/search?q=cache:jwwrEh5d6hUJ:knol.. In that case.. As seen previously. the copy gets all the datafiles at the same time. That is one advantage among many others of using RMAN for backups. needs media recovery This is the only case I know where instance recovery is not automatic.' before opening the database. Flashcopy. It may be fine. it is a bad idea to put all tablespaces in backup mode. and the way they are written.Oracle: Begin backup/End backup . 5 sur 8 02/02/2009 10:40 . What about ALTER DATABASE BEGIN BACKUP ? That command put all database tablespaces in backup mode at the same knol by Franck Pachot http://74. What if you do an online backup without setting tablespaces in backup mode ? If you don't put the tablespace in backup mode. end backup. and the copy lasts only few seconds. However that cannot be avoided if the instance crashes (or shutdown abort). it knows how it can read the datafiles in a way the copy is consistent: write the good version of datafile header. it re-reads the block to get a consistent image)..125. etc). you need to issue 'alter database. it is easier to use that command to put all tablespaces in backup mode during the operation. as it is better to do it one by one in order to minimize the supplemental redo logging overhead. Frequent questions Does Oracle write to data files while in hot backup mode ? Yes of course.. Why it is not used with RMAN backups RMAN is an Oracle tool. read the blocks with an i/o size that is multiple of the Oracle block size so that there is no fractured blocks. it would not be called 'online' backup if it were not the case. Then. and then the startup of the database will raise: ORA-1113: file .

to open the database. the online fuzzy bit is unset only when datafile is offline or read-only. not for backup mode. This is because in previous versions (<9i) the begin backup unsets the online fuzzy bit in the datafile header.Oracle: Begin backup/End backup .com/k. How to check which datafiles are in backup mode The V$BACKUP view shows the datafiles that are currently in backup mode (status ACTIVE). you should not have inconsistency But there may be other internal mechanisms that are not documented so that we can't be sure that this list of issues is exhaustive. ALTER DATABASE OPEN. Subsequent archive logs will be needed to recover up to the point of failure. Since 9i. That is sufficient to do an incomplete media recovery up to the point of 'end backup'. you have to do it again. What are the minimal archive logs to keep with the hot backup ? The backup done online is unusable if there is not at least the possibility to restore archive logs . And.132/search?q=cache:jwwrEh5d6hUJ:knol.up to the archive log that was archived just after the backup (of the whole database) ended. (and the only way Oracle has to set its value in the copy is to set it in the current file while it is copied) In that case you can can issue: ALTER DATABASE END BACKUP. Why use OS backups instead of RMAN 6 sur 8 02/02/2009 10:40 ..77. as it is not supported.a knol by Franck Pachot http://74. .google.from the archive log that was the current redo log when the backup started.125. it has to be recovered.. and set it back at when end backup is issued. Note that you will have no message What if the instance crashes while the tablespaces is in backup mode ? When you start the database after that. But your backup is not usable. Oracle will say that it requires recovery. This is because the SCN was frozen and it is the expected behaviour because if you restore the copied file. Some old documentation says to check V$DATAFILE_HEADER column FUZZY. we cannot rely on a backup done like that.

etc). This is the same reason why an offline backup is done after a normal shutdown (that do a checkpoint) and not a shutdown abort..dba-village.6 'Why Are Datafiles Being Written To During Hot Backup?' AskTom "Backup and Recovery -. Why BEGIN BACKUP takes a long time ? BEGIN BACKUP has to checkpoint the dirty buffers related with the tablespace. Flashcopy." That document has already been posted on : http://www. the OS backup are still used when using OS tools that can copy an entire database in seconds.77. so that the backup datafiles and the folowing redo log are sufficient to recover. France Article rating: Your rating: Activity for this knol This week: 92pageviews Totals: 2397pageviews Moderated collaboration Creative Commons Attribution 3. References Misconception: Hot backup mode stops writing to the datafiles (Jeremiah Wilton) METALINK Note:1050932. Yet. The duration of that checkpoint is proportional to the buffer cache size and the number of datafiles. The best way to do online backups is using RMAN as it has a tons of features that you cannot have with OS Share what you know Write a Knol Franck Pachot Oracle DBA Sophia-Antipolis.why extra redo is generated.Oracle: Begin backup/End backup .com/k.. 2008 2:42 AM. The performance of BEGIN BACKUP checkpoint has been improved in 10g.a knol by Franck Pachot http://74.132/search?q=cache:jwwrEh5d6hUJ:knol. Reviews 7 sur 8 02/02/2009 10:40 . but here it is at tablespace level only. for very large using mirror split (BCV.0 License Version: 4 Last edited: Jul 24.

Oracle's Health Mon.. Clone an Oracle by Sharad Srivastava Flag inappropriate content Comments Home | Terms of Service | Privacy Policy | Content Policy | Help ©2008 Google 8 sur 8 02/02/2009 10:40 .132/search?q=cache:jwwrEh5d6hUJ:knol. There are no reviews for this knol.77... Initialization 90% Franck Pachot also wrote Oracle: workarea maxium size Oracle: Recover a deleted datafile from unix/linux when database is still up Franck Pachot Oracle: passing a list as bind variable Related Knols Cloning Database Cloning Database by ashic ash Clone an Oracle 90% scribd. by alexander bubernak Initialization Para. Review This Knol Similar Content on the Web wordpress.. Oracle Applications..Oracle: Begin backup/End backup .a knol by Franck Pachot by Parikshit Paul Oracle's Health Mon.. by Koushikinath misra Oracle Applications..

Sign up to vote on this title
UsefulNot useful