Solved

How To Track Changes in SQL 2005 databases?

Posted on 2011-09-28
6
172 Views
Last Modified: 2012-08-13
Hi all,
how to track the changes happening in database?

I have a database, some process is trying to change the recovery model to simple and set it back to full.

so, how to identify these kind of scenarios?
please help, Thanks!
0
Comment
Question by:msdba
6 Comments
 
LVL 21

Accepted Solution

by:
JestersGrind earned 250 total points
ID: 36718784
I would run a profiler trace to capture what is happening.  Does it always happen at a specific time or is it random?  Make sure that you capture the login name, starttime and the textdata columns.

Greg


0
 

Author Comment

by:msdba
ID: 36719071
Thanks for the comments, Is there any other way other than running profiler?
0
 
LVL 21

Assisted Solution

by:JestersGrind
JestersGrind earned 250 total points
ID: 36719203
When the recovery model is changed, I believe, something is written to the SQL Server log.  There maybe something in the Windows Application log too.  I'm not sure how much information is given though.

Greg

0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 25

Assisted Solution

by:TempDBA
TempDBA earned 125 total points
ID: 36813260
You can create a trigger on the server for alter database command

create Trigger ResetRecoveryMode
on all server
for ALTER_DATABASE
as
begin
declare @tsql nvarchar(max)
SELECT @tsql=EVENTDATA().value('(/EVENT_INSTANCE/TSQLCommand/CommandText)[1]','nvarchar(max)')
if(CHARINDEX('RECOVERY',@tsql)>0)--verify whether the user is altering the recovery model
print 'some body alter the database RECOVERY setting'
rollback --if find the user alter the recovery model,then rollback
--alter database AdventureWorks
--SET RECOVERY FULL
end


Ref: http://social.msdn.microsoft.com/Forums/en-US/sqlgetstarted/thread/24ab1c40-310d-4bae-95f3-891ecdf8fa4c/
0
 
LVL 75

Assisted Solution

by:Anthony Perkins
Anthony Perkins earned 125 total points
ID: 36895323
If this is a large corporation and you had SQL Server 2008 you could use Policy Based Management to prevent this from happening:
http://msdn.microsoft.com/en-us/library/bb510667.aspx:

A better approach is to control who/what has permission to ALTER the Recovery Model.
0
 

Author Closing Comment

by:msdba
ID: 36986285
Thanks 2 All for the valuable comments.
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you having speed problem in loading SQL Server Management Studio, try to uncheck these options in your internet browser (IE -> Internet Options / Advanced / Security):    . Check for publisher's certificate revocation    . Check for server ce…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question