解决方法
1. 安装 readline 软件包
在 Linux 的安装光盘中就有该软件包,不用额外下载。
使用 YUM 前,需先配置好本地 YUM 源。
[root@localhost ~]# yum list readline
Loaded plugins: refresh-packagekit, security
Installed Packages
readline.i686 6.0-4.el6 @ol6_local
readline.x86_64 6.0-4.el6 @anaconda-OracleLinuxServer-201302251503.x86_64/6.4
[root@localhost ~]# yum install -y readline
Loaded plugins: refresh-packagekit, security
Setting up Install Process
Package readline-6.0-4.el6.x86_64 already installed and latest version
Nothing to do
[root@localhost ~]# rpm -qa | grep readline
readline-6.0-4.el6.x86_64
readline-6.0-4.el6.i686
[root@localhost ~]#
2. 安装 rlwrap 软件包
2.1. 下载 rpm 包
http://pan.baidu.com/share/link?shareid=3482858924&uk=2332205065
2.2. 使用 YUM 安装 rpm 软件包
[root@localhost ~]# yum localinstall -y rlwrap-0.37-1.el5.x86_64.rpm
3. 使用 rlwrap
编辑 oracle 用户的 .bash_profile 文件,在文件尾部添加下面两行内容。
[oracle@localhost ~]$ tail -2 /home/oracle/.bash_profile
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
[oracle@localhost ~]$
4. 使用 SQL*Plus,验证效果。
SQL> select status from v$instance;
STATUS
------------
OPEN
SQL> select status from v$instance;
OK 可以通过上下键查看历史命令。