Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Truncating Transaction Log

Author  Topic 

ninel
Posting Yak Master

141 Posts

Posted - 2006-11-16 : 11:29:22
The database is transactional and I don't mind truncating the older transactions as we have it all backed up but I don't want to truncate recent transactions in the log.

So can you delete lets say transactions in the log that are older than 3 months?

Thanks,
Ninel

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-11-16 : 11:53:14
make a full backup every week or so that will empty the transaction log.



Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-11-16 : 13:28:48
I'm missing something here ...

"we have it all backed up"

in which case there shouldn't be and pending transactions. Can you explain this in some more detail pls?

Kristen
Go to Top of Page

ninel
Posting Yak Master

141 Posts

Posted - 2006-11-16 : 13:39:47
I'm referring to database_log file. Right now its about 1.6 gigs. I don't want to delete data from the tables.

The logs eat up a lot of space. We're running out of space on our server and my manager wants us to truncate the logs.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-11-16 : 14:00:22
If your database is using FULL Recovery Model and you are NOT making Transaction Log Backups then it will grow forever.

If that's the case you need to introduce Transaction Log Backups. These will backup the Tlog, and then that space in the Tlogs is available for reuse.

Once you've got that in place you may want to do a one-time Shrink to get the files back to a sensible size, but thereafter let them re-establish an equilibrium size - rather than using Shrink as a database-management tool!

For more information:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=55210&SearchTerms=Why%20is%20my%20LDF%20Log%20File%20so%20big,Database%20Shrinking,Shrink,Shrinking

Kristen
Go to Top of Page

ninel
Posting Yak Master

141 Posts

Posted - 2006-11-16 : 14:16:00
But can I use the shrink or any other function to reduce the transaction log of data thats older than X amoutn of months?
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-11-16 : 15:37:55
I have to restrain myself here ....

... you want to change the way SQL server works to suit you? You have a better plan than the SQL Server development team? You want to change the behaviour of SQL Server to just keep "some" of the transaction in its log file? What the heck for?

Just make the Transaction Log backups and move on ...

If you want some auditing capability (which I seriously doubt that Transaction logs gives you, then instigate some Triggers and record the data changes in a format which you CAN report on. Easily. Have you tried looking at Transaction Log dumps as a means of working out what changed when and who was responsible? If that is a Business Case Need that you have then my advice would be to build a system that delivers that data & reporting ability to your users - and not hamstring the DBAs with reverse engineering logs to get management the data they THINK they need all of a sudden!

Kristen
Go to Top of Page

ninel
Posting Yak Master

141 Posts

Posted - 2006-11-16 : 15:45:22
Ok..... It was just a question.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-11-16 : 15:49:25
Well you've asked it twice, and I've answered it twice. Best I can do I'm afraid, someone smarter than me may have a better answer, but my advice stands: if you are in the land of SQL Server then do it the SQL-Server-way - I'm happy to try to answer any questions you may have trying to grapple with the implementation of that; Good luck!

Kristen
Go to Top of Page
   

- Advertisement -