Index Corruption HADR environment
Posted on 2017-04-30
We have an index corruption Issue at (HADR environment ) founded into db2diag of primary caused crash , this corruption occurred on primary. I've decided to
1-takeover on standby as no page corruption there and deactivated primary to avoid this corruption moved to standby
2-backup (new primary ) and drop db on old primary
3-restore on old primary (standby) , then working successfully
but doesn't know what the root cause of this page corruption I faced this issue twice during 40 days. My suspect is maybe index not building at true bases, even db2support hadn't got particularity more details they said maybe application code
Is there any way to ensure an index is working fine or not?
As my understanding, there are many flavors of index-related corruption problems, for instance:
Unique index contains duplicates with different RID(s) or same RID(s)
Multiple index entries pointing to the same RID
Index key is out of place (wrong index key order)
Row exists, but index keys do not exist in any or some of the indexes
Index entry pointing to an empty data slot or unused data slot or RID is invalid
Incorrect previous or next index page pointers, incorrect high key or other corruptions on index pages
And if this happens again, is there any different method unless backup and restore?
I found This maybe can be a solution could you please give me your thoughts can i do this as a solution ???
REORG the corrupted indexes or mark the index as bad by using the db2dart option /MI. When completed, rebuild it by accessing
I found some solutions here also i can provide
Depending on when index corruption was detected, we had 2 ways to solve the problem
1. During crash recovery
1.1 db2stop force
1.2 db2dart <dbname> /MI /TSI 2 /OI 2
1.3 db2 update dbm cfg using indexrec access
1.4 db2 connect to <dbname>
1.5 db2 "select tabschema, tabname from syscat.tables where tbspaceid=2 and tableid=2"
1.6 db2 "select count(*) from <tabschema>.<tabname>" ---> this will trigger an index rebuilding
2. When database is accessable
2.1 get the tabschema and tabname from syscat.table
db2 "select tabschema, tabname from syscat.tables where tbspaceid=2 and tableid=2"
2.2 db2 reorg indexes all for table <tabschema>.<tabname>
Please give me your recommendations