Tuesday, February 14, 2012

DB detach/attach lost data?

I used the technique of detaching, copying and attaching a database to setup
another one. The data did not get moved only the objects (tables, etc.).
After further investigation we found that the original db that was detached
also lost it's data. Good thing it was a test db. What could have happened?Hi
This would not normally be possible, the only thing I can think of is that
the transaction used to insert the data was rolled back and not committed or
you attached the wrong file(s)!
Before doing the detach try issuing as sp_helpfile to see what the data
files are.
John
"Jim Phillips" <jphillips@.marsys.com> wrote in message
news:O15lcMY$DHA.2484@.TK2MSFTNGP12.phx.gbl...
> I used the technique of detaching, copying and attaching a database to
setup
> another one. The data did not get moved only the objects (tables, etc.).
> After further investigation we found that the original db that was
detached
> also lost it's data. Good thing it was a test db. What could have
happened?
>|||Personally, I prefer to use db back-up/restore to move data. This has the
following benefits:
** You do not need to keep track of more than one file and that file you
name yourself (i.e. no searching for linked files)
** You do not need to take the original database of production
** You can easy move data across new servers without having to think of a
lot of database dependant settings such as languages etc.
** The file you move is just the size of the data, not including any extra
allocated space not currently in use.
There is more benefits, but these are the most important IMHO...
"Jim Phillips" <jphillips@.marsys.com> wrote in message
news:O15lcMY$DHA.2484@.TK2MSFTNGP12.phx.gbl...
I used the technique of detaching, copying and attaching a database to setup
another one. The data did not get moved only the objects (tables, etc.).
After further investigation we found that the original db that was detached
also lost it's data. Good thing it was a test db. What could have happened?

No comments:

Post a Comment