ORA-01948和ORA-04052錯誤的解決方案

來源:互聯網
上載者:User

ORA-01948和ORA-04052錯誤的解決方案

一、事件背景:

業務人員在建立一個物化視圖的時候,報了以下錯誤:

SQL> CREATE MATERIALIZED VIEW MV_RETAIL_wbmout_R

 2 TABLESPACE SAPDATA

 3 PCTUSED 0

 4 PCTFREE 10

 5 INITRANS 2

 6 MAXTRANS 255

 7 STORAGE (

 8 INITIAL 64K

 9 NEXT 1M

 10 MINEXTENTS 1

 11 MAXEXTENTS UNLIMITED

 12 PCTINCREASE 0

 13 BUFFER_POOL DEFAULT

 14 FLASH_CACHE DEFAULT

 15 CELL_FLASH_CACHE DEFAULT

 16 )

 17 NOCACHE

 18 LOGGING

 19 NOCOMPRESS

 20 NOPARALLEL

 21 BUILD DEFERRED

 22 REFRESH COMPLETE ON DEMAND

 23 WITH ROWID

 24 AS

 25 SELECT "record_code" FROM "wbm_store_out_record"@MYSQL

CREATE MATERIALIZED VIEW MV_RETAIL_wbmout_R

*

第 1 行出現錯誤:

ORA-04052: 在尋找遠程對象 datachk.wbm_store_out_record@OTO 時出錯

ORA-01948: 標識符的名稱長度 (31) 超過最大長度 (30)
 

其中"wbm_store_out_record"@MYSQL是遠程mysql資料庫上面的一個表,通過透明網關進行訪問;

 

二、尋找metalink的資料,整理如下

2.1 癥狀

 

Line # = 0 Column # = 0 Error Text = ORA-04052: error occurred when looking up remote object Oracle.V_STG_GENDGEN@DBLINK

ORA-01948: identifier's name length (31) exceeds maximum (30)

 

This occurs even though the SQL Server table name is less than 30 characters.

 

A query of the remote table via SQLPlus does not produce the error. However, running an anonymous block from SQLPlus does produce the error:

 

Error starting at line 1 in command:

declare

v_count integer;

begin

select count(*) into v_count from ORACLE.V_STG_GENDGEN@DBLINK ;

end;

Error report:

ORA-04052: error occurred when looking up remote object ORACLE.V_STG_GENDGEN@RAY

ORA-01948: identifier's name length (31) exceeds maximum (30)

04052. 00000 - "error occurred when looking up remote object %s%s%s%s%s"

*Cause: An error has occurred when trying to look up a remote object.

*Action: Fix the error. Make sure the remote database system has run

KGLR.SQL to create necessary views used for querying/looking up

objects stored in the database.

通過透明網關可以進行相應的select,但是諸如建立物化視圖的時候,就會報相應的列長度報錯;

2.2 原因

當通過透明網關訪問遠端ms、mysql資料庫時,當這些表中有任意的一列長度大於30個字元的時候就會報這個錯誤;

2.3 解決方案

方法一、根據報錯的內容,列的長度大於30個字元會報錯,修改相應列的長度小於30個字元即可(當系統已經上線後,一些欄位可能都被引用到了應用,所以這個時候修改列的名稱有一定的風險,不建議使用)

方法二、建立一個視圖,所有列的名稱長度都不超過30個字元即可(推薦使用)

因為我們的系統已經上線了,避免出現沒必要的問題,直接建立一個視圖即可;

Oracle 單一實例 從32位 遷移到 64位 方法 

在CentOS 6.4下安裝Oracle 11gR2(x64)

Oracle 11gR2 在VMWare虛擬機器中安裝步驟

Debian 下 安裝 Oracle 11g XE R2

Oracle RAC 11.2(12C)正確關閉順序 

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.