SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


12»»

Failed to restore a DB Expand / Collapse
Author
Message
Posted Tuesday, November 17, 2009 10:11 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, November 25, 2009 5:07 AM
Points: 3, Visits: 11
Hello all

i ve backuped a DB using Microsft SQL Server Management Studio right clik on db -> tasks ->back up
the backup was completed successfully ,but when i try to restore the database , i get this message [Directory lookup for file ...Operating system error 21]
what is it wrong that i did?

PS :i heard people talking that MSSMS creates two file (.bak,.log)
why the MSSMS have created ONLY ONE FILE for my database ?

PLZ help
Post #820559
Posted Tuesday, November 17, 2009 10:29 PM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Friday, February 26, 2010 10:06 PM
Points: 1,504, Visits: 775
What kind of backup did you perform.

Use the following query to check the list of files in your .bak file.

RESTORE FILELISTONLY FROM  DISK = N'D:\DB_name.BAK'

And also verify if the drive to which you are trying to roster actually exits. If not try changing the file path to an existing drive.



Tanx
Post #820562
Posted Tuesday, November 17, 2009 10:31 PM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, March 04, 2010 7:36 AM
Points: 1,425, Visits: 1,499
alaminfad (11/17/2009)
but when i try to restore the database , i get this message [Directory lookup for file ...Operating system error 21]
what is it wrong that i did?


After taking the backup you are immediately restoring it on the same server?
Details are not mentioned clearly.

PS :i heard people talking that MSSMS creates two file (.bak,.log)
why the MSSMS have created ONLY ONE FILE for my database ?
PLZ help


What you might have heard is SQL Server creates 2 files when a database is created not when backup is taken. By default a Database is created with 2 files 1 .MDF File (data file) and .LDF (log file).

You are confused that with the backups (.bak,.log) which is not true. When a backup is performed, it would be placed in the Backup Directory of that instance and would be a single .bak file (unless you have mentioned another file for backup by selecting ADD button)

Give more info here about the restore you tried and definitely someone would give a solution to your problem.

Have a nice day



Bru Medishetty

To get quick answers read the article
How to post data/code on a forum to get the best help


My Blog - learnsqlwithbru.com
Post #820563
Posted Wednesday, November 18, 2009 7:05 AM


SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Tuesday, March 02, 2010 5:18 AM
Points: 404, Visits: 351
Check the permissions for the account used to run the SQL Server service as this sounds like it is missing create permissions for the target directory. I encountered this a while ago but cannot remember the exact error message I received.

Regarding backups.
* If you run a full backup, you get a .bak file
* If you run a tranaction log backup, you get a .log file

You can change the file extension but these a typical values.

Hope this helps.
Post #820800
Posted Wednesday, November 18, 2009 7:11 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, March 04, 2010 7:36 AM
Points: 1,425, Visits: 1,499
Mark_Pratt (11/18/2009)

Regarding backups.
* If you run a full backup, you get a .bak file
* If you run a tranaction log backup, you get a .log file

You can change the file extension but these a typical values.

Hope this helps.

Generally I use the default transaction log files extension .trn.

I am not aware of what extensions others use.



Bru Medishetty

To get quick answers read the article
How to post data/code on a forum to get the best help


My Blog - learnsqlwithbru.com
Post #820806
Posted Wednesday, November 18, 2009 10:48 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, November 25, 2009 5:07 AM
Points: 3, Visits: 11
Thank you Sir for replying

Firstly

I want to restore the DB on a different server which is my local machine ,After have taken the backup , i copied the file to my local drive ,then i tried to restore it and the error appeared

SECONDLY

the backup which i've taken was a FULL BACK UP

THIRDLY

i noticed the path was incorrect here >> Restore wizard (Restore DB >> Options >>Restore the database files as : >> Restore As

E:\Netsoft DataBases\Employee.mdf

i do not even have an E drive


i hope that clarify the problem



THNX
Post #821367
Posted Wednesday, November 18, 2009 11:15 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, November 25, 2009 5:07 AM
Points: 3, Visits: 11
Thank you Sir for replying

You were right the path was incorrect here >> Restore wizard (Restore DB >> Options >>Restore the database files as : >> Restore As
E:\Netsoft DataBases\Employee.mdf
E:\Netsoft DataBases\Employee_log.LDF

i do not even have an E drive

when i changed the path for one file this error appears

System.data.sqlclient.sqlerror:The operation System returned the error 32 ...while Attempting 'Restore Container :: ValidateTargetforcreation on (....) (Misrosoft.SqlServer.smo)


when i changed the path for both files this error appears

System.data.sqlclient.sqlerror: file(...) is claimed by 'Employee_log'(2) and 'Employee' (1)The with move clause ....etc


Your Query was informative but the data are not editable

PS :the backup which i've taken was a FULL BACK UP

i hope that clarify the problem



THNX
Post #821373
Posted Monday, November 23, 2009 11:23 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, March 10, 2010 9:25 AM
Points: 37, Visits: 206
Retore the database using T-SQL commands. You will learn more if you use T-SQL instead of GUI
Post #823423
Posted Monday, November 23, 2009 1:54 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Wednesday, March 10, 2010 10:31 AM
Points: 253, Visits: 377
Lookup backups in BOL, specifically, look at the section where you are creating a database from a backup. I believe there is an example in there as well that will have all of the arguments that you will need to use.

Joie Andrew
"Since 1982"
Post #823504
Posted Thursday, November 26, 2009 2:56 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, November 30, 2009 2:13 AM
Points: 9, Visits: 7
Actually when you backup a database you will get only a database.bak file.
But when you restore the above database.bak file you should use datasbase.mdf and databse_log.ldf file of the default database.
These .mdf and .ldf files are generated at the time of database creation and not during the .bak restoring process.
The problem may be the due to
>>restore path for the above .ldf and .mdf file is not set properly.
>> overwrite the existing database may not be checked.
>>Restore option may not be checked.
>>Your database.bak file can be incomplete or corrupted.
>>You dont't have authority to access the database.
Post #825114
« Prev Topic | Next Topic »

12»»

Permissions Expand / Collapse