Failed to restore a DB

  • 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

  • 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 😀

  • 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

    Blog -- LearnSQLWithBru

    Join on Facebook Page Facebook.comLearnSQLWithBru

    Twitter -- BruMedishetty

  • 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.

  • 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

    Blog -- LearnSQLWithBru

    Join on Facebook Page Facebook.comLearnSQLWithBru

    Twitter -- BruMedishetty

  • 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

  • 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

  • Retore the database using T-SQL commands. You will learn more if you use T-SQL instead of GUI

  • 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"

  • 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.

  • Actually when you backup a database you will get only 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.

Viewing 11 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic. Login to reply