我试图用s3机器的数据导入数据库到我的本地机器,因为我已经从s3机器分离数据库并复制数据库并粘贴到本地机器的以下路径'D:\ Databases \ MSSQL \ OLTP \数据\ Test_AS.mdf” 现在,当我尝试将此mdf文件附加到SQL Server实例时,它显示一条错误消息:
Attach database failed for the server
Additional Information :
An exception occurred while executing Transact-SQL statement or batch
(Microsoft.SqlServer.Connectioninfo)
Unable to open the physical file "D:\Databases\MSSQL\OLTP\Data\Test_AS_log " Operating system error 2 : 2(failed to retrieve text for this error.Reason : 15105)"."(Microsoft SQL Server Error : 5120)"
SQL Server具有使用该位置执行此操作的权限。
答案 0 :(得分:1)
您需要在附加数据文件和日志文件时指定它们:
CREATE DATABASE DataBaseName
ON (FILENAME = 'D:\Databases\MSSQL\OLTP\Data\Test_AS.mdf'),
(FILENAME = 'D:\Databases\MSSQL\OLTP\Data\Test_AS_log.ldf')
FOR ATTACH;
答案 1 :(得分:0)