Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. probel with restore database - sql server

probel with restore database - sql server

Scheduled Pinned Locked Moved Database
databasequestionsql-serversysadminhelp
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Gali1978
    wrote on last edited by
    #1

    hi i try to backup and restore database using sql-server 2008 and got error. to backup i done this:

    BACKUP DATABASE MyDB TO DISK='d:\MyDB.BAK'

    (and its work fine) to restore i done this:

    USE MASTER RESTORE DATABASE MyDB FROM DISK='d:\MyDB.BAK

    and got this error:

    Msg 3159, Level 16, State 1, Line 7
    The tail of the log for the database "MyDB " has not been backed up. Use BACKUP LOG WITH NORECOVERY to backup the log if it contains work you do not want to lose. Use the WITH REPLACE or WITH STOPAT clause of the RESTORE statement to just overwrite the contents of the log.
    Msg 3013, Level 16, State 1, Line 7
    RESTORE DATABASE is terminating abnormally.

    Where I'm wrong ? what is missing ? thank's in advance

    G 1 Reply Last reply
    0
    • G Gali1978

      hi i try to backup and restore database using sql-server 2008 and got error. to backup i done this:

      BACKUP DATABASE MyDB TO DISK='d:\MyDB.BAK'

      (and its work fine) to restore i done this:

      USE MASTER RESTORE DATABASE MyDB FROM DISK='d:\MyDB.BAK

      and got this error:

      Msg 3159, Level 16, State 1, Line 7
      The tail of the log for the database "MyDB " has not been backed up. Use BACKUP LOG WITH NORECOVERY to backup the log if it contains work you do not want to lose. Use the WITH REPLACE or WITH STOPAT clause of the RESTORE statement to just overwrite the contents of the log.
      Msg 3013, Level 16, State 1, Line 7
      RESTORE DATABASE is terminating abnormally.

      Where I'm wrong ? what is missing ? thank's in advance

      G Offline
      G Offline
      Goutam Patra
      wrote on last edited by
      #2

      The database MyDB is already exists. Consider using WITH REPLACE to overwrite the database. Here [^] is more about restore.

      G 1 Reply Last reply
      0
      • G Goutam Patra

        The database MyDB is already exists. Consider using WITH REPLACE to overwrite the database. Here [^] is more about restore.

        G Offline
        G Offline
        Gali1978
        wrote on last edited by
        #3

        thank's for the help ! can i get a simple sample for what i need to do with my example ?

        G 1 Reply Last reply
        0
        • G Gali1978

          thank's for the help ! can i get a simple sample for what i need to do with my example ?

          G Offline
          G Offline
          Goutam Patra
          wrote on last edited by
          #4

          Perhaps this would help

          RESTORE DATABASE MyDB FROM DISK='d:\MyDB.BAK' WITH REPLACE

          G 1 Reply Last reply
          0
          • G Goutam Patra

            Perhaps this would help

            RESTORE DATABASE MyDB FROM DISK='d:\MyDB.BAK' WITH REPLACE

            G Offline
            G Offline
            Gali1978
            wrote on last edited by
            #5

            thank's for the help, but i got this error:

            Msg 3101, Level 16, State 1, Line 7

            Exclusive access could not be obtained because the database is in use.

            Msg 3013, Level 16, State 1, Line 7

            RESTORE DATABASE is terminating abnormally.

            G G 2 Replies Last reply
            0
            • G Gali1978

              thank's for the help, but i got this error:

              Msg 3101, Level 16, State 1, Line 7

              Exclusive access could not be obtained because the database is in use.

              Msg 3013, Level 16, State 1, Line 7

              RESTORE DATABASE is terminating abnormally.

              G Offline
              G Offline
              Gerben Jongerius
              wrote on last edited by
              #6

              You can't do a restore on a database that is in use. So you will first have to kill all clients accessing the database, either by stopping them or forcefully disconnecting them from the database. Check the activity using the 'Activity Monitor'.

              1 Reply Last reply
              0
              • G Gali1978

                thank's for the help, but i got this error:

                Msg 3101, Level 16, State 1, Line 7

                Exclusive access could not be obtained because the database is in use.

                Msg 3013, Level 16, State 1, Line 7

                RESTORE DATABASE is terminating abnormally.

                G Offline
                G Offline
                Goutam Patra
                wrote on last edited by
                #7

                Well your error message suggest the problem. Close all applications using the database you want to restore. Close all SSMS windows using the database you want to restore. And when you are running restore query use master database. Try to read the error messages in all cases. That will help you understand any problem.

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups