Knowledge Base : Glossary : Suggest a Question
Search The Knowledge Base
Browse The Knowledge Base
Knowledge Base : General : SQLServer

To shrink database [mdf and ldf]

Hi there,

we can use dbmaintaintool for DE to compress the database], following queries can be used for any SQL database

USE DATABASENAME
go
BACKUP LOG DATABASENAME WITH TRUNCATE_ONLY
go
DBCC SHRINKFILE (DATABASENAME_LOG,2)
go
DBCC SHRINKFILE ('DATABASENAME' , 0, TRUNCATEONLY)
go
DBCC SHRINKDATABASE ('DATABASENAME')
go


Thanks
ElanGovan Panchatcharam

Related Articles
There are no related articles


Viewer Comments Add Comment
No viewers have posted comments

Powered By AutoKB