2015年1月6日 星期二

SQL Server Operating system error 5: “5(Access is denied.)”

This is Windows related problem where SQL Server does not have appropriate permission to the folder which contains .bak file. The easiest work around that I found was to copy your .bak to default SQL backup location which has all the necessary permissions. You do not need to fiddle with anything. In SQL SERVER 2012, this location is

C:\Program Files\Microsoft SQL Server\MSSQL11.BI\MSSQL\DATA
"MSSQL11.BI" BI是我取的SQL SERVER 名子
預設位置如下
D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA
把檔案放在此位置 ,在databases按右鍵選擇 Attach 就沒出現問題了

also cna use this script

CREATE DATABASE AdventureWorks2008R2 ON (FILENAME = 'C:\reports\AdventureWorks2008R2_Database\AdventureWorks2008R2_Data.mdf'),
(FILENAME = 'C:\reports\AdventureWorks2008R2_Database\AdventureWorks2008R2_log.ldf') FOR ATTACH;

沒有留言:

張貼留言