SQL Server database migration methods

Source: Internet
Author: User

Recently I work in the company. Sometimes I need to copy the database on the company's server to my computer and bring it back home. When I feel good, I need to add a small class. Many of my friends may not, or are unfamiliar with how to quickly migrate databases.

Method 1: script

If your database is updated every day and the changes are not significant today, you can make all your changes into scripts and put them in the local database for execution. In this case, the company generally writes the same database publishing script.

Method 2: Backup and reduction

Select the database to be transferred from the database on the server, right-click, select all tasks-> back up the database; copy the backup to the local machine, select the local existing database (no need to create a new database) right click → task → Restore database.

Find the. bak file you copied. It is worth noting that sometimes an error occurs: two databases are not one database. In this case, you can overwrite the existing database with the options.

Method 3: If you only copy the database on the server to the local database, right-click the database and export the data to the corresponding local database according to the wizard (provided that the local database has no data, if there is data, it will not overwrite and there will be two identical records), and after it is done, it will get the functions and stored procedures in place, so this method is not recommended.

Method 4: Additional Method

First, separate the database connection, copy the database file (. mdf file) to the local device, right-click it, and append it to find the. mdf file.

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.