A fast way to get a quick look at all the log sizes and space used in a real time fashion.
The log watcher is only 3 small files (cklog.sql, cklog.cmd, sleep.exe) and a fast way to get a quick look at all the log sizes and space used in a real time fashion.
Sleep.exe must be in the working directory.
Take this script for example cklog.sql.
This method will bring you back a nicely formatted result set called from OSQL in a shell window. You could easily add a where clause and exclude specified databases. [ WHERE DBName Not IN (msdb,model)]
set nocount on
DECLARE @sql_command varchar(255)
CREATE TABLE #TempForLogSpace
[LogSize (MB)] int,
[LogSpaceUsed (%)] int,
SELECT @sql_command = 'dbcc sqlperf (logspace)'
SELECT * FROM #TempForLogSpace
DROP TABLE #TempForLogSpace
Take this file for example cklog.cmd.
This script will reference spleep.exe (resource kit) to initialize the script every 11 seconds calling cklog.sql.
Also note the path to the cklog.sql file
echo %%%%!!!!!!!!!!![SERVERNAME] LOGSTATS !!!!!!!!!!%%%%
OSQL -U[login] -P[password] -S[servername]-a -n -iC:\Monitor\cklog.sql
Like the one posted before, the use of the SP is like this: proc_alerts 1,18. This will show the first 18 alerts on the system. OR proc_alerts 20,35 will show from 20 to 35. This lets you manage the list without letting go out of the screen.
If you are using OSQL or ISQL from DOS querys are really hard to use, because the result is to big for the screen. With this procedure, you can especify from wich column to wich column show the list of tables. For Example: proc_tables master, 3, 10 will show you only a short list of […]
Now you can run administrative T-SQL tasks against all your databases in one shot. Very usefull for environments that have a seperate database for each client, ASP's, etc. It's pretty straight forward and can be used for almost any task. This example Looks for a table and prints the database name and selects from the […]
Ever forget to commit a transaction and then find out hours later that there is deadlocked transactions all over your database server? Worse yet has one of your coworkers done this to your database server? Never again, this stored procedure will net send the machine that has an open transaction, and send you (The DBA) […]