This article explains how to save SQLPLUS commands history on Linux within the package rlwrap (readline wapper).
- Package rlwrap?
- Install the Package rlwrap
- Verify the rlwrap package function
1- The package rlwrap:
The rlwrap utility can be used for other command-line tools and has useful features such as command completion and the ability to search commands or define custom vocabularies based on the tool by creating a command completion file for each command. Consult the rlwrap man page for more details.
To install this package, you can download the RPM package, use the source code .tar.gz, or use YUM to solve the dependencies automatically.
In our case, we are using the YUM to install the package readline wrapper.
. Search for the package rlwrap:
# yum search rlwrap Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: ftp.hosteurope.de * extras: ftp.hosteurope.de * updates: ftp.hosteurope.de Warning: No matches found for: rlwrap No matches found
The package rlwrap is not defined by default in the base repository.
2- Install the package rlwrap:
The package rlwrap is defined in the repository EPEL. the first step we will intall the repository EPEL.
a. Install the Repository EPEL:
# yum install -y epel-release
Note: (-y): to install directly without prompt.
b. Search the package rlwrap:
# yum search rlwrap rlwrap.x86_64 : Wrapper for GNU readline
C. Install the package rlwrap.
# yum install -y rlwrap.x86_64
3. Verify the rlwrap package function:
After installing the package rlwrap, we can use it via the command rlwrap:
a. Using the package rlwrap:
$ rlwrap sqlplus / as sysdba
b. For Sample uses, you can create an alias:
$ alias sqlplusrl='rlwrap sqlplus '
Note: You can create alias name as you prefer the name.
c. Exemple of using the alias:
$ sqlplusrl / as sysdba
Note: Now, you can execute SQLPLUS commands and can check the commands history.
With the package rlwrap, we can save the commands history SQLPLUS, RMAN, MYSQL…