Tuesday, April 10, 2012

DBCC ShrinkFile Empty File

DBCC ShrinkFile Empty File Option

Shrinks the data file or log file by specified percentage or empties the file by moving data into other file in the same file group.

DBCC Shrinkfile (Database_LogicalName, %of spaceto shrink)

DBCC Shrinkfile(kalyandb_log2, emptyfile) – Which will move the data into log2 file into other file and empties the current specified file. This file can be deleted by using Alter database remove file option.

Alter database database_name remove file kalyandb_log2 -- Removes file (But the file must be empty)

Select * from sys.database_files – which proivdes the complete information of the files which are associated with the current database.

No comments: