この記事は約12分45秒で読むことができます。

docker fileにしたいこと

sudo package install

[oracle@centos7 ~]$ docker exec --interactive --tty --user root --workdir / orcl_18cr3 bash
bash-4.2# yum install -y sudo
Installed:
  sudo.x86_64 0:1.8.23-3.el7
Complete!
bash-4.2# visudo
visudo: /etc/sudoers.tmp unchanged
vim install

[oracle@centos7 ~]$ docker exec --interactive --tty --user root --workdir / orcl_18cr3 bash
bash-4.2# yum -y install vim
Installed:
  vim-enhanced.x86_64 2:7.4.160-5.el7
Complete!
passwdコマンド install

[oracle@centos7 ~]$ docker exec --interactive --tty --user root --workdir / orcl_18cr3 bash
bash-4.2# whereis passwd
passwd: /etc/passwd
bash-4.2# yum install -y passwd
Installed:
  passwd.x86_64 0:0.79-4.el7

Complete!
bash-4.2# whereis passwd
passwd: /usr/bin/passwd /etc/passwd

passwordの設定

bash-4.2# whoami
root
bash-4.2# passwd
Changing password for user root.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
bash-4.2# passwd oracle
Changing password for user oracle.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
oracle user sudo enable

bash-4.2# visudo
## Same thing without a password
# %wheel        ALL=(ALL)       NOPASSWD: ALL
oracle          ALL=(ALL)       ALL

[oracle@centos7 ~]$ docker exec --interactive --tty --user root --workdir / orcl_18cr3 bash
bash-4.2# exit
[oracle@centos7 ~]$ docker exec -it orcl_18cr3 bash
[oracle@c75932116d78 ~]$ sudo echo "hey"

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for oracle:
hey
[oracle@c75932116d78 ~]$

epel repo install


rlwrap install sqlplus

[oracle@centos7 ~]$ docker exec -it orcl_18cr3 bash
[oracle@c75932116d78 ~]$ whoami
oracle
[oracle@c75932116d78 ~]$ 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  11824      0  0:00:01  0:00:01 --:--:-- 11827
[oracle@c75932116d78 ~]$ ls -lt
total 16
-rw-r--r--. 1 root root 15080 Jan 13 18:26 epel-release-7-11.noarch.rpm
lrwxrwxrwx. 1 root root    26 Jan  2 20:58 setPassword.sh -> /opt/oracle/setPassword.sh
[oracle@c75932116d78 ~]$ sudo rpm -ivh epel-release-7-11.noarch.rpm
Installed:
  rlwrap.x86_64 0:0.43-1.el7
Complete!
rlwrap dictionary install sqlplus

[oracle@c75932116d78 ~]$ ll
total 16
-rw-r--r--. 1 root root 15080 Jan 13 18:26 epel-release-7-11.noarch.rpm
lrwxrwxrwx. 1 root root    26 Jan  2 20:58 setPassword.sh -> /opt/oracle/setPassword.sh
[oracle@c75932116d78 ~]$ mkdir rlwrap-extensions
[oracle@c75932116d78 ~]$ ll
total 16
-rw-r--r--. 1 root   root     15080 Jan 13 18:26 epel-release-7-11.noarch.rpm
drwxr-xr-x. 2 oracle oinstall     6 Jan 13 18:29 rlwrap-extensions
lrwxrwxrwx. 1 root   root        26 Jan  2 20:58 setPassword.sh -> /opt/oracle/setPassword.sh
[oracle@c75932116d78 ~]$ cd rlwrap-extensions
[oracle@c75932116d78 rlwrap-extensions]$ pwd
/home/oracle/rlwrap-extensions
[oracle@c75932116d78 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  22940      0  0:00:02  0:00:02 --:--:-- 22946
[oracle@c75932116d78 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@c75932116d78 rlwrap-extensions]$ cd ~
[oracle@c75932116d78 ~]$ vim .bashrc
[oracle@c75932116d78 ~]$ vi
[oracle@c75932116d78 ~]$
glogin modify

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@c75932116d78 ~]$ find / -name *login*.sql -type f 2>/dev/null
/opt/oracle/product/18c/dbhome_1/sqlplus/admin/glogin.sql
[oracle@c75932116d78 ~]$ vi /opt/oracle/product/18c/dbhome_1/sqlplus/admin/glogin.sql
[oracle@c75932116d78 ~]$ sqlplus aine/ORACLE_PWD@pdb1

SQL*Plus: Release 18.0.0.0.0 - Production on Sun Jan 13 18:38:42 2019
Version 18.3.0.0.0

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

Last Successful login time: Sun Jan 13 2019 18:38:35 +09:00

Connected to:
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.3.0.0.0

AINE@pdb1>

Leave a Reply

Your email address will not be published. Required fields are marked *