database restore

  • anyone can help me. i want to make job that will do database restoration...

    i tried this script but doesn't work...

    RESTORE FILELISTONLY

    FROM DISK = 'D:BackUpYourBaackUpFile.bak'

    GO

    ----Make Database to single user Mode

    ALTER DATABASE ogcfinalnew

    SET SINGLE_USER WITH

    ROLLBACK IMMEDIATE

    ----Restore Database

    RESTORE DATABASE YourDB

    FROM DISK = 'D:BackUpYourBaackUpFile.bak'

    WITH MOVE 'YourMDFLogicalName' TO 'D:DataYourMDFFile.mdf',

    MOVE 'YourLDFLogicalName' TO 'D:DataYourLDFFile.mdf'

    /*If there is no error in statement before database will be in multiuser

    mode.

    If error occurs please execute following command it will convert

    database in multi user.*/

    ALTER DATABASE YourDB SET MULTI_USER

    GO

    thanks!

  • What precisely do you mean by 'doesn't work'? What part doesn't work, what error does it throw or what does it do that it shouldn't be doing?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • error:

    Msg 3201, Level 16, State 2, Line 1

    Cannot open backup device 'D:ogcfinalogcfinalnew'. Operating system error 2(The system cannot find the file specified.).

    Msg 3013, Level 16, State 1, Line 1

    RESTORE FILELIST is terminating abnormally.

    =====================================================================

    SEtup:

    RESTORE FILELISTONLY

    FROM DISK = 'D:\ogc\ogcfinalnew.bak'

    GO

    --- note: my backup is stored in this path: D:\ogc

  • In the first script you posted, you're missing the \ on the drive letter. You have D:BackUpYourBaackUpFile.bak instead of D:\BackUpYourBaackUpFile.bak The error message indicates that that's a problem with the actual script too. Can you check it?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • me too feel the same, you missed '\' in the script.

    Check if you can do the backup using SSMS?

  • i got it working....

    what i did was i do manual restoration then after that i generated the script and put it into the mssql jobs.

    thanks!

Viewing 6 posts - 1 through 5 (of 5 total)

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