The 开发者_运维知识库default SQL Server log directory is full on my C drive. How does one move the SQL Server error log default directory?
Use the SQL Configuration Manager
.
Here are the steps to change the startup to use a different directory. Once done restart server:
In SSMS
go to server properties and look for start up parameters. Right-click in object explorer, properties, then advanced
.
The path is the "e" switch. Change and restart.
It can't be set in documented SQL commands :-)
Basically, it's in the registry as one of the parameters to the sqlservr.exe binary when run as a windows service
When you use SSMS and click on generate script it creates T-SQL like this
USE [msdb]
GO
EXEC dbo.sp_set_sqlagent_properties @errorlog_file=N'C:MSSQL\Log\SQLAGENT.OUT'
GO
I just verified that it works, just make sure that the folder exist otherwise agent won't start
you probably also need to run this first, probably the proc above is disabled (by default)
EXEC master.dbo.sp_configure 'show advanced options', 1
RECONFIGURE
EXEC master.dbo.sp_configure 'Agent XPs', 1
RECONFIGURE
This is the best solution if you have made Typo when entering a new path. Can be confirmed with the registry setting: find
精彩评论