July 26, 2013 at 8:18 am
Is there a way to automatic log entry in sql server error log when a database is attached or detached or created or dropped. thnx
July 26, 2013 at 2:19 pm
goher2000 (7/26/2013)
Is there a way to automatic log entry in sql server error log when a database is attached or detached or created or dropped. thnx
Yes.
You can create a trigger "on all server" for events like create_database, drop_database then, you do whatever you want with the triggered event.
_____________________________________
Pablo (Paul) Berzukov
Author of Understanding Database Administration available at Amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.July 26, 2013 at 2:31 pm
Thanks - does the same works for attach / detach ?
July 26, 2013 at 2:57 pm
goher2000 (7/26/2013)
Thanks - does the same works for attach / detach ?
Databases are attached by using CREATE DATABASE blah blah blah FOR ATTACH so it should at least catch database attach.
I would suggest to test it, test both attaching/detaching via t-sql and the gui
_____________________________________
Pablo (Paul) Berzukov
Author of Understanding Database Administration available at Amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply