Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Truncate log


Truncate log

Author
Message
river1
river1
SSC Eights!
SSC Eights! (952 reputation)SSC Eights! (952 reputation)SSC Eights! (952 reputation)SSC Eights! (952 reputation)SSC Eights! (952 reputation)SSC Eights! (952 reputation)SSC Eights! (952 reputation)SSC Eights! (952 reputation)

Group: General Forum Members
Points: 952 Visits: 1357
Hi,

I have a database in SQL Server 2000.
This database is in full recovery model.

The log size is now of 10GB.

I have made a backup of the database (full backup) and i need to truncate the log, and then shrink it.


how can i truncate all the log from a database that is in full recovery model?


Thank you
Lynn Pettis
Lynn Pettis
SSC-Insane
SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)

Group: General Forum Members
Points: 24200 Visits: 37964
river-653653 (9/29/2009)
Hi,

I have a database in SQL Server 2000.
This database is in full recovery model.

The log size is now of 10GB.

I have made a backup of the database (full backup) and i need to truncate the log, and then shrink it.


how can i truncate all the log from a database that is in full recovery model?


Thank you



If your database is using the full recovery model, why don't you have regularly scheduled transaction log backups? Running scheduled transaction log backups will keep your transaction log file from continually growing. IF point in time recovery is not necessary, then I'd change your recovery model to simple.

How large is your database itself? I'd use this to help determine the initial size for your transaction log.


In SQL Server 2000, the simpliest way is BACKUP LOG WITH TRUNCATE_ONLY (hopefully that is correct, check BOL).

After you do that, you can use DBCC SHRINKFILE (again, look in BOL for more info).

Once that is done, run another full backup, and if you are leaving the database in full recovery, setup regularly scheduled transaction log backups to manage the size the transaction log.

Cool
Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
ps.
ps.
SSCrazy
SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)

Group: General Forum Members
Points: 2257 Visits: 3668
If you do not need point in time recovery (that's the reason u must have put the db in full recovery mode), why dont keep it in simple recovery mode?



Pradeep Singh
river1
river1
SSC Eights!
SSC Eights! (952 reputation)SSC Eights! (952 reputation)SSC Eights! (952 reputation)SSC Eights! (952 reputation)SSC Eights! (952 reputation)SSC Eights! (952 reputation)SSC Eights! (952 reputation)SSC Eights! (952 reputation)

Group: General Forum Members
Points: 952 Visits: 1357
My database as 430 MB in the data file and 10GB in the Log file.

I want to live the database in full recovery model, because i want to be able to do recovery in time.

I will do what you told me (truncate the log file, then shrink it) and then make another full backup to this database.


What does the backup log with_notruncate do exactly?

thank you
Steve Jones
Steve Jones
SSC-Dedicated
SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)

Group: Administrators
Points: 36118 Visits: 18744
If you want point in time recovery, you need to have log backups. Set them up, maybe once an hour to start, and keep all log backups since the most recent full. that way you can recover to a point in time.

A log backup will mark those transactions in the log as free, and the space can be reused. Note how big your log backups are, and then you can shrink the log to hold that much data, plus some pad. Likely your log is much bigger than it needs to be. However, a shrink should not be done regularly. Just for one-time events, like this, and use DBCC SHRINKFILE.

You can read about the backup command in books online to understand what the truncate does. Basically it's an emergency measure when you have filled the disk. If you haven't don't run it.

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
Lynn Pettis
Lynn Pettis
SSC-Insane
SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)

Group: General Forum Members
Points: 24200 Visits: 37964
river-653653 (9/29/2009)
My database as 430 MB in the data file and 10GB in the Log file.

I want to live the database in full recovery model, because i want to be able to do recovery in time.

I will do what you told me (truncate the log file, then shrink it) and then make another full backup to this database.


What does the backup log with_notruncate do exactly?

thank you


When you lookup DBCC SHRINKFILE, you will probaby want to shrink the transaction log to a size between 50 to 100 MB, that is about 10 to 20% the size of your database.

You also need to be sure to setup regularly scheduled transaction log backups between your full and differential backups. It is the regularly scheduled transaction og backups that will keep your transaction log from growing to 10 GB again, and will provide you with point in time recovery. If you don't have transaction log backups, you don't have the ability to performa point in time restore.

Please take the time to read BACKUP LOG in BOL. It will provide you with information regarding the options.

Cool
Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
GilaMonster
GilaMonster
SSC-Forever
SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)

Group: General Forum Members
Points: 47247 Visits: 44377
Please read through this - Managing Transaction Logs


Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


Lynn Pettis
Lynn Pettis
SSC-Insane
SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)

Group: General Forum Members
Points: 24200 Visits: 37964
GilaMonster (9/29/2009)
Please read through this - Managing Transaction Logs


Add I must that article to the library in my sig block.

Cool
Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
GilaMonster
GilaMonster
SSC-Forever
SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)

Group: General Forum Members
Points: 47247 Visits: 44377
Lynn Pettis (9/29/2009)
GilaMonster (9/29/2009)
Please read through this - Managing Transaction Logs


Add I must that article to the library in my sig block.


Much more and your sig will be larger than most of your posts. :-D ;-)


Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


Lynn Pettis
Lynn Pettis
SSC-Insane
SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)

Group: General Forum Members
Points: 24200 Visits: 37964
GilaMonster (9/29/2009)
Lynn Pettis (9/29/2009)
GilaMonster (9/29/2009)
Please read through this - Managing Transaction Logs


Add I must that article to the library in my sig block.


Much more and your sig will be larger than most of your posts. :-D ;-)


Handy though the links are...

Cool
Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search