MSSQL Backup and Data migration

Source: Internet
Author: User
Tags mssql mssqlserver

Version: MSSQL 2008

Backup scenario: SQL migration from a server to Server B, and the data is also migrated past.

Operating environment: A server: WINDOWS7 B Server: WINDOWS8.1 auxiliary tool: VNC

First, backup from a server:

OK, the backup is complete. Download file to b server via VNC's transfer files

After downloading, start the backup and restore database on Server B:

Backup may encounter the following issues:

1. "The database in the backup set is different from the existing database",

This problem is typically caused by a path or database version issue

Workaround: Use the following SQL script to perform the overwrite action directly in MSSQL of the destination server you need to back up

1  2  RESTORE DATABASEData_center3  from DISK = 'D:\Backup\DATA_CENTER.bak'   --bak file path4  with Replace, 5MOVE'Data_center'  to 'C:\Program Files\Microsoft SQL Server\mssql12. Mssqlserver\mssql\data\data_center.mdf',--MDF file path6MOVE'Data_center_log'  to 'C:\Program Files\Microsoft SQL Server\mssql12. Mssqlserver\mssql\data\data_center.ldf'   --ldf file path7  

After successful execution, at this time the database has a table structure, and then follow the system to restore the database again, you can.

2. In the process of re-executing 1, "Cannot gain exclusive access to the database because the database is in use"

Execute the following sql:

1 ALTER DATABASE [datebase] SET  with ROLLBACK IMMEDIATE

Then execute 1 of the SQL script, and finally you can execute the

ALTER  Database  [  datebase]  Set   Online  

In this way, the backup task is complete.

MSSQL Backup and Data migration

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.