Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2004
    Posts
    5

    Unanswered: dbcc shrink database

    Morning,

    Is there a specific command/clause in the DBCC SHRINKDATABASE command where I can force a database to release free space to the operating system ?

    Cheers,

    Duncan

  2. #2
    Join Date
    Jan 2003
    Location
    India
    Posts
    523
    Quote Originally Posted by Booth
    Morning,

    Is there a specific command/clause in the DBCC SHRINKDATABASE command where I can force a database to release free space to the operating system ?

    Cheers,

    Duncan
    yes . use TRUNCATEONLY.
    from BOL:

    TRUNCATEONLY

    Causes any unused space in the data files to be released to the operating system and shrinks the file to the last allocated extent, reducing the file size without moving any data. No attempt is made to relocate rows to unallocated pages. target_percent is ignored when TRUNCATEONLY is used.

  3. #3
    Join Date
    Mar 2004
    Posts
    114
    See BOL for it

    Code:
    DBCC SHRINKDATABASE ( database_name , TRUNCATEONLY )
    TRUNCATEONLY will reduce all free space until last extension allocated.
    Else, try
    Code:
    DBCC SHRINKDATABASE ( database_name , 1 )
    to release all less 1 percent

  4. #4
    Join Date
    Nov 2004
    Posts
    5
    Thanks fellas but I've tried both of those options and the database in question has automatically grabbed any existing space as free space. Both commands completed after only a few seconds.

    FYI - The database is set to autogrow but only in very small amounts. The database grabs far more free space.

    Is it worth turning off autogrow or is it possible that the database has been corrupted in some way ?

    Any ideas ?

Posting Permissions

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