Alter Logical FileName during Restore

  • Can two databases have same logical filenames in the same instance?

    In my instance, database already exists say A.

    I have to restore DB B with the same backup used for database A in the same instance.

    So, once the database B is restored, A and B will have same logical fileNames.

    Can I leave it as is? Or do i alter only after B is restored?

    Or is there a way where I can change the logical file for B while restoring?

    Thanks.

  • Yes, the same logical file names can be used in multiple databases. I've actually seen instances with hundreds of databases that all have the same logical file names because new user DBs are created by restoring from a backup of a template database.

    As to changing the logical file name, if you want to change those you'd have to change it after the restore, using ALTER DATABASE <database name> MODIFY FILE (NAME=<current logical name>, NEWNAME=<new logical name>)

    Documentation at https://msdn.microsoft.com/en-us/library/bb522469.aspx

    Cheers!

Viewing 2 posts - 1 through 1 (of 1 total)

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