what must i backup

2
When can I safely delete Archived Redo Logs? Backup and Recovery Tips Copyright © Howard Rogers 2001 24/10/2001 Page 1 of 2 When can I safely delete Archived Redo Logs? Archives are required to roll restored Data Files forward from the time they were backed up to the current time of the rest of the database. If you read that statement carefully enough, you’ll see that it implies that any archives generated from a time earlier than the time a Data File was backed up are not going to be needed to roll it forward, and are hence disposable. The simple rule is, therefore, that whenever a new backup is successfully completed, all archives from a time prior to the start of that backup can be deleted. Note the important qualifier there: it’s the start of the backup that is important. That’s because a Data File is dated by the SCN contained in its header, regardless of what times (i.e., what SCN) actually pertains to the contents of that block. Imagine, for example, that you begin backing up a Data File at 10.00am, and you finish at 10.10am. Oracle will see that entire Data File as being from time 10 o’clock, because that’s what the SCN will tell it –even though different bits of that file might actually be at any one of those ten minutes. If you’d deleted all archives from a time before 10.10am, though, you’d never be able to roll the Data File forward from what it supposes is its time of 10 o’clock, because you can’t skip gaps in the archive sequence. On the other hand, if you’d deleted an archive from time 9.59am, you’d have no trouble performing recovery –because the Data File thinks itself to be older than that, and therefore has no reason to re-perform any of the transactions such an archive would have contained. The same reasoning applies when you consider the database as a whole. It might (for example) take you three hours to backup an entire database, one Data File at a time. You need all the archives from the time that entire backup started –because you can’t guarantee which of the many possible Data Files it contains might be the one that blows up and needs to be restored and recovered. It might be the file that was backed up at 10.00am, or the one at 12.45pm. If you’ve kept all the archives since the time the thing started at 10.00am, however, you’ll have no problem recovering either. The above comments are obviously relevant to hot backups –but they apply equally well to cold backups, too. When you perform a cold backup, you are likely to be copying the entire database at one sitting –and all its constituent Data Files will be at the same SCN, the one issued when you shut the database down. All archives before that time are thus never going to be required to recover any part of the database. But all archives after that time might be. So, in practice, it remains true, even for cold backups, that you need to retain all archives from the time you started to perform the backup onwards.

Upload: rocker12

Post on 07-Mar-2016

216 views

Category:

Documents


3 download

DESCRIPTION

Archives are required to roll restored Data Files forward from the time they were backed up to the current time of the rest of the database. Imagine, for example, that you begin backing up a Data File at 10.00am, and you finish at 10.10am. Oracle will see that entire Data File as being from time 10 o’clock, because that’s what the SCN will tell it –even though different bits of that file might actually be at any one of those ten minutes.

TRANSCRIPT

Page 1: What must I backup

What must I backup? Backup and Recovery Tips

Copyright © Howard Rogers 2001 19/10/2001 Page 1 of 1

What must I backup? The answer to this question depends on another: are you performing hot backups or cold (in other words, is the database up and running when you take the backup, or have you shut it down completely before starting?). If you are performing cold backups, then things are very simple: you back up the entire database without qualification. That means you need to take copies of all Control Files, all Data Files and all Online Redo Logs. You also need to make sure that the Password File (if there is one), the init.ora and the Archived Redo Logs (if you’re taking them) get backed up, too. Strictly speaking, you can always re-create a lost Password File using the orapwd utility; and a lost init.ora can always be reconstructed from an alert log. But in the event of disaster, you really want recovery to be performed with as few hassles as possible –and having to faff around reconstructing small files that could so easily have been backed up in the first place is more trouble than it is worth. If you are performing hot backups, things get rather trickier, because you run up against Rogers’ First Rule of Hot Backups –which is that no part of an Oracle database can be copied hot without the resulting copy containing internal inconsistencies that render those copies useless. (In case you are panicking, there’s a second Rogers’ Rule, too: Oracle provides mechanisms for making internally inconsistent Control Files and Data Files consistent). What that means is this: copies of the Control Files can be taken, because we have the ALTER DATABASE BACKUP CONTROLFILE TO ‘BLAH.BKP’ command to make the hot copies internally consistent. Copies of the Data Files can also be taken, because we have the redo available to make the internally inconsistent copies useable. But copies of the Online Redo Logs are a big no-no, because there is no mechanism available for making inconsistent copies of redo log consistent and useable. Given that the mechanism for fixing up the Data File copies is redo, it follows that you can’t realistically perform hot backups at all unless you have all required redo permanently available –and that means you must be running in archivelog mode, and generating archives. And since those archives are going to be crucial to making your Data File copies useable, you’d better make sure you include them in your backup, too. Likewise, the same comments as I made earlier about backing up the Password File and init.ora are also applicable. Summing all of that up: COLD = Control Files, Data Files, Online Redo Logs, init.ora, Password File, Archived Redo Logs (if present) HOT = Control Files, Data Files, init.ora, Password File, Archived Redo Logs (not optional!), but not the online Logs.