Thứ Hai, 12 tháng 12, 2011

Script to shrink a database non used space

HOW To SHRINK a Database?
SQL Script to shrink a non used space from a database
-- ***********************************************************************************/
-- Description  :    SQL Script to shrink a non used space from a database
-- Compatibility  :     7.0+
-- This Script should be executed in master
-- ***********************************************************************************/
DBCC shrinkdatabase ( <database name>, <target_percent>)
go
Where

  • database_name Is the name of the database to be shrunk. If 0 is specified, the current database is used.
  • target_percent, is the percentage of free space that you want left in the database file after the database has been shrunk.
OUTPUT
In above example, you see the result only for those database files, which are being shrunk, or in other words SQL Server does not display rows for those files which are not shrunk.

Không có nhận xét nào:

Đăng nhận xét