You're getting that first error because kdcb
already exists. And the backed up database is not that same database. If you want to overwrite an existing, separate database (that isn't the same. With the same you don't need to specify replace), you need to include the REPLACE
option:
RESTORE DATABASE KeltieCochrane_v2
FROM DISK = 'C:\KeltieCochrane_v220120220.BAK'
WITH
MOVE 'KeltieCochrane_v2' TO 'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\KeltieCochrane_v2.mdf',
MOVE 'KeltieCochrane_v2' TO 'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\KeltieCochrane_v2_1.ldf',
REPLACE
WARNING!!! You need to be very careful and make serious consideration by specifying REPLACE
. Here is an exact excerpt from BOL regarding REPLACE
:
Replace Option Impact
REPLACE should be used rarely and only after careful consideration.
Restore normally prevents accidentally overwriting a database with a
different database. If the database specified in a RESTORE statement
already exists on the current server and the specified database family
GUID differs from the database family GUID recorded in the backup set,
the database is not restored. This is an important safeguard.
The REPLACE option overrides several important safety checks that
restore normally performs. The overridden checks are as follows:
Restoring over an existing database with a backup taken of another database.
With the REPLACE option, restore allows you to overwrite an existing database with whatever database is in the backup set, even if
the specified database name differs from the database name recorded in
the backup set. This can result in accidentally overwriting a database
by a different database.
Restoring over a database using the full or bulk-logged recovery model where a tail-log backup has not been taken and the STOPAT option
is not used.
With the REPLACE option, you can lose committed work, because the log written most recently has not been backed up.
Overwriting existing files.
For example, a mistake could allow overwriting files of the wrong type, such as .xls files, or that are being used by another database
that is not online. Arbitrary data loss is possible if existing files
are overwritten, although the restored database is complete.