Home All Groups Group Topic Archive Search About

How to restore a database when the database is deleted

Author
26 Aug 2005 5:46 AM
ad
I use
    backup database pubs to disk='c:\pubbackup.bak'
to backup pubs database.
Then I detach pubs, and delete pubs.mdf and pubs.lof

After delete the files, I use
    restore database pubs from  disk='c:\pubbackup.bak'
to restore database form backup file, but it fail with message: "Can't find
pubs database"

How can I restore a database when the database is deleted?

Author
26 Aug 2005 6:46 AM
R.D
Try this
create new database pubs(EMPTY); now you will be able restore

Regards
R.D

Show quote
"ad" wrote:

>
> I use
>     backup database pubs to disk='c:\pubbackup.bak'
> to backup pubs database.
> Then I detach pubs, and delete pubs.mdf and pubs.lof
>
> After delete the files, I use
>     restore database pubs from  disk='c:\pubbackup.bak'
> to restore database form backup file, but it fail with message: "Can't find
> pubs database"
>
> How can I restore a database when the database is deleted?
>
>
>
>
>
Author
26 Aug 2005 7:30 AM
Tibor Karaszi
There's got to be something more going on... Below works perfectly on my machine:

USE master
backup database pubs to disk='c:\pubbackup.bak'
drop database pubs
restore database pubs from  disk='c:\pubbackup.bak'
use pubs
select * from authors


Show quote
"ad" <a*@wfes.tcc.edu.tw> wrote in message news:exDV6FgqFHA.3444@TK2MSFTNGP12.phx.gbl...
>
> I use
>    backup database pubs to disk='c:\pubbackup.bak'
> to backup pubs database.
> Then I detach pubs, and delete pubs.mdf and pubs.lof
>
> After delete the files, I use
>    restore database pubs from  disk='c:\pubbackup.bak'
> to restore database form backup file, but it fail with message: "Can't find
> pubs database"
>
> How can I restore a database when the database is deleted?
>
>
>
>
Author
26 Aug 2005 9:11 AM
ad
Thanks

"Tibor Karaszi" <tibor_please.no.email_kara***@hotmail.nomail.com>
???????:ey8hDAhqFHA.1***@tk2msftngp13.phx.gbl...
Show quote
> There's got to be something more going on... Below works perfectly on my
> machine:
>
> USE master
> backup database pubs to disk='c:\pubbackup.bak'
> drop database pubs
> restore database pubs from  disk='c:\pubbackup.bak'
> use pubs
> select * from authors
>
>
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
>
> "ad" <a*@wfes.tcc.edu.tw> wrote in message
> news:exDV6FgqFHA.3444@TK2MSFTNGP12.phx.gbl...
>>
>> I use
>>    backup database pubs to disk='c:\pubbackup.bak'
>> to backup pubs database.
>> Then I detach pubs, and delete pubs.mdf and pubs.lof
>>
>> After delete the files, I use
>>    restore database pubs from  disk='c:\pubbackup.bak'
>> to restore database form backup file, but it fail with message: "Can't
>> find pubs database"
>>
>> How can I restore a database when the database is deleted?
>>
>>
>>

AddThis Social Bookmark Button