创建 SQL Server 2008 R2 数据库备份并在 SQL Server 2012 上还原

Create SQL Server 2008 R2 database Backup and Restore it on SQL Server 2012

我正在尝试将数据库从 .bak 文件(从 sql server 2008 r2 express edition 创建)恢复到 sql server 2012 express edition。 我右键单击我在 sql server2012 数据库上创建的新数据库。单击任务 -> 还原 -> 数据库。在还原数据库 window I select 'Device' 单选按钮上。单击 'Select backup devices' 并从 'Locate backup file' window 中选择 'aaa.bak' 文件,当我单击 'Add' 时,出现以下异常。我尝试在不同的博客上进行搜索,但找不到任何与解决此问题或至少帮助我找出异常有关的东西的任何东西 -

===================================

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

------------------------------
Program Location:

   at Microsoft.SqlServer.Management.Common.ServerConnection.GetExecuteReader(SqlCommand command)
   at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteReader(String sqlCommand, SqlCommand& command)
   at Microsoft.SqlServer.Management.SqlMgmt.BrowseFolderEx.IsPathExisting(String path, Nullable`1& isFolder)
   at Microsoft.SqlServer.Management.SqlMgmt.BrowseFolderEx.HandleFileNamePaths(String filePath)
   at Microsoft.SqlServer.Management.SqlMgmt.BrowseFolderEx.OnOK(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.RunDialog(Form form)
   at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
   at System.Windows.Forms.Form.ShowDialog()
   at Microsoft.SqlServer.Management.SqlManagerUI.SqlRestoreSelectBackupSource.AddFile()
   at Microsoft.SqlServer.Management.SqlManagerUI.SqlRestoreSelectBackupSource.buttonAdd_Click(Object sender, EventArgs e)

===================================

Incorrect syntax near 's'.
Unclosed quotation mark after the character string ''. (.Net SqlClient Data Provider)

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

------------------------------
Server Name: xxx
Error Number: 102
Severity: 15
State: 1
Line Number: 1


------------------------------
Program Location:

   at Microsoft.SqlServer.Management.Common.ConnectionManager.ExecuteTSql(ExecuteTSqlAction action, Object execObject, DataSet fillDataSet, Boolean catchException)
   at Microsoft.SqlServer.Management.Common.ServerConnection.GetExecuteReader(SqlCommand command)

这听起来像是权限问题。

首先尝试将 *.bak 文件移动到 SQL 服务器的数据目录(或您保存其他数据库文件的位置)。然后重做你的步骤。