Dewitt Harrison
Dewitt Harrison

Reputation: 51

Restore Production to Dev Different logical file name

I am trying to setup a nightly job to restore Development from a Production backup every night. Issue I am hitting is the logical file name on production is different on development. I am trying to restore and use move to set the file name.

Error I am receiving is 'Logical file 'BICUAT2' is not part of database 'BCIUAT'

Restore database BCIUAT
from disk = '\\ServerIP\SQLBackups\BICAP1\BICUAT\BICUAT_20180131220212.bak'
with recovery,
move 'BICUAT2'
to 'E:\Program Files\Microsoft SQL Server\MSSQL12.DEV\MSSQL\DATA\BICUAT',
move 'BICUAT2_log'
to 'E:\Program Files\Microsoft SQL Server\MSSQL12.DEV\MSSQL\DATA\BICUAT_log

Upvotes: 0

Views: 655

Answers (1)

David Browne - Microsoft
David Browne - Microsoft

Reputation: 89121

You can't change the logical filenames in a RESTORE. You can only specify different file locations for each file with MOVE ... TO. RESTORE can also not split or combine logical files or filegroups, or grow or shrink files.

A full restore always creates a database with exactly the same number of filegroups, files, and file sizes as the database that was backed-up.

Upvotes: 2

Related Questions