SQL SVR 2016 - 将系统数据库重新定位到不同的驱动器(无效目录错误消息 5121)

SQL SVR 2016 - 将系统数据库重新定位到不同的驱动器(无效目录错误消息 5121)

我刚刚安装了 SQL Server 2016,并尝试将系统数据库重新定位到计算机上的其他驱动器上。Drive:D我已运行以下命令,但始终出现相同的错误。我能想到的唯一问题是文件权限,我SQLSERVER的原始路径文件夹中有一个用户,我无法找到该用户并将其归属于新位置。我在 Google 上搜索过,所有帮助文章似乎都指定了相同的说明,主要是针对服务器 2008R2 和 2012,2016 是否更改了任何内容,导致其无法正常工作?

关注的链接:
https://docs.microsoft.com/en-us/sql/relational-databases/databases/move-system-databases
https://ask.sqlservercentral.com/questions/119177/need-to-move-tempdb-from-c-drive-to-g-drive.html

用户:在许多帮助文章中,他们列出了要添加到新位置的 SQL 实例用户,但我不认为 SQL SVR 2016 具有相同的用户,因为我在我的文件夹中看不到任何实例用户。

不过,我确实从磁盘 D 中删除了以下用户:Users/Everyone。

驱动器 D 上的文件夹权限:
管理员
系统
创建者所有者

查询语句:

ALTER DATABASE tempdb
    MODIFY FILE(NAME = 'tempdev', FILENAME = 'D:\MSSQL13.MSSQLSERVER\tempdb.mdf')

ALTER DATABASE tempdb
    MODIFY FILE(NAME = 'templog', FILENAME = 'D:\MSSQL13.MSSQLSERVER\templog.ldf')

ALTER DATABASE model
    MODIFY FILE(NAME = 'modeldev', FILENAME = 'D:\MSSQL13.MSSQLSERVER\model.mdf')

ALTER DATABASE model
    MODIFY FILE(NAME = 'modellog', FILENAME = 'D:\MSSQL13.MSSQLSERVER\modellog.ldf')

ALTER DATABASE msdb
    MODIFY FILE(NAME = 'MSDBData', FILENAME = 'D:\MSSQL13.MSSQLSERVER\MSDBData.mdf')

ALTER DATABASE msdb
    MODIFY FILE(NAME = 'MSDBLog', FILENAME = 'D:\MSSQL13.MSSQLSERVER\MSDBLog.ldf')

错误:

Msg 5121, Level 16, State 1, Line 5
The path specified by "D:\MSSQL13.MSSQLSERVER\tempdb.mdf" is not in a valid directory.
Msg 5121, Level 16, State 1, Line 8
The path specified by "D:\MSSQL13.MSSQLSERVER\templog.ldf" is not in a valid directory.
Msg 5121, Level 16, State 1, Line 11
The path specified by "D:\MSSQL13.MSSQLSERVER\model.mdf" is not in a valid directory.
Msg 5121, Level 16, State 1, Line 14
The path specified by "D:\MSSQL13.MSSQLSERVER\modellog.ldf" is not in a valid directory.
Msg 5121, Level 16, State 1, Line 17
The path specified by "D:\MSSQL13.MSSQLSERVER\MSDBData.mdf" is not in a valid directory.
Msg 5121, Level 16, State 1, Line 20
The path specified by "D:\MSSQL13.MSSQLSERVER\MSDBLog.ldf" is not in a valid directory.

答案1

目标文件夹权限中缺少 NT SERVICE\MSSQLSERVER...

相关内容