Forum Stats

  • 3,767,980 Users
  • 2,252,736 Discussions
  • 7,874,399 Comments

Discussions

Sql Plus Connection Issues

Chandhan S J
Chandhan S J Member Posts: 3 Green Ribbon

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/[email protected] <<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/[email protected] <<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