March 22, 2007 at 11:36 am
I'm looking to create an alert to let me know when anyone creates a database on one of my SQL 2000 boxes but I can;t seem to find an easy way to do it. There seems to be specific ways of doing this in SQL 2005 but not 2000. Any ideas? I could create a table with all the databases and run periodic checks of all current databases against it but I was looking for a slightly better way.
cheers
March 22, 2007 at 11:40 am
I really should read other posts before sticking my own up! Just read Log - Creation of objects......
March 23, 2007 at 6:05 am
you can also save a copy of sysdatabases to a table, and schedule a job to compare that table to the current sysdatabases to compare changes....same thing at the database level. ..sysobjects for new/changed tables.
Lowell
March 23, 2007 at 6:42 am
I also needed something similar. All I did is to schedule a job that runs periodically that will get a count(*) of sysdatabases and compare it against the current count. An email is automatically sent to me if the count changes.
March 23, 2007 at 7:06 am
same here...in my case, developers were dropping and recreating databases all the time, just needed to be aware of it really; so i had to save the previous data and do a left join, to see if the dbid changed, and other data like that.
Lowell
March 25, 2007 at 10:56 pm
The easiest (and most evil) way to know when someone wants to drop or create a database in SQL 2000 is to deny drop database and create database permissions to everyone except you. Then believe me that you will know right away when someone tries to drop or create a database because they'll come yelling at you!!!
March 26, 2007 at 8:37 am
I definitely like Robert's approach.
I used to do this with objects by making my own DB, then storing a copy of sp_configure and sysobjects for each db. Then I'd have a job that would grab a new copy and compare it to the old one. If there were differences, it sent me a note.
March 26, 2007 at 10:14 am
I have never yet been at a client that didn't have at least a half-dozen people with SA priviledges, so that (locking out db create permission) wouldn't work in any shop I have been in! 🙂 Numerous shops I have consulted at have EVERYTHING/EVERY APP log in as sa!!
Best,
Kevin G. Boles
SQL Server Consultant
SQL MVP 2007-2012
TheSQLGuru on googles mail service
March 26, 2007 at 11:40 am
Creation of databases is always reserved for the sa or someone in the sysadmin fixed role. Since this is a development situation as opposed to production the scenario changes a bit. Unless youir shop is super security concious all of the developers will generally be in the db_owner fixed riole for their given databases. This allows them to truncate tables and the transaction log, two very important functions in a development environment that need not be on the DBAs plate. However there is one drawback to being db_owner - your developers can drop their database. Don't ask why, but I have seen developers drop their database (without backing it up) and expected the ability to recreate the database themselves and have the DBA restore their data !
RegardsRudy KomacsarSenior Database Administrator"Ave Caesar! - Morituri te salutamus."
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply