restore multiple SQL Server databases from single dump file - sql-server

we have received a single dump (.dmp) file created for multiple databases. Could someone please tell me
how do you create this single file ? and
more importantly how do I restore these databases to a new sql server instance

Can't check at the moment as not at my DB server, however if it's what I think it is, try right clicking on your SERVER name in SQL Management studio, navigate to tasks, and backup/restore databases.
This may also be an option on individual tables, containing multiple tables.

Related

How to copy databases automatically from one server to another in efficient way (not backup and restore)

every once in a while I need to move a database from one server (QA) to another (production )
until now I used to perform backup on one server copy to the other server and then restore it...
is there a way to do it more efficiently?
maybe an automated job?
mirror? replication?
I'm searching for one-two clicks solution..
tnx.
I already made an automated script that does all of the following:
1)backup.
2)zip.
3)copy.
4)unzip.
5)restore.
Could you possible create an SSIS package (using the Transfer Database Task+ Transfer SQL Server Objects) that you can execute when you need it? You could create a 'template' package and use it for further use with just changing the connections.
See this blog post for some more details:
https://www.mssqltips.com/sqlservertip/2064/transfer-database-task-and-transfer-sql-server-objects-task-in-ssis/
From the link above:
Transfer Database Task: The Transfer Database Task is used to move a database to another SQL Server instance or create a copy on the same
instance (with different database name). This task works in two modes
[...]:
Offline : In this mode, the source database is detached from the source server after putting it in single user mode, copies of the mdf,
ndf and ldf files are moved to specified network location [...]
Online : In this mode, the task uses SMO to transfer the database objects to the destination server. In this mode, the database is
online during the copy and move operation, but it will take longer as
it has to copy each object from the database individually [...].
Transfer SQL Server Objects Task The Transfer SQL Sever Objects task is used to transfer one or more SQL Server objects to a different
database, either on the same or another SQL Server instance. This
allows you to select different types of objects you want to transfer.
You can select tables, views, stored procedures, user defined
functions etc. [...]
Not sure what it would take to make this package transferable among the different databases you may need to copy, but maybe it's worth exploring.
Good luck! :)

Automatically update SQL Server database from tables in MS Access

I'm new to SQL Server and trying to automatically update tables in SQL Server from tables in MS Access.
I have an Access database of metadata that must be kept updated for sending records to other groups. I also have a database in SQL Server which also has these same metadata tables. Currently these tables in the SQL Server database get updated manually by exporting the Access tables as Excel files, and then importing them into the SQL Server tables.
It's not the most efficient process and could lead to errors in the SQL Server database if someone forgets to check that they are using the most recent data from Access. So I would like to integrate some of the tables from Access to my database in SQL Server. Ideally I would like for the tables in my SQL Server database to be updated whenever Access is updated or at least update the tables automatically in the SQL Server database when I open it.
Would replicating the Access tables be the best? I am using SQL Server 2014 Developer so I think I have this capability. From my understanding, mirroring is for an entire database not just pieces of it. However, I do not want to be able to alter the metadata from SQL Server and have it reflected in Access. I cannot tell if reflecting the tables would do this...?
I also looked at this post about writing multiple insert statements but was confused (What is the best way to auto-generate INSERT statements for a SQL Server table?). Someone else suggested importing all the data into SQL Server and then using an ODBC driver to connect the two, but I'm also not sure how this would update the database in SQL Server anytime Access is updated.
If you have any suggestion and a link to easy to follow tutorial I would really appreciate it!
Thanks
In Access, go to 'External Data', ODBC Database, and connect to the SQL Server database directly - make sure you select 'Link to the data source by creating a linked table' on the first page of the wizard. Now, this linked table is available in Access, but is actually the SQL Server table.
Get rid of the local Access tables, using the new linked tables in their place in whatever queries, forms, reports, etc that you have in Access.
Now, any changes to the tables you see in this Access db ARE changes to the SQL Server database.

Creating a snapshot database to another SQL Server

I'm trying to save the values of several columns of one table to another table on a different server. I am using SQL Server. I would like to do this without running external programs that query from this database and insert the results into the new database. Is there any way to do this from within the SQL Server Management Studio?
This is a recurring event that occurs every hour. I have tried scheduling maintenance tasks that execute custom T-SQL scripts but I'm having trouble getting the connection to the remote server.
Any help would be appreciated.
If you can set up the remote server as a linked server you should be able to configure the SQL Server Agent to execute jobs that contain queries that access tables on both the local and linked server. Remember that you might have to configure the access rights for the account used to run SQL Server Agent so that it has permissions to read/write tables on both servers.
This practice might not be without issues though as this article discusses.
You can use a 4 part name like;
INSERT [InstanceName].[DatabaseName].[SchemaName].[TableName]
SELECT * FROM [SourceInstanceName].[SourceDatabaseName].[SourceSchemaName].[SourceTableName]
But first you will have to set the remote server as a linked server as so;
https://msdn.microsoft.com/en-us/library/aa560998.aspx

SQL Server database remote transfer - best method

I have two databases, one on a remote server the other local. (SQL Server 2008)
The database on my local server has the entire structure setup but no data. I would like to copy the data from the remote server to my server and I am wondering the best method in which to do this.
The main issue I am experiencing is the user that I have to the remote database has limited permissions. I cannot read the stored procedures, user defined functions so when I use Import/Export wizard I do not get the schema etc. So a regular dump/restore is not working for me as it restores the tables without the Primary Keys/Foreign Keys and the stored procedures.
I'd like to do this,
INSERT INTO localtable SELECT * FROM remotedb.table
I was having issues because of the IDENTITY fields and I had to explicitly name all of the columns. Also I am not sure if SQL Server Management Studio allows you to use two different databases, remote and local, so I was looking for any advice.
I have also tried applications like SQL FTP and Backup and it fails because it runs out of memory (I have 16GB of memory on the machine and the DB is like 4GB). I also can use the SQL Server import/export wizard but then I don't get the schema information. I also tried SQL Compare from Red Gate and it runs into issues with the permissions. Unfortunately I do not have the time to request and gain access to a new user so I was hoping someone had a creative idea.
You can definitely use SQL Server Backups for this. It will not run out of memory. If it does please tell us the message (because likely you are misinterpreting it). This is the fastest possible and the most complete solution.
You can tell the export wizard to also script the schema. It is hidden under "advanced" somewhere (terrible UI). But the script will be extremely big and I know of no way to execute it.
You can drop all schema objects except PKs in the target database. Then you can use remote queries to copy all the data over. You will not get any problems with foreign keys and identity columns if you drop the beforehand. After you are done you can recreate all those objects. It is probably best if you use a transaction for all of this because that way you get consistent source data from a point-in-time.

SQL Server - Schema only replication

Is there a way to replicate only schema (and all schema objects) without data between two SQL server instances?
For copying, rather than replicating, the simplest way would be to "Create scripts" for the database and run them on target server. This will create a new blank database on the new server.
Replicaton in SQL server implies that as you make changes to one schema they are automatically replicated on the other server. This can be done to some extent with SQL server replication, you just prevent he data being transferred but setting a criteria. I don't see how this would be of much use though.
I found this researching something else so I don't know if it is still an issue for you or not but there is an object in SSIS called Transfer SQL Server Objects. I haven't used it before but it has an option to copy data or not and you can select copy all objects or just specific types of objects, permissions etc.

Resources