Issues that occur when you restore a database "Device activation Error" solution __ Database

Source: Internet
Author: User
Tags mssql
A database is backed up on one machine, and the backup file is hit and copied to another machine, but there is a mistake in preparing the restore, the prompt is: "Device activation error, physical file name: D:/program files/microsoft sqlserver/mssql/finance_ Data.mdf "may be wrong. File Finance_data cannot be restored to D:/program Files/microsoft sqlserver/mssql/finance_data.mdf. Use the WITH MOVE option to identify the file   Effective location ... " The error shown in the following illustration
Workaround:Directory not correct
--The detailed steps to solve the first problem:

1. Methods in Enterprise Manager:
--Right Button "database"
--All Tasks
--Restore Database
--Enter the restored database name in "Revert to Database Library"
--Restore Select "From Device"--Select device--add--Add your backup file--OK, back to the database restore interface
--Backup number--Select Content--Select the content you want to restore that backup
---option--Change the physical file name in the "Move to physical file name" to the file name you want your data file to hold
--select "Force Restore on existing database" if the database to be restored already exists-
-Determine


2. Use the SQL statement method (assuming your backup file name is: C:/xx.bak

--Lists the logical file names in the backup file
Restore filelistonly from disk= ' C:/xx.bak '


--Use the MOVE option with the statement recovery, based on the logical file name listed above
Restore database name after recovery
From disk= ' C:/xx.bak '
With move ' logical data file name 1 ' to ' c:/physical data file name 1 '
, move ' logical data file name 2 ' to ' c:/physical data file name 2 '
...
, move ' logical data file name n ' to ' c:/physical data file name n '

Problem:



Answer:

--My experience:
---First look at the database before the backup in the Query Analyzer, usually only if it is not self-backup to do so, if it is self-made of course know what the database.
Restore filelistonly from disk= ' J:/java component/Source code example/eclipse write shopping system/newshop/db/db_shop backup '
--Note: He provides a backup file instead of an MDF file, and cannot be used in an additional way
--then build an empty database in Enterprise Manager, as in this case: Db_bookmanage
--then the method in Enterprise Manager:
--"db_bookmanage" under the right button "database"
--Select "All Tasks"
--Select "Restore Database"
--Enter the restored database name in "Revert to Database Library"
--Restore Select "From Device"--Select device--add--Add your backup file--OK, back to the database restore interface
--Backup number--Select Content--Select the content you want to restore that backup
---option--Change the physical file name in the "Move to physical file name" to the file name you want your data file to hold
--select "Force Restore on existing database" if the database to be restored already exists
-Determine

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.