in reply to Re: How to open SQL 2005 errorlog?
in thread How to open SQL 2005 errorlog?
I did check the value of $ref->{log_open_error}. It is blank. And $sqlErrorLog does point to correct path and file name. Please see the sample below. From the output, we see it grabbed the first link of log for SQL 2000 error. For SQL 2005, however, it showed 'yp2'.
Sample script:
The output is:... # now open the errorlog file for scan unless (open(LOG, "$sqlErrorlog")) { $ref->{log_open_error} = "***Error: could not open $sqlErrorlo +g for read. "; $ref->{log_open_error} .= Win32::FormatMessage(Win32::GetLastE +rror); return $ref; } print "Error: $ref->{log_open_error}\n"; print "$sqlErrorlog\n"; # get the very first errorlog line. It has the version info. $_ = <LOG>; print "$_\n"; if (/^\s*([\d\/\-]+\s+[\d\:\.]+)\s+(?:kernel|Server|spid\d+)\s+(Micros +oft\s+SQL\s+Server.+)/i) { ($ref->{first_recorded_date}, $ref->{sql_version}) = ($1, $2 +); print " DT: $ref->{first_recorded_date}\n"; print " Version: $2\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How to open SQL 2005 errorlog?
by almut (Canon) on Jun 06, 2007 at 22:50 UTC | |
by jc7 (Initiate) on Jun 07, 2007 at 17:57 UTC | |
by almut (Canon) on Jun 07, 2007 at 20:53 UTC | |
by jc7 (Initiate) on Jun 08, 2007 at 20:50 UTC | |
by almut (Canon) on Jun 08, 2007 at 22:40 UTC | |
|