无法安装 Adventureworks 2012 数据库 - 操作系统错误 5:访问被拒绝 [英] Cannot install adventureworks 2012 database - Operating system error 5: Access is denied

查看:34
本文介绍了无法安装 Adventureworks 2012 数据库 - 操作系统错误 5:访问被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 sql server 2012 中安装 AdventureWorks 2012 数据库.我从这个链接获得了 mdf 文件 - http://msftdbprodsamples.codeplex.com/releases/view/93587

I am trying to install AdventureWorks 2012 database in sql server 2012. I got the mdf file from this link - http://msftdbprodsamples.codeplex.com/releases/view/93587

这是我下载的文件名-AdventureWorks2012_Database.zip

Here is the name of the file I downloaded - AdventureWorks2012_Database.zip

我在 Windows 7 64 位上执行所有这些操作.

I am doing all this on a windows 7 64 bit.

我收到以下错误:

Attach database failed for Server 'SuperPC\SQL2012'.  (Microsoft.SqlServer.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=11.0.2100.60+((SQL11_RTM).120210-1917+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Attach+database+Server&LinkId=20476

ADDITIONAL INFORMATION:

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

Unable to open the physical file "C:\Databases\AdventureWorks2012_Data.mdf". Operating system error 5: "5(Access is denied.)". (Microsoft SQL Server, Error: 5120)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&ProdVer=11.00.2100&EvtSrc=MSSQLServer&EvtID=5120&LinkId=20476

推荐答案

问题原因 - 将数据库 mdf 和 ldf 文件放在官方"SQL 服务器安装文件夹之外的目录中.

The reason for the problem - Putting the database mdf and ldf files in a directory outside the "official" SQL server installation folder.

解决方案 -

http://tryingmicrosoft.com/error-while-attaching-a-database-to-sql-server-2008-r2/

将您的 .mdf 文件和 ldf 文件粘贴到此目录中 -C:\Program Files\Microsoft SQL Server\MSSQL11.SS2012\MSSQL\DATA

Paste your .mdf file and ldf file in this directory - C:\Program Files\Microsoft SQL Server\MSSQL11.SS2012\MSSQL\DATA

没有解决问题的解决方案 -

Solutions that did NOT solve the problem -

1 - 取消阻止压缩文件.还检查了 mdf 和 ldf 文件没有被阻止.(步骤 - 右键单击​​ zip 文件 > 属性 > 取消阻止)

1 - Unblocking the zipped files. Also checked that mdf and ldf files are not blocked. (Steps - right click zip file > properties > unblock)

2 - 以管理员身份运行 SSMS 2012.

2 - Run SSMS 2012 as administrator.

3 - 运行表单的 SQL 查询 -

3 - Run SQL query of the form -

CREATE DATABASE MyAdventureWorks 
    ON (FILENAME = 'C:\MySQLServer\AdventureWorks_Data.mdf'), 
    (FILENAME = 'C:\MySQLServer\AdventureWorks_Log.ldf') 
    FOR ATTACH; 

这篇关于无法安装 Adventureworks 2012 数据库 - 操作系统错误 5:访问被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆