Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 database backup and restore

Author  Topic 

vpcnk
Starting Member

2 Posts

Posted - 2014-04-10 : 00:25:40
I have two databases on the same mssql instance - testdb and mirrordb.

testdb has some data. mirrordb has no data.

I want to copy the data of testdb into mirrordb.

so I want to backup testdb and restore mirrordb from the backup file of testdb.

I tried :

BACKUP DATABASE "testdb" TO DISK='c:\mssql\backup\testdb.bkup' WITH NOFORMAT,INIT,STATS=10
restore DATABASE "mirrordb" from DISK='c:\mssql\backup\testdb.bkup' WITH recovery,STATS=10

but get the error :



Msg 3154, Level 16, State 4, Line 1

The backup set holds a backup of a database other than the existing 'mirrordb' database.

Msg 3013, Level 16, State 1, Line 1

RESTORE DATABASE is terminating abnormally.



can somebody tell me how to do this right?

appreciate the feedback.

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2014-04-17 : 19:38:59
restore DATABASE "mirrordb" from DISK='c:\mssql\backup\testdb.bkup' WITH recovery,REPLACE,STATS=10



===============================================================================
“Everyone wants a better life: very few of us want to be better people.”
-Alain de Botton
Go to Top of Page
   

- Advertisement -