In Linux, the problem of invalid Del key and return of sqlplus in Oracle is solved.

Source: Internet
Author: User

In Linux, the problem of invalid Del key and return of sqlplus in Oracle is solved.

PS: Recently, I am studying oracle in my spare time because of my work needs. I found that when I remotely log on to the sqplus of oracle in Linux Using SSH clients such as SecureCRT or putty, when you press the Backspace key or Del key to delete a wrong character, ^ H or other messy characters may appear, which is quite awkward. Although you can delete the character by pressing Ctrl + Backspace, however, the usage efficiency is seriously affected. Google finally solved this problem perfectly. The summary record is as follows. This article is the most complete summary of this problem:

Messy characters

I. Solutions in SecureCRT terminal: (not perfect)

On the SecureCRT terminal, if you want to use Backspace under sqlplus to delete characters, there are two temporary methods.

The first is to use the stty command to redefine ^ H. You can execute stty erase ^ H before using sqlplus, or put this sentence in the. bash_profile file of the oracle user.

Stty command introduction:
There is an stty command in Unix or Linux. It is used to print or change the setting of terminal (terminal.
Common parameters:
-A -- all: Use a human-readable table to print all existing settings.
-G -- save: Use the stty readable table to print all existing settings.
-- Help
-- Version

View the current stty settings,

The second is to use SecureCRT settings. In the session attribute Terminal-> Emulation-> Mapped Keys, select one of Backspace sends delete or Delete sends backspace, and make sure that the other one is not selected.

Another problem is that the upper and lower arrows in sqlplus under bash shell cannot be used to display the upper and lower commands, but only ^ [A, which can be solved by installing rlwrap!

Ii. Solution Using rlwrap: (perfect)

1. Install the rlwrap and readline Libraries

You can use the yum source of EPEL to directly install CentOS. The steps are as follows:

(1) install EPEL6 yum source in RHEL/CentOS/SL Linux 6.x:

32-bit System Selection:

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

64-bit System Selection:

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

Import key:

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

By default, the epel. repo and epel-testing.repo profiles are created under/etc/yum. repos. d.

(2) install rlwrap and readline:

# yum install rlwrap readline readline-devel

If there is no rlwrap or readline in the source of other Linux distributions (for example, the SUSE Enterprise Edition does not have these two packages by default), download these two source code packages for compilation and installation.

# 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# 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

(3) set the system alias of sqlplus:

# vim /home/oracle/.bash_profile

Add:

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

Log out of oracle and log on again. Now sqlplus is used to it!

Articles you may be interested in:
  • Simple oracle Installation and SQLPLUS usage
  • Common oracle SQL plus commands

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.