Wednesday, March 21, 2012

Restore database error: Microsoft SQL-DMO (ODBC SQLState: 42000)

I created a complete backup of a SQL Server 7 database so that I can
recreate it on a SQL Server 2000 database.
I tried 2 options but got the following errors.
1. Using EM's Tools | Restore Database, I typed in BaseFinal as the name
of the database and tried restoring it. I selected the backup
BaseFinal_Backup.BAK as the device.
Microsoft SQL-DMO (ODBC SQLState: 42000)
Device activation error. The physical file name
'E:\Mssql\Data\BaseFinal_Data.mdf' may be incorrect. File
'BaseFinal_Data' cannot be restored to
'E:\Mssql\Data\BaseFinal_Data.mdf'.
Use WITH MOVE to identify a valid location for the file.
Device activation error. The physical file name
'E:\Mssql\Data\BaseFinal_Log.ldf' may be incorrect. File 'BaseFinal_Log'
cannot be restored to 'E:\Mssql\Data\BaseFinal_Log.ldf'. Use
WITH MOVE to identify a valid location for the file.
RESTORE DATABASE is terminating abnormally.
2. Using EM, I created an empty BaseFinal database. Using Tools |
Restore Database, selected BaseFinal and tried restoring it selecting
the device from my C drive.
Microsoft SQL-DMO (ODBC SQLState: 42000)
The backup set holds a backup of a database other than the existing
'BaseFinal' database.
RESTORE DATABASE is terminating abnormally.
Thanks.
PLEASE REPLY TO THE GROUP. THANKS.
*** Sent via Developersdex http://www.codecomments.com ***
Don't just participate in USENET...get rewarded for it!When you are restoring with EM, check the Options tab, part "Restore
database files as:" in the middle. There you can change the path to the
files, so it points to a valid drive and folder.
Dejan Sarka, SQL Server MVP
Associate Mentor
Solid Quality Learning
More than just Training
www.SolidQualityLearning.com
"malehit@.devdex.com" <anonymous@.devdex.com> wrote in message
news:uVSmPTFiEHA.2340@.TK2MSFTNGP11.phx.gbl...
> I created a complete backup of a SQL Server 7 database so that I can
> recreate it on a SQL Server 2000 database.
> I tried 2 options but got the following errors.
> 1. Using EM's Tools | Restore Database, I typed in BaseFinal as the name
> of the database and tried restoring it. I selected the backup
> BaseFinal_Backup.BAK as the device.
> Microsoft SQL-DMO (ODBC SQLState: 42000)
> Device activation error. The physical file name
> 'E:\Mssql\Data\BaseFinal_Data.mdf' may be incorrect. File
> 'BaseFinal_Data' cannot be restored to
> 'E:\Mssql\Data\BaseFinal_Data.mdf'.
> Use WITH MOVE to identify a valid location for the file.
> Device activation error. The physical file name
> 'E:\Mssql\Data\BaseFinal_Log.ldf' may be incorrect. File 'BaseFinal_Log'
> cannot be restored to 'E:\Mssql\Data\BaseFinal_Log.ldf'. Use
> WITH MOVE to identify a valid location for the file.
> RESTORE DATABASE is terminating abnormally.
> 2. Using EM, I created an empty BaseFinal database. Using Tools |
> Restore Database, selected BaseFinal and tried restoring it selecting
> the device from my C drive.
> Microsoft SQL-DMO (ODBC SQLState: 42000)
> The backup set holds a backup of a database other than the existing
> 'BaseFinal' database.
> RESTORE DATABASE is terminating abnormally.
> Thanks.
> PLEASE REPLY TO THE GROUP. THANKS.
> *** Sent via Developersdex http://www.codecomments.com ***
> Don't just participate in USENET...get rewarded for it!|||Hi,
It seems you have given a physical location which is not in the new server
(Drive and directory) while loading in SQL 2000.
Please follow the below steps in query analyzer:-
Restore filelistonly from disk='c:\backup\dbname.bak'
( replace the 'c:\backup\dbname.bak' with the actual backup file name with
path where the file resides.)
This will give you the Logical and Physical file names of the Backup file
name. While loading you should give the
correct logical file name and the place to keep the physical file. But
Physical file name can be a diffrent one.
Restore Database <dbname> from disk= 'c:\backup\dbname.bak' with
move 'logical_mdf_name' to 'c:\mssql\data\phys_data_name.mdf',
move 'logical_ldf_name' to 'c:\mssql\data\phys_log_name.ldf'
(Replace the logical_mdf_name and logical_ldf_name with the logical name you
got from RESTORE FILELISTONLY command.
Ensure that the directory give in physical file name is there in the server)
Thanks
Hari
MCDBA
"Dejan Sarka" <dejan_please_reply_to_newsgroups.sarka@.avtenta.si> wrote in
message news:unJyQaFiEHA.4064@.TK2MSFTNGP12.phx.gbl...
> When you are restoring with EM, check the Options tab, part "Restore
> database files as:" in the middle. There you can change the path to the
> files, so it points to a valid drive and folder.
> --
> Dejan Sarka, SQL Server MVP
> Associate Mentor
> Solid Quality Learning
> More than just Training
> www.SolidQualityLearning.com
> "malehit@.devdex.com" <anonymous@.devdex.com> wrote in message
> news:uVSmPTFiEHA.2340@.TK2MSFTNGP11.phx.gbl...
>|||The following code did the trick.
RESTORE FILELISTONLY
FROM DISK = 'C:\INTOP\DBFinal_Backup.BAK'
RESTORE DATABASE DB1639
FROM DISK = 'C:\INTOP\DBFinal_Backup.BAK'
WITH MOVE 'DBFinal_Data' TO 'C:\Program Files\Microsoft SQL
Server\MSSQL\Data\DB1639_Data.mdf',
MOVE 'DBFinal_Log' TO 'C:\Program Files\Microsoft SQL
Server\MSSQL\Data\DB1639_Log.ldf'
GO
Thanks for the help.
PLEASE REPLY TO THE GROUP. THANKS.
*** Sent via Developersdex http://www.codecomments.com ***
Don't just participate in USENET...get rewarded for it!

No comments:

Post a Comment