hello monks,
I am attempting to assign the output of a sqlplus command to an array. Assuming I can get that far I'll need to try to parse it with regexes but I'm not there yet. :)
Here's what I've been able to come up with so far:
#!/bin/perl
# credentials / environment variables
$ORACLE_HOME="/u01/app/oracle/product/10.2.0.4";
$ORACLE_SID=qaecom1;
$sqlplus="/u01/app/oracle/product/10.2.0.4/bin/sqlplus";
$USERNAME=dbuser;
$PASS=pass;
$SID=${ORACLE_SID};
@TSPACES=`$sqlplus -s -l $USERNAME/$PASS@$SID \@/opt/bin/ops/mlb_tabl
+espace.sql | awk '{print $1}' $sqlplus -s -l $USERNAME/$PASS@$SID
+\@/opt/bin/ops/mlb_tablespace.sql | awk '{print $3}' $sqlplus -s -l
+$USERNAME/$PASS@$SID \@/opt/bin/ops/mlb_tablespace.sql | awk '{print
+ $2}' $sqlplus -s -l $USERNAME/$PASS@$SID \@/opt/bin/ops/mlb_table
+space.sql | awk '{print $4}'`;
The biggest problem I am having, currently, is getting the script to recognize the environment variables needed to access the oracle db. Namely ORACLE_HOME.
Here is what happens when I attempt to run the script:
[db07-dc2:~] root% Error 6 initializing SQL*Plus
Message file sp1<lang>.msb not found
SP2-0750: You may need to set ORACLE_HOME to your Oracle software dire
+ctory
Then it just hangs.. I was wondering if anyone might have some advice on how to get this script to work with Oracle DB.
Thanks
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.