SQL Server 2008: Shrink database files

1137475 pts.
Tags:
Database
SQL Server 2008
In SQL Server 2008, is there a way I can shrink my files (log and data) on all of my databases? I've already tried to use SSMS and right click each one but that's way too slow. Is there anything faster?
1

Answer Wiki

Thanks. We'll let you know when a new response is added.
To shrink database file execute the following t-sql query

DBCC SHRINKFILE(yourdb);
GO

to shrink database using sql server management studio you can take the help of this link: https://msdn.microsoft.com/en-us/library/ms189035.aspx 

to shrink log file execute the following t-sql query

DBCC SHRINKFILE(yourdb_log);
GO

To shrink transaction log file using sql server management studio you can take the help of this link: http://www.sqlserverlogexplorer.com/shrink-transaction-file/  

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: