Home  >  Article  >  Database  >  ORA-01948和ORA-04052错误的解决方法

ORA-01948和ORA-04052错误的解决方法

WBOY
WBOYOriginal
2016-06-07 16:43:062251browse

一、事件背景: 业务人员在创建一个物化视图的时候,报了以下错误: SQLgt; CREATE MATERIALIZED VIEW MV_RETAIL_wbmout_R 2 T

一、事件背景:

业务人员在创建一个物化视图的时候,报了以下错误:

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)正确关闭顺序 

本文永久更新链接地址:

linux

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn