+ Post New Thread
Results 1 to 3 of 3
How do you do....it? Thread, how to shrink an ldf file in Technical; hi how to shrink an ldf file in sql server 2008? one of my db ldf file is 68GB any ...
  1. #1
    ful56_uk's Avatar
    Join Date
    Mar 2008
    Location
    Essex
    Posts
    554
    Thank Post
    105
    Thanked 23 Times in 21 Posts
    Rep Power
    18

    how to shrink an ldf file

    hi

    how to shrink an ldf file in sql server 2008? one of my db ldf file is 68GB any way to reduce this?

  2. #2

    TechMonkey's Avatar
    Join Date
    Dec 2005
    Location
    South East
    Posts
    3,287
    Thank Post
    225
    Thanked 405 Times in 302 Posts
    Rep Power
    162
    there is a script to do it but I don't have it to hand right this sec. I'll hunt it down.

  3. #3

    TechMonkey's Avatar
    Join Date
    Dec 2005
    Location
    South East
    Posts
    3,287
    Thank Post
    225
    Thanked 405 Times in 302 Posts
    Rep Power
    162
    Found it

    Batch File:
    Code:
    @echo off
    if .%1==. goto DisplayUsage
    if .%2==. goto DisplayUsage
    echo shrinking log file for database %2
    echo.
    echo backup log %2 with no_log      >  "%temp%\shrink.sql"
    echo dbcc shrinkdatabase (%2, 0)    >>  "%temp%\shrink.sql"
    echo.                               >>  "%temp%\shrink.sql"
    echo.
    osql -S %1 -d %2 -Usa -P -n -i"%temp%\shrink.sql"
    echo.
    goto Exit
    :DisplayUsage
    echo Shink the log file of a SQL Database v1.00
    echo.
    echo Usage:  ShrinkDBLog <your server name>\SIMS sims
    echo.
    echo Where:
    echo    Server\Instance        is the SQL Server and the SQL Server Instance if one is present
    echo    DatabaseName  SQL database name to shrink, eg sims
    echo.
    echo Examples:
    echo     ShrinkDBLog AdminPC\SIMS sims
    echo     ShrinkDBLog AnotherPC sims
    echo.
    pause
    :Exit
    Readme
    Code:
    1. Edit the batch file (ShrinkDBLog.bat) by adding the SA password after -P in the OSQL command line :
    
    e.g. -Ppassword
    
    2. Run the batch file from the command prompt using the following command (where <dbname> is the appropriate database [sims or ccsfms]) :
    
    shrinkdblog <servername>\escc <dbname>
    
    e.g. shrinkdblog server3\escc sims

SHARE:
+ Post New Thread

Similar Threads

  1. Very large Citrix XenAPPRMS_log.ldf
    By cookie_monster in forum Thin Client and Virtual Machines
    Replies: 3
    Last Post: 13th May 2010, 12:00 PM
  2. [MS Office - 2007] .docx file size bloat when printing file with multiple pictures.
    By pete in forum Office Software
    Replies: 5
    Last Post: 29th April 2010, 10:03 AM
  3. Xibo - Shrink whole website in a window?
    By reggiep in forum AV and Multimedia Related
    Replies: 1
    Last Post: 8th February 2010, 01:21 PM
  4. [SIMS] LDF growing very quickly
    By rhyds in forum MIS Systems
    Replies: 6
    Last Post: 27th February 2008, 02:47 PM
  5. [SIMS] sims ldf file nearly 17 gig
    By edie209 in forum MIS Systems
    Replies: 11
    Last Post: 22nd November 2007, 10:30 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •