Problem occurs when we try to
restore a database from backup set, but using MOVE option and when you provide
wrong logical name of file in MOVE section of RESTORE script.
To avoid this problem, first, one must verify original logical names of files by using following RESTORE FILELISTONLY .
FROM DISK = N'D:\temp.bak' WITH
MOVE 'TraceDB' TO 'd:\TraceDB2',
MOVE 'TraceDB_logw' TO 'd:\TraceDB2_log',
FILE = 4, NOUNLOAD, REPLACE, STATS = 10
To avoid this problem, first, one must verify original logical names of files by using following RESTORE FILELISTONLY .
Now if somehow I use wrong logical file name, it will
return error.
Correct the logical names, as per RESTORE FILELISTONLY output and it will work fine.
RESTORE DATABASE [TraceDB2] FROM DISK = N'D:\temp.bak' WITH
MOVE 'TraceDB' TO 'd:\TraceDB2',
MOVE 'TraceDB_logw' TO 'd:\TraceDB2_log',
FILE = 4, NOUNLOAD, REPLACE, STATS = 10
No comments:
Post a Comment