[OnCloud] How to import a Microsoft SQL (MSSQL) database

In this tutorial, we will be showing you how to import your MSSQL database to your onCloud database server using the Microsoft Server Management Studio tool, which can be downloaded from the link below:

http://www.microsoft.com/en-us/download/details.aspx?id=8961

1) Open Microsoft SQL Server Management Studio and connect to the database server with using the database server name, login and password that you created for your database. This information can be found on the https://manage.myhosting.com control panel, under the More Services -> Databases link and by clicking on your database name in the list, next to the label 'External Hostname'.

Connection Settings

 

2) After you connect to the database server, find your database name in the object explorer pane.

Object Explorer

 

3) After selecting your database from the list click the "New Query" button from the top of the page to import your data.

New Query

 

4) Open up your .sql file in a text editor like Notepad++ and copy and paste it into the Query Window. Make sure that there are no "Create" or "Use" statements with the old database name included in the Query Window.

If any of these commands are present please remove them or put /***** in front of the command and *****/ right after it to comment it out.

After you make the changes click "Execute" to import the data to your database.

Execute Query

 

5) Make sure the execution of the import was completed successfully.

Query Successful

6) If you receive an error message for "Out of Memory Exception" that means the database is too big to be imported which means you need to try another method to import to the server.

Out of Memory Exception

 

Alternative Method (command line)

1) Open a Command Prompt window as an Administrator to import your database on the same computer that you have installed Microsoft SQL Server Management Studio on.

Open Command Prompt

Command Prompt Window

2)        Use this command as indicated below to import your database to your MS SQL database server.

Sqlcmd –S <SQL DATABASE SERVER NAME> -U <SQL DATABASE USERNAME> -P <SQL DATABASE PASSWORD> -d <SQL DATABASE NAME> -i <SQL DATABASE LOCATION ON THE LOCAL MACHINE> -o <Report file location on the local machine (Optional)>

Command Prompt Window

3) Wait until the command has completed. This process will take some time depending on your database file size.

Command Finished Executing

 

4) View your log file and check for any errors that may have occurred during the import process.

Check for errors

At the conclusion of this tutorial, you should now have successfully imported your MSSQL database to your onCloud database server.

 

 

Was this article helpful?
0 out of 0 found this helpful