SQL SERVER – Copy Database from Instance to Another Instance – Copy Paste in SQL Server

SQL Server has feature which copy database from one database to another database and it can be automated as well using SSIS.

Make sure you have SQL Server Agent Turned on as this feature will create a job. The same job will execute the task. Make sure that SSIS is properly configured as well with necessary security permissions. You can automate this process as well control error logging.

Following are the steps to copy database from one instance to another instance.

SQL SERVER - Copy Database from Instance to Another Instance - Copy Paste in SQL Server copywizard1

SQL SERVER - Copy Database from Instance to Another Instance - Copy Paste in SQL Server copywizard2
Specify Source Server
SQL SERVER - Copy Database from Instance to Another Instance - Copy Paste in SQL Server copywizard3
Specify Destination Server
SQL SERVER - Copy Database from Instance to Another Instance - Copy Paste in SQL Server copywizard4
Here you can select option if you want to keep the database ONLINE when it is being copied.
SQL SERVER - Copy Database from Instance to Another Instance - Copy Paste in SQL Server copywizard5
You can also select option of MOVE or COPY database as well.

SQL SERVER - Copy Database from Instance to Another Instance - Copy Paste in SQL Server copywizard6
Give appropriate database name.
SQL SERVER - Copy Database from Instance to Another Instance - Copy Paste in SQL Server copywizard7
On this screen you can select additional options to copy as well.
SQL SERVER - Copy Database from Instance to Another Instance - Copy Paste in SQL Server copywizard8
You create the package over here.
SQL SERVER - Copy Database from Instance to Another Instance - Copy Paste in SQL Server copywizard9
You can schedule the package using SQL Server Agent.
SQL SERVER - Copy Database from Instance to Another Instance - Copy Paste in SQL Server copywizard10

SQL SERVER - Copy Database from Instance to Another Instance - Copy Paste in SQL Server copywizard11

SQL SERVER - Copy Database from Instance to Another Instance - Copy Paste in SQL Server copywizard12
When this process is over it will show the success message and database will be copied to another server.
SQL SERVER - Copy Database from Instance to Another Instance - Copy Paste in SQL Server copywizard13

You can see how easy is the process to copy the database to another server.

Watch SQL in Sixty Seconds Episode on same subject.

Reference: Pinal Dave (https://blog.sqlauthority.com)

, ,
Previous Post
SQL SERVER – Getting Columns Headers without Result Data – SET FMTONLY ON
Next Post
SQL SERVER – A Quick Notes on SQL Azure

Related Posts

59 Comments. Leave new

  • Hi,
    I think this doesn’t copy the primary keys and constraint.
    Could anybody please suggest me some free tool to copy SQL Database from remote server

    Reply
  • Hi,
    Could anybody please suggest me a free tool which can copy primary keys and all constraints when copying remote database?

    Reply
    • yes , i had this problem and i think in this way you can’t copy keys
      i use generate scripts always
      this way is very faster too

      Reply
  • I am geeting an error While trying to find a folder on SQL an OLE DB error was encountered with error code ….(Login failed for user ‘user’). I am passing correct credential for source and destination server ( they are different )
    Any help?

    Reply
  • Hi Dave,
    How to make SQL Server Agent(SQLExpress) turn on? My SQL is MS SQL 2008 R2. I couldn’t turn it on. Please help me

    Reply
  • How can I transfer records(only selected columns) from table A in SQL 2005 to SQL 2008 located on same server? I tried folowing but it doesn’t recognize source tables

    Reply
  • How can I transfer records(only selected columns) from table A in SQL 2005 to SQL 2008 located on same server select/insert ? I tried following but it doesn’t recognize source table (error: Invalid object name SourceTable ):

    Use [DestinationTable]

    Insert into [DestinationTable].dbo.[table1]
    (id, itemName,ItemCode)

    Select id, itemName,ItemCode
    from [SourceTable].dbo.[table1]

    Is my SQL script incorrect?

    Reply
  • I am new to sql server. I have to copy one database to another machine which runs sql server 2008R2> I have created agent job but its fails. source machine is in Domain but destination machine is not in domain. it is in network but in workgroup

    Reply
  • Nikhil Bhivgade
    November 29, 2013 2:21 pm

    i want to daily update my sql-server daily which is hosted from the local server how can i do this ?
    For eg :- 1 Table having total 10 records next days their are total 15 records so 5 new records have been added, so i want to update this daily.

    Reply
  • can u explain how to create jobs in sql server 2008R2

    Step by Step

    Reply
  • Thanks it saved me lot of time. You Rock…

    Reply
  • Thank you very much for the valuable Article.

    Reply
  • I have actually tried it, it ran successfully, but then i am not able to see copied DBs on destination server? Any thing i am missing?

    Reply
  • I have SQL Server 2012 and I want to create similar DB in SQL 2008 instance, can i do that or there will be any problem with Schema due to newly introduced Data types

    Reply
  • This Option is not available in SQL Server 2012, when migrating from SQLExpress to other instance.
    Is it OK, to detach and attach ?

    Reply
  • Hi

    I need to do this using c# . Is that possible

    Reply
  • I am experiencing the same error at the Execute SQL Server Agent Job step as many of the others here.

    3 scenarios:
    1. works – source and destination db are on the same SQL server instance
    2. SQL Server Agent Job (error) – source and destination db are on the same server, but different SQL server instance (same version of SQL 11.0/2012)
    3. SQL Server Agent Job (error) – source and destination db are on different servers (same version of SQL 11.0/2012)

    Admin permissions doesn’t appear to be the issue.

    Hopefully, someone will be able to come up with a resolution for this error.

    Reply
    • If you have a similar error, On destination server, you need to create a new credential, asociated with a login in the destination server that has sysadmin server role, later, when you have the crendential, you need to create, on the destination server, a new proxy, it has to asociate with your new credential, later run again Copy database wizard on the source server, and in “Schedule the package” page, change — integration Services Account with your new Proxy.
      :D

      Reply
      • Hi Jose.
        Could you be please more specific, how to create a new credentilal and new Proxy.

        Thanks, Martin.

      • Hi martin,
        Follow this steps:
        1.- Open your destination instance with Microsoft SQL Management Studio, later clic on Security -> Credential -> Right clic and clic on New Credential (create a new credential asociate with an account that has sysadmin server role;).
        2.- Later, You need to activate your SQL Server Agent, after that, clic on Sql Server Agent -> Proxies -> Right clic and clic on New Proxies (You create a new proxies asociated with the credential ).

      • Thanks Jose.
        I have done this, but i still getting the same error (Execute SQL Server Agent Job (Error).
        Any idea why? I want to copy database on the same server (SQL Server 2008 R2) from one instance to another.

        Best Regards, Martin.

      • Thanks @Jose for helping @Martin

  • Thank you Jose for your valuable step by step guidance, its work for me.

    Reply
  • How can i automate this process?

    I have an MSSQL server with more than 30 databases of various size connected (in overall they are near 1TB size)
    In the same time i have a ‘test’ database that is connected to my application.
    I want to copy database to ‘test’ db without restoring them from backup into a new db with a new name, etc. SQL copy wizard does this perfect, but i have no idea how to automate this.

    Generating the SQL scripts for each db also works, but such sql script also is very big (some of my db’s are near 100GB and storing the such sql scripts or backup files will require x2 additional server space, which is not appropriate solution).

    The only possible way seems to use SQL Copy Database Wizard, but i am not able to run it manually every time i need to restore database into a new one. Any ideas how to improve this process?

    Thanks in advance.

    Reply
  • I get an error towards the end when its trying to execute the sql agent service. I have that agent turned on , on both instances any help please?

    Reply
  • I assume this is the same error lots of people have been getting but I don’t see any fix yet. still waiting please .

    Reply

Leave a Reply

Menu