在新UAT服务器上,需要将tempdb放置在SSD(固态硬盘)上。由于SSD(固态硬盘)特性,所以tempdb的文件只能放置在D盘下面,而不能是D盘下的某一个目录下面。
ALTER DATABASE tempdb
MODIFY FILE(name='tempdev', filename='D:\tempdb.mdf') ;
GO
ALTER DATABASE tempdb
MODIFY FILE(name='templog', filename='D:\templog.ldf') ;
GO
修改了tempdb的目录后,重启数据库服务,结果出现错误信息:“FCB::Open failed: Could not open file D:\tempdb.mdf for file number 1. OS error: 2(The system cannot find the file specified.)" ,具体错误信息如下所示:
2015-05-27 ;11:56:44.88 spid9s The resource database build version is 12.00.2000. This is an informational message only. No user action is required.
2015-05-27 ;11:56:45.49 spid9s Starting up database 'model'.
2015-05-27 ;11:56:45.67 Server The SQL Server Network Interface library successfully registered the Service Principal Name (SPN) [ MSSQLSvc/GEK-MIS01UAT.gfg1.esquel.com ] for the SQL Server service.
2015-05-27 ;11:56:45.67 Server The SQL Server Network Interface library successfully registered the Service Principal Name (SPN) [ MSSQLSvc/GEK-MIS01UAT.gfg1.esquel.com:1433 ] for the SQL Server service.
2015-05-27 ;11:56:45.83 spid9s Clearing tempdb database.
2015-05-27 ;11:56:45.84 spid9s Error: 5123, Severity: 16, State: 1.
2015-05-27 ;11:56:45.84 spid9s CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file 'D:\tempdb.mdf'.
2015-05-27 ;11:56:45.94 spid9s Error: 17204, Severity: 16, State: 1.
2015-05-27 ;11:56:45.94 spid9s FCB::Open failed: Could not open file D:\tempdb.mdf for file number 1. OS error: 2(The system cannot find the file specified.).
2015-05-27 ;11:56:45.94 spid9s Error: 5120, Severity: 16, State: 101.
2015-05-27 ;11:56:45.94 spid9s Unable to open the physical file "D:\tempdb.mdf". Operating system error 2: "2(The system cannot find the file specified.)".
2015-05-27 ;11:56:45.94 spid9s Error: 1802, Severity: 16, State: 4.
2015-05-27 ;11:56:45.94 spid9s CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
2015-05-27 ;11:56:45.94 spid9s Could not create tempdb. You may not have enough disk space available. Free additional disk space by deleting other files on the tempdb drive and then restart SQL Server. Check for additional errors in the event log that may indicate why the tempdb files could not be initialized.
2015-05-27 ;11:56:45.94 spid9s SQL Trace was stopped due to server shutdown. Trace ID = '1'. This is an informational message only; no user action is required.
2015-05-27 ;11:56:46.20 spid16s The SQL Server Network Interface library could not deregister the Service Principal Name (SPN) [ MSSQLSvc/xxxx.xxxx.xxxx.com ] for the SQL Server service. Error: 0x2af9, state: 61. Administrator should deregister this SPN manually to avoid client authentication errors.
2015-05-27 11:56:46.20 spid16s The SQL Server Network Interface library could not deregister the Service Principal Name (SPN) [ MSSQLSvc/xxxx.xxx.xxxx.com:1433 ] for the SQL Server service. Error: 0x2af9, state: 61. Administrator should deregister this SPN manually to avoid client authentication errors.
我猜测是系统权限问题导致,于是我右键单击D盘的属性选项,在”Security“里面找到Users(xxxx\Users),授予用户”Full Control“权限,然后重启数据库实例,问题解决。我后面测试了一下,其实在Windows Server 2012下,将任何数据库文件放置在磁盘根目录下都有这个权限问题.