Wednesday, March 28, 2012

Restore transactions based on date range?

Hi there -- I'm a developer who mostly uses SQL Server from that
perspective, not a DBA, and I had a client ask me a question recently that I
couldn't answer.
My client has a database that is updated constantly. A few weeks ago, he
accidentially deleted about two weeks worth of data from the database.
Since then the db's users have continued to update new data. So basically
the database is missing about two weeks worth of data from a couple of
months ago.
Is there a way to restore just those two weeks worth of data from the
transaction logs? From everything that I know and everything I've found,
you restore a database to a point in time, instead of picking out a date
range from a backup. But as I said, I'm not a DBA. So any advice would be
appreciated. Thanks!If your customer has transaction log backups covering this period, you might be able to do this.
Either restore (db and then log backups) up to just before that deletion, to a new database. Then
transfer the desired data over to the production database (take relationships, constraints, triggers
etc into considerations).
Or, use some log reader tool and see if it can "mine" out counter statements for the delete process
from your log backup. I've listed some such tools at http://www.karaszi.com/SQLServer/links.asp
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Mike Ripplinger" <miker@.entrerock.com> wrote in message
news:egaC1EKRHHA.3316@.TK2MSFTNGP02.phx.gbl...
> Hi there -- I'm a developer who mostly uses SQL Server from that perspective, not a DBA, and I had
> a client ask me a question recently that I couldn't answer.
> My client has a database that is updated constantly. A few weeks ago, he accidentially deleted
> about two weeks worth of data from the database. Since then the db's users have continued to
> update new data. So basically the database is missing about two weeks worth of data from a couple
> of months ago.
> Is there a way to restore just those two weeks worth of data from the transaction logs? From
> everything that I know and everything I've found, you restore a database to a point in time,
> instead of picking out a date range from a backup. But as I said, I'm not a DBA. So any advice
> would be appreciated. Thanks!
>|||Thanks for your help! I will pass this info along.
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:%23qmgAZKRHHA.4252@.TK2MSFTNGP05.phx.gbl...
> If your customer has transaction log backups covering this period, you
> might be able to do this.
> Either restore (db and then log backups) up to just before that deletion,
> to a new database. Then transfer the desired data over to the production
> database (take relationships, constraints, triggers etc into
> considerations).
> Or, use some log reader tool and see if it can "mine" out counter
> statements for the delete process from your log backup. I've listed some
> such tools at http://www.karaszi.com/SQLServer/links.asp
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Mike Ripplinger" <miker@.entrerock.com> wrote in message
> news:egaC1EKRHHA.3316@.TK2MSFTNGP02.phx.gbl...
>> Hi there -- I'm a developer who mostly uses SQL Server from that
>> perspective, not a DBA, and I had a client ask me a question recently
>> that I couldn't answer.
>> My client has a database that is updated constantly. A few weeks ago, he
>> accidentially deleted about two weeks worth of data from the database.
>> Since then the db's users have continued to update new data. So
>> basically the database is missing about two weeks worth of data from a
>> couple of months ago.
>> Is there a way to restore just those two weeks worth of data from the
>> transaction logs? From everything that I know and everything I've found,
>> you restore a database to a point in time, instead of picking out a date
>> range from a backup. But as I said, I'm not a DBA. So any advice would
>> be appreciated. Thanks!
>

No comments:

Post a Comment