开发者

How to track deleted database

Suppose my sql server 2008 with username(sa) and password(testpass),with a instance(mypc).

i am having two computer name system1 and system2. If i am deleting the any database then

how can i track from which system this desir开发者_Go百科ed database is deleted.


You can set up a server audit to monitor all CREATE/ALTER/DROP DATABASE events.

CREATE SERVER AUDIT [DatabaseChanges]
    TO APPLICATION_LOG;

CREATE SERVER AUDIT SPECIFICATION [DatabaseChangesSpec]
FOR SERVER AUDIT [DatabaseChanges]
    ADD (DATABASE_CHANGE_GROUP);


Interesting question, I've never run into this type of scenario before. What problem are you trying to solve?

You could monitor the filesystem where the database files are stored. Perhaps a command line application, or Windows service. When it detected database files to be deleted, you would then know.

Alternatively, from the client connection, you could try to connect to the database. If the login succeeded but database schema was not found, you could assume that the database had been deleted.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜