who create new db or drop db

  • Is there a way that I can get an alert that a database is created or dropped and by who in all our sql servers?

    Thanks

  • Check the default trace. (nice articles here on the subject).

  • Thank you, can you point me a link to the article.

  • You know there's a search button top right on this page...

    http://www.sqlservercentral.com/articles/SQL+Server+2005/64547/

  • Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Thanks a lot

  • Thanks, the standard report has so many new features I haven't found. I guess thies is recorded by default trace.

    Thanks again

  • SQLMyFriend (5/4/2011)


    Thanks, the standard report has so many new features I haven't found. I guess thies is recorded by default trace.

    Thanks again

    yes it is.

  • I see the report of schema change history, I see our report is huge, I export to excel to do some filtering.

    If MS can add some filter on the report itself, that would be very helpful.

  • SQLMyFriend (5/4/2011)


    I see the report of schema change history, I see our report is huge, I export to excel to do some filtering.

    If MS can add some filter on the report itself, that would be very helpful.

    Post a thread on connect and propose the idea.

    Plan A would be the find the Rdl file in question, edit it to your needs and move on with it. I garantee it'll be faster that way (assuming you can edit those reports out)! :w00t:

  • You can create trigger for that -

    IF EXISTS (SELECT * FROM sys.server_triggers

    WHERE name = 'ddl_trig_database')

    DROP TRIGGER ddl_trig_database

    ON ALL SERVER;

    GO

    CREATE TRIGGER ddl_trig_database

    ON ALL SERVER

    FOR DROP_DATABASE

    AS

    PRINT 'Database Droped.'

    SELECT EVENTDATA().value('(/EVENT_INSTANCE/TSQLCommand/CommandText)[1]','nvarchar(max)')

    GO

    DROP TRIGGER ddl_trig_database

    ON ALL SERVER;

    GO

    -MJ
    Please do not print mails and docx unless it is absolutely necessary. Spread environmental awareness.

  • You can create trigger for that-

    IF EXISTS (SELECT * FROM sys.server_triggers

    WHERE name = 'ddl_trig_database')

    DROP TRIGGER ddl_trig_database

    ON ALL SERVER;

    GO

    CREATE TRIGGER ddl_trig_database

    ON ALL SERVER

    FOR DROP_DATABASE

    AS

    PRINT 'Database Droped.'

    SELECT EVENTDATA().value('(/EVENT_INSTANCE/TSQLCommand/CommandText)[1]','nvarchar(max)')

    GO

    DROP TRIGGER ddl_trig_database

    ON ALL SERVER;

    GO

    -MJ
    Please do not print mails and docx unless it is absolutely necessary. Spread environmental awareness.

Viewing 13 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic. Login to reply