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

本文介绍如何更改 SQL Server 错误日志及 SQL Server Agent 错误日志的位置,包括步骤详解及注意事项。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

今天早上同事让我将SQL Server的数据文件和系统文件迁移到存储上面,盘符等都修改,迁移数据文件和Mater/error log之后,将之前的磁盘从dependency中去掉,旧的盘OFFLIEN,然后做Failover测试发现SQL Agent没起来,突然想到SQL Agent也有路径要修改。当时已经不记得怎么改了,网上搜到下面这篇文章,希望以后带大家也有帮助。

 

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

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值