2010-07-27 235 views
0

從我的託管帳戶備份數據庫。使用以下腳本進行恢復。sql server還原數據庫

RESTORE DATABASE [XYZ] 
FROM DISK = N'E:\Online Website Backup\_db_backups\XYZ.bak' 
WITH FILE = 1, MOVE N'XYZ' TO N'C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\XYZ.mdf', 
MOVE N'XYZ_log' TO N'C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\XYZ.LDF', 
MOVE N'sysft_XYZ' TO N'C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\FTData\XYZ', 
NOUNLOAD, REPLACE, STATS = 10 
GO 

收到以下錯誤

Msg 3634, Level 16, State 1, Line 1 
The operating system returned the error '5(Access is denied.)' while attempting 'OpenForRestore' on 'C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\FTData\XYZ\SQL.HDR'. 
Msg 3156, Level 16, State 2, Line 1 
File 'sysft_XYZ' cannot be restored to 'C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\FTData\XYZ'. Use WITH MOVE to identify a valid location for the file. 
Msg 3119, Level 16, State 1, Line 1 
Problems were identified while planning for the RESTORE statement. Previous messages provide details. 
Msg 3013, Level 16, State 1, Line 1 
RESTORE DATABASE is terminating abnormally. 

感謝。

回答

2

使用沒有權限的文件夾/文件中的用戶帳戶:

操作系統返回了錯誤「5(拒絕訪問。)」試圖對「C「OpenForRestore」: \ Program Files(x86)\ Microsoft SQL Server \ MSSQL.1 \ MSSQL \ FTData \ XYZ \ SQL.HDR'。

+0

使用Windows身份驗證登錄。它應該有權訪問。 – 2010-07-27 16:11:44

+0

@Aseem Gautam:您已登錄,但這不一定是用於訪問備份的帳戶。 – 2010-07-27 16:12:55

+0

是的,謝謝,明白了。修改文件夾安全設置。 – 2010-07-27 16:14:28

相關問題