In Linux, the SQL plus upper and lower keys cannot display historical commands.

Source: Internet
Author: User

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'

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.