sql - Oracle, restore from back up data with special conditions -
i'm trying restore database file 2 days ago, rows special conditions. build 2 databases , created database links between them. more detail in example:
currently:
city id name location type 1 [sdo.geom] 1 2 b [sdo.geom] 2 district id name atrr1 location atrr2 type ... 1 aa <null> [sdo.geom] 1 2 bb [sdo.geom] <null> 2 3 cc [sdo.geom] 1 4 dd <null> [sdo.geom] 1
2 day agos:
city id name location type 1 [sdo.geom] 1 2 b [sdo.geom] 2 3 c [sdo.geom] 1 4 d [sdo.geom] 1 district id name atrr1 location atrr2 type ... 1 aa [sdo.geom] 1 3 cc <null> [sdo.geom] <null> 1
the question restore , type=1 in every tables, , if field 2 days ago null , have value remain. expect result is:
city id name location type 1 [sdo.geom] 1 2 b [sdo.geom] 2 3 c [sdo.geom] 1 4 d [sdo.geom] 1 district id name atrr1 location atrr2 type ... 1 aa [sdo.geom] 1 2 bb [sdo.geom] <null> 2 3 cc [sdo.geom] 1
as far can go, wrote script (using minus , stuff) return data like:
table id action city 3 "add" city 4 "add" district 1 "modify" district 3 "modify" (but nothing change) district 4 "remove"
my plan remove first, re-add , modify (to avoid foreign key constraints).
the difficult part modifying, when use minus compare tables, don't know field changed, intend update fields. tables have different number of fields , special field sdo_geometry. need advice on how write procedure update whole rows database table name , primary key (id). thank you.
Comments
Post a Comment