The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 02-11-2009
pareshan pareshan is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 24
Korn Shell and Oracle

Hi Guys,

I haven't worked on oracle much but I have a situation where I have to do bdf in all the servers and insert that information into oracle table. I have already created table which have 7 columns, I can insert manually but I dont know how to insert that using Korn shell.

SERVER_ID NOT NULL NUMBER(6)
FS_LOCAL_NAME NOT NULL VARCHAR2(200)
LOCAL_MOUNT NOT NULL CHAR(1)
TOTAL_SPACE NOT NULL NUMBER(10)
USED_SPACE NUMBER(10)
SPACE_AVAILABLE NUMBER(10)
PERCENTAGE_USED NUMBER(3,2)

This is just a example I have done manually and its inserting data
#!/bin/ksh
sqlplus pareshan/ac6e94aac5b1b979902c0b0b1f42621761c@let01a<<EOF
insert into unix_servers values (1,'superior','Y',89885485,858757,4657575,2);
EXIT
EOF

But the thing I need is I have run df command which gives output like this

Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol4 1048576 298504 744256 29% /
/dev/vg00/lvol1 1014648 65224 847952 7% /stand
/dev/vg00/lvol8 4194304 1451112 2722456 35% /var
/dev/vg3psw/lvol12 3145728 1221208 1804256 40% /var/mqm
/dev/vg00/lvol10 4194304 3749008 441888 89% /var/adm/sw
/dev/vg00/lvol9 4194304 16744 4144936 0% /var/adm/crash
/dev/vg00/lvol7 5242880 1871528 3345048 36% /usr
/dev/vg3psw/lvol1 4194304 3867784 323984 92% /usr/local
/dev/vg3psw/lvol7 10338304 8815105 1428012 86% /usr/local/vertex
/dev/vg3psw/lvol2 12738560 8080720 4622144 64% /usr/local/oracle
/dev/vg3psw/lvol9 5120000 1286387 3594077 26% /usr/local/g1_3.2_SE
/dev/vghome_old/lvol1


and have to insert those data in the respective column in the oracle table.

Plz Help,