Sign In | Register Now About Bytes | Help | Site Map
Connecting Tech Pros Worldwide

How to safely trim log space

Question posted by: Richard (Guest) on August 1st, 2008 03:35 PM
Hi,

We have a few development dbs version 8, but really doesnt matter,
that are non-recoverable ( LOGRETAIN OFF). How do I trim the log
space ? db2 get db cfg for MYDB | grep 'First active log files'
shows blank.
And there are tons of logfiles and filling diskspace.

As a side note, most of our dbs we have LOGRETAIN=YES and I trim all
logfiles with numbers no less than the
first active logfile no. Now with nonrecoverable dbs, how do I remove
logfiles safely since there's no active log no ?


Your answer are most appreciated.
Ajean's Avatar
Ajean
Guest
n/a Posts
August 2nd, 2008
10:15 AM
#2

Re: How to safely trim log space
On 8月1日, 下午11时27分, Richard <RSL...@gmail.com>wrote:
Quote:
Hi,
>
We have a few development dbs version 8, but really doesnt matter,
that are non-recoverable ( LOGRETAIN OFF). How do I trim the log
space ? db2 get db cfg for MYDB | grep 'First active log files'
shows blank.
And there are tons of logfiles and filling diskspace.
>
As a side note, most of our dbs we have LOGRETAIN=YES and I trim all
logfiles with numbers no less than the
first active logfile no. Now with nonrecoverable dbs, how do I remove
logfiles safely since there's no active log no ?
>
Your answer are most appreciated.





Why would you like to remove it?

I think you'd better keep it

Pierre StJ's Avatar
Pierre StJ
Guest
n/a Posts
August 2nd, 2008
08:35 PM
#3

Re: How to safely trim log space
On Aug 1, 11:27*am, Richard <RSL...@gmail.comwrote:
Quote:
Hi,
>
We have a few development dbs version 8, but really doesnt matter,
that are non-recoverable ( LOGRETAIN OFF). *How do I trim the log
space ? *db2 get db cfg for MYDB | grep 'First active log files'
shows blank.
And there are tons of logfiles and filling diskspace.
>
As a side note, most of our dbs we have LOGRETAIN=YES and I trim all
logfiles with numbers no less than the
first active logfile no. *Now with nonrecoverable dbs, how do I remove
logfiles safely since there's no active log no ?
>
Your answer are most appreciated.


The logs in the log path are useless for recovery so there's no reason
to keep them.
If LOGRETAIN=No then then the logs get regenerated empty at every new
activation of the db.
If you have many logs in there, al you have to is deactivate the db
and reissue an activate command.
If there are still many logs, they will all be empty ssave for 2 pages
of 4k each.
If that is too many, then revisit the LOGPRIMARY value. That
determines the number of log files that get preallocated every time
you activate the db.

Hope this helps, Pierre.pedesin

Richard's Avatar
Richard
Guest
n/a Posts
August 2nd, 2008
11:45 PM
#4

Re: How to safely trim log space
On Aug 2, 4:28*pm, Pierre StJ <p.stjacq...@videotron.cawrote:
Quote:
On Aug 1, 11:27*am, Richard <RSL...@gmail.comwrote:
>
Quote:
Hi,

>
Quote:
We have a few development dbs version 8, but really doesnt matter,
that are non-recoverable ( LOGRETAIN OFF). *How do I trim the log
space ? *db2 get db cfg for MYDB | grep 'First active log files'
shows blank.
And there are tons of logfiles and filling diskspace.

>
Quote:
As a side note, most of our dbs we have LOGRETAIN=YES and I trim all
logfiles with numbers no less than the
first active logfile no. *Now with nonrecoverable dbs, how do I remove
logfiles safely since there's no active log no ?

>
Quote:
Your answer are most appreciated.

>
The logs in the log path are useless for recovery so there's no reason
to keep them.
If LOGRETAIN=No then then the logs get regenerated empty at every new
activation of the db.
If you have many logs in there, al *you have to is deactivate the db
and reissue an activate command.
If there are still many logs, they will all be empty ssave for 2 pages
of 4k each.
If that is too many, then revisit the LOGPRIMARY value. *That
determines the number of log files that get preallocated every time
you activate the db.
>
Hope this helps, * Pierre.pedesin


Thank you for your suggestions. That verifies I have a flaw in my
thinking. I CAN remove logfiles safely if file no if greater than
first active log. Actually I store them to our backup server, then
remove the inactive logs on the server. But for non-recoverable DBs
the whole of it ( primary + secondary ) logs are needed. There are no
safe log file numbers I can
remove is there ? Let say there is 100 logfiles from S0000000.LOG to
S0000099.LOG and if I assign logprimary=3, I can't say with certain
that I can delete logs S0000003...99
when db is idle thinking logs S00000,1,3 are primaries, and S000004 to
99 are secondaries. At any moment, DB2 can choose to use any of those
files. Correct ?
I can adjust the size of logfile pool by setting LOGPRIMARY and
LOGSECOND, but removing log files may compromised db integritiy. Yes
you might deactive and reactive db
that will trim the logs but not removing logs.

Confirm or Deny ?

 
Not the answer you were looking for? Post your question . . .
189,876 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
  • Didn't find the answer you were looking for?
    Post Your Question
  • Top Community Contributors