October 21, 2009

Sql Server : Shrink Database

-- Sql Server 2000
1 -
dbcc shrinkfile(dbName_log,1)
Go
2 -
BACKUP LOG dbName WITH TRUNCATE_ONLY
Go
3 -
select * from sysfiles
OR
-- File sixe in MB.
SELECT name, size*8192/(1024*1024) AS sizeInMB , * FROM sysfiles


--- Sql Server 2008

Alter Database Test Set Recovery Simple
GO

Alter Database Test Set Recovery Full
GO

DBCC SHRINKFILE ('Test_log', 1)
GO
Note: Test is a database name.

No comments:

Post a Comment