Mistake #2: Choosing (or defaulting to) an inappropriate archivelog setting
Let’s say you back up your database nightly. If your database were obliterated in a hardware failure at 3:58 pm, would it be important to recover the changes made to the database since last night? If it’s a training or test database, or a production database that doesn’t change much, perhaps just the restoring database backup from last night would be fine. Otherwise, you probably would be interested in recovering the work that’s been done since last night. (And having users insistently and repeatedly ask you when they’ll get their data back would only serve to increase your interest in completing the recovery.)
Remember the online redo logs from Mistake #1? As we discussed, they are vital to database recoveries. Let’s talk more about how they work.
Databases have more than one redo log. Let’s say that our database has three redo logs (logs 1, 2, and 3). Let’s also say it takes about 30 minutes for a redo log to fill. When log 1 fills with transactional data, it closes, and log 2 begins writing. When log 2 fills, log 3 starts writing. When log 3 fills, log 1 gets overwritten.
Losing the information in log 1 is fine, as long as you don’t need it later. You can get copies of each redo log before it is overwritten. These are called archived redo logs, and they are only generated if the database is running in archivelog mode.
Now, back to our 3:58 pm database obliteration scenario. Let’s say your backup was made at 3 am last night; you are running in archivelog mode; and you back up your archive logs every hour, on the hour.
You would restore your backup from 3 am, then “apply” the archived redo logs made since the 3 am backup. Applying redo logs replays the transactions stored in the redo logs, “applying” them to your restored database. This is how you get your database changes back since this morning. You’d be able to replay enough transactions to get your database to the state it was in at 3 pm when you made your hourly archivelog backup. (I’m oversimplifying here to more easily illustrate the concept.)
If you weren’t running in archivelog mode, you’d restore your backup from last night at 3 am, then you’d be done, because it would not be possible to replay the transactions made since 3 am. You would lose all work done since 3 am this morning.
If you run in archivelog mode, there are backup types that you can run that otherwise would not be available to you.
So, rollforward recoveries and more available backup types are the good points about running in archivelog mode.
There are some bad points, too:
• Archivelog mode can make your database run more slowly, although in many cases it’s undetectably so.
• You’ll have to manage the archivelogs – if the file system/drive they are on fills up, the database will hang. You’ll need some mechanism to delete them in a timely (not to early, not too late) fashion.
But what if you don’t care about getting your transactions back since 3 am? And what if you don’t make a backup type that is capable of replaying transactions and applying them to the backup? In either case, running in archivelog mode will not help you. Don’t bother with it.
Do you know what your archive logging strategy is? Is that strategy serving your business well?