獲取導致匯入失敗的資料(四)

yangtingkun發表於2008-05-19

前不久從一個資料庫執行匯出操作時報錯,透過直接路徑方式跳過後,匯入時候再次報錯。推測是由於源資料庫出現的異常導致表中資料超過表定義的精度。

由於源資料庫中錯誤記錄已經被刪除,因此只能想辦法從匯出的dmp檔案中獲取錯誤記錄。

匯出、匯入過程的描述可以參考:

EXP9R2上匯出時報錯ORA-3113ORA-24324http://yangtingkun.itpub.net/post/468/460647

EXP9R2上匯出時報錯ORA-3113ORA-24324(二):http://yangtingkun.itpub.net/post/468/460831

繼續探討導致SQLPLUS程式崩潰的原因。

獲取導致匯入失敗的資料:http://yangtingkun.itpub.net/post/468/461401

獲取導致匯入失敗的資料(二):http://yangtingkun.itpub.net/post/468/461600

獲取導致匯入失敗的資料(三):http://yangtingkun.itpub.net/post/468/461660

BEFORE觸發器修正資料錯誤:http://yangtingkun.itpub.net/post/468/461506

 

 

在上面一篇文章中,透過修改表結構和設定觸發器,最終使得異常資料成功插入。不過在查詢異常資料時,導致了sqlplus程式的崩潰:

SQL> SELECT * FROM
  2  (
  3     SELECT ROWNUM RN, TRADE_RATE, ORDER_AMOUONT, SEND_AMOUNT, RECEIVE_AMOUNT,
  4     UNIT_PRICE, MAX_PRICE, MIN_PRICE, PRICE_RATE
  5     FROM SHGOV_ORDER
  6     WHERE ROWNUM < 31324
  7  )
  8  WHERE RN > 31322;

        RN TRADE_RATE ORDER_AMOUONT SEND_AMOUNT RECEIVE_AMOUNT UNIT_PRICE  MAX_PRICE  MIN_PRICE PRICE_RATE
---------- ---------- ------------- ----------- -------------- ---------- ---------- ---------- ----------
     31323 -5.353E+19    -3.120E+77  -5.054E+29     -5.300E+35 -1.952E-15 3.3295E-31         -~ -5.156E+23

*** glibc detected *** sqlplus: free(): invalid next size (normal): 0x000000001ca94a40 ***
======= Backtrace: =========
/lib64/libc.so.6[0x3c0a66e8a0]
/lib64/libc.so.6(cfree+0x8c)[0x3c0a671fbc]
sqlplus(safifre+0xc)[0x42c69c]
sqlplus[0x423675]
sqlplus[0x4155fa]
sqlplus[0x413a7b]
sqlplus[0x419bba]
sqlplus[0x433596]
sqlplus[0x43253b]
sqlplus[0x408433]
sqlplus[0x40780e]
/lib64/libc.so.6(__libc_start_main+0xf4)[0x3c0a61d8a4]
sqlplus[0x40773a]
======= Memory map: ========
00400000-00494000 r-xp 00000000 08:02 10031306                           /opt/oracle/product/9.2/bin/sqlplus
00594000-0059b000 rwxp 00094000 08:02 10031306                           /opt/oracle/product/9.2/bin/sqlplus
1ca33000-1cb16000 rwxp 1ca33000 00:00 0
3c0a200000-3c0a21a000 r-xp 00000000 08:02 3365501                        /lib64/ld-2.5.so
3c0a419000-3c0a41a000 r-xp 00019000 08:02 3365501                        /lib64/ld-2.5.so
3c0a41a000-3c0a41b000 rwxp 0001a000 08:02 3365501                        /lib64/ld-2.5.so
3c0a600000-3c0a744000 r-xp 00000000 08:02 3365502                        /lib64/libc-2.5.so
3c0a744000-3c0a944000 ---p 00144000 08:02 3365502                        /lib64/libc-2.5.so
3c0a944000-3c0a948000 r-xp 00144000 08:02 3365502                        /lib64/libc-2.5.so
3c0a948000-3c0a949000 rwxp 00148000 08:02 3365502                        /lib64/libc-2.5.so
3c0a949000-3c0a94e000 rwxp 3c0a949000 00:00 0
3c0aa00000-3c0aa82000 r-xp 00000000 08:02 3365504                        /lib64/libm-2.5.so
3c0aa82000-3c0ac81000 ---p 00082000 08:02 3365504                        /lib64/libm-2.5.so
3c0ac81000-3c0ac82000 r-xp 00081000 08:02 3365504                        /lib64/libm-2.5.so
3c0ac82000-3c0ac83000 rwxp 00082000 08:02 3365504                        /lib64/libm-2.5.so
3c0ae00000-3c0ae02000 r-xp 00000000 08:02 3365505                        /lib64/libdl-2.5.so
3c0ae02000-3c0b002000 ---p 00002000 08:02 3365505                        /lib64/libdl-2.5.so
3c0b002000-3c0b003000 r-xp 00002000 08:02 3365505                        /lib64/libdl-2.5.so
3c0b003000-3c0b004000 rwxp 00003000 08:02 3365505                        /lib64/libdl-2.5.so
3c0b200000-3c0b215000 r-xp 00000000 08:02 3365398                        /lib64/libpthread-2.5.so
3c0b215000-3c0b414000 ---p 00015000 08:02 3365398                        /lib64/libpthread-2.5.so
3c0b414000-3c0b415000 r-xp 00014000 08:02 3365398                        /lib64/libpthread-2.5.so
3c0b415000-3c0b416000 rwxp 00015000 08:02 3365398                        /lib64/libpthread-2.5.so
3c0b416000-3c0b41a000 rwxp 3c0b416000 00:00 0
3c0ca00000-3c0ca0d000 r-xp 00000000 08:02 3365507                        /lib64/libgcc_s-4.1.1-20070105.so.1
3c0ca0d000-3c0cc0c000 ---p 0000d000 08:02 3365507                        /lib64/libgcc_s-4.1.1-20070105.so.1
3c0cc0c000-3c0cc0d000 rwxp 0000c000 08:02 3365507                        /lib64/libgcc_s-4.1.1-20070105.so.1
3c11a00000-3c11a14000 r-xp 00000000 08:02 3365523                        /lib64/libnsl-2.5.so
3c11a14000-3c11c13000 ---p 00014000 08:02 3365523                        /lib64/libnsl-2.5.so
3c11c13000-3c11c14000 r-xp 00013000 08:02 3365523                        /lib64/libnsl-2.5.so
3c11c14000-3c11c15000 rwxp 00014000 08:02 3365523                        /lib64/libnsl-2.5.so
3c11c15000-3c11c17000 rwxp 3c11c15000 00:00 0
2aaaaaaab000-2aaaaaaad000 rwxp 2aaaaaaab000 00:00 0
2aaaaaaad000-2aaaab5fd000 r-xp 00000000 08:02 10162165                   /opt/oracle/product/9.2/lib/libclntsh.so.9.0
2aaaab5fd000-2aaaab6fd000 ---p 00b50000 08:02 10162165                   /opt/oracle/product/9.2/lib/libclntsh.so.9.0
2aaaab6fd000-2aaaab75c000 rwxp 00b50000 08:02 10162165                   /opt/oracle/product/9.2/lib/libclntsh.so.9.0
2aaaab75c000-2aaaab76f000 rwxp 2aaaab75c000 00:00 0
2aaaab76f000-2aaaab771000 r-xp 00000000 08:02 10162044                   /opt/oracle/product/9.2/lib/libwtc9.so
2aaaab771000-2aaaab870000 ---p 00002000 08:02 10162044                   /opt/oracle/product/9.2/lib/libwtc9.so
2aaaab870000-2aaaab871000 rwxp 00001000 08:02 10162044                   /opt/oracle/product/9.2/lib/libwtc9.so
2aaaab871000-2aaaab894000 rwxp 2aaaab871000 00:00 0
2aaaab895000-2aaaab8bf000 rwxp 2aaaab895000 00:00 0
2aaaab8e2000-2aaaab8ec000 r-xp 00000000 08:02 3365244                    /lib64/libnss_files-2.5.so
2aaaab8ec000-2aaaabaeb000 ---p 0000a000 08:02 3365244                    /lib64/libnss_files-2.5.so
2aaaabaeb000-2aaaabaec000 r-xp 00009000 08:02 3365244                    /lib64/libnss_files-2.5.so
2aaaabaec000-2aaaabaed000 rwxp 0000a000 08:02 3365244                    /lib64/libnss_files-2.5.so
2aaaac000000-2aaaac021000 rwxp 2aaaac000000 00:00 0
2aaaac021000-2aaab0000000 ---p 2aaaac021000 00:00 0
7fff2465d000-7fff24673000 rwxp 7fff2465d000 00:00 0                      [stack]
ffffffffff600000-ffffffffffe00000 ---p 00000000 00:00 0                  [vdso]
Aborted

顯然導致錯誤的原因是由於資料的異常,導致了Oracle在處理資料的時候,出現了記憶體衝突的問題,最終導致sqlplus程式的結束。參照上一篇文章,如果將這些異常的“數值”轉化為字串,並安裝字串型別來訪問,並不會造成問題,而如果直接根據數值型別來訪問這些異常的“數值”,就導致了問題的產生。

不過,如果因為資料異常就導致如此嚴重的程式崩潰,是否Oracle也太不健壯了,如果sqlplus給出錯誤資訊,似乎比直接程式崩潰更合理一些。

根據這個資訊查詢metalink,發現了部分類似的情況,Oracle認為這並非是個bug,而是由於沒有設定LD_ASSUME_KERNEL引數導致的。類似的描述可以參考:Doc ID:  Note:352493.1

不過嘗試了設定LD_ASSUME_KERNEL,發現這個方法似乎沒有什麼效果,依然造成了sqlplus程式的崩潰。

嘗試了不同平臺上的SQLPLUS客戶端,發現表現也不相同。

10.2.0.3版本為例,linux 64-X86平臺上的錯誤和上面的一致。

Solaris Sparc64則出現了下面的錯誤:

$ sqlplus test/test@172.25.198.230/bjtest

SQL*Plus: Release 10.2.0.3.0 - Production on 星期三 3 19 23:01:53 2008

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.


連線到:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production

SQL> SELECT * FROM
  2  (
  3     SELECT ROWNUM RN, TRADE_RATE, ORDER_AMOUONT, SEND_AMOUNT, RECEIVE_AMOUNT,
  4     UNIT_PRICE, MAX_PRICE, MIN_PRICE, PRICE_RATE
  5     FROM SHGOV_ORDER
  6     WHERE ROWNUM < 31324
  7  )
  8  WHERE RN > 31322;

Segmentation Fault - core dumped

而對於Windows平臺下的32sqlplus,似乎並沒有引起任何的異常:

SQL> conn test/test@172.25.198.230/bjtest
已連線。
SQL> SELECT * FROM
  2  (
  3   SELECT ROWNUM RN, TRADE_RATE, ORDER_AMOUONT, SEND_AMOUNT, RECEIVE_AMOUNT,
  4   UNIT_PRICE, MAX_PRICE, MIN_PRICE, PRICE_RATE
  5   FROM SHGOV_ORDER
  6   WHERE ROWNUM < 31324
  7  )
  8  WHERE RN > 31322;

        RN TRADE_RATE ORDER_AMOUONT SEND_AMOUNT RECEIVE_AMOUNT UNIT_PRICE  MAX_PRICE  MIN_PRICE PRICE_RATE
---------- ---------- ------------- ----------- -------------- ---------- ---------- ---------- ----
     31323 -5.353E+19    -3.120E+77  -5.054E+29     -5.300E+35 -1.952E-15 3.3295E-31         -~ -5.156E+2

而且無論是windows下的sqlplusw工具,還是命令列sqlplus命令,都不會報錯。看來似乎sqlplus客戶端的保護程式碼還是windows環境下更好一些。

再次查詢metalink,發現如果設定環境變數MALLOC_CHECK_=1,則sqlplus仍然會報錯,但是不會導致程式的崩潰。

[oracle@bjtest ~]$ export MALLOC_CHECK_=1
[oracle@bjtest ~]$ sqlplus test/test
malloc: using debugging hooks

SQL*Plus: Release 9.2.0.4.0 - Production on 星期一 5 19 23:17:20 2008

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

malloc: using debugging hooks

連線到:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production

SQL> SET PAGES 100 LINES 120
SQL> SELECT * FROM
  2  (
  3     SELECT ROWNUM RN, TRADE_RATE, ORDER_AMOUONT, SEND_AMOUNT, RECEIVE_AMOUNT,
  4     UNIT_PRICE, MAX_PRICE, MIN_PRICE, PRICE_RATE
  5     FROM SHGOV_ORDER
  6     WHERE ROWNUM < 31324
  7  )
  8  WHERE RN > 31322;

        RN TRADE_RATE ORDER_AMOUONT SEND_AMOUNT RECEIVE_AMOUNT UNIT_PRICE  MAX_PRICE  MIN_PRICE PRICE_RATE
---------- ---------- ------------- ----------- -------------- ---------- ---------- ---------- ----------
     31323 -5.353E+19    -3.120E+77  -5.054E+29     -5.300E+35 -1.952E-15 3.3295E-31         -~ -5.156E+23

*** glibc detected *** sqlplus: free(): invalid next size (normal): 0x000000000457fd70 ***
*** glibc detected *** sqlplus: free(): invalid pointer: 0x000000000457fdd0 ***
SQL> SELECT * FROM DUAL;

D
-
X

更多的相關描述可以參考:Bug No. 6074363

 

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/4227/viewspace-277828/,如需轉載,請註明出處,否則將追究法律責任。

相關文章