After running SQL statements in Linux sqlplus, you can use the up and down keys to find out the historical commands.
Follow the steps below to set
1. Download rlwrap from
2. Install rlwrap
[Root @ localhost] # tar-zxvf rlwrap-0.30.tar.gz
[Root @ localhost] # rlwrap-0.30 cd
[Root @ localhost rlwrap-0.30] #./configure
[Root @ localhost rlwrap-0.30] # make
[Root @ localhost rlwrap-0.30] # make install
[Root @ localhost rlwrap-0.30] # rlwrap
3. Use rlwrap, rlwrap sqlplus/as sysdba
At this time, the familiar up/down key function is back.
4. Set the alias so that sqlplus runs in rlwrap by default.
[Root @ localhost rlwrap-0.30] # vi/home/Oracle/. bash_profile
Add the following content
Alias sqlplus = 'maid sqlplus'
The alias definition uses single quotes instead of the one on the TAB./home/oracle/is the oracle user's home directory.
The preceding settings require Oracle users to log on again,
If the above settings do not work, you can set them in/home/oracle/. bashrc so that alias will be set every time you change to bash.
Use type sqlplus for verification. If the following information is displayed, the alias setting is successful.
Sqlplus is aliased to 'rlwrap sqlplus'