Notifying DBAs of New SharePoint Databases

In our production environment, the Database Administrators like to know when a new database is created or dropped. As well they should.  They normally use a DDL trigger to send out an email when one of these events occurs.  The problem we ran into was that in Windows SharePoint Services 3 (WSS3/SharePoint 2007), the trigger broke SharePoint’s ability to create new content databases!  Perhaps the account that ran the procedure didn’t have enough rights to run sp_send_dbmail, but we don’t know for sure.  If you know why, tell everyone in the comments.

The way we fixed it was to, instead, create a nightly agent job on the SQL Server that just looked for new database records in sys.databases.

SELECT name, create_date
FROM sys.databases
order by create_date desc

Just add a WHERE clause that filters the databases based on how often you run your job. If any databases exist since the last time you ran the job, send out an email.

0 Comments

Leave a Reply