I have a problem - I need to copy few certain tables from MSSQL DB on Windows Server to my Linux machine.
My final goal is to make a backup from Windows, do a few things with it on Linux and then re-create those tables again on another MSSQL DB on Windows.
Is there way to do that with sqlcmd and bcp only? Can BCP, which is running on Linux, create a backup of table on Linux like pg_dump does it?
Thank you
Related
I've been running SQL Server Express 2019 on our Linux Server, and I am currently planning our disaster recovery setup.
I was already able to backup the database automatically, but I can't seem to restore the database to a SQL Server on Windows. I've been using a localDB instance to test it, but I seem to be unable to restore the database to it
Note: the .bak file came from Linux SQL Server.
Every time I try to restore the database it says that the sysfiles1 is corrupted, but when I try to restore a database from a Windows SQL Server, it works fine. I also tried to restore the Linux database back to itself and that works, too.
There have been many articles that show how to migrate from Windows to Linux but I can't find any that shows how to migrate from Linux to Windows.
The reason I want to test if I can go back to Windows is that we only have one server that runs Linux in the office and a lot of Windows computers.
TLDR: I want to know if its possible to migrate database from Linux to Windows
The problem is LocalDB. I got same error each time I tried to restore database from linux. Then I made same restore in another server (SQL Server Standart is installed) and it successfully restored database. Then I restored to my local machine from that SQL Server Standart backup.
I am using SQL Server 2008 (Express Edition).
I want to create a job which will delete all data from the all the table(>50) in the DB everyday at night 1:00.
Instead of Deleteting i decide to restore the DB from the Script.
It would have been easy by using SQL Server Agent, But this is limitation in SQL Server Express.
I figured out that we can create jobs "manually" by creating batch files and SQL script files, and running them via Windows Task Scheduler.
I have no clue what i have to write in bat file and sql file.This is my first time where i am working so deeply in SQL configuration. Can someone help please?
Name of the script which i need to restore is test.sql.
If any one has different approach , please share.
Thanks
Prat
Your batch files needs to look like this. Change the path to your .sql file and also put in the sql server info. You can read more about sqlcmd HERE. Also note the case on the switches -S and -i as it does matter.
sqlcmd -S <ComputerName>\<InstanceName> -i C:\test.sql
I have a .sql file which was exported from 2008 MS SQL server from windows computer, is there a way to import the sql file and recreate the database on a mac/osx platform? I apologize if this questions has been answered, I couldn't find a suitable response for my problem.
Thanks regardless.
If the .sql file is actual SQL statments; create table, insert, etc, then you should be able to execute it in another RDBMS. You will probably have to edit the SQL as it will probably have SQL Server specific syntax but the general form should be the same.
Create a DB in your target RDBMS on Mac and then execute the .sql file.
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.
i have installed Sql Server 2008, Oracle 10I and DB2, i want a Dos batch file which can display which databases are running.
Thanks
This will be a pretty complicated batch file to write. You will need to use other tools to determine which of the database server types you mentioned are running. You would be better off writing an application to do this.