|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Tuesday, May 14, 2013 12:38 PM
Points: 846,
Visits: 1,451
|
|
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,
A Democracy works great until the day you find yourself on the sheep side of a vote between 5 wolves and 4 sheep on what’s for dinner when neither have eaten in many days. A free Republic where the rights of the few and the individual are protected is the only one in which Freedom and Prosperity for all have a chance to blossom.
|
|
|
|
|
SSChampion
        
Group: General Forum Members
Last Login: 2 days ago @ 12:22 PM
Points: 10,571,
Visits: 11,871
|
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Tuesday, May 14, 2013 12:38 PM
Points: 846,
Visits: 1,451
|
|
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,
A Democracy works great until the day you find yourself on the sheep side of a vote between 5 wolves and 4 sheep on what’s for dinner when neither have eaten in many days. A free Republic where the rights of the few and the individual are protected is the only one in which Freedom and Prosperity for all have a chance to blossom.
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Tuesday, May 14, 2013 6:30 PM
Points: 38,
Visits: 382
|
|
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!
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Monday, April 08, 2013 4:51 AM
Points: 4,
Visits: 42
|
|
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, ...
|
|
|
|
|
SSChampion
        
Group: General Forum Members
Last Login: 2 days ago @ 12:22 PM
Points: 10,571,
Visits: 11,871
|
|
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
|
|
|
|
|
SSChampion
        
Group: General Forum Members
Last Login: 2 days ago @ 12:22 PM
Points: 10,571,
Visits: 11,871
|
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Tuesday, May 14, 2013 6:30 PM
Points: 38,
Visits: 382
|
|
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
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Tuesday, May 14, 2013 12:38 PM
Points: 846,
Visits: 1,451
|
|
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,
A Democracy works great until the day you find yourself on the sheep side of a vote between 5 wolves and 4 sheep on what’s for dinner when neither have eaten in many days. A free Republic where the rights of the few and the individual are protected is the only one in which Freedom and Prosperity for all have a chance to blossom.
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Tuesday, May 14, 2013 6:30 PM
Points: 38,
Visits: 382
|
|
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!
|
|
|
|