jc7 has asked for the wisdom of the Perl Monks concerning the following question:
sub scanSQLErrorlog { …… # now open the errorlog file for scan: unless (open(LOG, "$sqlErrorlog")) { $ref->{log_open_error} = "***Error: could not open $sqlErrorlog for re +ad. "; $ref->{log_open_error} .= Win32::FormatMessage(Win32::GetLastError); return $ref; } # get the very first errorlog line. It has the version info: $_ = <LOG>; if (/^\s*(\d\/\-+\s+\d\:\.+)\s+(?:kernel|Server|spid\d+)\s+(Microsoft\ +s+SQL\s+Server.+)/i) { ($ref->{first_recorded_date}, $ref->{sql_version}) = ($1, $2); } …… }
The first line of SQL server 2000 error log is like:
2007-05-30 08:29:03.17 server Microsoft SQL Server 2000 - 8.00.2040 (I +ntel X86)
After running the script,
$ref->{first_recorded_date} has “2007-05-30 08:29:03.17”
$ref->{sql_version} has “Microsoft SQL Server 2000 - 8.00.2040 (Intel X86)”
The first line of SQL server 2005 error log is like:
2007-05-30 15:49:21.56 Server Microsoft SQL Server 2005 - 9.00.305 +4.00 (Intel X86)
After running the script,
$ref->{first_recorded_date} has nothing.
$ref->{sql_version} has nothing.
It does not grab anything from the log of SQL 2005. There is no error message either.
Edit: g0n - code tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to open SQL 2005 errorlog?
by almut (Canon) on Jun 06, 2007 at 20:08 UTC | |
by Anonymous Monk on Jun 06, 2007 at 21:24 UTC | |
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 | |
|