You can create a new db then use the “Restore Wizard” enabling the Overwrite option or:
View the contents of the backup file:
RESTORE FILELISTONLY FROM DISK='c:\your.bak'
note the logical names of the .mdf & .ldf from the results, then:
RESTORE DATABASE MyTempCopy FROM DISK='c:\your.bak'
WITH
MOVE 'LogicalNameForTheMDF' TO 'c:\MyTempCopy.mdf',
MOVE 'LogicalNameForTheLDF' TO 'c:\MyTempCopy_log.ldf'
This will create the database MyTempCopy
with the contents of your.bak
.
(Don’t create the MyTempCopy, it’s created during the restore)
Example (restores a backup of a db called ‘creditline’ to ‘MyTempCopy’):
RESTORE FILELISTONLY FROM DISK='e:\mssql\backup\creditline.bak'
>LogicalName
>--------------
>CreditLine
>CreditLine_log
RESTORE DATABASE MyTempCopy FROM DISK='e:\mssql\backup\creditline.bak'
WITH
MOVE 'CreditLine' TO 'e:\mssql\MyTempCopy.mdf',
MOVE 'CreditLine_log' TO 'e:\mssql\MyTempCopy_log.ldf'
>RESTORE DATABASE successfully processed 186 pages in 0.010 seconds (144.970 MB/sec).