Permissions error when attaching a database: “Cann

2020-08-10 07:47发布

I am running SQL Server 2012 Enterprise Edition. I have downloaded the AdventureWorks 2012 OLTP data files (both .mdf and .ldf). I saved them to the AW folder that I created in My Documents where I unzipped the file. I go to SQL Server Management Studio (SSMS) right-click on database, and click attach in the context menu. In the dialog I click find.

The UI does not allow me to navigate to folder. I try typing the full path to the file, and then I get the following error:

Cannot access the specified path or file on the server. Verify that you have the necessary security privileges and that the path or file exists.

I closed SSMS and restarted it, this time running as the administrator. Same bad result.

This should not be this hard. What are the exact steps to successfully attach the AdventureWorks2012 database to SSMS?

Thanks!

7条回答
【Aperson】
2楼-- · 2020-08-10 07:49

Connecting to the SQL server using the 'sa' user did the trick for me. Not everyone can have permission to do that so make sure the user you are using for SQL Authentication has all necessary privileges.

查看更多
Anthone
3楼-- · 2020-08-10 07:51

It doesn't matter what permissions the account that you open the management studio has, the important account is the one that the sql server service is running as. By default it only has access to the default location specified during the install, so you can either do as the previous poster said and move your files to there, or add the service account to the permissions of the folder where you want to store your files so that it can access that location.

查看更多
够拽才男人
4楼-- · 2020-08-10 07:56

Connecting to the server by Windows Authentication worked for me. I don't know if that is possible in your case.

查看更多
欢心
5楼-- · 2020-08-10 07:57

In my case it was related to the drives not being dependencies of the SQL Server role (Clustered Server). When I added the disks as dependencies under the SQL Server role, I could browse the drives from SSMS again.

查看更多
姐就是有狂的资本
6楼-- · 2020-08-10 08:03

Put your files to default location for Database Engine data files. If you didn't reconfigure anything it should be

\Program Files\Microsoft SQL Server\MSSQL11.<InstanceID>\MSSQL\Data

And then Attach db using SSMS.

查看更多
beautiful°
7楼-- · 2020-08-10 08:06

Just go to service in your computer and search for MSSQLSERVER restart the service by stop and start.

查看更多
登录 后发表回答