Does backup create Filegroup/File for restore in another database

  • last month, I had made a backup of a database into a different name in the same server.

    I just made some change to the first database - I added a filegroup and a file into it and moved 10 critical indexes into it.

    Can I just backup and restore into the database 2? or do I have to create the same filegroup and file names into the 2nd database and then do the restore?

    Thanks

    Dan

  • You need not create any file groups in the database2, I guess you are trying to overwrite the existing Database2.


    Bru Medishetty

    Blog -- LearnSQLWithBru

    Join on Facebook Page Facebook.comLearnSQLWithBru

    Twitter -- BruMedishetty

  • Yes, I am trying to put the backup on the existing Database2.

  • When you overwrite the existing Database, you do not need to worry about creating the new Filegroups in the database2, it will be written by the new backup of the Database1 ( and the New File groups will be available)


    Bru Medishetty

    Blog -- LearnSQLWithBru

    Join on Facebook Page Facebook.comLearnSQLWithBru

    Twitter -- BruMedishetty

  • Bru

    When I tried to restore it into DB2, I get this message:

    The file 'c:\OVE\OVE_Data.ndf' cannot be overwritten. It is being used by database 'OVE'. [SQLSTATE 42000] (Error 1834) File 'OVE_Index' cannot be restored to 'c:\OVE\OVE_Data.ndf'. Use WITH MOVE to identify a valid location for the file. [SQLSTATE 42000] (Error 3156) Problems were identified while planning for the RESTORE statement. Previous messages provide details.[SQLSTATE 42000] (Error 3119) RESTORE DATABASE is terminating abnormally. [SQLSTATE 42000] (Error 3013)

    Apparently it does not know where to create the new file-so it is trying to put it in the same place as the original database! that cannot work...

    Dan

  • Obviously when you get backup and try to restore in the same SQL Instance, this error would occur, I thought you would have been aware of this. When restoring, you need to mention a new location or a new Name for the Data and Log Files and also choose overwrite existing.


    Bru Medishetty

    Blog -- LearnSQLWithBru

    Join on Facebook Page Facebook.comLearnSQLWithBru

    Twitter -- BruMedishetty

  • Thanks Bru.

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

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