2011年3月1日火曜日

CentOS5.5で、Pro*C chcvs

☆CentOS 5.5 32bit
[oracle@c32 chcsv]$ uname -a
Linux c32.tsystem.gr.jp 2.6.18-194.32.1.el5 #1 SMP Wed Jan 5 17:53:09 EST 2011 i686 i686 i386 GNU/Linux
[oracle@c32 chcsv]$ cat /etc/issue
CentOS release 5.5 (Final)
Kernel \r on an \m

☆chcsv
[oracle@c32 chcsv]$

[oracle@c32 chcsv]$ ls -l ..
合計 660632
-rw-r--r-- 1 root root 668734007 2月 26 20:47 10201_database_linux32.zip
drwxr-xr-x 2 oracle oinstall 4096 2月 26 20:50 Desktop
drwxrwx--- 7 oracle oinstall 4096 2月 26 21:14 app
drwxr-xr-x 2 oracle oinstall 4096 3月 1 00:38 chcsv
-rw-r--r-- 1 oracle oinstall 13757 2月 26 21:20 chcsv_v20.tar.gz
-rw-r--r-- 1 oracle oinstall 2439269 2月 28 23:21 compat-gcc-7.3-2.96.128.i386.rpm
-rw-r--r-- 1 oracle oinstall 13928 2月 26 21:20 csvload_v12.tar.gz
drwxr-xr-x 6 oracle oinstall 4096 7月 3 2005 database
-rw-r--r-- 1 oracle oinstall 4570051 2月 28 23:25 gcc-3.2.3-20.i386.rpm
-rw-rw-rw- 1 root root 850 2月 28 01:15 include.txt
drwxr-xr-x 30 oracle oinstall 4096 2月 27 23:59 src
drwxr-xr-x 2 oracle oinstall 4096 2月 28 00:32 tmp
[oracle@c32 chcsv]$

☆compat-gccが必要
wget ftp://ftp.pbone.net/mirror/www.whiteboxlinux.org/whitebox/3.0/en/os/x86_64/RedHat/RPMS/compat-gcc-7.3-2.96.128.i386.rpm

☆pcscfg.cfgを書き換え
[oracle@c32 chcsv]$ ls -l /opt/oracle/app/oracle/product/10.2.0/db_1/precomp/admin/pcscfg.cfg.20110226 /opt/oracle/app/oracle/product/10.2.0/db_1/pre
comp/admin/pcscfg.cfg
-rw-r----- 1 oracle oinstall 374 3月 1 00:31 /opt/oracle/app/oracle/product/10.2.0/db_1/precomp/admin/pcscfg.cfg
-rw-r----- 1 oracle oinstall 228 6月 28 2005 /opt/oracle/app/oracle/product/10.2.0/db_1/precomp/admin/pcscfg.cfg.20110226
[oracle@c32 chcsv]$
[oracle@c32 chcsv]$ cat /opt/oracle/app/oracle/product/10.2.0/db_1/precomp/admin/pcscfg.cfg
sys_include=(/usr/lib/gcc-lib/i386-redhat-linux7/2.96/include,/usr/include,/usr/include/sys,/usr/include/linux,/usr/lib/gcc/i386-redhat-linux/4.1.1/include,/opt/oracle/app/oracle/product/10.2.0/db_1/precomp/public)
include=($ORACLE_HOME/precomp/public)
include=($ORACLE_HOME/rdbms/demo)
include=($ORACLE_HOME/network/public)
include=($ORACLE_HOME/plsql/public)
ltype=short
[oracle@c32 chcsv]$
☆実際にはこれでOK (ts:20110315)
[oracle@c32 chcsv]$ cat /opt/oracle/app/oracle/product/10.2.0/db_1/precomp/admin/pcscfg.cfg
sys_include=(/usr/lib/gcc-lib/i386-redhat-linux7/2.96/include,/usr/include,/usr/lib/gcc/i386-redhat-linux/4.1.1/include,/opt/oracle/app/oracle/product/10.2.0/db_1/precomp/public)
ltype=short
[oracle@c32 chcsv]$ ls -l /opt/oracle/app/oracle/product/10.2.0/db_1/precomp/admin/pcscfg.cfg*
-rw-r----- 1 oracle oinstall 191 3月 6 00:18 /opt/oracle/app/oracle/product/10.2.0/db_1/precomp/admin/pcscfg.cfg
-rw-r----- 1 oracle oinstall 228 6月 28 2005 /opt/oracle/app/oracle/product/10.2.0/db_1/precomp/admin/pcscfg.cfg.20110226
-rw-r----- 1 oracle oinstall 447 3月 1 00:25 /opt/oracle/app/oracle/product/10.2.0/db_1/precomp/admin/pcscfg.cfg.20110228
-rw-r----- 1 oracle oinstall 374 3月 1 00:31 /opt/oracle/app/oracle/product/10.2.0/db_1/precomp/admin/pcscfg.cfg.20110305
[oracle@c32 chcsv]$
☆前のバイナリと変わりはないみたい。
[oracle@c32 chcsv]$ ls -l ./chcsv ../chcsv.20110305/chcsv
-rwxr-xr-x 1 oracle oinstall 65339 3月 1 00:38 ../chcsv.20110305/chcsv
-rwxr-xr-x 1 oracle oinstall 65339 3月 6 00:31 ./chcsv
[oracle@c32 chcsv]$
[oracle@c32 chcsv]$ cmp ./chcsv ../chcsv.20110305/chcsv
[oracle@c32 chcsv]$

☆BUILD書き換え
[oracle@c32 chcsv]$ ls -l BUILD*
-rwxr-xr-x 1 oracle oinstall 1334 3月 1 00:33 BUILD
-rwxr-xr-x 1 oracle oinstall 1211 4月 5 1999 BUILD.20110226
[oracle@c32 chcsv]$
[oracle@c32 chcsv]$ diff BUILD.20110226 BUILD
11,12c11,13
< make -f $ORACLE_HOME/precomp/demo/proc/proc.mk build \ < EXE=chcsv OBJS="chcsv.o sqlda.o Option.o OutPut.o Signal.o" --- > #make -f /opt/oracle/app/oracle/product/10.2.0/db_1/rdbms/demo/demo_rdbms32.mk build \
> make -f /opt/oracle/app/oracle/product/10.2.0/db_1/rdbms/demo/demo_rdbms.mk build \
> EXE=chcsv OBJS="chcsv.o sqlda.o Option.o OutPut.o Signal.o" chcsv
[oracle@c32 chcsv]$

[oracle@c32 chcsv]$ sqlplus indou/indou

SQL*Plus: Release 10.2.0.1.0 - Production on 火 3月 1 00:45:00 2011

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



Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
に接続されました。
SQL> create table tbl_test(
2 fld001 varchar2(5),
3 fld002 number(5,1),
4 fld003 date
5 );

表が作成されました。

SQL> insert into tbl_test values ('01234', 1234.5, sysdate);

1行が作成されました。

SQL> insert into tbl_test values ('01235', 1934.9, sysdate-5);

1行が作成されました。

SQL> select * from tbl_test;

FLD001 FLD002 FLD003
--------------- ---------- --------
01234 1234.5 11-03-01
01235 1934.9 11-02-24

SQL> exit
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

[oracle@c32 chcsv]$ echo "select * from tbl_test" | ./chcsv indou/indou
01234,1234.5,11-03-01
01235,1934.9,11-02-24
[oracle@c32 chcsv]$ echo $?
0
[oracle@c32 chcsv]$