最近一直在进行ORACLE 10g和PRO*C的学习,其中遇到了不少的问题,现记录下来,以供以后参考。

一、常见问题

[注:我的linux版本是rhel 5,Oracle版本是10g]

1、在ORACLE 10g 安装准备的过程中:缺少libXp.so.6依赖

上网搜过不少文章,但是都不是很好的解决

我自己摸索出一个解决方法:

在RHEL5的安装盘中找到libXp-1.0.0-8.i386.rpm,进行安装后,便可解决。

2、在ORACLE 10g 安装过程中Xlib: connection to ":0.0" refused by server

Xlib: connection to ":0.0" refused by server

Xlib: No protocol specified

Error: Can't open display: :0.0

以root用户登陆,在shell中运行

[root@brady ~]# xhost local:oracle

non-network local connections being added to access control list

然后oracle身份就可以运行X程序了。

man xhost中有这样一段

A complete name has the syntax ‘‘family:name’’ where the families are as follows:

inet      Internet host (IPv4)

inet6     Internet host (IPv6)

dnet      DECnet host

nis       Secure RPC network name

krb       Kerberos V5 principal

local     contains only one name, the empty string

si        Server Interpreted

其中local那个是用来解决同一台机器的不同用户访问X的问题的。

3.proc: error while loading shared libraries: libclntsh.so.10.1:

cannot open shared object file: No such file or directory

解决方法:

在/etc/profile中添加

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib:/usr/local/lib;

export LD_LIBRARY_PATH

然后可以用source /etc/profile 生效一下

4、PCC-S-02201错误在用proc进行编译的时候(proc iname=test.pc) 出错

错误信息有很多:

PCC-S-02201, Encountered the symbol ";" when expecting one of the following....

发生 PCC-S-02201 错误时有两种解决办法:

1)升级编译器

2)设置 parse=none

更正后的命令:proc iname=test.pc parse=none

结果生成test.c文件

5、error: sqlca.h: No such file or directory执行gcc -o test test.c时:

test.c:152:19: error: sqlca.h: No such file or directory

sqlca.h在$ORACLE_HOME/precomp/public/下

更正后的命令:gcc -o test test.c-I $ORACLE_HOME/precomp/public

6、undefined reference to `sqlcxt'执行5中的命令时出现错误如下:

test.c:(.text+0x5e5): undefined reference to `sqlcxt'

需要用到$ORACLE_HOME/lib/libclntsh.so

故需加上-L $ORACLE_HOME/lib -l clntsh

更正后的命令为:

gcc -o test test.c -I /home/oracle/oracle/product/10.2.0/db_1/precomp/public -L $ORACLE_HOME/lib -l clntsh

OK!至此编译成功!

但是这样写太麻烦

7、自定义的结构体总是编译不过去,提示类型不对

我的环境是suse10sp2+oracle10g, 程序中定义了如下结构体,并在EXEC SQL中使用此结构体的变量

typedef struct Tjkjmlog{

char  m_getdatatime[18 +1];

char  m_monitorcode[6 +1];

char  m_ip[23 +1];

char  m_res[30+1];

char  m_alarmlevel[2+1];

char  m_info[128 +1];

}Tjkjmlog;

编译错误如下:

hrwang:~/test # proc iname=jkserv.pc

Pro*C/C++: Release 10.2.0.1.0 - Production on Mon Sep 27 10:15:46 2010

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

System default option values taken from: /opt/or1/precomp/admin/pcscfg.cfg

Syntax error at line 491, column 2, file jkserv.pc:

Error at line 491, column 2 in file jkserv.pc

Tjkjmlog jmlog;

.1

PCC-S-02201, Encountered the symbol "Tjkjmlog" when expecting one of the followi

ng:

auto, char, const, double, enum, extern, float, int, long,

ulong_varchar, OCIBFileLocator OCIBlobLocator,

OCIClobLocator, OCIDateTime, OCIExtProcContext, OCIInterval,

OCIRowid, OCIDate, OCINumber, OCIRaw, OCIString, register,

short, signed, sql_context, sql_cursor, static, struct,

typedef, union, unsigned, utext, uvarchar, varchar, void,

volatile, a typedef name, a precompiled header, exec oracle,

exec oracle begin, exec, exec sql, exec sql begin,

exec sql end, exec sql type, exec sql var, exec sql include,

The symbol "enum," was substituted for "Tjkjmlog" to continue.

Error at line 0, column 0 in file jkserv.pc

PCC-F-02102, Fatal error while doing C preprocessing

自定义的结构体提示没有发现的错误,通常是由于结构体定义在了

EXEC SQL BEGIN DECLARE SECTION;

EXEC SQL END DECLARE SECTION;

这两个语句的外面,只要将结构体定义在这两句中间就可以了。如下:

EXEC SQL BEGIN DECLARE SECTION;

typedef struct Tjkjmlog{

char  m_getdatatime[18 +1];

char  m_monitorcode[6 +1];

char  m_ip[23 +1];

char  m_res[30+1];

char  m_alarmlevel[2+1];

char  m_info[128 +1];

}Tjkjmlog;

Tjkjmlog jmlog;    /* 定义结构体变量 */

EXEC SQL END DECLARE SECTION;

8、proc编译时,提示相关的表需要声明

我的环境是在suse10sp2+oracle10g。 程序中使用exec sql insert into t_jm_err_his语句,编译时,总提示如下错误:

hrwang:~/test # proc iname=jkserv.pc

Pro*C/C++: Release 10.2.0.1.0 - Production on Mon Sep 27 09:42:53 2010

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

System default option values taken from: /opt/or1/precomp/admin/pcscfg.cfg

Error at line 677, column 10 in file jkserv.pc

EXEC SQL insert into T_jm_err_his

.........1

PLS-S-00201, identifier 'T_JM_ERR_HIS' must be declared

Error at line 677, column 10 in file jkserv.pc

EXEC SQL insert into T_jm_err_his

.........1

PLS-S-00000, SQL Statement ignored

Semantic error at line 677, column 10, file jkserv.pc:

EXEC SQL insert into T_jm_err_his

.........1

PCC-S-02346, PL/SQL found semantic errors

出现这样的错误,我们可以proc iname=jkserv.pc userid=scott/hrwang来进行编译,

并且确保scott用户对这个表有权限(根据你的oracle情况更改用户名和密码)。或者你可以将userid=scott/hrwang 加入$oracle_home/precomp/admin/pcscfg.cfg文件中,这样在编译时就不用每次都指定了。

9、error while loading shared libraries: $ORACLE_HOME/lib/libnnz10.so:

cannot restore segment prot after reloc: Permission denied

执行程序(./test)时提示错误:

error while loading shared libraries: $ORACLE_HOME/lib/libnnz10.so:

cannot restore segment prot after reloc: Permission denied

相关的文章:

Topic:

Some Linux distributions with SELinux enabled may prevent IDL from running under the default security context. This TechTip is a workaround for CR#41937

Discussion:

Newer Linux distributions have enabled new kernel security extensions from the SELinux project at the NSA. These extensions allow finer-grained control over system security. However, SELinux also changes some default system behaviors, such as shared library loading, that can be problematic to third party programs.If you receive the error message "cannot restore segment prot after reloc: Permission denied" when launching IDL, then your SELinux configuration is preventing IDL from launching.

To rectify this issue, you can either:

(1)Change the default security context for IDL by issuing the command:

chcon -t texrel_shlib_t /usr/local/rsi/idl_6.1/bin/bin.linux.x86/*.so

(2)Disabling SELinux altogether by setting the line

SELINUX=disabled

in your /etc/sysconfig/selinux file.

我使用的解决办法:chcon -t texrel_shlib_t $ORACLE_HOME/lib/*.so

注:这篇文章很多内容是转自互联网,具体出处找不到了:(。 7、8是自己添加上去的。3、4、5、6这几个问题也都遇到并按照上述方法解决了。其它的还没有试过。

二、SUSE10SP2+ORACLE10G的PRO*C的环境设置

下面我再将自己配置suse10sp2+oracle10的proc环境进行一下说明,供大家参考:

(1)安装oracle这步我就省略了

(2)在/etc/profile文件中添加相关oracle环境变量设置:

ORACLE_SID=HRWANG

ORACLE_HOME=/opt/or1

LD_LIBRARY_PATH=/opt/or1/lib:/lib:/usr/lib:/usr/local/lib

PATH=$ORACLE_HOME/bin:$PATH

export ORACLE_SID ORACLE_HOME LD_LIBRARY_PATH PATH

上述环境变量应该根据你的情况进行调整,不能死搬硬套。更改完成后可以通过source /etc/profile来使其在当前shell中生效。

(3)更改$ORACLE_HOME/precomp/admin/pcscfg.cfg为如下内容:

sys_include=(/opt/or1/precomp/public,/usr/include,/usr/lib/gcc/i586-suse-linux/4.1.2/include,/usr/lib/gcc-lib/i486-suse-linux/2.95.3/include,/usr/lib/gcc-lib/i386-redhat-linux/3.2.3/include,/usr/lib/gcc-lib/i386-redhat-linux7/2.96/include)

ltype=short

userid=scott/hrwang           #数据库用户名密码,根据你的情况填写

mode=oracle

parse=none

sqlcheck=semantics

dbms=v8

def_sqlcode=true

此文件的sys_include中应包含sqlca.h所在的路径,我这里为/opt/or1/precomp/public。还需要包括stddef.h所在的路径,我这里为/usr/lib/gcc/i586-suse-linux/4.1.2/include。如果这两个文件你也不知道在什么位置,可以通过

#find / -name "sqlca.h"

#find / -name "stddef.h"

来查找。另外再将常用的头文件路径加上即可,如/usr/include。

oracle中prot是什么意思,Oracle 10g及pro*c相关问题及解决方法相关推荐

  1. oracle中如何写函数【oracle技术】

    oracle中如何写函数[oracle技术] | 浏览:1377 | 更新:2014-04-29 23:14 | 标签:oracle 在oracle数据开发中函数是必不可少的.函数可以一般是可以完成某 ...

  2. confluence中org.apache.tomcat.util.net.NioEndpoint$Acceptor.run Socket accept failed的解决方法

    confluence中org.apache.tomcat.util.net.NioEndpoint$Acceptor.run Socket accept failed的解决方法 参考文章: (1)co ...

  3. JavaScript中的window.close在FireFox和Chrome上不能正常动作的解决方法

    原文:JavaScript中的window.close在FireFox和Chrome上不能正常动作的解决方法 JS中关闭窗口的方法window.close()在IE上能够正常动作,而在FireFox和 ...

  4. Easyui中使用jquery或js动态添加元素时出现的样式失效的解决方法

    Easyui中使用jquery或js动态添加元素时出现的样式失效的解决方法 在添加完之后,可以使用 $.parser.parse();这个方法进行处理: (1) 对整个页面重新渲染: $.parser ...

  5. Cent OS 6/7 中通过yum安装软件时提示cannot find a valid baseurl...的解决方法

    Cent OS 6/7 中通过yum安装软件时提示cannot find a valid baseurl...的解决方法 参考文章: (1)Cent OS 6/7 中通过yum安装软件时提示canno ...

  6. 在xp中不能查看或更改文件夹的“只读”属性或“系统”属性解决方法

    在xp中不能查看或更改文件夹的"只读"属性或"系统"属性解决方法 症状  您可能会遇到下列任一症状: • 不能使用文件夹的"属性"对话框查看 ...

  7. VS2010中,无法嵌入互操作类型“……”,请改用适用的接口的解决方法

    原文:VS2010中,无法嵌入互操作类型"--",请改用适用的接口的解决方法 1.提示:在VS2010,在引用COM组件的时候,出现了无法嵌入互操作类型"--" ...

  8. 在小皮面板中使用cmd进入mysql命令,包含mysql错误unknown variable ‘secure_file_priv‘解决方法(超详细)

    在小皮面板中使用cmd进入mysql命令,包含mysql错误unknown variable 'secure_file_priv'解决方法(超详细) 先按win+r键打开运行对话框,输入cmd,进入: ...

  9. AD中同一网络的铺铜与导线不能连接到一起的解决方法

    AD中同一网络的铺铜与导线不能连接到一起的解决方法 博主第一次写博客,格式有些问题还请见谅 #明明是同一个网络,铺铜和导线却无法连接? 我在画板子的时候遇到了这样的问题,如图: 明明是相同的网络,但是 ...

最新文章

  1. linux php-fpm优化 php-fpm.conf 重要参数详解
  2. Oracle的服务介绍以及正常运行必须启动的服务
  3. 计算机论文答辩2分钟演讲稿,毕业答辩发言稿三分钟
  4. 利用INF安装服务启动 及 浅析瑞星行为检测、360主动防御
  5. python elasticsearch bulk_Elasticsearch —— bulk批量导入数据
  6. android怎样判断插入数据是否成功_Android 端 V1/V2/V3 签名的原理
  7. Effective C# Item17:尽量减少装箱和拆箱
  8. 相机模型与标定(四)--opencv单目标定例子使用说明
  9. PHP for循环时模拟计算进度
  10. sublime text3找到定义_决策易aPaaS,一款非技术人员也能使用的自定义开发神器
  11. 怎么给php加音乐,给网站加上背景音乐的方法
  12. 求一个序列所有区间不同数的个数之和
  13. RTKLIB2.4.3中一些问题的修复---RTKLIB学习系列文章(二)
  14. PJzhang:漏洞渗透测试框架“天使之剑(AngelSword)”
  15. JSP使用EL表达式实现if,else
  16. Linux下MySQL基本操作
  17. 万字阐述智能驾驶汽车安全体系
  18. mac移动硬盘初始化
  19. codevs1373 射命丸文
  20. mPOS终端的全球与中国市场2022-2028年:技术、参与者、趋势、市场规模及占有率研究报告

热门文章

  1. 关于图片onload事件兼容性处理, 谷歌浏览器版本 56.0.2896.3 (64-bit) 微信客户端浏览器 canvas篇
  2. 黑马程序员软件测试课后习题答案
  3. 五大存储模型关系模型 键值存储 文档存储 列式存储 图形数据库
  4. SwiftUI 问答之更改 TabView 选项卡时如何运行函数
  5. 2016--聊聊读书
  6. PHP 根据文字内容添加图片上实现自动换行的小程序
  7. Hive beeline常用操作
  8. 大数据环境下,征信,真的那么美好吗?
  9. 定位python内存泄漏问题
  10. Efficient Graph-Based Image Segmentation论文思路