Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RESTORE Database 1

Status
Not open for further replies.

arpan

Programmer
Oct 16, 2002
336
IN
This question pertains to SQL Server 2000 running on Win2K Pro. I have a database back-up named BSI4200.bkp is my C: drive. Please note that I haven't made the back-up on my machine; I got it from someone. Now to RESTORE this database, I am using the following code:
Code:
RESTORE DATABASE BSI4200
FROM DISK='C:\BSI4200.bkp'
WITH 
MOVE 'BSI4200' TO 'C:\Program Files\Microsoft SQL Server\MSSQL$ARPAN\Data\BSI4200.mdf',
MOVE 'BSI4200_log'  TO 'C:\Program Files\Microsoft SQL Server\MSSQL$ARPAN\Data\BSI4200.ldf'
but this throws the following error:

Logical file 'BSI4200' is not part of database 'BSI4200'. Use RESTORE FILELISTONLY to list the logical file names.
RESTORE DATABASE is terminating abnormally.

I modified the above code & introduced the following code at the very beginning of the code:
Code:
RESTORE FILELISTONLY
FROM DISK='C:\BSI4200.bkp'
keeping the rest of the code as it is but this also throws exactly the same error as before but at the same time says 2 row(s) affected in the 'Messages' pane. The 2 rows are
Code:
-------------------------------------------------------------------------------------------
LogicalName       PhysicalName             Type     FileGroupName   Size     MaxSize
-------------------------------------------------------------------------------------------
BSI4103       C:\SQLData\BSI4200.mdf         D          PRIMARY    3801088   35184372080640
BSI4103_log   C:\SQLLog\BSI4200_log.ldf      L            NULL     4784128   35184372080640
-------------------------------------------------------------------------------------------
I don't understand from where is 'BSI4103' coming? I don't have anything named BSI4103. Also there are no directories named SQLData & SQLLog existing in my C: drive! What is happening? How do I restore the database?

Thanks,

Arpan
 
This is data from the original database that was backed up.
If you exclude the move option these are the files it will try (and fail) to create.

Your problem is that you have used the names BSI4200 and BSI4200_log instead of BSI4103 and BSI4103_log.

======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
Thanks, mate, for your suggestion. You hit the nail on the head. The DB was named BSI4103 earlier & I wasn't aware of this fact. Later I got it verified from my friend who had created the back-up.

Thanks once again,

Regards,

Arpan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top