Sql 2012文件附件 [英] Sql 2012 file attach

查看:103
本文介绍了Sql 2012文件附件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我分离了一个sql 2012数据库,并将文件表文件夹和mdf和ldf文件移动到同一台机器中的另一个驱动器。现在我需要附上文件

但是有错误

请帮助



我有什么试过:



我做了以下步骤

1.数据库 - >右键单击 - >附上

2.点击添加按钮并选择mdf文件

3.clicked ok

显示以下错误<标的:Microsoft SQL Server Management Studio

---------------------------- -



I detached one sql 2012 DB and moved the file table folder and mdf and ldf files to another drive in the same machine. Now I need to attach the files
but got error
Please help

What I have tried:

I did the below steps
1. database -> right click ->attach
2.Clicked add button and selected the mdf file
3.clicked ok
It shows the below error
TITLE: Microsoft SQL Server Management Studio
------------------------------

Attach database failed for Server 'SQL7\MSSQLSERVER2012'.  (Microsoft.SqlServer.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=11.0.2218.0+((SQL11_RTM_GDR).120612-1251+)&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 "D:\data\DB\MyFileTable". Operating system error 2: "2(The system cannot find the file specified.)".
A file activation error occurred. The physical file name 'D:\data\DB\MyFileTable' may be incorrect. Diagnose and correct additional errors, and retry the operation.
Could not open new database 'MYDB'. CREATE DATABASE is aborted. (Microsoft SQL Server, Error: 5120)

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





------------------ ------------

按钮:



OK

--- ---------------------------



D. :\ datata \ DB \ MyFileTable 是我以前的DB文件路径。我现在将它们移动到E盘。



这个DB包含相同路径中的MDF,LDF文件以及我有一个文件夹来保存文件表同样的道路。但以前路径在D中,错误消息显示它仍在检查文件表的D驱动器。我将文件表文件夹移动到D驱动器和E驱动器中的MDF和LDF并尝试。然后它工作正常。但我需要在附加之前将文件表也移动到E盘。



------------------------------
BUTTONS:

OK
------------------------------

D:\data\DB\MyFileTable was my previous path of the DB files. I now moved them to E drive.

This DB contains MDF , LDF files in the same path and along with that I have one folder to keep file table too in the same path. But previously the path was in D and the error message shows that it is still checking D drive for the file table.I moved the file table folder to D drive and MDF and LDF in E Drive itself and tried.Then it worked fine. But i need to move the file table also to E drive before attaching.

推荐答案

Quote:

附加数据库时,所有数据文件(MDF和LDF文件)都必须可用。如果任何数据文件具有与首次创建数据库或上次连接数据库时不同的路径,则必须指定文件的当前路径。

附加数据库时,如果找到MDF和LDF文件在不同的目录中,其中一个路径包含\\?\GlobalRoot,操作将失败。

When you attach a database, all data files (MDF and LDF files) must be available. If any data file has a different path from when the database was first created or last attached, you must specify the current path of the file.
When you attach a database, if MDF and LDF files are located in different directories and one of the paths includes \\?\GlobalRoot, the operation will fail.



附加数据库 [ ^ ]

或者只是尝试将文件复制到旧位置然后再试一次。



希望,它有助于:)


Attach a Database[^]
or just try copying file to its old location and try again.

Hope, it helps :)


这篇关于Sql 2012文件附件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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