Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
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: 935 | 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