1

I am trying to restore a databse from .bak file (created from sql server 2008 r2 express edition) to sql server 2012 express edition. I right click on the new databse I have created on sql server2012 database. Click on Tasks -> Restore -> Database. On Restore Database window I select 'Device' radio button. Upon clicking 'Select backup devices' and Selecting 'aaa.bak' file from 'Locate backup file' window when I click on 'Add' I get the following exception. I tried searching on different blogs but couldn't find anything remotely close to something that would solve this problem or at least help me find out what the exception is about -

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

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)
1
  • Try using t-SQL command RESTORE and see what happens then... Commented Mar 19, 2015 at 17:54

1 Answer 1

2

This sounds like a permission issue.

Try to move the *.bak file to the data-directory of the SQL-server first (or where you keep your other DB files). Then redo your steps.

Sign up to request clarification or add additional context in comments.

3 Comments

That worked like magic ! I just copied the file one level up. I am just curious. What kind of permission/s do I need to restore the .bak file when I am the Administrator on the system ?
Ok. Just figured it out. It was nothing else but the foledr name. It had apostrophe in it. So as soon as I copied the file in a folder without an apostrophe in it's name the restore worked :)
It's wasn't your permission, but the SQL-servers. But apparently that was not your issue after all. Glad I could help you figure it out though, even through luck ;-) The reason I mentioned permissions is because I recently had that problem, with a similar exception. Turned out SQL-server didn't have permission to add a DB from a specific folder.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.