Shrink DB

  • what is the process of shrink DB and shrink file ?

  • either\or not both

    Lookup DBCC SHRINKDATABASE and DBCC SHRINKFILE. You'll see this a million times on here, why do you want to shrink the database or its files?

    They'll likely only grow again and both operations are expensive.

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • Is this for a production db. If so I wouldn't shrink the db and there are considerations to take into account when shrinkung the logfile many people advise not to. is the db part of any log shipping?

    SQl 2005

    Shrink LOG

    USE database_name

    GO

    DBCC SHRINKFILE(2,1)

    BACKUP LOG database_name WITH TRUNCATE_ONLY

    DBCC SHRINKFILE(2,1)

    Make sure log file is file 2 first.

    Sql 2008

    USE <dbname>;

    GO

    DBCC SHRINKFILE (<logfile logicalname>.,100);

    GO

    I would back up the db straight after if it is in full recovery mode and you are backing up T-log files on a regular basis

  • Tanaji Chougale (10/9/2012)


    what is the process of shrink DB and shrink file ?

    Please refer the site fo rmore info....

    http://blogs.msdn.com/b/suhde/archive/2009/03/16/shrinking-the-transaction-log-files-in-sql-server.aspx

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply