Skip to Main Content

Sql Plus Connection Issues

Chandhan S JNov 16 2021

I am having some issues when connecting using Command Line in Unix.
rm -rf /home/oracle/Desktop/Unix_Sample_Files/Test1.txt
sqlplus -s hr/hr@oracle <<EOF
set linesize 32767
set pagesize 50000
spool /home/oracle/Desktop/Unix_Sample_Files/Test1.txt
select * from employees;
spool off
exit
EOF
This is working fine and giving the output.
But the below is not working and giving the error. Tried all the methods but was unable to resolve them.
rm -rf /home/oracle/Desktop/Unix_Sample_Files/Test2.txt
sqlplus -s sys as sysdba/oracle@oracle <<EOF
spool /home/oracle/Desktop/Unix_Sample_Files/Test2.txt
set linesize 32767
set pagesize 50000
select * from v$database;
spool off
exit
EOF
The error is
SP2-0306: Invalid option.
Usage: CONN[ECT] [{logon|/|proxy} [AS {SYSDBA|SYSOPER|SYSASM|SYSBACKUP|SYSDG|SYSKM|SYSRAC}] [edition=value]]
where <logon> ::= <username>[/<password>][@<connect_identifier>]
<proxy> ::= <proxyuser>[<username>][/<password>][@<connect_identifier>]

Comments
Post Details
Added on Nov 16 2021
3 comments
32 views