Sqlserver计算机改名问题

1、登录显示历史记录

SQL Server Management Studio登录历史记录清除:

首先关闭SQL Server Management 软件

打开用户文件目录

C:\Users\Administrator\AppData\Roaming\Microsoft\SQL Server Management Studio\19.0

删除UserSettings.xml

2、修改SQL Server 实例的名称

新建查询输入:

EXEC sp_dropserver '旧服务器名称';
EXEC sp_addserver '新服务器名称', 'local';

重新启动 SQL Server 和 SQL Server 代理服务

安全性—>登录名 右击旧服务器名称重命名

然后,重起数据库服务,这时再执行

select @@servername

3、维护计划及代理作业删除

新建的SqlServer维护计划想要删除时删不掉的问题

先执行下面的语句将维护计划的ID查出。

select * from sysmaintplan_plans

将查出的ID填入到下面几句话中的”中,并执行。

delete from sysmaintplan_log where plan_id = ''
delete from sysmaintplan_subplans where plan_id = ''
delete from sysmaintplan_plans where id = ''

在Sql Agent中删除相应的代理作业和维护计划