1. An invisible oracle 11 bug.
It was in September 2016 I was importing an oracle 11 database. I suddenly
see an issue while import, which I have not seen before. So I tried to re-import
but the issue still re-occurs. So I tried with other database dump still the same
issue and it continued with other oracle databases. The issue was.
ORA-31693:Table data object DEPARTMENT failed to load/unload and is being
skipped due to error
ORA-02354: error in exporting importing data
ORA-39776: fatal Direct Path API error loading table DEPARTMENT
ORA-00600: internal error code, arguments: [klaprs_11], [60], [2], [164], [], [], [], [], [],
[], [], []
I started googling around to find out the solution but to my surprise I don’t see
anything specific solution to my issue. So I thought to look into oracle
support- knowledge base, Archive, community, patches, documentation, bugs
etc but I have seen only workarounds for this issue but no exact solution. I
have also raised the question with oracle community but still no clear solution.
Also there was no clear explanation why this is happening? So I started
exploring myself by running all the scripts to find out the reason. It took
many days to zero down the reason why it occurs and reason it occurs is very
unusual.
The issue occurs when you create a default column and immediately drop it.
To our wonder the corruption happens to a different column which you create
while you create and drop this default column. And when you export this
database and try to import it then you reproduce this issue.
You can also reproduce this issue by selecting the corrupted column.
Select employee_address from department where employee_address is not
null;
you should get null values as result or oracle.sql.NUMBER@7ec7ec0d (if
number) or oracle.sql.NCLOB@7ec7ec0d (if clob). Something like below.
2. So what is the solution?
Take the backup of the table.
If data in column is required.
Solution 1:
a) Create table temp_employee as employee.
b) Create a temporary column of the corrupted column
temp_employee_addres
c) Update column temp_employee_address = employee_address
without corrupted data
d) Drop old column employee_addres
e) Rename temp_employee_address to employee_address
OR
If data in column is not required.
Solution 2:
a) Drop the corrupted column
b) Create a fresh column
Solution 3:
a) Never create a default column and drop it immediately.
3. This invisible reality happened with many oracle 11 databases.
This invisible bug is fixed in oracle 12.
Note: If this bug is already in the exported dump file. Whether you import in any
oracle version it will solve your issue.