none
Reclaim SQL server space after deleting document content from Database RRS feed

  • Question

  • Hi,

    We have deleted some document content from the Database. how to reclaim the SQL Server space.

    Thanks,


    Thursday, December 12, 2019 1:13 AM

All replies

  • If you want to reclaim the space and release to windows OS, you will need to shrink the database\file. it is highly recommend not to shrink the database. Please google about shrinking database, you can learn the reasons.

    Refer : https://littlekendra.com/2016/11/08/shrinking-sql-server-data-files-best-practices-and-why-it-sucks/

    If this is the case, you will need analyse the cost to benefit factor before shrinking the Db.

    Also, since you mentioned, document content, is that stored in the database or blobs with external reference?


    Hope it Helps!!

    Thursday, December 12, 2019 3:50 AM
  • If you delete lot of CLOB/BLOB data then you can use DBCC CLEANTABLE (Transact-SQL) to clean up the allocated space.

    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    Thursday, December 12, 2019 5:14 AM
    Moderator
  • Hi NJPA1234,

     

    >>We have deleted some document content from the Database. how to reclaim the SQL Server space.

     

    If you are deleting CLOB/BLOB data? Would you please try to reorganize the primary key index of the table:

     

    ALTER INDEX PK_MyTable on dbo.MyTable REORGANIZE

     

    And execute the below DBCC Command

     

    DBCC UPDATEUSAGE (0)

    GO

     

    Best regards,

    Dedmon Dai


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Friday, December 13, 2019 7:09 AM