Solved

How to restore a backup to a server

Posted on 2011-03-17
10
342 Views
Last Modified: 2012-05-11
I backed up the following 2 databases:

aspnetstockPro and stockselectsql to

F:\SQLServerBackups\aspnetstockpro_new.bak
and
F:\SQLServerBackups\stockselectsql_new.bak

Then I reinstalled SQL Server 2005. After doing this I had no databases on the server except  
System Databases and Database Snapshots.

I need to restore aspnetstockPro and stockselectsql to the server.
They should appear on the Databases list.

I tried to execute the following SQL statement to restore aspnetstockpro :

restore database aspnetstockpro
from disk = 'F:\SQLServerBackups\aspnetstockpro_new.bak' with replace,
move 'aspnetstockpro' to 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\aspnetstockpro.MDF',
move 'aspnetstockpro_Log' to 'C:\Microsoft SQL Server\Data\aspnetstockpro.LDF'

Error:

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

What do I need to do? Image of the server files Image of the backup directory
0
Comment
Question by:Dovberman
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 4

Expert Comment

by:LeDaouk
ID: 35155999
try attach database and locate the .mdf file: more faster , but keed the .ldf with th mdf in the same folder
0
 
LVL 14

Expert Comment

by:Daniel_PL
ID: 35156011
Try this and find out logcal names of your files:
RESTORE FILELISTONLY from disk = 'F:\SQLServerBackups\aspnetstockpro_new.bak'

Then Restore:
RESTORE DATABASE aspnetstockpro
FROM DISK = 'F:\SQLServerBackups\aspnetstockpro_new.bak',
MOVE '<logical mdf file name>' to 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\aspnetstockpro.MDF',
MOVE '<logical log file name here>' to 'C:\Microsoft SQL Server\Data\aspnetstockpro.LDF'

You don't need replace because, there's nothing to replace ;)
0
 
LVL 25

Expert Comment

by:slam69
ID: 35156404
Or just right click on databases select restore and then use the gui?

enter the name of teh NEW database ie name of teh old you are now creating from teh backup

hit teh radio button next to from device and hit the ...

frind your file and hit ok then put a check in the box underneath restore in teh lower now populated window

0
 

Author Comment

by:Dovberman
ID: 35156773
Daniel PL

Thanks, I found the logical names.

I tried the following:

RESTORE DATABASE aspnetstockpro
FROM DISK = 'F:\SQLServerBackups\aspnetstockpro_new.bak',
MOVE 'aspnetdb' to 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\aspnetstockpro.MDF',
MOVE 'aspnetdb_log' to 'C:\Microsoft SQL Server\Data\aspnetstockpro.LDF'

Error:

Msg 102, Level 15, State 1, Line 5
Incorrect syntax near 'aspnetdb'.

Can you help with the syntax error?

Thanks,
0
 
LVL 25

Expert Comment

by:slam69
ID: 35156814
did you try the gui?
0
Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

 
LVL 14

Accepted Solution

by:
Daniel_PL earned 500 total points
ID: 35156907
I've eaten WITH, sorry


RESTORE DATABASE aspnetstockpro
FROM DISK = 'F:\SQLServerBackups\aspnetstockpro_new.bak'
WITH MOVE 'aspnetdb' to 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\aspnetstockpro.MDF',
MOVE 'aspnetdb_log' to 'C:\Microsoft SQL Server\Data\aspnetstockpro.LDF'

Open in new window

0
 

Author Comment

by:Dovberman
ID: 35157002
The error message indicates file not found.

Msg 5133, Level 16, State 1, Line 8
Directory lookup for the file "C:\Microsoft SQL Server\Data\aspnetstockpro.LDF" failed with the operating system error 3(The system cannot find the path specified.).
Msg 3156, Level 16, State 3, Line 8
File 'aspnetdb_log' cannot be restored to 'C:\Microsoft SQL Server\Data\aspnetstockpro.LDF'. Use WITH MOVE to identify a valid location for the file.
Msg 3119, Level 16, State 1, Line 8
Problems were identified while planning for the RESTORE statement. Previous messages provide details.
Msg 3013, Level 16, State 1, Line 8
RESTORE DATABASE is terminating abnormally.

I will search for  Data\aspnetstockpro.LDF

Perhaps the original backup did not create a log file.
0
 
LVL 14

Expert Comment

by:Daniel_PL
ID: 35157017
Make sure SQL Server service account has access to C:\Microsoft SQL Server\Data\ folder and check that folder exist.
0
 

Author Comment

by:Dovberman
ID: 35160221
I finally got it.

RESTORE DATABASE aspnetstockpro
FROM DISK = 'F:\SQLServerBackups\aspnetstockpro_new.bak'
WITH REPLACE

Thanks,
0
 

Author Closing Comment

by:Dovberman
ID: 35160229
Thank you.
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

Suggested Solutions

Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now