SQL Server Performance

Restore .bak file to another database

Discussion in 'SQL Server 2005 General Developer Questions' started by baburk, Nov 4, 2008.

  1. baburk New Member

    Hi,
    I generated bak file using this query from DATABASE Test ,
    BACKUP DATABASE Test TO DISK = 'Test.bak' WITH INIT
    For restoring I gave another DATABASE restoreDB
    RESTORE DATABASE [restoreDB]
    FROM DISK = 'C:program FilesMicrosoft SQL ServerMSSQL.1MSSQLBackupTest.bak'
    WITH REPLACE,
    MOVE 'restoreDB_Data' TO 'C:program FilesMicrosoft SQL ServerMSSQL.1MSSQLData
    estoreDB.mdf',
    MOVE 'restoreDB_Log' TO 'C:program FilesMicrosoft SQL ServerMSSQL.1MSSQLData
    estoreDB.ldf'
    then I got this error.
    Logical file 'restoreDB_Data' is not part of database 'restoreDB'. Use RESTORE FILELISTONLY to list the logical file names.
    RESTORE DATABASE is terminating abnormally.
    The main aim is to copy entire DATABASE Test to DATABASE restoreDB.
    Thanks in advance.

  2. Luis Martin Moderator

    Are the physicals names correct?.I mean, something like test.mdf and test.ldf sound more likely.
  3. madhuottapalam New Member

    It must be the problem of logical Data and log file name
    Run the following command and copy the logical name and replace the strikthrough portion belowRESTORE FILELISTONLY FROM DISK='C:program FilesMicrosoft SQL ServerMSSQL.1MSSQLBackupTest.bak'
    RESTORE DATABASE [restoreDB]
    FROM DISK = 'C:program FilesMicrosoft SQL ServerMSSQL.1MSSQLBackupTest.bak'
    WITH REPLACE,
    MOVE 'LogicalDatafileName' TO 'C:program FilesMicrosoft SQL ServerMSSQL.1MSSQLData
    estoreDB.mdf',
    MOVE 'LogicalLogfilename' TO 'C:program FilesMicrosoft SQL ServerMSSQL.1MSSQLData
    estoreDB.ldf'
    The logical name must be the name in backup set not the target db
    Madhu
  4. baburk New Member

    Dear Madhu,

    Thanks for ur help.
    From your query I tried like this
    RESTORE FILELISTONLY FROM DISK='C:program FilesMicrosoft SQL ServerMSSQL.1MSSQLBackupTest.bak'

    RESTORE DATABASE [restoreDB]
    FROM DISK = 'C:program FilesMicrosoft SQL ServerMSSQL.1MSSQLBackupTest.bak'
    WITH REPLACE,
    MOVE 'Test' TO 'C:program FilesMicrosoft SQL ServerMSSQL.1MSSQLData
    estoreDB.mdf',
    MOVE 'Test_Log' TO 'C:program FilesMicrosoft SQL ServerMSSQL.1MSSQLData
    estoreDB.ldf'
    Then I got this error.

    There is insufficient free space on disk volume 'C:' to create the database. The database requires 22681174016 additional free bytes, while only 19623108608 bytes are available.
    Problems were identified while planning for the RESTORE statement. Previous messages provide details.
    RESTORE DATABASE is terminating abnormally.

    ie it needs 32768 GB of space.
    Help me to solve.
  5. Luis Martin Moderator

    Easy, erase some files to get more space for database.Or, if you have other physical or logical disk, move mdf to that one.
  6. rohit2900 Member

    [quote user="baburk"]
    ie it needs 32768 GB of space
    [/quote]
    It needs '21.1234893798828' GB not 32768....
    as 22681174016 Byte = 22149584 KB
    22149584 KB = 21630.453125 MB
    21630.453125 MB = 21.1234893798828 GB
    See if your C drive has enough space available.
    Hope this helps
  7. satya Moderator

    Just to add up you might find the backup file size may not be that big as compared to the data files, but when it needs to restore the actual MDF & LDF files sizes must be created back there.
    So in this csae see if you have additional space within your system to test the backup.

Share This Page