Restroing DB to multiple files

  • Is it possible to restore a database's logical path to multiple physical files?

    The following produces an expected file or id error message.

    RESTORE DATABASE TestDB

    FROM DISK = 'Z:\SQLServerBackups\AdventureWorks2012.bak'

    WITH MOVE 'AdventureWorks2012_Data' TO 'C:\MySQLServer\testdb.mdf', 'C:\MySQLServer\testdb2.ndf',

    MOVE 'AdventureWorks2012_Log' TO 'C:\MySQLServer\testdb.ldf';

    GO

  • nope, logical and physical names are a one to one relationship

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

  • Not possible. A restore recreates the DB as it was at the time of backup. If the database that was backed up had one data file then the restored database has one data file.

    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
  • If it is not possible to restore to multiple files, is it possible to automate moving the data to multiple ndf files after the restore?

  • only by scripting up exactly what you want to do.

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

  • marks_262 (6/18/2013)


    If it is not possible to restore to multiple files, is it possible to automate moving the data to multiple ndf files after the restore?

    Depends what you want to do specifically (and why)

    There's no ALTER DATABASE SPREAD DATA ACROSS FILES command.

    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

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

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