Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Restore Error

Author  Topic 

mistux
Yak Posting Veteran

90 Posts

Posted - 2005-04-23 : 17:12:52
When I try to restore a database from computer A to computer B I get:

"Device activation error. The physical file name "xxxx.mdf" may be incorrect. File "yyy" cannot be restored to "xxxx.mdf" use WITH MOVE to identify a valid location for the file."

Any suggestions?

Michael
For all your DNC needs for your CNC machines. www.mis-group.com

Kristen
Test

22859 Posts

Posted - 2005-04-24 : 03:09:53
Are you using Enterprise Manger or just raw T-SQL (e.g. in Query Analyser)?

Here's what I use in Query Analyser:

USE master -- (Can't sit in the database whilst its being restored!)
GO

ALTER DATABASE TARGET_DATABASE SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO

RESTORE DATABASE TARGET_DATABASE
FROM DISK = 'x:\PathToBackupFile\SOURCE_DATABASE_BACKUPFILE.BAK'
WITH
REPLACE,
-- NORECOVERY, -- Use if more T/Logs to recover
RECOVERY, -- Use if no more T/Logs to recover
STATS = 10, -- Show progress (every 10%)
MOVE 'SOURCE_DB_LOGICAL_NAME_data' TO 'x:\SomeRestorePath\TARGET_DATABASE.mdf',
MOVE 'SOURCE_DB_LOGICAL_NAME_log' TO 'x:\SomeRestorePath\TARGET_DATABASE.ldf'
GO

/*
-- If restoring additional TRANSACTION LOGs, after the main backup:
-- Make sure the NORECOVERY option is used above
-- then repeat the following for latest differential backup

RESTORE DATABASE TARGET_DATABASE
FROM DISK = 'x:\PathToBackupFile\TARGET_DATABASE_yyyymmdd_hhmm_Diff.BAK'
WITH
-- RECOVERY, -- Use if NO more T/Logs to recover
NORECOVERY, -- Use if there are T/Logs to recover
STATS = 10 -- Show progress (every 10%)

-- then repeat the following for each transaction log, in order
RESTORE LOG TARGET_DATABASE
FROM DISK = 'x:\PathToBackupFile\TARGET_DATABASE_yyyymmdd_hhmm_Trans.BAK'
WITH
-- RECOVERY, -- Use if NO more T/Logs to recover
NORECOVERY, -- Use if more T/Logs to recover
STATS = 10 -- Show progress (every 10%)
*/

-- Rename logical names:
ALTER DATABASE TARGET_DATABASE
MODIFY FILE (NAME = 'SOURCE_DB_LOGICAL_NAME_data',
NEWNAME = 'TARGET_DATABASE_data')
GO
ALTER DATABASE TARGET_DATABASE
MODIFY FILE (NAME = 'SOURCE_DB_LOGICAL_NAME_log',
NEWNAME = 'TARGET_DATABASE_log')
GO

Kristen
Go to Top of Page

Luis Martin
Yak Posting Veteran

54 Posts

Posted - 2005-04-24 : 10:49:49
Did you check destination path exist?
Go to Top of Page

mistux
Yak Posting Veteran

90 Posts

Posted - 2005-04-24 : 10:54:24
quote:
Originally posted by Kristen

Are you using Enterprise Manger or just raw T-SQL (e.g. in Query Analyser)?

Kristen



I am using Enterprise Manager

Michael
For all your DNC needs for your CNC machines. www.mis-group.com
Go to Top of Page

mistux
Yak Posting Veteran

90 Posts

Posted - 2005-04-24 : 10:56:41
quote:
Originally posted by Luis Martin

Did you check destination path exist?



Since I am not sure what that is, I am gonna say: "no."

I'll go see if I can find that and try it.

Michael
For all your DNC needs for your CNC machines. www.mis-group.com
Go to Top of Page

mistux
Yak Posting Veteran

90 Posts

Posted - 2005-04-24 : 11:26:34
Got it!

On the Options tab, under "Restore database file as:" I had to manually edit the path under: "Move to physical file name" to the path where all my other .MDF files were stored.

Thanks everyone!

Michael
For all your DNC needs for your CNC machines. www.mis-group.com
Go to Top of Page
   

- Advertisement -