Link to home
Start Free TrialLog in
Avatar of Krieg
Krieg

asked on

RESTORE DATABASE?

Dear Everybody,

I have a problem on how to restore the MSSQL Backup file. It will be restored thru network.
I hope you can help me with this. I actually have my source code below, but it gives an error.
I am using SQL Query Analyzer before putting it in Delphi 6.

Here's the SQL Query Analyzer code:

RESTORE DATABASE Oliver
   FROM DISK = '\\sqlserver\c$\OliverBackup.bak'
   WITH MOVE 'Oliverbackup' TO '\\sqlserver\c$\oliverbackup.mdf',
   MOVE 'Oliverbackup_log' TO '\\sqlserver\c$\oliverbackup_log.ldf'

Error:

Server: Msg 3234, Level 16, State 2, Line 1
Logical file 'Oliverbackup' is not part of database 'Oliver'. Use RESTORE FILELISTONLY to list the logical file names.
Server: Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.

I don't want to use the RESTORE FILELISTONLY since you cannot specify there the path.

I hope you can help me guys.

Thanks in advance.
Avatar of rafrancisco
rafrancisco

Try this to list the name of the data files:

RESTORE FILELISTONLY
   FROM DISK = '\\sqlserver\c$\OliverBackup.bak'
Avatar of Krieg

ASKER

hi rafrancisco,

I actually tried this code already, and what I need is the RESTORE DATABASE where you can specify a certain path. But I don't if why it will give an error when using this command.

After issuing the previous command, look at the name of the data file and replace it below.  The error means that there is no Oliverbackup in your backup.  Most probably it is called Oliverbackup_Data:

RESTORE DATABASE Oliver
   FROM DISK = '\\sqlserver\c$\OliverBackup.bak'
   WITH MOVE 'Oliverbackup_Data' TO '\\sqlserver\c$\oliverbackup.mdf',
   MOVE 'Oliverbackup_log' TO '\\sqlserver\c$\oliverbackup_log.ldf'
ASKER CERTIFIED SOLUTION
Avatar of Jim P.
Jim P.
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Krieg

ASKER

Hi Guys,

Thank you for sharing your solutions, but I think I have to give the points to jimpen.

Thanks to you all :)

Thank you for the points.  As is obvious, I have run into this many times. Good luck on your DR plan.