Use sqlplus arrow keys in Linux

Source: Internet
Author: User
Tags call back

I use Ubuntu 10.04 and install rlwrap using sudo apt-get install rlwrap.

The usage is: rlwrap sqlplus. After entering, you can use the direction key. You do not need to enter rlwrap to modify your bashrc and add alias sqlplus = 'rlwrap sqlplus '. After this takes effect, you no longer need to enter rlwrap to use the direction keys.

When running SQL * Plus in Linux Shell, the history command line browsing function is not provided. On the contrary, in Windows, when running SQL * Plus in the doscommand window, you can use the up and down keys to jump back to the previously executed SQL statements. You can modify them as needed, and then press [Enter] to submit them again.

To achieve the same purpose in Linux, you can install rlwrap. This program is a Shell and can run any commands you provide to it, including parameters, and add the command history browsing function. The rlwrap program is under the GPL license.

1: Installation
Rlwrap-0.28.tar.gz: http://utopia.knoware.nl /~ Hlub/uck/rlwrap/

1) decompress the Installation File
[Oracle @ Channel-MQ3 ~] $ Gunzip rlwrap-0.28.tar.gz
[Oracle @ Channel-MQ3 ~] $ Tar xvf rlwrap-0.28.tar

2) switch to the root user and run the following command:
[Root @ Channel-MQ3 ~] # Cd/home/oracle/rlwrap-0.28
[Root @ Channel-MQ3 rlwrap-0.28] # ls
Aclocal. m4 completions configure INSTALL README TODO
AUTHORS config. h configure. ac Makefile src tools
Bash30-005.patch config. h. in COPYING Makefile. am stamp-h1
BUGS config. log distribution Makefile. in test
ChangeLog config. status doc NEWS test. log
[Root @ Channel-MQ3 rlwrap-0.28] #./configure
[Root @ Channel-MQ3] # make
[Root @ Channel-MQ3] # make install

2: Use
$ Rlwrap [-options]
[Oracle @ Channel-MQ3 ~] $ Which rlwrap
/Usr/local/bin/rlwrap
[Oracle @ Channel-MQ3 ~] $ Rlwrap sqlplus/as sysdba

SQL * Plus: Release 10.2.0.1.0-Production on Wed Jul 18 10:31:11 2007
Copyright (c) 1982,200 5, Oracle. All rights reserved.

Connected:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0-Production
With the Partitioning, OLAP and Data Mining options

SQL> select * from v $ sga;

NAME VALUE
------------------------------
Fixed Size 1219856
Variable Size 121635568
Database Buffers 310378496
Redo Buffers' 7168000

-- Use the up key to call back the last command executed, press [Enter] to re-execute or modify it, and then press [Enter] to execute
SQL> select * from v $ sga;

NAME VALUE
------------------------------
Fixed Size 1219856
Variable Size 121635568
Database Buffers 310378496
Redo Buffers' 7168000

  • 1
  • 2
  • Next Page

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.