How to import MSSQL database dump from Plesk into local MS SQL server? - sql-server

I have a plesk account and an MS SQL database from which I got a dump through this interface they provide:
So I downloaded the dump file but it does not come as a .txt file but it comes without any extension and when I try to import it in my local MS SQL Server it fails always.
And when I try to open the dump file with notepad it shows weird characters(see picture below).
What am I doing wrong?

I got it to work by extracting the dump file from the zip and renaming it with a .bak extension. Then did a Database restore in MS SQL Management Studio and selected this backup file (.bak). Hope that helps.

I finally found my way using a php script found on github I had to fork it to update couple things cause it became obsolete.
I had to go this way for couple reasons:
I didn't have admin access to the plesk server to enable remote DB access
I wasn't able to export it into any format readable by mysql
So with the php script i could load it unto the server and run it,
The script copies an MSSQL into MySQL. Here is my fork.

Related

How to import Plesk SQL Server dump to my localhost

I take 'export dump' from Plesk SQL Server.
I'm trying to import it to my localhost via Microsoft SQL Server Management Studio.
But files look like broken or encoded. Isn't there any way to import Plesk dump into the localhost?
I found the answer here How to import MSSQL database dump from Plesk into local MS SQL server?
Once you have the Plesk SQL Server dump .zip file on your local workstation and you've loaded it into your .zip utility, you'll see it has only one file inside the .zip.
Extract the file you find in the zip. It has no extension. The fact it has no extension adds some mystery to those of us doing this for the first time, because it effectively hides from us the fact that this file is a SQL Server backup file.
Rename the extensionless file as a .bak file.
Use SQL Server Management Studio's "Restore Database..." action to import the .bak file.
Set up local login to this new local database; you would typically make sure the login has dbo access to the new db.
Adjust the configuration on your local code to point at the new db. AND DONE.

Uploading database to Azure SQL

I need to upload an MDF file to Azure SQL. According to Is it possible to attach a MDF file to an Azure SQL database? the correct way to do this is to import the MDF to SQL Server Management Studio and then right click and export it to Azure SQL.
However all I'm getting is an error claiming that:
I have no idea what this actually means nor why I am unable to upload the database to Azure. Any suggestions?
In order to import a Database to Azure, you will need to create a BACPAC file. Instructions can be found in this MSDN blog post.
And just in case you run into it, this question has some good links for where to get the SQL Server Data Tools required to import a BACPAC from Azure. You probably need to get those installed before being able to export to BACPAC.
Update: Adding this so you can see my export options:
This message means that you will need to create a Windows VM within Azure that has a full install of SQL Server on it.
https://msdn.microsoft.com/en-us/library/azure/jj823132.aspx
Another way is using this tool.
http://sqlazuremw.codeplex.com/
It will generate the script from your local database and execute it on Azure Sql.

Deploying .bak file from SQL Server in Mac

Ok, I know this may sound stupid but, is there any way to deploy a database from a .bak file exported from SQL Server into any kind of Mac software? If there, which one?
If that is not possible, is there a way that I could deploy that database if I first deploy it into SQL Server and export it, maybe in a different way?
Thanks in advance.
The bak file created by SQL Server is a database backup file, and you will only be able to restore it to a Microsoft SQL Server instance.
If you want to port a MSSQL database to some other RDBMS, your best bet is to use a tool for migrating the data directly from the running MSSQL datbbase to another running RDBMS. Perhaps a third party tool, or you could build an SSIS package to do the migration.
You can create a MySQL database and try the MySQL migration tool.
But just given a .bak file, you will not be able simply to read the file; you will need to extract data from a running database instance.

Is it possible to access the queries in a file created by SQL Server?

Is it possible to access the queries and procedures in a file created by SQL Server without installing SQL Server? Problem is that I am having problems to install the SQL server / Express version.
When all else fails - always try to open files in notepad and see what happens.
In this case, .sql files definitely can be opened with notepad - they are just text files. The extension is just there to give you the ability to double-click on them and by default open in Management Studio (or whatever you want to use to edit SQL files).

How to view installed Northwind database?

I have installed a sample database, specifically Northwind from http://msdn.microsoft.com/en-us/library/8b6y4c7s.aspx.
After installing the .msi file, I dont see any Northwind database in my local sql express server when using SQL Server management studio. Am i missing a step? Do i have to run some script?
From the download page:
After downloading SQL2000SampleDb.msi, extract the sample database scripts by
double-clicking SQL2000SampleDb.msi. SQL2000SampleDb.msi will extract the
database scripts and this readme file into this
default folder:
C:\SQL Server 2000 Sample Databases
So it seems to me you have to go to that folder and execute the SQL files installed there for the database to be created.
you don't mention which msi file, but most of them seem to relate to a sample database.
Which database software are you using?
From the download page on the page you linked to:
After downloading SQL2000SampleDb.msi,
extract the sample database scripts by
double-clicking SQL2000SampleDb.msi.
SQL2000SampleDb.msi will extract the
database scripts and this readme file
into this default folder: C:\SQL
Server 2000 Sample Databases
I didn't download it to see what gets extracted, but I'm betting there's a script or two that you can run to create the database. Probably a *.sql, that you can open and run in a query window.
EDIT: I just downloaded and extracted. It looks like all you need to do is execute the contents of instnwnd.sql (which should be in C:\SQL Server 2000 Sample Databases). Open a new query window (in SSMS etc.), load the file, and press F5.

Resources