SQLServer -- How to completely copy a database, sqlserver Database

Source: Internet
Author: User

SQLServer -- How to completely copy a database, sqlserver Database

For the sake of conciseness, the source database is referred to as S, and the target database is called T.

SqlDelta is required in this article. Click to open the link.

1. Right-click the source S to generate a database creation script;



2. Modify the script to create the target database T, mainly to change the original database name and file path to the actual one.

3. sqlserver2014 allows you to directly view partition functions and partition schemes, right-click to generate related creation statements, and then execute them on T.


4. Open the SqlDelta interface. The Source is the old DB, and the Target is the new DB. Note that the source connection permission should be at least dbowner; otherwise, scripts such as stored procedures cannot be generated.

If the configuration is complete, click Run in the upper-right corner.


5. For example, remove unnecessary items (such as users) and click Generate script in the upper right corner.


6. Copy the generated scripts to the "new query" Window of the new DB. The execution is half done.

7. After the execution is complete, click Refresh in to compare the table and view information again to see if there are different items.

If there is a difference, copy the corresponding script and re-execute it until the two are completely consistent.

For example, the Red Circle is different from the source and target.





Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.