Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Who has accessed my 2005 server?


Who has accessed my 2005 server?

Author
Message
YSLGuru
YSLGuru
SSC Eights!
SSC Eights! (959 reputation)SSC Eights! (959 reputation)SSC Eights! (959 reputation)SSC Eights! (959 reputation)SSC Eights! (959 reputation)SSC Eights! (959 reputation)SSC Eights! (959 reputation)SSC Eights! (959 reputation)

Group: General Forum Members
Points: 959 Visits: 1659
Jack,

I just re-discovered this script, something I used a while back and I've hit an odd snag. Last time I see I posted that when i ran it I only got info from the last/most recent trc file. I just troed thsi again and darned if I'm not still having the same issue. I did check and the DB COmpatability for my MASTER DB is 2005 and I am using a 2005 server and yet the value of T.Path is the same for all rows retruned and that is the last trc file created. I checked and there are 5 trc files and 2 of those have todays date so I'm trying to figure out why I'm still getting just the last one.

Any thoiughts?

I'm gonna use this for some Login auditing checkjs because it looks like this is the only way in SQL 2005 to find out login auditing data. I can't believe that by 2005 the SQL Server product didn;t have some decent auditing abilities yet.

Thanks

Kindest Regards,

Just say No to Facebook!
Jack Corbett
  Jack Corbett
SSChampion
SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)

Group: General Forum Members
Points: 11014 Visits: 14858
If you are using the current version of the script you should be getting data from ALL the trace files. The T.path column will only return the path of the current file which is why there is a CASE statement setting up the first parameter in the call to fn_trace_gettable. T.path comes form the sys.traces table so it only has the current file name.



Jack Corbett

Applications Developer

Don't let the good be the enemy of the best. -- Paul Fleming
At best you can say that one job may be more secure than another, but total job security is an illusion. -- Rod at work

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
YSLGuru
YSLGuru
SSC Eights!
SSC Eights! (959 reputation)SSC Eights! (959 reputation)SSC Eights! (959 reputation)SSC Eights! (959 reputation)SSC Eights! (959 reputation)SSC Eights! (959 reputation)SSC Eights! (959 reputation)SSC Eights! (959 reputation)

Group: General Forum Members
Points: 959 Visits: 1659
Jack Corbett (12/22/2009)
If you are using the current version of the script you should be getting data from ALL the trace files. The T.path column will only return the path of the current file which is why there is a CASE statement setting up the first parameter in the call to fn_trace_gettable. T.path comes form the sys.traces table so it only has the current file name.



"yeaaaahhhhhh, I'm gonna need you to come in this wekedn, yeahhhh, both Saturday & sunday, uhh,huuu"

Right now I am figuratively banging my head and yelling "Idiot!" at myself.

Thanks. SOmetims its hard to see the data for the rows & columns

Kindest Regards,

Just say No to Facebook!
charlesd
charlesd
SSC Rookie
SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)

Group: General Forum Members
Points: 39 Visits: 468
The script is very useful. I know it was designed for SQL 2005, however it also seems to work on SQL 2008. I have tried it on several SQL 2008 servers successfully, but I am getting an error on one of them and I'm not sure exactly why. SQL Server would be running on a Windows 2008 R2 Virtual Server. Here is the error:
Server: Msg 567, Level 16, State 7, Line 1
File 'S:\Microsoft SQL Server\MSSQL.1\MSSQL\Data\MSSQL10.trc' either does not exist or is not a recognizable trace file. Or there was an error opening the file.
This is definitely a valid file on the server. I am able to open it directly with SQL Profiler, but not using the script from a query window in SSMS.

Thanks!



marie contencin
marie contencin
Forum Newbie
Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: General Forum Members
Points: 4 Visits: 126
Hi,
I do not like "NULL" value in results.
May I suggest this :

...
CASE
when S.type_desc is NULL then 'allowed via a Windows Group'
else S.type_desc
end as type_desc,
...
:-)
Jack Corbett
  Jack Corbett
SSChampion
SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)

Group: General Forum Members
Points: 11014 Visits: 14858
charlesd (4/2/2013)
The script is very useful. I know it was designed for SQL 2005, however it also seems to work on SQL 2008. I have tried it on several SQL 2008 servers successfully, but I am getting an error on one of them and I'm not sure exactly why. SQL Server would be running on a Windows 2008 R2 Virtual Server. Here is the error:
Server: Msg 567, Level 16, State 7, Line 1
File 'S:\Microsoft SQL Server\MSSQL.1\MSSQL\Data\MSSQL10.trc' either does not exist or is not a recognizable trace file. Or there was an error opening the file.
This is definitely a valid file on the server. I am able to open it directly with SQL Profiler, but not using the script from a query window in SSMS.

Thanks!


Charles,

Sorry for the delayed reply. This version of the script actually doesn't work on 2008 R2 because MS changed the path to the trace file a bit so the CASE that creates the path doesn't work correctly. Here's what you need to change for R2:


sys.fn_trace_gettable(CASE WHEN PATINDEX('%Log[_]%', path)<> 0
THEN LEFT(path, PATINDEX('%Log[_]%', path) + 2) +
'.trc'
ELSE T.[path]
END, T.max_files)





Jack Corbett

Applications Developer

Don't let the good be the enemy of the best. -- Paul Fleming
At best you can say that one job may be more secure than another, but total job security is an illusion. -- Rod at work

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
Jack Corbett
  Jack Corbett
SSChampion
SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)

Group: General Forum Members
Points: 11014 Visits: 14858
marie contencin (4/4/2013)
Hi,
I do not like "NULL" value in results.
May I suggest this :

...
CASE
when S.type_desc is NULL then 'allowed via a Windows Group'
else S.type_desc
end as type_desc,
...
:-)


Marie,

That's a nice little add, if you don't like the NULL's.



Jack Corbett

Applications Developer

Don't let the good be the enemy of the best. -- Paul Fleming
At best you can say that one job may be more secure than another, but total job security is an illusion. -- Rod at work

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
charlesd
charlesd
SSC Rookie
SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)

Group: General Forum Members
Points: 39 Visits: 468
Thanks for those suggestions, but I am getting a syntax error when I try to run them. Could you please send me the entire script with the change.

Thanks



YSLGuru
YSLGuru
SSC Eights!
SSC Eights! (959 reputation)SSC Eights! (959 reputation)SSC Eights! (959 reputation)SSC Eights! (959 reputation)SSC Eights! (959 reputation)SSC Eights! (959 reputation)SSC Eights! (959 reputation)SSC Eights! (959 reputation)

Group: General Forum Members
Points: 959 Visits: 1659
Jack Corbett (4/9/2013)
charlesd (4/2/2013)
The script is very useful. I know it was designed for SQL 2005, however it also seems to work on SQL 2008. I have tried it on several SQL 2008 servers successfully, but I am getting an error on one of them and I'm not sure exactly why. SQL Server would be running on a Windows 2008 R2 Virtual Server. Here is the error:
Server: Msg 567, Level 16, State 7, Line 1
File 'S:\Microsoft SQL Server\MSSQL.1\MSSQL\Data\MSSQL10.trc' either does not exist or is not a recognizable trace file. Or there was an error opening the file.
This is definitely a valid file on the server. I am able to open it directly with SQL Profiler, but not using the script from a query window in SSMS.

Thanks!


Charles,

Sorry for the delayed reply. This version of the script actually doesn't work on 2008 R2 because MS changed the path to the trace file a bit so the CASE that creates the path doesn't work correctly. Here's what you need to change for R2:


sys.fn_trace_gettable(CASE WHEN PATINDEX('%Log[_]%', path)<> 0
THEN LEFT(path, PATINDEX('%Log[_]%', path) + 2) +
'.trc'
ELSE T.[path]
END, T.max_files)



jack

Did you update the actual script as well for R2 or did you just make the changes in the posting?

Kindest Regards,

Just say No to Facebook!
charlesd
charlesd
SSC Rookie
SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)

Group: General Forum Members
Points: 39 Visits: 468
I found the error and was able to get the script to run on SQL Server 2008 R2. I needed to change every occurrence of 'path' to 'T.[path]'.

Thanks!



Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search