Ask a question »

Oracle - Using SQLPlus under Linux

May 2015

SQLPlus is a command line tool which allows you to store and retrieve data in Oracle, a relational database management system. Databases consist of tables that can be manipulated using SQL. SQL is a programming language used for managing databases. SQL queries are sent to the server using this SQLPlus tool. If you are using SQLPlus under Linux then you cannot rollback your command using the UP arrow or backspace button. This will display special characters. You need to use some existing commands such as L to review last command, R to redo last command, etc. You can install rlwrap package for Oracle in Linux when you are working with SQLPlus in a Linux environment to view previous commands.

[Oracle] - using SQLPlus under Linux




Intro


You would be surprised to see that you can't rollback your command with the up arrow (last command entered) or the backspace button (actual command correction).Special characters are displayed.

Some existing commands

  • Review the last command entered:


L
  • Redo last command entered:


R
  • Correcting last command entered:


c/text_tobe_corrected/text_corrected



Type R to have the command executed.

Using rlwrap

  • However, for those who want to return to a more classic methodology, you can download the rlwrap package:


apt-get install rlwrap sur Debian, etc.
  • Log as follows:


rlwrap sqlplus user/pass@SID
  • You can now use your arrow keys and backspace. Commands (R, L and c) mentioned above can be used too.

Automate the use of rlwrap

  • To automate the use of rlwrap, add the following line in your .bashrc file:


alias sqlplus='rlwrap sqlplus' 
  • Run the following command for the changes are taken into account:


source ~/.bashrc 
  • Now you no longer need to specify rlwrap: the "sqlplus" command will automatically be interpreted as "rlwrap sqlplus".
For unlimited offline reading, you can download this article for free in PDF format:
Oracle-using-sqlplus-under-linux.pdf

See also

In the same category

Published by jad05. - Latest update by Virginia Parsons
This document entitled « Oracle - Using SQLPlus under Linux » from Kioskea (en.kioskea.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.