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