Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (6.1k points)
closed by

I have listed the command down below that I used in Unix environment to connect to Oracle database:

sqlplus test/test@'(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=hostname.com )(PORT=1521)))(CONNECT_DATA=(SID=mysid))'

It is showing me an error:

Use SQL*Plus to execute SQL, PL/SQL and SQL*Plus statements.

Usage 1: sqlplus -H | -V

    -H             Displays the SQL*Plus version and the

                   usage help.

    -V             Displays the SQL*Plus version.

Usage 2: sqlplus [ [<option>] [{logon | /nolog}] [<start>] ]

  <option> is: [-C <version>] [-L] [-M "<options>"] [-R <level>] [-S]

closed

4 Answers

0 votes
by (13k points)
 
Best answer

- The command you used in the Unix environment to connect to an Oracle database is:

  `sqlplus test/test@'(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=hostname.com)(PORT=1521)))(CONNECT_DATA=(SID=mysid))'`

- The error you are encountering suggests that you need to use SQL*Plus to execute SQL, PL/SQL, and SQL*Plus statements.

- SQL*Plus has two usage options:

  1. `sqlplus -H` or `sqlplus -V`: The `-H` option displays the SQL*Plus version and provides usage help, while the `-V` option displays only the SQL*Plus version.

- The general usage syntax for `sqlplus` is as follows:

  `sqlplus [ [<option>] [{logon | /nolog}] [<start>] ]`

  - `<option>`: Represents optional parameters that can be used with `sqlplus`. These include `-C <version>`, `-L`, `-M "<options>"`, `-R <level>`, and `-S`.

  - `[{logon | /nolog}]`: Denotes the option to specify a logon or run SQL*Plus without logging in. You would replace `logon` with your actual connection details or use `/nolog` to start SQL*Plus without connecting to a database.

  - ` [<start>]`: Refers to an optional parameter to run a script or a command after connecting to the database.

- Ensure that you provide the correct syntax and replace the relevant parts in the command with your specific values (e.g., `test/test` with the actual username/password and `hostname.com` with the correct hostname). This should help you establish a successful connection to the Oracle database.

0 votes
by (11.7k points)

You just have to do make this change, I hope this will work for you. 

sqlplus USER/PW@//hostname:1521/SID

lf you want to get more insights into SQL, check out this SQL Course from Intellipaat.

0 votes
by (11.4k points)
Check your command syntax and usage. Use SQL*Plus for executing statements in Oracle.
0 votes
by (7.8k points)
The Unix command you used to connect to an Oracle database is showing an error. To resolve this, make sure you're using SQL*Plus to execute SQL, PL/SQL, and SQL*Plus statements. The correct usage syntax for the `sqlplus` command is `sqlplus [ [<option>] [{logon | /nolog}] [<start>] ]`. Replace the relevant parts in the command (e.g., username/password and hostname) with your actual values. By providing the correct syntax and values, you should be able to establish a successful connection to the Oracle database.

Related questions

0 votes
2 answers
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...