Linux中oracle 解决backspace和上下键使用出现乱码

简介:   I. yum方式安装CentOS系统默认的yum软件仓库中没有rlwrap这个包,需要通过第三方yum源安装。

  

I. yum方式安装

CentOS系统默认的yum软件仓库中没有rlwrap这个包,需要通过第三方yum源安装。

a. 安装第三方yum源

# rpm -ivh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6                          //导入key

默认会在/etc/yum.repos.d/下创建epel.repo和epel-testing.repo两个配置文件。

b. 安装rlwrap和readline

# yum install rlwrap readline readline-devel

II. 源码包安装

其他Linux发行版如果源里没有rlwrap和readline的(如SUSE企业版默认没有这两个包),要分别下载这两个源码包编译安装一下。

a. 安装readline

# wget ftp://ftp.gnu.org/gnu/readline/readline-6.2.tar.gz
# tar zxvf readline-6.2.tar.gz
# cd readline-6.2/
# ./configure
# make
# make install

b. 安装rlwrap

# wget http://utopia.knoware.nl/~hlub/rlwrap/rlwrap-0.37.tar.gz
# tar zxvf rlwrap-0.37.tar.gz
# cd rlwrap-0.37/
# ./configure
# make
# make install






在Windows操作系统上,当在DOS命令窗口中运行SQL*Plus的时候,可以使用向上,向下键来跳回之前已经执行过的SQL语句.你可以根据需要修改他们,然后按Enter键重新提交执行. 然而,当在Linux Shell中运行SQL*Plus的时候,并不提供浏览历史命令行的功能. 为了在Linux中达到同样的目的,你可以安装rlwrap,这个程式本身是个Shell,可以运行任何你提供给它的命令包括参数,并添加命令历史浏览功能.The rlwrap program is under the GPL license.


  一:安装readline 

  OS的安装光盘里提供了readline包(在安装包的centos/rpms目录下,有两个以readline开头的包). 

  [root@oracle11g ~]# rpm -Uvh readline* 

  error: Failed dependencies: libtermcap-devel is needed by readline-devel-5.1-1.1.i386.rpm

  [root@oracle11g ~]# rpm -Uvh libtermcap-devel-2.0.8-46.1.i386.rpm 

  [root@oracle11g ~]# rpm -Uvh readline* 

  package readline-5.1-1.1 is already installed 

  [root@oracle11g ~]# rpm -Uvh readline-devel-5.1-1.1.i386.rpm 

  二:安装rlwrap 

  Download:http://utopia.knoware.nl/~hlub/uck/rlwrap/ 

  [root@oracle11g ~]# tar -zxvf rlwrap-0.30.tar.gz 

  [root@oracle11g ~]# cd rlwrap-0.30 

  [root@oracle11g rlwrap-0.30]# ./configure 

  [root@oracle11g rlwrap-0.30]# make 

  [root@oracle11g rlwrap-0.30]# make install 

         或者直接可以:yum install rlwrap readline readline-devel

  [root@oracle11g rlwrap-0.30]# vi /home/oracle/.bash_profile(该文件 在你所安装的oracle目录下可找到)

  alias sqlplus='rlwrap sqlplus' 

  alias rman='rlwrap rman' 

但用这样的注释,在每次logout 后,都要每次执行 source ./.bash_profile才会生效

最方便的是在.bashrc文件中添加

 alias sqlplus='rlwrap sqlplus' 
  alias rman='rlwrap rman' 

接着执行source ./bashrc这样即使注销也不会失效


  三:使用rlwrap 

  [oracle@oracle11g ~]$ sqlplus / as sysdba 

  SQL*Plus: Release 11.1.0.6.0 - Production on Tue Jul 29 21:28:30 2008 

  Copyright (c) 1982, 2007, Oracle. All rights reserved. 

  Connected to: 

  Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production 

  With the Partitioning, OLAP, Data Mining and Real Application Testing options 

  SQL> select * from v$sga; 

  NAME VALUE 

  -------------------- ---------- 

  Fixed Size 1299116 

  Variable Size 155192660 

  Database Buffers 79691776 

  Redo Buffers 2347008 

  使用向上键调回最后执行的命令,按Enter键重新执行或修改后按Enter键执行. 

  SQL> select * from v$sga; 

  NAME VALUE 

  -------------------- ---------- 

  Fixed Size 1299116 

  Variable Size 155192660 

  Database Buffers 79691776 

  Redo Buffers 2347008 

  SQL> 

  Notes: 

  解决在sqlplus下输错命令后正常删除的方法 

  [oracle@oracle11g ~]$ vi /home/oracle/.bash_profile 

  添加stty erase ^h 
目录
相关文章
|
12月前
|
Oracle 关系型数据库 MySQL
Oracle Linux 8.10 编译安装sysbench
Oracle Linux 8.10 编译安装sysbench
407 34
|
11月前
|
Oracle Cloud Native 关系型数据库
Oracle Linux 10 - Oracle 提供支持 RHEL 兼容发行版
Oracle Linux 10 - Oracle 提供支持 RHEL 兼容发行版
448 11
Oracle Linux 10 - Oracle 提供支持 RHEL 兼容发行版
|
11月前
|
Oracle Cloud Native 关系型数据库
Oracle Linux 9.6 正式版发布 - Oracle 提供支持 RHEL 兼容发行版
Oracle Linux 9.6 正式版发布 - Oracle 提供支持 RHEL 兼容发行版
470 0
Oracle Linux 9.6 正式版发布 - Oracle 提供支持 RHEL 兼容发行版
|
10月前
|
Oracle 关系型数据库 Linux
MyEMS开源系统安装之CentOS/RHEL/Rocky/AlmaLinux/Oracle Linux
本指南介绍如何在CentOS/RHEL/Rocky/AlmaLinux/Oracle Linux服务器上部署MyEMS开源能源管理系统。内容涵盖系统准备、数据库配置、多个MyEMS服务(如myems-api、myems-admin、myems-modbus-tcp等)的安装与配置,以及Nginx服务器设置和防火墙规则调整。通过完成所有步骤,您将能够访问MyEMS Admin UI和Web UI,默认端口分别为8001和80,初始登录凭据已提供。
651 0
|
12月前
|
Oracle 关系型数据库 MySQL
Oracle linux 8 二进制安装 MySQL 8.4企业版
Oracle linux 8 二进制安装 MySQL 8.4企业版
515 1
|
Linux
SecureCRT连接Linux时乱码问题
本文详细介绍了在使用SecureCRT连接Linux服务器时出现乱码问题的解决方法,包括设置SecureCRT字符编码、检查和配置Linux服务器字符编码、调整终端设置等。通过这些方法,您可以有效解决SecureCRT连接Linux时的乱码问题,确保正常的终端显示和操作。希望本文能帮助您在实际操作中更好地解决类似问题,提高工作效率。
1376 17
|
Oracle 关系型数据库 Linux
linux8安装oracle 11g遇到的问题记录
Oracle 11g在Linux 8上安装时会遇到link编译环节的问题。官方建议忽略安装中的链接错误,安装完成后应用DBPSU 11.2.0.4.240716补丁及一次性补丁33991024,再重新编译二进制文件,并配置监听器和数据库。但因11g已退出服务期,这些补丁需付费获取。网上信息显示22年1月的PSU补丁也可解决问题,找到该补丁后按常规方式打补丁即可。如有需求或疑问可咨询我。
715 20
|
Oracle Cloud Native 关系型数据库
Oracle Linux 9.5 正式版发布 - Oracle 提供支持 RHEL 兼容发行版
Oracle Linux 9.5 正式版发布 - Oracle 提供支持 RHEL 兼容发行版
338 10
Oracle Linux 9.5 正式版发布 - Oracle 提供支持 RHEL 兼容发行版
|
7月前
|
Linux 应用服务中间件 Shell
二、Linux文本处理与文件操作核心命令
熟悉了Linux的基本“行走”后,就该拿起真正的“工具”干活了。用grep这个“放大镜”在文件里搜索内容,用find这个“探测器”在系统中寻找文件,再用tar把东西打包带走。最关键的是要学会使用管道符|,它像一条流水线,能把这些命令串联起来,让简单工具组合出强大的功能,比如 ps -ef | grep 'nginx' 就能快速找出nginx进程。
791 1
二、Linux文本处理与文件操作核心命令
|
7月前
|
Linux
linux命令—stat
`stat` 是 Linux 系统中用于查看文件或文件系统详细状态信息的命令。相比 `ls -l`,它提供更全面的信息,包括文件大小、权限、所有者、时间戳(最后访问、修改、状态变更时间)、inode 号、设备信息等。其常用选项包括 `-f` 查看文件系统状态、`-t` 以简洁格式输出、`-L` 跟踪符号链接,以及 `-c` 或 `--format` 自定义输出格式。通过这些选项,用户可以灵活获取所需信息,适用于系统调试、权限检查、磁盘管理等场景。
458 137