Resolve SQL plus cannot use up and down arrows

Time:2020-10-31

1 problem description

SQLPLUSHistorical commands cannot be obtained by using up and down arrows in, as shown in the following figure:

Resolve SQL plus cannot use up and down arrows

Press the up and down arrow to display^[[A/^[[B

2 solutions

Installation requiredrlwrapIf you can, you can use the package manager to installCentOS, which is compiled and installed from the source code.

2.1 download source code

officialGithubsurePoke it here, the latest version is0.43

Resolve SQL plus cannot use up and down arrows

2.2 installation

After uploading to the server, decompress, compile and install:

tar -zxvf rlwrap-0.43.tar.gz
cd rlwrap-0.43
./configure
make 
make install

The author is in./configureThis step encountered the following errors:

Resolve SQL plus cannot use up and down arrows

Install a library to solve:

yum install readline-devel

again./configureThere is no problem

Resolve SQL plus cannot use up and down arrows

2.3 testing

userlwrap sqlplusReplace the originalsqlplusSign in:

rlwrap sqlplus xxx/xxx as sysdba

So you can use up and down arrows.

Because the author is inrootTest on theoracleThere may be permission problems when testing on users, as shown in the following figure:

Resolve SQL plus cannot use up and down arrows

Create the file in the corresponding directory:

cd /home/oracle
sudo touch .sqlplus_history

Cannot execute after creating:

Resolve SQL plus cannot use up and down arrows

Modify the group permissions to:

sudo chmod g+w .sqlplus_history

Resolve SQL plus cannot use up and down arrows

2.4 alias

For ease of use, you can add an alias:

alias sp='rlwrap sqlplus'

So you can use it next time

sp xxx/xxx as sysdba

Signed in.

Recommended Today

Kafka learning materials

Kafka 1、 Benefits of message middleware 1. Decoupling It allows you to extend or modify processes on both sides independently, as long as you make sure they comply with the same interface constraints. It would be a great waste to put resources on standby to handle such peak visits. The use of message queue can […]