在新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下,將任何數據庫文件放置在磁盤根目錄下都有這個權限問題.