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)

usp_ShrinkAllLogs

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).

Brandon_Forest@sbcglobal.net

Swim to Live, Live to Surf.

 

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

Find Database Recovery Mode

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

FORUM

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

FORUM

Database Disaster Recovery

Database in Recovery Mode

FORUM

Database is in recovery status.

Database is in recovery status.

FORUM

Database Recovery Help

Database Recovery Help

Tags
logs    
sql server 2008    
truncate table    
 
Contribute

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
Editor, SQLServerCentral.com

Already a member? Jump in:

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