Skip to main content

Questions tagged [sqlplus]

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

Filter by
Sorted by
Tagged with
1 vote
1 answer
217 views

-bash: /usr/lib/oracle/19.10/client64/bin/sqlplus: No such file or directory

I'm trying to run Oracle Linux 9(aarch64) on M2 MacBook Air using UTM, so that I can develop my python application that is required to connect to Oracle Database 11g. Because the python app requires ...
ernix's user avatar
  • 121
1 vote
1 answer
79 views

SQL*Plus version not printing in tempfile

I am trying to execute below Unix script to fetch the Oracle version from Windows command prompt using ssh command to connect to Unix terminal. #!/use/bin/ksh Freport=/tmp/test.txt cd /usr/oracle2/...
Chakkara's user avatar
-1 votes
1 answer
73 views

Pass a linux variable into oracle script [duplicate]

I am trying to pass mount_point details in my oracle script. I am able to pass integer variable using below code but not able to send mount point details in oracle script: sed "s/@@pqr@@/$space/g&...
Divya's user avatar
  • 1
1 vote
1 answer
2k views

Inserting into a Oracle table from a shell variable storing thousands of values

I'm trying to insert records into a column in Oracle where the values are passed from a shell variable. The variable itself stores pattern generated from a list of files. This pattern is generated on ...
AntiNational's user avatar
0 votes
1 answer
429 views

Bind variables in terminal

Is it possible to request a variable directly in the terminal? For example, I want to use command cat <some-file>, but I want the terminal to ask what file name to use. Just like in SQL plus I'm ...
Bieroed's user avatar
0 votes
1 answer
560 views

Unix command substitution when using sqlplud

Trying to invoke a sql file from unix shells script. ExecuteSql1.sh #!/bin/sh ## steps to get the connection and form it. result=`sqlplus -S ${connectURL} << EOF SET PAGES 0 lines 800 @ /sql/...
Tim's user avatar
  • 103
0 votes
1 answer
951 views

bash script does not continue after executing query with sqlplus

here I'm trying to run a normal query with sqlplus and dump the result into CSV file, then I have another job to do, I facing problem my script does not continue after executing sqlplus query it just ...
yong shi's user avatar
1 vote
1 answer
20k views

Shell script that starts sqlplus utility and executes a query, gathers output

I'm trying to do this: In sample.sh: #!/bin/bash sqlplus / as sysdba select * from dual; And just when I run this shell script, it opens sqlplus utility, but it cannot execute the next line that I ...
Shantharam Puranik's user avatar
0 votes
2 answers
758 views

Is it possible not to override a file in case of error when redirecting STDOUT?

I have a simple syntactically wrong command like this that is meant to be run on Unix/Linux hosts $ echo "first string $PATH" > out.lst $ ECHO second string %PATH% > out.lst The first line ...
Massimo Pasquini's user avatar
0 votes
0 answers
65 views

Query Oracle database through python

Background: New to python. I have a high security client. Anything on the O/S must go through a lengthy (nearly impossible in some cases) process to be approved by the IA department. I want to ...
Marinaio's user avatar
  • 298
0 votes
0 answers
812 views

How to call 'ALTER SESSION' inside a sqlplus call in shell script

I have a requirement to call ALTER SESSION command within an existing shell script's SQLPlus block. When I tried to call it as EXECUTE IMMEDIATE 'alter session set optimizer_dynamic_sampling=5', it ...
Aaron Morales's user avatar
0 votes
0 answers
586 views

How to Assign SQLPLUS output value to Variable from root

I am trying to assign sqlplus output to unix variable as a root user using the following function function sql { su - oracle -c " export ORACLE_HOME=$( "`grep "OraG" /u01/app/oraInventory/...
CoolChap007's user avatar
2 votes
1 answer
466 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 ...
Z.Szymon's user avatar
  • 143
0 votes
1 answer
1k 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 ...
A Sanghvi's user avatar
1 vote
1 answer
1k 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 ...
Nir's user avatar
  • 1,355
-1 votes
1 answer
2k 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 ...
Praveen Verma's user avatar
0 votes
1 answer
314 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 ...
FunTomas's user avatar
  • 451
0 votes
1 answer
2k 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 ...
ashish_k's user avatar
  • 375
-2 votes
1 answer
602 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 ...
sandeep's user avatar
1 vote
0 answers
1k 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 ...
A.Bhargava's user avatar
1 vote
1 answer
402 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 ...
deepak pandey's user avatar
1 vote
0 answers
1k 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 ...
StarKev2525's user avatar
1 vote
2 answers
30k 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 ...
Srikanth Yadake's user avatar
-1 votes
1 answer
62 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'; ...
Abstract Circle's user avatar
0 votes
1 answer
207 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/$...
amine tabenyoussef's user avatar
-1 votes
1 answer
4k 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 ...
lucia's user avatar
  • 83
1 vote
2 answers
22k 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 ...
user2488578's user avatar
4 votes
2 answers
8k 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 ...
elbarna's user avatar
  • 12.8k