Two Methods for copying SQL Server databases and their data

Source: Internet
Author: User

The first method is the simplest:

(1) Find the installation directory of SQL Server... Microsoft SQL Server \ mssql.1 \ MSSQL \ data

(2) copy the files:. MDF and. LDF.

(3) copy the two files in step 2 to the data directory of the target server.

(4) Right-click Database-add-Select. MDF file-all the way to OK. OK! . For example:

This method is the easiest way to avoid errors, but the SQL Server service must be stopped when copying files, which is not allowed in many cases.

 

Method 2: Use Database Backup

(1) Right-click database instance-task-backup to record the target location

(2) copy the. Bak file to the backup directory of the target server

(3) Right-click Database-Restore database-enter the name of the target database (from the shortcut menu)-select the source device.

(3) Option-overwrite the database first

Note that the path "restored to" in this step must exist. Otherwise, the database will fail to be restored.

(4) OK. OK! .

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.