Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)


By Banyardi Schmardi,

This is an update to my previous script usp_ShrinkDBLogs.

The first script records the recovery mode of the database, changes it to simple, does a DBCC Shrinkdatabase, and then returns the recovery to the recorded mode. As before, you can use this script with a database name as the input parameter for a single database, or no parameters for all the databases.

The second script usp_Call_ShrinkAllLogs_Metrics, will call usp_ShrinkDBLogs and track both the recovery type and database size on disk from before and after the Shrink.

Note: Once this script has been run, full database backup(s) must be made to reinitialize the transaction Log Sequence Number (LSN).

Swim to Live, Live to Surf.


Total article views: 929 | Views in the last 30 days: 2
Related Articles

Find Database Recovery Mode

The scripts provided below will show you the "Recovery Mode (Model)" for any given database


script to find all databases ,which are not in full recovery mode

jacky-script to find all databases ,which are not in full recovery mode


Database Disaster Recovery

Database in Recovery Mode


Database is in recovery status.

Database is in recovery status.


Database Recovery Help

Database Recovery Help

sql server 2008    
truncate table    

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones