May 28, 2008 at 6:53 am
I have a job I've scripted to push to multiple SQL instances and any new ones that I build in the future. Due to the fact that some of these instances are clustered and some are standalone with various disk configurations I'd like to be able to alter the script to drop the job output file to the instance's error log folder. I'm having difficulty locating a script to return this value though and for that matter I'm not even sure if I can get to that value since it most likely resides in the Resource database, not master.
Any help is appreciated!
- Tim Ford, SQL Server MVPhttp://www.sqlcruise.comhttp://www.thesqlagentman.com http://www.linkedin.com/in/timothyford
May 28, 2008 at 6:58 am
What comes to mind is using xp_readerrorlog to get the log, then looking for the line that reads
Logging SQL Server messages in file 'D:\Somewhere\ERRORLOG'.
It seems to be there whether the current error log was created due to a service start or a cycle.
It's possible to get at the startup parameters (including the location of the errorlog) with SMO using the Microsoft.SqlServer.Management.Smo.Wmi namespace.
Third option is to read the startup parameter from the registry (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLServer\Parameters) (Path will differ for instances)
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply