SQL*Plus history under Linux
Asked Answered
C

2

15

How to make sqlplus in Linux to maintain history of my queries? So that I could use up/down arrows to get my previous query.

Centrum answered 11/8, 2010 at 7:1 Comment(0)
C
17

rlwrap package is needed. Used like this:

$ rlwrap sqlplus user/password@sid

Nice to place alias to .bashrc:

alias sqlplus="rlwrap sqlplus"

Found answer here:

http://sysdba.wordpress.com/2006/10/08/how-to-use-rlwrap-to-get-a-command-history-in-sqlplus/

Centrum answered 11/8, 2010 at 7:41 Comment(1)
Use "rlwrap -l" to make rlwrap accept CTRL-C to cancel running commands.Luge
P
4

Starting with the release "Oracle 12c release 2" (SQL*Plus Release 12.2.0.1.0) they have now introduced the history command.

For the up / down arrows you probably still need rlwrap though.

Reference for history command:

https://docs.oracle.com/database/122/SQPUG/HISTORY.htm#SQPUG-GUID-CCF9B047-3122-4644-BA06-5FA4B5812E9F

Penology answered 26/7, 2017 at 9:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.