|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to restore a database when the database is deletedI 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? 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? > > > > > 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 quoteTibor 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? > > > > 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? >> >> >> |
|||||||||||||||||||||||