次の方法で共有


Steps to change the default location of SQL Server /SQL Server Agent - Error log files

 

Recently came across a customer scenario, wherein the 'ask' was to change the current location of SQL Server Errorlog files to a different location. Here’s a simple way to get this done:

Steps to change Location of SQL Svr Errorlog files

Step 1. First, identify the current location of SQL Server Errorlog files.

Refer my previous post on How to: Verify path for SQL Server Error Log Files

Step 2. For error log parameter "-e", change the current path to new location.

-e<New_Errorlog_location_here>\ERRORLOG

WARNING: Make sure that correct folder exists else consecutive attempt to start SQL Server service will fail with error “The request failed or the service did not respond in a timely fashion….”

Step 3. Re-cycle the SQL Server service for changes to take effect.

Step…

Steps to change Location of SQL Svr Agent Errorlog

Step 1. This is relatively simple and can be done using below code:

USE msdb
GO
EXEC msdb.dbo.sp_set_sqlagent_properties @errorlog_file=N'<New_Errorlog_Location>\SQLAGENT.OUT'
GO

Hope this helps!

Disclaimer: I work at Microsoft. Everything here, though, is my personal opinion and is not read or approved by Microsoft before it is posted. No warranties or other guarantees will be offered as to the quality of the opinions or anything else offered here.