docker rlwrap周りの整備で粘り勝った話

まえがき

docker images oracleを使う時にさっと環境整備したかったので、粘ってシェルスクリプト書き切った。

参考文献

su oracleがrootユーザーからできないとき、んっってなったので、調べた。

su: cannot open session: Permission denied  

事前にdockerホストにepel-repo登録しておく

ほんとは一元化したいけど、エスケープハマったので、妥協してしまった。粘り勝っていない。。エスケープ上手く扱えるようになりたい。

コード表示

[oracle@centos doclan]$ sudo cp /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 /etc/yum.repos.d/epel.repo .
[sudo] oracle のパスワード:
[oracle@centos doclan]$ ll
合計 16
drwxr-xr-x. 3 root   root   4096  5月 25 13:14 19cr3
-rw-r--r--. 1 root   root   1662  5月 25 17:45 RPM-GPG-KEY-EPEL-7
-rwxr-xr-x. 1 oracle docker  659  5月 25 17:37 env.sh
-rw-r--r--. 1 root   root    951  5月 25 17:45 epel.repo

env.sh

汚い ^^;まぁ、うまいやりかた思いついたら、描き直そう。

コード表示

[oracle@centos doclan]$ cat env.sh
#!/bin/bash

echo 'root_pwd' | passwd --stdin root
yum install -y passwd && \
yum install -y sudo
echo 'oracle_pwd' | passwd --stdin oracle
echo 'oracle ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
sed -i -e 's/^\(oracle   hard   memlock\)/#\1/' /etc/security/limits.d/oracle-database-preinstall-19c.conf

cp /mnt/RPM-GPG-KEY-EPEL-7 /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 && \
cp /mnt/epel.repo /etc/yum.repos.d/epel.repo

su oracle -c 'cd ~ && \
sudo yum update -y && \
sudo yum install -y rlwrap && \
sudo yum install -y vim && \
sudo mkdir -p rlwrap-extensions && \
cd rlwrap-extensions && \
sudo curl -LO http://www.linuxification.at/download/rlwrap-extensions-V12-0.05.tar.gz && \
sudo tar xvfz rlwrap-extensions-V12-0.05.tar.gz
'

su oracle -c 'sed -i -e "$ a alias sqlplus=\"rlwrap -pRed -if ~/rlwrap-extensions/sqlplus sqlplus\"" ~/.bashrc'

su oracle -c '
cat </opt/oracle/product/19c/dbhome_1/sqlplus/admin/glogin.sql
COLUMN OTHER_PLUS_EXP FORMAT A200
COLUMN PLAN_PLUS_EXP  FORMAT A200
SET NUMWIDTH 13
SET LINESIZE 1000
SET LONG 40000
SET LONGCHUNKSIZE 40000
SET PAGESIZE 50000
SET SERVEROUTPUT ON
SET TAB OFF
SET TRIMSPOOL ON
set feed on
--set autotrace traceonly
set timing on
--set hist on
DEFINE_EDITOR=nano
set sqlp "_USER'''\'@''\''_CONNECT_IDENTIFIER> "
EOF
'
su oracle

実行

コード表示

[oracle@centos doclan]$ docker run -v /home/oracle/doclan:/mnt -v /home/oracle/doclan/19cr3/init:/docker-entrypoint-initdb.d/startup -d --name orcl_19cr3 --shm-size=4g -p 1521:1521 -p 5500:5500 -e TZ=Asia/Tokyo -e ORACLE_PWD=ORACLE_PWD -e ORACLE_SID=ORCL -e ORACLE_PDB=pdb1 oracle/database:19.3.0-ee
[oracle@centos doclan]$ docker ps -a
CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS                   PORTS                                            NAMES
42b3dd2da618        oracle/database:19.3.0-ee   "/bin/sh -c 'exec $O…"   7 hours ago         Up 7 hours (unhealthy)   0.0.0.0:1521->1521/tcp, 0.0.0.0:5500->5500/tcp   orcl_19cr3
[oracle@centos doclan]$ docker exec --interactive --tty --user root --workdir / orcl_19cr3 bash
bash-4.2# cd /mnt && ./env.sh
[oracle@42b3dd2da618 mnt]$ cat /opt/oracle/product/19c/dbhome_1/sqlplus/admin/glogin.sql
COLUMN OTHER_PLUS_EXP FORMAT A200
COLUMN PLAN_PLUS_EXP  FORMAT A200
SET NUMWIDTH 13
SET LINESIZE 1000
SET LONG 40000
SET LONGCHUNKSIZE 40000
SET PAGESIZE 50000
SET SERVEROUTPUT ON
SET TAB OFF
SET TRIMSPOOL ON
set feed on
--set autotrace traceonly
set timing on
--set hist on
DEFINE_EDITOR=nano
set sqlp "_USER'@'_CONNECT_IDENTIFIER> "
[oracle@42b3dd2da618 mnt]$ sqlplus sys/ORACLE_PWD@pdb1 as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Sat May 25 19:54:10 2019
Version 19.3.0.0.0

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


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SYS@pdb1> show pdbs

       CON_ID CON_NAME                       OPEN MODE  RESTRICTED
------------- ------------------------------ ---------- ----------
            3 PDB1                           READ WRITE NO

あとがき

エスケープうまくなりたい。

epel repo install & rlwrap install sqlplus

reference

[CentOS7]EPELリポジトリの簡単な追加方法



https://qiita.com/inomasa/items/391c025532db6b87a1d5
https://qiita.com/hrnrtmks/items/0643fa3cea4237a92a4b
http://discus-hamburg.cocolog-nifty.com/mac_de_oracle/2013/07/oracle-database.html


[oracle@centos7 ~]$ docker exec --interactive --tty --user root --workdir / orcl_12cr2 bash
bash-4.2# curl -O https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 15080  100 15080    0     0  11228      0  0:00:01  0:00:01 --:--:-- 11236
bash-4.2# ls -lt
total 16
-rw-r--r--.   1 root root 15080 Dec 26 14:59 epel-release-7-11.noarch.rpm
drwxrwxrwt.   1 root root    60 Dec 26 14:59 tmp
drwxr-xr-x.   1 root root     6 Dec 26 14:53 run
dr-xr-x---.   1 root root    59 Dec 26 11:48 root
drwxr-xr-x.   1 root root    67 Dec 26 11:44 var
drwxr-xr-x.   1 root root   167 Dec 26 11:44 etc
drwxr-xr-x.   5 root root   340 Dec 23 13:11 dev
dr-xr-xr-x. 323 root root     0 Dec 23 13:11 proc
drwxr-xr-x.   1 root root    20 Dec 23 09:05 opt
drwxr-xr-x.   1 root root    20 Dec 23 08:35 home
lrwxrwxrwx.   1 root root    19 Dec 23 08:20 docker-entrypoint-initdb.d -> /opt/oracle/scripts
dr-xr-xr-x.  13 root root     0 Dec 23 06:45 sys
drwxrwxrwx.   4 1000 1001    32 Dec 23 06:31 mnt
lrwxrwxrwx.   1 root root     7 Nov  6 08:58 bin -> usr/bin
lrwxrwxrwx.   1 root root     7 Nov  6 08:58 lib -> usr/lib
lrwxrwxrwx.   1 root root     9 Nov  6 08:58 lib64 -> usr/lib64
lrwxrwxrwx.   1 root root     8 Nov  6 08:58 sbin -> usr/sbin
drwxr-xr-x.   1 root root    54 Nov  6 08:58 usr
dr-xr-xr-x.   2 root root     6 Apr 11  2018 boot
drwxr-xr-x.   2 root root     6 Apr 11  2018 media
drwxr-xr-x.   2 root root     6 Apr 11  2018 srv
bash-4.2# rpm -ivh epel-release-7-11.noarch.rpm
warning: epel-release-7-11.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:epel-release-7-11                ################################# [100%]
bash-4.2# yum update
Loaded plugins: ovl
epel/x86_64/metalink                                                                                                           | 8.7 kB  00:00:00     
epel                                                                                                                           | 3.2 kB  00:00:00     
(1/3): epel/x86_64/group_gz                                                                                                    |  88 kB  00:00:08     
(2/3): epel/x86_64/updateinfo                                                                                                  | 944 kB  00:00:09     
(3/3): epel/x86_64/primary                                                                                                     | 3.6 MB  00:00:30     
epel                                                                                                                                      12770/12770
Resolving Dependencies
--> Running transaction check
---> Package tzdata.noarch 0:2018f-2.el7 will be updated
---> Package tzdata.noarch 0:2018g-1.el7 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================
 Package                          Arch                             Version                                 Repository                            Size
======================================================================================================================================================
Updating:
 tzdata                           noarch                           2018g-1.el7                             ol7_latest                           483 k

Transaction Summary
======================================================================================================================================================
Upgrade  1 Package

Total download size: 483 k
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
tzdata-2018g-1.el7.noarch.rpm                                                                                                  | 483 kB  00:00:07     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Updating   : tzdata-2018g-1.el7.noarch                                                                                                          1/2 
  Cleanup    : tzdata-2018f-2.el7.noarch                                                                                                          2/2 
  Verifying  : tzdata-2018g-1.el7.noarch                                                                                                          1/2 
  Verifying  : tzdata-2018f-2.el7.noarch                                                                                                          2/2 

Updated:
  tzdata.noarch 0:2018g-1.el7                                                                                                                         

Complete!
bash-4.2# cd /etc/yum.repos.d/
bash-4.2# pwd
/etc/yum.repos.d
bash-4.2# ls -lt
total 28
-rw-rw-r--. 1 root root 14370 Nov  6 08:59 public-yum-ol7.repo
-rw-r--r--. 1 root root  1050 Oct  2  2017 epel-testing.repo
-rw-r--r--. 1 root root   951 Oct  2  2017 epel.repo
-rw-rw-r--. 1 root root   230 Feb 12  2015 osquery-s3-centos7.repo
bash-4.2# vim /etc/yum.repos.d/epel.repo
bash-4.2# yum -y install rlwrap
Loaded plugins: ovl
Resolving Dependencies
--> Running transaction check
---> Package rlwrap.x86_64 0:0.43-1.el7 will be installed
--> Processing Dependency: perl(Data::Dumper) for package: rlwrap-0.43-1.el7.x86_64
--> Processing Dependency: /usr/bin/python3 for package: rlwrap-0.43-1.el7.x86_64
--> Running transaction check
---> Package perl-Data-Dumper.x86_64 0:2.145-3.el7 will be installed
---> Package python34.x86_64 0:3.4.9-1.el7 will be installed
--> Processing Dependency: python34-libs(x86-64) = 3.4.9-1.el7 for package: python34-3.4.9-1.el7.x86_64
--> Processing Dependency: libpython3.4m.so.1.0()(64bit) for package: python34-3.4.9-1.el7.x86_64
--> Running transaction check
---> Package python34-libs.x86_64 0:3.4.9-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================
 Package                                  Arch                           Version                             Repository                          Size
======================================================================================================================================================
Installing:
 rlwrap                                   x86_64                         0.43-1.el7                          epel                               119 k
Installing for dependencies:
 perl-Data-Dumper                         x86_64                         2.145-3.el7                         ol7_latest                          47 k
 python34                                 x86_64                         3.4.9-1.el7                         epel                                51 k
 python34-libs                            x86_64                         3.4.9-1.el7                         epel                               8.3 M

Transaction Summary
======================================================================================================================================================
Install  1 Package (+3 Dependent packages)

Total download size: 8.5 M
Installed size: 30 M
Downloading packages:
warning: /var/cache/yum/x86_64/7Server/epel/packages/rlwrap-0.43-1.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY00:01:10 ETA 
Public key for rlwrap-0.43-1.el7.x86_64.rpm is not installed
(1/4): rlwrap-0.43-1.el7.x86_64.rpm                                                                                            | 119 kB  00:00:01     
(2/4): python34-3.4.9-1.el7.x86_64.rpm                                                                                         |  51 kB  00:00:03     
(3/4): perl-Data-Dumper-2.145-3.el7.x86_64.rpm                                                                                 |  47 kB  00:00:09     
(4/4): python34-libs-3.4.9-1.el7.x86_64.rpm                                                                                    | 8.3 MB  00:00:12     
------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                 707 kB/s | 8.5 MB  00:00:12     
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Importing GPG key 0x352C64E5:
 Userid     : "Fedora EPEL (7) "
 Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
 Package    : epel-release-7-11.noarch (installed)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : python34-libs-3.4.9-1.el7.x86_64                                                                                                   1/4 
  Installing : python34-3.4.9-1.el7.x86_64                                                                                                        2/4 
  Installing : perl-Data-Dumper-2.145-3.el7.x86_64                                                                                                3/4 
  Installing : rlwrap-0.43-1.el7.x86_64                                                                                                           4/4 
  Verifying  : perl-Data-Dumper-2.145-3.el7.x86_64                                                                                                1/4 
  Verifying  : python34-3.4.9-1.el7.x86_64                                                                                                        2/4 
  Verifying  : python34-libs-3.4.9-1.el7.x86_64                                                                                                   3/4 
  Verifying  : rlwrap-0.43-1.el7.x86_64                                                                                                           4/4 

Installed:
  rlwrap.x86_64 0:0.43-1.el7                                                                                                                          

Dependency Installed:
  perl-Data-Dumper.x86_64 0:2.145-3.el7                python34.x86_64 0:3.4.9-1.el7                python34-libs.x86_64 0:3.4.9-1.el7               

Complete!
bash-4.2# yum list | grep  rlwrap
rlwrap.x86_64                           0.43-1.el7                   @epel      
bash-4.2# which rlwrap
/usr/bin/rlwrap

rootでinstallしたので、oracleユーザーからは見えなかった。。


[oracle@609a69bc0b21 ~]$ sudo curl -O https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm
[sudo] password for oracle: 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 15080  100 15080    0     0  11244      0  0:00:01  0:00:01 --:--:-- 11253
[oracle@609a69bc0b21 ~]$ ls -lt
total 16
-rw-r--r--. 1 root root 15080 Dec 26 16:17 epel-release-7-11.noarch.rpm
lrwxrwxrwx. 1 root root    26 Dec 23 08:35 setPassword.sh -> /opt/oracle/setPassword.sh
[oracle@609a69bc0b21 ~]$ sudo rpm -ivh epel-release-7-11.noarch.rpm
Preparing...                          ################################# [100%]
	package epel-release-7-11.noarch is already installed
[oracle@609a69bc0b21 ~]$ sudo yum -y install rlwrap
Loaded plugins: ovl
Resolving Dependencies
--> Running transaction check
---> Package rlwrap.x86_64 0:0.43-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================
 Package                            Arch                               Version                                 Repository                        Size
======================================================================================================================================================
Installing:
 rlwrap                             x86_64                             0.43-1.el7                              epel                             119 k

Transaction Summary
======================================================================================================================================================
Install  1 Package

Total download size: 119 k
Installed size: 281 k
Downloading packages:
rlwrap-0.43-1.el7.x86_64.rpm                                                                                                   | 119 kB  00:00:01     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : rlwrap-0.43-1.el7.x86_64                                                                                                           1/1 
  Verifying  : rlwrap-0.43-1.el7.x86_64                                                                                                           1/1 

Installed:
  rlwrap.x86_64 0:0.43-1.el7                                                                                                                          

Complete!
[oracle@609a69bc0b21 ~]$ sudo which rlwrap
/bin/rlwrap
[oracle@609a69bc0b21 ~]$ rlwrap
Usage: rlwrap [options] command ...

Options:
  -a[password prompt]        --always-readline[=password prompt]
  -A                         --ansi-colour-aware
  -b                  --break-chars=
  -c                         --complete-filenames
  -C                 --command-name=
  -D  <0|1|2>                --history-no-dupes=<0|1|2>
  -e                --extra-char-after-completion=
  -f        --file=
  -g                 --forget-matching=
  -h                         --help
  -H                   --history-filename=
  -i                         --case-insensitive
  -I                         --pass-sigint-as-sigterm
  -l                   --logfile=
  -m[newline substitute]     --multi-line[=newline substitute]
  -M  <.ext>                 --multi-line-ext=<.ext>
  -n                         --no-warnings
  -N                         --no-children
  -o                         --one-shot
  -O                 --only-cook=
  -p[colour]                 --prompt-colour[=colour]
  -P                  --pre-given=
  -q                  --quote-characters=
  -r                         --remember
  -R                         --renice
  -s                      --histsize= (negative: readonly)
  -S                 --substitute-prompt=
  -t                   --set-term-name=
  -U                         --mirror-arguments
  -v                         --version
  -w                      --wait-before-prompt= (msec, <0  : patient mode)
  -W                         --polling
  -z         --filter= ('rlwrap -z listing' writes a list of installed filters)

bug reports, suggestions, updates:
https://github.com/hanslub42/rlwrap
[oracle@609a69bc0b21 ~]$ 


[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

[epel-debuginfo]
name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch/debug
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1

[epel-source]
name=Extra Packages for Enterprise Linux 7 - $basearch - Source
#baseurl=http://download.fedoraproject.org/pub/epel/7/SRPMS
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1

[oracle@609a69bc0b21 ~]$ rlwrap -pRed sqlplus /nolog

SQL*Plus: Release 12.2.0.1.0 Production on Wed Dec 26 16:21:55 2018

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

@> 
[oracle@609a69bc0b21 ~]$ sqlplus /nolog

SQL*Plus: Release 12.2.0.1.0 Production on Wed Dec 26 16:22:41 2018

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

@> 


[oracle@609a69bc0b21 ~]$ sqlplus sys/ORACLE_PWD as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Wed Dec 26 16:24:07 2018

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SYS@ORCL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
[oracle@609a69bc0b21 ~]$ 
[oracle@609a69bc0b21 ~]$ rlwrap -pRed sqlplus sys/ORACLE_PWD as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Wed Dec 26 16:24:36 2018

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SYS@ORCL> select instance_name from v$instance;

INSTANCE_NAME
----------------
ORCL

1 row selected.

Elapsed: 00:00:00.02
SYS@ORCL> select instance_name from v$instance;

INSTANCE_NAME
----------------
ORCL

1 row selected.

Elapsed: 00:00:00.00
SYS@ORCL> 


# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=

# User specific aliases and functions
alias sqlplus='rlwrap -pRed sqlplus'


[oracle@centos7 ~]$ docker exec -it orcl_12cr2 /bin/bash
[oracle@609a69bc0b21 ~]$ rlwrap -pRed sqlplus sys/ORACLE_PWD as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Wed Dec 26 16:28:00 2018

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SYS@ORCL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
[oracle@609a69bc0b21 ~]$ sqlplus sys/ORACLE_PWD as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Wed Dec 26 16:28:13 2018

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SYS@ORCL> 


[oracle@609a69bc0b21 ~]$ ll
total 16
-rw-r--r--. 1 root root 15080 Dec 26 16:17 epel-release-7-11.noarch.rpm
lrwxrwxrwx. 1 root root    26 Dec 23 08:35 setPassword.sh -> /opt/oracle/setPassword.sh
[oracle@609a69bc0b21 ~]$ mkdir rlwrap-extensions
[oracle@609a69bc0b21 ~]$ ll
total 16
-rw-r--r--. 1 root   root     15080 Dec 26 16:17 epel-release-7-11.noarch.rpm
drwxr-xr-x. 2 oracle oinstall     6 Dec 26 16:29 rlwrap-extensions
lrwxrwxrwx. 1 root   root        26 Dec 23 08:35 setPassword.sh -> /opt/oracle/setPassword.sh
[oracle@609a69bc0b21 ~]$ cd rlwrap-extensions
[oracle@609a69bc0b21 rlwrap-extensions]$ pwd
/home/oracle/rlwrap-extensions
[oracle@609a69bc0b21 rlwrap-extensions]$ wget http://www.linuxification.at/download/rlwrap-extensions-V12-0.05.tar.gz
bash: wget: command not found
[oracle@609a69bc0b21 rlwrap-extensions]$ curl -O http://www.linuxification.at/download/rlwrap-extensions-V12-0.05.tar.gz  
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 57847  100 57847    0     0  28254      0  0:00:02  0:00:02 --:--:-- 28273
[oracle@609a69bc0b21 rlwrap-extensions]$ tar xvfz rlwrap-extensions-V12-0.05.tar.gz
adrci
asm+
asmcmd
dgmgrl
README
README.english
rman
sql+
sql.functions
sqlplus
sqlplus.all
sqlplus.cdb
sqlplus.dba
sqlplus.dbms_packages
sqlplus.functions
sqlplus.gvdollar
sqlplus.init
sqlplus._init
sqlplus.packages
sqlplus.rman
sqlplus.tables
sqlplus.user
sqlplus.utl_packages
sqlplus.vdollar
[oracle@609a69bc0b21 rlwrap-extensions]$ 


@> SELECT * FROM v$
Display all 104 possibilities? (y or n)
ABORT          CONNECT        DROP           INCREMENT      MAXEXTENTS     OPTION         REVOKE         STARTUP        VALIDATE
ACCESS         CREATE         ELSE           INDEX          MINUS          ORDER          ROWID          SUCCESSFUL     VALUES
ALTER          CURRENT        EXCLUSIVE      INITIAL        MLSLABEL       PAGESIZE       ROWNUM         SYNONYM        VARCHAR
ARCHIVE        DATABASE       EXISTS         INSERT         MODE           PARAMETER      ROWS           TABLE          VARCHAR2
AUDIT          DATE           FILE           INTEGER        MODIFY         PCTFREE        SELECT         TABLESPACE     VIEW
BETWEEN        DECIMAL        FLOAT          INTERSECT      NOAUDIT        PLUGGABLE      SESSION        THEN           WHENEVER
CHAR           DEFAULT        FROM           INTO           NOCOMPRESS     PRIOR          SHARE          TRANSACTIONAL  WHERE
CHECK          DEFERRABLE     GRANT          LEVEL          NOWAIT         PRIVILEGES     SHUTDOWN       TRIGGER        WITH
CLUSTER        DEFERRED       GROUP          LIKE           NULL           PUBLIC         SIZE           UNION          
COLUMN         DELETE         HAVING         LINESIZE       NUMBER         QUIESCE        SMALLINT       UNIQUE         
COMMENT        DESC           IDENTIFIED     LOCK           OFFLINE        RENAME         SPOOL          UNQUIESCE      
COMPRESS       DISTINCT       IMMEDIATE      LONG           ONLINE         RESOURCE       START          UPDATE         
@> SELECT * FROM v$IN
INCREMENT  INDEX      INITIAL    INSERT     INTEGER    INTERSECT  INTO       


# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=

# User specific aliases and functions
alias sqlplus='rlwrap -pRed -if ~/rlwrap-extensions/sqlplus sqlplus'


[oracle@609a69bc0b21 ~]$ sqlplus sys/ORACLE_PWD as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Wed Dec 26 16:45:15 2018

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SYS@ORCL> select instance_name from v$instance;

INSTANCE_NAME
----------------
ORCL

1 row selected.

Elapsed: 00:00:00.01
SYS@ORCL> SELECT 
Display all 104 possibilities? (y or n)
ABORT          CONNECT        DROP           INCREMENT      MAXEXTENTS     OPTION         REVOKE         STARTUP        VALIDATE
ACCESS         CREATE         ELSE           INDEX          MINUS          ORDER          ROWID          SUCCESSFUL     VALUES
ALTER          CURRENT        EXCLUSIVE      INITIAL        MLSLABEL       PAGESIZE       ROWNUM         SYNONYM        VARCHAR
ARCHIVE        DATABASE       EXISTS         INSERT         MODE           PARAMETER      ROWS           TABLE          VARCHAR2
AUDIT          DATE           FILE           INTEGER        MODIFY         PCTFREE        SELECT         TABLESPACE     VIEW
BETWEEN        DECIMAL        FLOAT          INTERSECT      NOAUDIT        PLUGGABLE      SESSION        THEN           WHENEVER
CHAR           DEFAULT        FROM           INTO           NOCOMPRESS     PRIOR          SHARE          TRANSACTIONAL  WHERE
CHECK          DEFERRABLE     GRANT          LEVEL          NOWAIT         PRIVILEGES     SHUTDOWN       TRIGGER        WITH
CLUSTER        DEFERRED       GROUP          LIKE           NULL           PUBLIC         SIZE           UNION          
COLUMN         DELETE         HAVING         LINESIZE       NUMBER         QUIESCE        SMALLINT       UNIQUE         
COMMENT        DESC           IDENTIFIED     LOCK           OFFLINE        RENAME         SPOOL          UNQUIESCE      
COMPRESS       DISTINCT       IMMEDIATE      LONG           ONLINE         RESOURCE       START          UPDATE         
SYS@ORCL> SELECT sysdate from dual;

SYSDATE
---------
26-DEC-18

1 row selected.

Elapsed: 00:00:00.01
SYS@ORCL>