Questions tagged [sqlplus]

an Oracle cli tool to access databases, mixing SQL statements with the PL/SQL language.

Filter by
Sorted by
Tagged with
0
votes
0answers
19 views

How can I run sqlplus as nobody

I have a bash script (/bin/foo) where I export PATH, LD_LIBRARY_PATH, ORACLE_HOME, ORACLE_SID and I can run sqlplus (Oracle SQL client) from the script, but when I try to run it like this sudo -u ...
2
votes
1answer
56 views

Executing linux aliases from sqlplus

In sqlplus there is an option to execute standard shell commands, simply by prefixing them with '!'. Example: SQL>!ps -af returns expected processes. My question is, is there an option to execute ...
0
votes
1answer
252 views

ssh sqlplus command has $ symbol and it gets substituted

I'm Running some SQLPLUS code over ssh. ssh -q node1 'export ORACLE_SID=DB11D_1;ORAENV_ASK=NO;. oraenv >/dev/null 2>&1;sqlplus -s / as sysdba << ENDSQL whenever sqlerror exit 1 alter ...
1
vote
1answer
522 views

bind variable and shell scripting with sqlplus [closed]

I wish to execute DMLs using bind variable with shell scripts. For example, something like: #!/bin/bash SH_NUM=10 sqlplus -S test_user/test_pass <<EOD var a number; a:=${SH_NUM} insert into ...
-1
votes
1answer
431 views

Generating .XLS file as an output file of sqlplus query and sending that .XLS file as an attachment in email

I am generating output file (.xls format) from the below DB query- sqlplus -S -L user/pass@DB <<EOF | sed '/^$/d' >> home/test/query_output.xls set line 22000 set head off set feedback ...
0
votes
1answer
80 views

Different output when executing script manually and via cron/jenkins job

I have a shell script which opens sqlplus and select some data from db containing chinese characters. When I execute it manually, the output contains those characters. When I do it via cron or jenkins ...
0
votes
1answer
215 views

unable to spool through shell(ksh)

I've written a shell script in which i've defined variables : Last_Month,last_date and first_date and i'm trying to execute the below sql from the shell : /app/oracle/product/10.2.0/bin/sqlplus -s ...
-2
votes
1answer
259 views

string comparison not working with sqlplus output

Code: iIMSI=`sqlplus -s ${APP_ORA_USER}/${APP_ORA_PASS}@${APP_DB_INST} << EOF SET HEAD OFF PAGESIZE 0 LINESIZE 1000 TRIMOUT ON TIMING OFF select resource_value from agd1_resources where ...
1
vote
0answers
387 views

Referencing dynamically created table names in Create statement written in shell script

I need to write a script to automatically generate a month end report. The generation process involved creating tables in database and then accessing them later in the same script to create another ...
1
vote
1answer
253 views

How to capture only the stderror in this bash script?

this is my scash script query="select * from blabla;" sqlplus64 -S /nolog <<ENDOFSQL>>errorLog.txt CONNECT username/pwd@domainName:1521/serviceName ...
1
vote
0answers
712 views

Running SQLPlus Oracle Command as Root returns incorrect answer

I am trying to create a script that checks the usage of each disk in an ASMDISK group. I have my script setup on one node in each RAC cluster. It works on several of the servers without issue, but ...
0
votes
2answers
9k views

Shell script : Redirect sql query output to a file

Inside a shell script, I have written below sqlq(){ result=`sqlplus -S sss/eee@sid < $1|grep -v '^$'` echo $result } echo "select * from emp" > q.sql sqlq q.sql I need to direct the output to ...
-1
votes
1answer
37 views

Pick Values From A Oracle Select Query

I have executed the below command (Part of a 2 step procedure required for password reset when we face the error ORA-28007). SQL> select USER#,NAME,PASSWORD FROM user$ where name='TESTUSER'; ...
0
votes
1answer
124 views

how to concatenate Login, pwd and @server variables?

how to concatenate Login, pwd and @server variables ?? ex: export Login_va="Login" export pwd_va="pwd" export server_var="@server" echo whenever sqlerror exit | sqlplus $Login/$...
-1
votes
1answer
2k views

save output into a file from sqlplus query in ksh script

The thing is that it overwrites in Result.txt and I only get the last query. How can I fix this? #!/bin/sh while read -r line do echo "'$line'" sqlplus -s whatever/whatever <<-EOF SPOOL ...
1
vote
2answers
13k views

Pass shell variables to SQL statement

I want to pass shell variables to an SQL statement. Both shell script and SQL statement are present in the same script file. I want the values of the variables retMonth, retLastDay and retPrvYear in ...
4
votes
2answers
3k views

SQLplus and Oracle, bad UTF-8 display

I have set export NLS_LANG=Italian_ITALY.UTF8 db is on UTF-8 SELECT * FROM NLS_DATABASE_PARAMETERS NLS_CHARACTERSET |AL32UTF8 But sqlplus ...