I'm a complete novice to DB2 and as our DBA has quit, I need to try and learn the basics of it at least! Been reading some guides for it on various sites including IBM's, but have a couple of questions so far.
How can you specify where DB2 stores its log files ? From what I can tell, it seems to be storing it in two locations:
In the second directory, there are 10 log files, but in the first directory, there are over 7500 log files!! As the server is rapidly running out of space, is it ok to delete the majority of the log files from the /logfiles-db2 directory, except for say, the last 50 ?
More importantly, when I look around in the command centre, it appears as if there hasn't been any backup taken on the database since February . . . . . .(what was the DBA doing I hear you ask!!!), and I intend on taking one but I need to clear some space first or add another drive to the server.
If I delete the log files, will this impact any backups or am I best to take a backup first before I delete the log files ? Or, does the backup rely on all those log files ? Or does it only look at the last 10 log files in the SQLOGDIR directory ? I noticed that the 10 log files are all the same size.
There are two types of log files:
- active -- needed for crash recovery;
- archived -- needed for rollforward recovery after a restore.
Archived logs are normally stored in a separate location, as in your case. Active logs are archived when they don't contain active transactions.
You only need archived logs that are created after the beginning of a backup that you want to restore. If your policy is to keep only one backup image you can safely delete all archived logs that are older than that image.
If I deleted the archive logs and then performed a back-up, would we still be able to restore the database if required to how it is today ? The server itself is used for pre-production testing and that's the reason it's not been backed up like the others.
I've had a look at your link, and it looks very informative, thanks. However, I'm not sure at all on the command I would use, would it be along the lines of
DB2 PRUNE HISTORY 20120601 AND DELETE LOGFILE PRIOR TO S0007450.LOG
Thanks for the link to the book n_i, is going to be bed time reading for me tonight - such an exciting life I lead!
papadi, in an ideal world, that would be exactly what the business does. However, I've been told that the funds are not available to do so, so unfortunately, for the time being, I need to make sure it runs without issues until we recruit a replacement DBA.