Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
Article Discussions
»
Article Discussions by Author
»
Discuss content posted by Roy Ernest
»
What, when and who? Auditing 101 - Part 2
15 posts, Page 1 of 2
1
2
»»
What, when and who? Auditing 101 - Part 2
Rate Topic
Display Mode
Topic Options
Author
Message
Roy Ernest
Roy Ernest
Posted Sunday, January 15, 2012 2:30 AM
Hall of Fame
Group: General Forum Members
Last Login: 2 days ago @ 7:52 AM
Points: 3,280,
Visits: 6,622
Comments posted to this topic are about the item
What, when and who? Auditing 101 - Part 2
-Roy
Post #1236252
lotusnotes
lotusnotes
Posted Monday, January 16, 2012 6:09 AM
SSC Rookie
Group: General Forum Members
Last Login: Thursday, April 18, 2013 9:17 AM
Points: 35,
Visits: 117
CDC is fine for tracking DATA but what about WHO changed it? I can't even seem to write a join query to show the changes to the data by who?
Back to audit triggers then, unless anyone can enlighten me.
Thanks
Post #1236551
Roy Ernest
Roy Ernest
Posted Monday, January 16, 2012 6:46 AM
Hall of Fame
Group: General Forum Members
Last Login: 2 days ago @ 7:52 AM
Points: 3,280,
Visits: 6,622
Who can be done by SQL Audit... I am half way through writing that article. That is the 3rd part of this series.
-Roy
Post #1236583
Jack Corbett
Jack Corbett
Posted Monday, January 16, 2012 7:49 AM
SSChampion
Group: General Forum Members
Last Login: Friday, May 17, 2013 12:22 PM
Points: 10,571,
Visits: 11,871
Nice article. One question, you mention that it would be a good idea to have the database in Snapshot Isolation mode, but you don't really give any details as to why? I'd really like to know why I should use snapshot isolation along with CDC.
Jack Corbett
Applications Developer
Don't let the good be the enemy of the best. --
Paul Fleming
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
How to Post Performance Problems
Crosstabs and Pivots or How to turn rows into columns Part 1
Crosstabs and Pivots or How to turn rows into columns Part 2
Post #1236629
Roy Ernest
Roy Ernest
Posted Monday, January 16, 2012 8:06 AM
Hall of Fame
Group: General Forum Members
Last Login: 2 days ago @ 7:52 AM
Points: 3,280,
Visits: 6,622
I gave a recommendation that for CDC to use Snapshot isolation due to two reason.
1. To make sure that there is no blocking caused when trying to get the LSN.
2. To make sure that you get the right LSN.
On a busy OLTP server, you are going to have high number of data changes and that means that the Max LSN will be changing at a very rapid rate. You want to make sure that the MAX LSN is the same through out the query you are using to retrieve the changes.
But it all depends on how you are retrieving the changes. There fore it is just a recommendation. It is not a must. I hope I was able to answer that question.
-Roy
Post #1236634
trevor.pinkney
trevor.pinkney
Posted Monday, January 16, 2012 9:23 AM
Forum Newbie
Group: General Forum Members
Last Login: Monday, January 07, 2013 11:47 AM
Points: 3,
Visits: 21
Hey Roy,
Looking forward to Part #3. I really think 'Who' changed the data or 'What Process' is critical when it comes to logging.
I wanted to let you know how my company handles auditing 'WHO' in the hopes you may 'speak to it' in your next article.
We use a table similar to "Product". In the stored procedures that change data in this table we force developers to specify a LogUserID and a LogProcessID. The LogUserID represents the person logged into the system that pressed the 'save button' or 'delete button' on the GUI or it may be a system user. The LogProcessID is used to indicate if the change was triggered by a Web Application, A Nightly 'Product Price Update' Job sql server job, a windows service, a web service etc.
PRODUCT TABLE SCHEMA
----------------------------------
ProductID
Description
Price
LogUserID
AppProcessID
DateTimeModified
DateTimeInserted
PRODUCT TABLE SCHEMA IN LOG DATABASE - A trigger inserts into a duplicate table
------------------------------------------
AuditID
Action
ProductID
Description
Price
LogUserID
AppProcessID
DateTimeModified
DateTimeInserted
Anyway - I am really curious about the 'Who' in part #3 and hope you can cover this scenario in your article.
Post #1236689
Roy Ernest
Roy Ernest
Posted Monday, January 16, 2012 10:45 AM
Hall of Fame
Group: General Forum Members
Last Login: 2 days ago @ 7:52 AM
Points: 3,280,
Visits: 6,622
Hey Trevor,
Half of the article is already done. That part covers the "who". I have to do some work on the article to cover writing to Event log. Once that is done, I will submit it for publication.
Your present idea works when you have a controlled system like that. It just wont store the data if the update or select is done using SSMS. SQL Audit will be able to catch that.
-Roy
Post #1236744
trevor.pinkney
trevor.pinkney
Posted Monday, January 16, 2012 12:32 PM
Forum Newbie
Group: General Forum Members
Last Login: Monday, January 07, 2013 11:47 AM
Points: 3,
Visits: 21
Hey Roy,
You are right. The current method we don't catch SSMS changes. There also isn't a way to "Force" developers to supply a LogUserID. In some cases when we troubleshoot the database will say it was "Roy" that made the change, but really it was a System User because the developer script didn't update the LogUserID column. It gets messy when we delete rows from a table. The first thing we have to do is update the LogUserID for the rows we delete. Then we delete them.
Looking forward to part 3.
-Trevor
Post #1236794
SQLRNNR
SQLRNNR
Posted Monday, January 16, 2012 12:50 PM
SSCoach
Group: General Forum Members
Last Login: Monday, May 20, 2013 1:07 PM
Points: 18,733,
Visits: 12,332
Nicely done Roy.
Jason
AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server 2008
SQL RNNR
Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #1236802
WayneS
WayneS
Posted Monday, January 16, 2012 2:27 PM
SSCertifiable
Group: General Forum Members
Last Login: Today @ 9:12 AM
Points: 6,370,
Visits: 8,235
Nice article Roy. Thanks!
Wayne
Microsoft Certified Master: SQL Server 2008
If you can't explain to another person how the code that you're copying from the internet works, then
DON'T USE IT
on a production system! After all,
you
will be the one supporting it!
Links:
For better assistance in answering your questions
,
How to ask a question
,
Performance Problems
,
Common date/time routines
,
CROSS-TABS and PIVOT tables Part 1
&
Part 2
,
Using APPLY Part 1
&
Part 2
,
Splitting Delimited Strings
Post #1236860
« Prev Topic
|
Next Topic »
15 posts, Page 1 of 2
1
2
»»
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.