Kbase P8590: How to roll forward AI files to a specific point in time
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  7/15/2005 |
|
Status: Verified
GOAL:
How to roll forward AI files to a specific point in time
GOAL:
How to roll forward using endtime or endtrans options
FIX:
The process of rolling forward an After Image file to a specific point in time or to a specific transaction is useful when recovering a database with a bad block in the AI file. This allows recovery of as much data as possible from the corrupt AI file. This feature is also useful in cases where it is known that the database became corrupt after a certain point in time and allow recovery up to that point. For Example:
rfutil <dbname> -C roll forward endtime <time> -a <ai-file>
where <time> is in the form: yyyy:mm:dd:hh:mm:ss
rfutil <dbname> -C roll forward endtrans <trid> -a <ai-file>
where <trid> is the transaction id number
The times can be pulled from the database.lg file or by using the aimage scan verbose. The transaction ids can only be found using aimage scan verbose.
The following example demonstrates how to use these features:
1) Create a file called myV6demo.st as shown below:
d ./myV6demo.d1 f 1024
d ./myV6demo.d2
b ./myV6demo.b1 f 32
b ./myV6demo.b2
2) Create a copy of demo.db in the void myV6demo database:
prostrct create myV6demo
procopy demo myV6demo
3) Create backup copy of myV6demo:
probkup myV6demo myV6demo.bak
4) Start After Imaging in initial AI extent:
rfutil myV6demo -C aimage begin unbuff -a myV6demo.ai
5) Create procedure, "updcust.p", that updates all customers in db:
for each customer:
customer.max-credit = customer.max-credit + 10.
end.
6) Create procedure, "delcust.p", that deletes all customers in db:
for each customer:
for each order where order.Cust-Num = customer.Cust-Num:
for each order-line where order-line.Order-num =
order.Order-num:
delete order-line.
end.
delete order.
end.
delete customer.
end.
7) Run procedure, "updcust.p", that updates all customers in db:
pro myV6demo -p updcust.p
8) Run procedure, "delcust.p", that deletes all customers in db:
pro myV6demo -p delcust.p
9) Scan AI extent to see where delete operations began. It may be advisable to save the output in a file and use an editor to find the entry in which you are interested. In our example, RL_LSTMOD is the seperator between updcust.p and delcust.p.
rfutil myV6demo -C aimage scan verbose -a myV6demo.a1
code = RL_INMEM (1637)
transaction index = 0 (1638)
transaction index = 0 (1638)
dbkey = 0 update counter = 0 (1639)
code = RL_LSTMOD (1637) <-- db open for updcust.o
transaction index = 0 (1638)
dbkey = 32 update counter = 772 (1639)
code = RL_TBGN (1637)
transaction index = 755 (1638)
dbkey = 0 update counter = 0 (1639)
Trid: 755 Fri Oct 3 08:08:06 1997
...
code = RL_TEND (1637)
transaction index = 787 (1638).
dbkey = 0 update counter = 0 (1639)
Trid: 787 Fri Oct 3 08:08:06 1997
code = RL_LSTMOD (1637) <-- db open for delcust.p
transaction index = 0 (1638)
dbkey = 32 update counter = 773 (1639)
code = RL_TBGN (1637) <-- start of first delete.
transaction index = 788 (1638)
dbkey = 0 update counter = 0 (1639)
Trid: 788 Fri Oct 3 08:08:39 1997
code = RL_IXREM (1637)
transaction index = 788 (1638)
dbkey = 6560 update counter = 74 (1639)
10) Note the delete starts at Trid: 788 Fri Oct 3 08:08:39 1997 If other transactions, which need to be included in the roll forward, also begin at this time, you will need to use the Trid
to roll forward to endtrans.
11) To recover the database to just before the deletes start:
rfutil myV6demo -C aimage end -a myV6demo.ai
prodel myV6demo
prostrct create myV6demo
prorest myV6demo myV6demo.bak
a) To roll forward and stop at time when deletes began:
rfutil myV6demo -C roll forward endtime 1997:10:03:08:08:39 -a myV6demo.ai
b) To roll forward and stop at transaction where deletes began:
rfutil myV6demo -C roll forward endtrans 788 -a myV6demo.ai
.