December 12, 2007 at 12:05 pm
Thanks a ton for all reply and thoughts.. 🙂
Does anyone have a way that you can check for space used of all the databases on a server without the use of sp_spaceused stored proc. This proc has a tendency to cause quite a bit of blocking and this information is needed during production hours. Dont care so much as to the space of each table but would love to be able to use this on the databases themselves. Also there is one caveat....has to work on all versions of SQL from 7 to 2k5.
Thanks again....
-D-
DHeath
December 12, 2007 at 3:13 pm
I have a couple of scripts I use weekly to monitor growth rates. Unfortunately, it's one script for 7/2000, one script for 2005. If you run the 2000 one on a 2005 server, you get quite different results.
You can use sp_spaceused per DB (doesn't return individual table stats)- something like:
exec sp_msforeachdb 'use ? exec sp_spaceused'
Not sure if the locking works out any differently.
I've attached the scripts I use. I think I pinched some of the code from sp_spaceused anyway, so the locking may work out the same. The output is a little more user-friendly than sp_spaceused.
MARCUS. Why dost thou laugh? It fits not with this hour.
TITUS. Why, I have not another tear to shed;
--Titus Andronicus, William Shakespeare
December 12, 2007 at 4:33 pm
thanks a lot.. much appreciated and will try the scripts you passed along...
Thanks again
DHeath
December 12, 2007 at 8:25 pm
hi,
I used the attached script to check space.
Regards
Ahmed
December 12, 2007 at 9:10 pm
Why do you need this during production hours? You should have enough space free in your database to last for some period of time, a month, 6, a year, something. You do not want to be running close to being out of space, especially during production hours.
Typically space used/free space is something you'd have shown once a day, calculated overnight.
December 12, 2007 at 9:40 pm
Its ran during production hours because this system i have will monitor over 140+ sql servers and these servers are worldwide. So if there is a problem and my support team is working on any particualr system then for us to get a quick "snapshot" of the server that is current..like within the past 2 minutes then we need accurate data and it must be ran at that time. As you know servers have problems at all times of the day :). Anyways the monitoring tool runs pretty much 24/7 on some server some where... and this is not just limited to SQL...(Oracle,informix,etc) also reside out there an those alone have there own count NOT included in the 140+ and totally different scripts as well. Tried to sum it up in a brief statement.. hopefully i did..
-D-
DHeath
December 12, 2007 at 11:18 pm
Just in case you dislike cursors as much as I... see attached...
--Jeff Moden
Change is inevitable... Change for the better is not.
December 14, 2007 at 9:28 am
How about 'setting execution context' instead of a 'use' statement:
exec sp_msforeachdb 'exec ?..sp_spaceused'
RegardsRudy KomacsarSenior Database Administrator"Ave Caesar! - Morituri te salutamus."
December 14, 2007 at 9:46 am
This script gives you a number of ways to analyze space usage on a server:
File Details
Total by Database and File
Total by Database and Filegroup
Total by Database and Filegroup Type
Total by Disk, Database, and Filepath
Total by Disk and Database
Total by Database
This script works for SQL 7, 2000, and 2005.
Get Server Database File Information
December 14, 2007 at 10:24 am
Thanks everyone.. much appreciated...
-D-
ssc comes thru again...as usual 😎
DHeath
December 14, 2007 at 10:37 am
Hi guys,
How to find out databases used as mirror (all time in restoring mode),
to be excluded from the scripts.
Thanks,
Ahmed
December 16, 2007 at 1:12 pm
You could add some logic utilising IF DATABASEPROPERTYEX([dbname], 'Status') = 'ONLINE'...
MARCUS. Why dost thou laugh? It fits not with this hour.
TITUS. Why, I have not another tear to shed;
--Titus Andronicus, William Shakespeare
Viewing 12 posts - 1 through 11 (of 11 total)
You must be logged in to reply to this topic. Login to reply