Re: Creating a T-SQL Stored Procedure to Truncate and Shrink ALL Log Files

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Steven Durfey (s_durfey_at_hotmail.com)
Date: 03/03/04


Date: 3 Mar 2004 08:08:36 -0800

Rich

I suggest you setup a SQL 2000 Agent Job executing the following TSQL
command:
DBCC SHRINKFILE(2, TRUNCATEONLY)
on the DB(s) in question. Set it to run off hours, the "2" should be
for the
Log(LDF) file, a "1" should be the for MDF file.

I'm still waiting myself to see a script that will parse thru the DBs
on a server and build the DBCC above for every DB.

good luck

Steven



Relevant Pages

  • Re: SQL 2005 --> Replicate Production DB to Development DB
    ... The DBCC CHECKIDENT command now ... SQL2005 SP2 fixes a DBCC CHECKIDENT bug with the exact symtoms that you ... We are using push replication so it looks like I will have to execute the ...
    (microsoft.public.sqlserver.replication)
  • FWD: RE: [dbi] RE: succint view of problem - getting results from DBCC INDEXDEFRAG - DBD::ODBC
    ... Subject: [dbi] RE: succint view of problem - getting results from DBCC ... ** command: ... If DBCC printed error messages, ...
    (perl.dbi.users)
  • Re: How to deny DBCC SQLPERF(logspace)
    ... DBCC statements that act as Database Console Commands for Microsoft? ... I know that if we can find the place where the permissions of each DBCC ... command stored, we can update the table directly to change the permissions. ...
    (microsoft.public.sqlserver.security)
  • Re: SQL 2005 --> Replicate Production DB to Development DB
    ... We are using push replication so it looks like I will have to execute the ... But I am having problems with the 'DBCC CHECIDENT' command. ... Consider the following .pre file generated from the snapshot agent ...
    (microsoft.public.sqlserver.replication)
  • Re: DBCC error 913
    ... Then I run the command sp_dboption dbname,'Single user',true also. ... this command runs inside a cursor and DBCC checkdb commands starts after that. ... >> This is simple DBCC script I am running on the server every sunday. ... >> database is online and in live. ...
    (microsoft.public.sqlserver.server)