RESTORE THE DATABASE SYNTAX IN SQL SERVER 2005

  • HEY I NEED HELP IN HOW TO RESTORE THE DATABASE SYNTAX IN SQL SERVER 2005..CAN ANY ONY HELP THIS...!

    ESPECILLY MOVING DISKS.......

    I AM HAVING SYNTAX LIKE THIS

    RESTORE DATABASE UK

    FROM DISK = ' '

    WITH MOVE ' ' TO 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\UK.mdf',

    MOVE ' ' TO 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\UK_log.ldf'

    I AM GETING ERROR LIKE THIS

    Msg 3154, Level 16, State 4, Line 1

    The backup set holds a backup of a database other than the existing 'UK' database.

    Msg 3013, Level 16, State 1, Line 1

    RESTORE DATABASE is terminating abnormally.

  • This is the best place to start from if syntax is your issue:

    http://msdn.microsoft.com/en-us/library/ms186858.aspx

    -- Gianluca Sartori

  • RESTORE DATABASE UK

    FROM DISK = '\\SQLSERVER\Backup\Newfull.bak'

    WITH REPLACE,

    MOVE 'LIST_New' TO 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\UK.mdf',

    MOVE 'LIST_Log' TO

    'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\UK_log.mdf'

    WHEN I AM EXECUTING THIS COMMAND I AM GETTING ERROR

    Msg 3234, Level 16, State 2, Line 1

    Logical file 'New' is not part of database 'UK'. Use RESTORE FILELISTONLY to list the logical file names.

    Msg 3013, Level 16, State 1, Line 1

    RESTORE DATABASE is terminating abnormally.

  • Please don't type in all caps. It's the online equivalent of shouting at us. There's not need to use bold, caps and large fonts, they're not going to get your question answered any faster.

    As the error clearly states, the logical file name you have specified is not part of the database and you should use RESTORE FILELISTONLY to see what the logical names of the files are in order to correctly specify them in the WITH MOVE clause.

    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
  • What do you get when you request the filelist (filelistonly)?

    I suppose the suffix "_new" is not part of the logical filename.

    -- Gianluca Sartori

  • GilaMonster (5/24/2010)


    ... the logical file name you have specified is not part of the database and you should use RESTORE FILELISTONLY ...

    Sorry for echoing, Gail.

    -- Gianluca Sartori

  • Raju The Leader (5/24/2010)


    RESTORE DATABASE UK

    FROM DISK = '\\SQLSERVER\Backup\Newfull.bak'

    WITH REPLACE,

    MOVE 'LIST_New' TO 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\UK.mdf',

    MOVE 'LIST_Log' TO

    'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\UK_log.mdf'

    WHEN I AM EXECUTING THIS COMMAND I AM GETTING ERROR

    Msg 3234, Level 16, State 2, Line 1

    Logical file 'New' is not part of database 'UK'. Use RESTORE FILELISTONLY to list the logical file names.

    Msg 3013, Level 16, State 1, Line 1

    RESTORE DATABASE is terminating abnormally.

    Hi Raju

    typing in CAPS is a form of shouting on forums, so please do not shout 😉

    For us to help you, please post the results of the following query and we will be able to generate a restore statement that works for your sql server backup file.

    RESTORE FILELISTONLY

    FROM DISK = '\\SQLSERVER\Backup\Newfull.bak'

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • Try this...

    RESTORE FILELISTONLY

    FROM DISK = 'CompletePathOfbackupFile.bak'

    Once you get the logical file names

    RESTORE DATABASE DB_Name

    FROM DISK = 'CompletePathOfbackupFile.bak'

    WITH MOVE 'logical name restored from first statment' To 'CompletePathForNewDBName.mdf',

    MOVE 'logical name restored from first statment_log' To 'DBName_log' TO 'CompletePathForNewDBName.ldf'

    - SAMJI
    If you marry one they will fight with you, If you marry 2 they will fight for you 🙂

Viewing 8 posts - 1 through 7 (of 7 total)

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