Perform SQLDump on SQL Server - sql-server

Is there a way to perform a SQL Dump in a SQL Server? Because on mysql we can easily do that with mysqldump command but on a SQL Server when I try to export the data it seems that it's only allowing to export per table and not per database. Now when I try to do the copy database it tries to copy the source db to a destination db. Now I came from MYSQL and I thought that it will somehow behave the same way.
Any idea on how to achieve this?
Thanks for those who will reply

In SQL Server you would either use Backup and Restore, or extract all the schema and data into a .bacpac file.

Related

Oracle DB Table to SQL Server DB Table

I am wondering if there is a way to replicate an oracle table over to a sql server table. Both servers are on the same network. I would like to have this automated perhaps using a stored procedure on the sql instance. Is there any way to do this automatically? Or can anyone point me to a good sql script to connect to an oracle db server and export a table file?
You could use an Oracle linked server on SQL-Server. In this way you would use the Oracle data directly from SQL-server.
Take a look at this tutorial: http://blogs.msdn.com/b/dbrowne/archive/2013/10/02/creating-a-linked-server-for-oracle-in-64bit-sql-server.aspx
You can use the Import Data function located under Tasks when you right click on a database in SQL Server Management Studio. It will walk you through picking the Source, the Destination, and how the columns map to each other.
Look at this:
http://www.microsoft.com/en-us/download/details.aspx?id=28766
Maybe it should help you

Backup a single table in SQL server not using Select into

For SQL Server 2008 is there an out of the box way to backup a singe table? On other database I've seen straightforward backup and restore commands for a single table but have not found it on SQL Server.
I am looking for commands like backup table and restore table which I've come across for other databases.
Use powershell to copy the table from one server/database to another.
http://blogs.technet.com/b/heyscriptingguy/archive/2011/05/06/use-powershell-to-copy-a-table-between-two-sql-server-instances.aspx
This uses the sql client library and bulk copy. As long as you have credentials, this can be executed anywhere as long as powershell is installed!
There is one option using SSMS.
Check this out.

How to copy .mdb file to .mdf file

I want to copy the ms access database(.mdb) to sql server database(.mdf). I did it with sql server Import and export data service. But I want it copy the data regularly or a specific time. Is it possible or not. I have tried to create a batch file
copy /y "E:\Dinesh Work\for-reports.mdb" "C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\for-reports.mdf"
but it gives the following error:
The process cannot access the file because it is being used by another process.
I have same tables in my sql server database as msaccess database. Is there any solution with batch file or something else.
Any suggestion will be appreciated.
Thanks in Advance.
This sounds like you want to use the Access database to edit the data in the SQL Server database.
Is that correct?
If yes, do you really need to copy the data?
You could also link from Access to the SQL Server tables.
This way, you have tables in Access that look like normal local Access tables, but they are really just links to SQL Server tables. You can edit data in these tables in Access, but you are actually writing directly into the SQL Server database.
Here are some examples how to set this up:
Link to SQL Server data
Access to SQL Server: Linking Tables
MDB and MDF files are wildly different types. You can't just copy them.
You might try setting up an SSIS task to do a regular data transfer - something like ETL if you're familiar with that term.
EDIT: The reason you're seeing the file locked error is because SQL Server maintains that lock on the MDF file while the database is running. In order to move or copy it you need to take that particular database offline.
As #Yuck said, you can not just copy the file and rename it, you need something like ETL or just a tool to export data.
I did xportdsl to copy from a h2database to a mssql and mssql to oracle
http://code.google.com/p/xportdsl/
I used gorm and a hacky dsl that worked and it is still working
You can script a bat file to execute something like this java -jar xportdsl.jar test001.txt

Equivalent of Oracle export for SQL Server and/or db2

Can SQL Server or db2 do entire database exports like oracle (using exp command)?
I've searched the internets and found bcp for SQL Server. But it seems I would have to iterate over all the tables to get what I want.
For db2 it looks to be roughly the same. Is there something I'm missing? Anyone have any suggestions and/or any opinions? Thanks ahead of time.
This is for SQL SERVER
Backup & Restore
To take an entire database with SQL Server, you can do a BACKUP and RESTORE
BACKUP: http://msdn.microsoft.com/en-us/library/ms186865.aspx
RESTORE: http://msdn.microsoft.com/en-us/library/ms186858.aspx
Export and Import
You can right click a database in SQL Server Management Studio, and under TASKS, click on EXPORT DATA. Follow the Wizard to choose the objects you want to export and put them into the appropriate location.
Custom SSIS for Raw format
Build a SSIS package that will read data from source table and put it into a RAW file on disk for later use. Raw files holds the structure of the table and the data.
DB2 for Linux, UNIX, and Windows has a utility called db2move, which generates the DDL to rebuild the database from scratch, and iterates through all the tables to dump their contents to flatfiles via the EXPORT command.

Most efficient way to move a few SQL Server tables to SQLite?

I have a fairly large SQL Server database; I'd like to pull 4 tables out and dump them directly into an sqlite.db for remote querying (via nightly batch).
I was about to write a script to step through(most likely on a unix host kicked off via cron); but there should be a simpler method to export the tables directly (SQLite not an option in the included DTS Import/Export wizard)
What would the most efficient method of dumping the SQL Server tables to SQLite via batch be?
You could export your data from ms-sql with sqlcmd to a text file, and later import this with a bulk import in sqlite. Read this question and answers to get an idea how to do this in sqlite.
You could create a batch file and run this with cron, I guess.
If you were considering DTS, then you might be able to do so via ODBC. MSSQL -> ODBC -> Sqlite
http://www.ch-werner.de/sqliteodbc/

Resources