After the successful installation RHEL6.5 ORACLE11GR2, write PROC program error Solution


   
 1. proc: error while loading shared libraries : libclntsh.so.11.1: can not open shared object file: No such file or directory
Solution: https: //blog.csdn.net/roofwei/article/details/38946453
 into the $ ORACLE_HOME / lib folder, check whether there libclntsh
. 1> [Oracle @ OracleDB lib] CD $ $ ORACLE_HOME / lib

2> [Oracle @ OracleDB lib] $ pwd
/opt/oracle/app/product/11.2.0/dbhome_1/lib

to root user to modify /etc/ld.so.conf add $ ORACLE_HOME / lib path

3> [root @ RHELDB tmp] # vi /etc/ld.so.conf, document as follows:

the include ld.so.conf.d / * .conf
/opt/oracle/app/product/11.2.0/dbhome_1/lib # Note: this can only write absolute path, ORACLE_HOME can not write $ / lib

4> [root @ RHELDB tmp] # ldconfig
------ ---------------
author: roofwei
source: CSDN
original: https: //blog.csdn.net/roofwei/article/details/38946453
Disclaimer: This article is a blogger original article, reproduced, please attach Bowen link!
   
  * C 2.Pro / C ++: Release 11.2.0.1.0 - Production's ON Sun Apr 21 08:25:21 2019

.. Copyright (c) 1982, 2009, the Oracle and / or the ITS Affiliates All Rights Reserved

System default values taken the Option from: /opt/oracle/app/product/11.2.0/dbhome_1/precomp/admin/pcscfg.cfg
 
   
   error AT Line 0, column 0 in File first.pc
PCC-F-02102, Fatal error the while doing C Preprocessing
solution :
https://www.linuxidc.com/Linux/2013-08/88880p2.htm

Description pcscfg.cfg position in the system header file is incorrect, you need to re-set:
View pcscfg.cfg file:

$ [@ oracleserver the Oracle ~ ] $ cat /home/oracle/OraHome1/oracle10g/precomp/admin/pcscfg.cfg
sys_include=(/ade/aime_rdbms_9819/oracle/precomp/public,/usr/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
查找头文件 stddef.h 位置:

1》[root@oracleserver ~]# find / -name "stddef.h" -print
/usr/include/xulrunner-sdk-1.9/system_wrappers/stddef.h
/usr/include/linux/stddef.h
/usr/lib/bcc/include/stddef.h
/usr/lib/gcc/i386-redhat-linux/3.4.6/include/stddef.h
/usr/lib/gcc/i386-redhat-linux/4.1.1/include/stddef.h
/usr/lib/syslinux/com32/include/bitsize/stddef.h
/usr/lib/syslinux/com32/include/stddef.h
/usr/src/kernels/2.6.18-194.el5-i686/include/linux/stddef.h
Compare discovered, pcscfg.cfg in /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/include and /usr/lib/gcc-lib/i386-redhat-linux7/2.96/include path are invalid , the path does not match the actual system, can be modified to /usr/lib/gcc/i386-redhat-linux/4.1.1/include and /usr/lib/gcc/i386-redhat-linux/3.4.6/include :

$ CAT /home/oracle/OraHome1/oracle10g/precomp/admin/pcscfg.cfg
sys_include = (/ ADE / aime_rdbms_9819 / Oracle / precomp / public, / usr / the include, / usr / lib / GCC-lib / the i486-SUSE -linux / 2.95.3 / the include, / usr / lib / GCC / the i386-RedHat Linux-/ 4.1.1 / the include, / usr / lib / GCC / the i386-RedHat Linux-/ 3.4.6 / the include)
LTYPE = Short
write a simple test program at:

$ proc test.pc
Pro * C / C ++: Release 10.2.0.1.0 - Production's ON Tue May 21 16:07:16 2013

. Copyright (c) 1982, 2005, All Rights Reserved the Oracle .

Default values taken from the Option System: /home/oracle/OraHome1/oracle10g/precomp/admin/pcscfg.cfg




3. / usr / bin / LD: CAN not the Find -lclntsh
/opt/oracle/app/product/11.2.0/dbhome_1/lib $ ORACLE_HOME /
vi ~ / .bashrc
Xport LIBRARY_PATH = $ LIBRARY_PATH: / opt / the Oracle / App / Product / 11.2.0 / dbhome_1 / lib: / usr / lib :.






login database:
sqlplus system
the Enter passwd: the Oracle
SQL> the SELECT * from emp;
close the database:
the shutdown load immediate;



method RHEL6.5 system administration login database:
the first step : to be logged in as an administrator the Oracle
sqlplus / nolog
SQL> conn SYS AS sysdba; as a system administrator connection
SQL> startup nomount; startup command to start the database instance
SQL> alter database mount; mount the database
SQL> alter database open; speak database alter database command status changed to open

Step two: normal user login:
sqlplus System
passwd: the Oracle
close the database:
SQL> the shutdown load immediate;

  Table EMP Create (
       ID Number,
       name VARCHAR2 (30),
       the salary Number  
   );
   
   into the database:
   INSERT INTO EMP values (. 1, 'test1', 123);
   the commit;

 

 

Next programming

//first.pc C language

/ *
[Oracle @ OracleDB] $ proc first.pc
[Oracle @ OracleDB] $ GCC first.c -lclntsh
[Oracle @ OracleDB ./a.out $
* /

#include <stdio.h>

/ * * a data structure comprising /
Exec SQL the include SQLCA;
int main ()
{

char userpasswd [30] = "System / Oracle";
char var_name [30];
/ * link database * /
Exec SQL Connect: userpasswd;
/ * query * /
Exec SQL SELECT name INTO: from EMP WHERE ID = var_name. 1;
the printf ( "% S var_name = \ n-", var_name);

/ * unlink after filing * /
Exec SQL the commit Work Release;
}

 

mycpp.pc C ++ written language

. // proc = *** *** PC oname the parse = none code = cpp cpp;.
// proc mycpp.pc oname = mycpp.cpp the parse = none code = cpp
// G ++ mycpp.cpp -lclntsh
//. /a.out
#include <the iostream>
the using namespace STD;

/ * contains a data structure * /
Exec SQL the include SQLCA;
int main ()
{
    Exec SQL DECLARE the begin sectionTop;
    char userpasswd [30] = "System / Oracle";
    char var_name [30];
    Exec SQL DECLARE End sectionTop;
    / * link database * /
    Exec SQL Connect: userpasswd;
    / * query * /
    Exec SQL SELECT name INTO: from EMP WHERE ID = var_name. 1;
    COUT << "var_name =" < <var_name << endl;
    / * break the link * / after submitting
    exec sql commit work release;

}

 

Guess you like

Origin www.cnblogs.com/smarkshare/p/10973367.html