Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««1234»»

Who has accessed my 2005 server? Expand / Collapse
Author
Message
Posted Monday, December 21, 2009 5:17 PM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Thursday, December 4, 2014 10:11 AM
Points: 892, Visits: 1,560
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!
Post #837665
Posted Tuesday, December 22, 2009 5:50 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Thursday, December 18, 2014 8:26 AM
Points: 10,381, Visits: 13,436
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

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 #838330
Posted Wednesday, January 20, 2010 12:03 PM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Thursday, December 4, 2014 10:11 AM
Points: 892, Visits: 1,560
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!
Post #850732
Posted Tuesday, April 2, 2013 8:27 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, December 17, 2014 5:59 AM
Points: 39, Visits: 432
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!



Post #1437927
Posted Thursday, April 4, 2013 3:56 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, December 8, 2014 6:24 AM
Points: 4, Visits: 87
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,
...
Post #1438705
Posted Tuesday, April 9, 2013 7:40 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Thursday, December 18, 2014 8:26 AM
Points: 10,381, Visits: 13,436
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

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 #1440319
Posted Tuesday, April 9, 2013 7:41 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Thursday, December 18, 2014 8:26 AM
Points: 10,381, Visits: 13,436
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

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 #1440320
Posted Tuesday, April 9, 2013 8:45 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, December 17, 2014 5:59 AM
Points: 39, Visits: 432
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



Post #1440381
Posted Tuesday, April 9, 2013 9:07 AM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Thursday, December 4, 2014 10:11 AM
Points: 892, Visits: 1,560
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!
Post #1440407
Posted Tuesday, April 9, 2013 9:13 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, December 17, 2014 5:59 AM
Points: 39, Visits: 432
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!



Post #1440415
« Prev Topic | Next Topic »

Add to briefcase «««1234»»

Permissions Expand / Collapse