Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Request Tracker: Users

Merging divergent databases

 

 

Request Tracker users RSS feed   Index | Next | Previous | View Threaded


phil at macprofessionals

Apr 25, 2012, 4:54 PM

Post #1 of 3 (217 views)
Permalink
Merging divergent databases

I recently experienced a hardware failure that required that I restore the database from a backup that was a few days old. I was later able to recover the database at the time of the failure, but not until some new tickets had been created and others modified.

Is there some clever way I can query the recovered database for everything that changed since the failure, and then merge it into the live database, which is missing those changes? The difference is not a whole lot, so even a somewhat manual process would be better than nothing.


phil at macprofessionals

Apr 25, 2012, 4:54 PM

Post #2 of 3 (208 views)
Permalink
Merging divergent databases [In reply to]

I recently experienced a hardware failure that required that I restore the database from a backup that was a few days old. I was later able to recover the database at the time of the failure, but not until some new tickets had been created and others modified.

Is there some clever way I can query the recovered database for everything that changed since the failure, and then merge it into the live database, which is missing those changes? The difference is not a whole lot, so even a somewhat manual process would be better than nothing.


tjrc at sanger

Apr 26, 2012, 2:27 AM

Post #3 of 3 (201 views)
Permalink
Re: Merging divergent databases [In reply to]

On 26 Apr 2012, at 00:54, Phillip Frost wrote:

> I recently experienced a hardware failure that required that I restore the database from a backup that was a few days old. I was later able to recover the database at the time of the failure, but not until some new tickets had been created and others modified.
>
> Is there some clever way I can query the recovered database for everything that changed since the failure, and then merge it into the live database, which is missing those changes? The difference is not a whole lot, so even a somewhat manual process would be better than nothing.

Oooh, nasty. I feel for you! I think you could write scripts to retrieve tickets from one database and merge them into the other, although you'd have to allow the tickets and transactions to have a different id once transferred.

The logic of the script would have to be something along the lines of:

# script 1
connect to source_rt;
search for tickets to transfer;
foreach found ticket {
dump ticket basics;
dump ticket requestors, owner, watchers;
foreach transaction {
dump transaction;
foreach attachment {
dump attachment;
}
}
}

# script 2
connect to dest_rt;
open dump file;
foreach ticket in dump file {
create a new ticket object in dest_rt;
populate it with basics from ticket (not the ID, obviously);
set watchers, requestor etc;
foreach transaction on the ticket in the dump file {
create a new transaction object in distort;
populate it;
foreach attachment on the transaction {
create an attachment object in the database;
populate it;
}
}
}

You can probably fairly easily lift the appropriate bits of code from the main RT sources.

Regards,

Tim

--
The Wellcome Trust Sanger Institute is operated by Genome Research
Limited, a charity registered in England with number 1021457 and a
company registered in England with number 2742969, whose registered
office is 215 Euston Road, London, NW1 2BE.

Request Tracker users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.