Sunday, December 28, 2014

Running Oracle XE 11gR2 in Nova-Docker container on OpenStack RDO Juno (CentOS 7)

*****************************
UPDATE as of 12/30/2014
*****************************
Today's Big Story @LXER.com

 

Docker image arahman/docker-oracle-xe-11g:latest  allows to build Nova-Docker
Container on RDO Juno running Oracle XE instance, which may be accessed remotely via floating IP assigned to nova instance. Several network configuration files require tuning with Nova system  instance-name and floating IP assigned
from neutron external pool.

   Nova-Docker driver  has been set up on RDO Juno per http://www.linux.com/community/blogs/133-general-linux/799569-running-nova-docker-on-openstack-rdo-juno-centos-7

   Docker image arahman/docker-oracle-xe-11g:latest to be pulled in is provided by https://registry.hub.docker.com/u/arahman/docker-oracle-xe-11g/

**********************
Pull in  docker image
**********************

# docker pull arahman/docker-oracle-xe-11g

**************************
Upload image to Glance
**************************

 # . keystonerc_admin
 # docker save arahman/docker-oracle-xe-11g:latest   | glance image-create --is-public=True --container-format=docker --disk-format=raw --name arahman/docker-oracle-xe-11g:latest

**********************************
 Launch  as Nova instance
**********************************

 # .  keystonerc_demo
 # nova boot --image "arahman/docker-oracle-xe-11g:latest"  --flavor m1.small --key_name oskey --nic net-id=demo_private-net-id Ubuntu-OracleXE

  Floating IP assigned 192.168.1.171

 


 Via ssh connection provided for root

[root@junodocker ~]# ssh root@192.168.1.171
root@192.168.1.171's password:
Last login: Sun Dec 28 17:45:38 2014 from 192.168.1.57

********************************************
Update  /etc/hosts inserting  first row  :-
********************************************

192.168.1.171  instance-00000019

where IP address is floating IP assigned to nova instance from neutron
external pool, hostname is nova system instance-name obtained by instance
been launched via mentioned docker's image arahman/docker-oracle-xe-11g:latest

If by any chance ssh login fails, then run :-

# docker exec container-id  /usr/sbin/sshd -D 


 
*****************************************
In more details :-
*****************************************

[root@fedora21 ~(keystone_admin)]# ssh root@192.168.1.158
ssh: connect to host 192.168.1.158 port 22: Connection refused

***************
Then run :-
***************

[root@fedora21 ~(keystone_admin)]# docker ps -a
CONTAINER ID        IMAGE                                   COMMAND             CREATED             STATUS                     PORTS               NAMES
6c60e38c729d        arahman/docker-oracle-xe-11g:latest     "/sbin/my_init"     58 seconds ago      Up 56 seconds                                  nova-94fdd382-63c8-4a66-966b-614ae561669a  
edad8c35fb59        arahman/docker-oracle-xe-11g:latest     "/sbin/my_init"     About an hour ago   Exited (0) 2 minutes ago                       nova-9e25598b-6c87-4d00-a721-68add5787e44  
d1194425b3cc        derby0112/docker-glassfish41:latest     "/sbin/my_init"     5 hours ago         Exited (2) 2 minutes ago                       nova-57566a04-7e0e-4147-9061-879066d0d708  
4eb390cf155d        derby_start/docker-glassfish41:latest   "/sbin/my_init"     24 hours ago        Exited (2) 22 hours ago                        nova-1fee359a-eb7f-4ecd-9386-24755513e4c6

**********************************************
Next step starting sshd inside container :-
********************************************** 

[root@fedora21 ~(keystone_admin)]# docker exec 6c60e38c729d /usr/sbin/sshd -D

********************************* ***
Now retry to ssh to container :-
************************************

[root@fedora21 ~(keystone_admin)]# ssh root@192.168.1.158
The authenticity of host '192.168.1.158 (192.168.1.158)' can't be established.
ECDSA key fingerprint is 8d:fe:ae:e8:d3:46:b0:31:ad:0d:d5:15:61:f4:b8:12.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.158' (ECDSA) to the list of known hosts.
root@192.168.1.158's password:

root@instance-00000011:~# ps -ef
UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 20:56 ?        00:00:00 /usr/bin/python3 -u /sbin/my_init
root       130     1  0 20:57 ?        00:00:00 /usr/bin/runsvdir -P /etc/service
root       131   130  0 20:57 ?        00:00:00 runsv syslog-ng
root       132   130  0 20:57 ?        00:00:00 runsv sshd
root       133   130  0 20:57 ?        00:00:00 runsv cron
root       134   133  0 20:57 ?        00:00:00 /usr/sbin/cron -f
root       135   131  0 20:57 ?        00:00:00 syslog-ng -F -p /var/run/syslog-ng.pid --no-caps
root       136   132  0 20:57 ?        00:00:00 /usr/sbin/sshd -D
root       147   136  0 20:58 ?        00:00:00 sshd: root@pts/0   
root       149   147  0 20:58 pts/0    00:00:00 -bash
root       160   149  0 20:58 pts/0    00:00:00 ps -ef


******************************************************
Verify  && update if required following files
******************************************************

oracle@instance-00000019:~$ cat ./product/11.2.0/xe/network/admin/listener.ora
# listener.ora Network Configuration File:

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/xe)
      (PROGRAM = extproc)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
      (ADDRESS = (PROTOCOL = TCP)(HOST = instance-00000019)(PORT = 1521))
    )
  )

DEFAULT_SERVICE_LISTENER = (XE)


oracle@instance-00000019:~$ cat ./product/11.2.0/xe/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File:

XE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = instance-00000019)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = XE)
    )
  )

EXTPROC_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
    )
    (CONNECT_DATA =
      (SID = PLSExtProc)
      (PRESENTATION = RO)
    )
  )

*******************
Start database
*******************

oracle@instance-00000019:~$ cat  dbStart
#!/bin/bash
lsnrctl start ;
sqlplus / as sysdba << EOF
startup ;
exit ;
EOF


oracle@instance-00000019:~$ ./dbStart

LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 28-DEC-2014 18:51:56

Copyright (c) 1991, 2011, Oracle.  All rights reserved.

Starting /u01/app/oracle/product/11.2.0/xe/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.2.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora
Log messages written to /u01/app/oracle/product/11.2.0/xe/log/diag/tnslsnr/instance-00000019/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=instance-00000019)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date                28-DEC-2014 18:51:56
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Default Service           XE
Listener Parameter File   /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora
Listener Log File         /u01/app/oracle/product/11.2.0/xe/log/diag/tnslsnr/instance-00000019/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=instance-00000019)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

SQL*Plus: Release 11.2.0.2.0 Production on Sun Dec 28 18:51:56 2014

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

Connected to an idle instance.

SQL> ORACLE instance started.

Total System Global Area  601272320 bytes
Fixed Size            2228848 bytes
Variable Size          192941456 bytes
Database Buffers      402653184 bytes
Redo Buffers            3448832 bytes
Database mounted.
Database opened.
SQL> Disconnected from Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production


  

*************************************************************
At this point we can see oracle daemons running :-
*************************************************************

oracle@instance-00000019:~$ ps -ef

UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 17:41 ?        00:00:00 /usr/bin/python3 -u /sbin/my_init
root        42     1  0 17:41 ?        00:00:00 /usr/bin/runsvdir -P /etc/service
root        43    42  0 17:41 ?        00:00:00 runsv syslog-ng
root        44    42  0 17:41 ?        00:00:00 runsv cron
root        45    42  0 17:41 ?        00:00:00 runsv sshd
root        46    43  0 17:41 ?        00:00:00 syslog-ng -F -p /var/run/syslog-ng.pid --no-caps
root        47    44  0 17:41 ?        00:00:00 /usr/sbin/cron -f
root        48    45  0 17:41 ?        00:00:00 /usr/sbin/sshd -D
root        88    48  0 17:46 ?        00:00:00 sshd: oracle [priv]
oracle      90    88  0 17:47 ?        00:00:00 sshd: oracle@pts/0 
oracle      91    90  0 17:47 pts/0    00:00:00 -bash
oracle     655     1  0 19:00 ?        00:00:00 /u01/app/oracle/product/11.2.0/xe/bin/tnslsnr LISTENER
oracle     663     1  0 19:00 ?        00:00:00 xe_pmon_XE
oracle     665     1  0 19:00 ?        00:00:00 xe_psp0_XE
oracle     667     1  0 19:00 ?        00:00:00 xe_vktm_XE
oracle     671     1  0 19:00 ?        00:00:00 xe_gen0_XE
oracle     673     1  0 19:00 ?        00:00:00 xe_diag_XE
oracle     675     1  0 19:00 ?        00:00:00 xe_dbrm_XE
oracle     677     1  0 19:00 ?        00:00:00 xe_dia0_XE
oracle     679     1  0 19:00 ?        00:00:00 xe_mman_XE
oracle     681     1  0 19:00 ?        00:00:00 xe_dbw0_XE
oracle     683     1  0 19:00 ?        00:00:00 xe_lgwr_XE
oracle     685     1  0 19:00 ?        00:00:00 xe_ckpt_XE
oracle     687     1  0 19:00 ?        00:00:00 xe_smon_XE
oracle     689     1  0 19:00 ?        00:00:00 xe_reco_XE
oracle     691     1  0 19:00 ?        00:00:00 xe_mmon_XE
oracle     693     1  0 19:00 ?        00:00:00 xe_mmnl_XE
oracle     695     1  0 19:00 ?        00:00:00 xe_d000_XE
oracle     697     1  0 19:00 ?        00:00:00 xe_s000_XE
oracle     699     1  0 19:00 ?        00:00:00 xe_s001_XE
oracle     701     1  0 19:00 ?        00:00:00 xe_s002_XE
oracle     703     1  0 19:00 ?        00:00:00 xe_s003_XE
oracle     711     1  0 19:00 ?        00:00:01 xe_vkrm_XE
oracle     713     1  0 19:00 ?        00:00:00 xe_qmnc_XE
oracle     727     1  0 19:00 ?        00:00:00 xe_cjq0_XE
oracle     737     1  0 19:00 ?        00:00:00 xe_q000_XE
oracle     739     1  0 19:00 ?        00:00:00 xe_q001_XE
oracle     745     1  0 19:05 ?        00:00:00 xe_smco_XE
oracle     763     1  0 19:15 ?        00:00:00 xe_w000_XE

*******************************************************
Configuring remote connection to XE@192.168.1.171
*******************************************************
Password for system is  given by https://registry.hub.docker.com/u/arahman/docker-oracle-xe-11g/

$ sudo /opt/sqldeveloper/sqldeveloper.sh
[sudo] password for boris:

 Oracle SQL Developer
 Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.


  


   Connect to Oracle Application Express web management console with following settings:

url: http://192.168.1.171:8080/apex 
workspace: INTERNAL 
user: ADMIN 
password: oracle


     

    
****************************************************
Service oracle-xe provided by original docker image also works fine :-
****************************************************

root@instance-00000019:~# service oracle-xe stop
Shutting down Oracle Database 11g Express Edition instance.
Stopping Oracle Net Listener.

root@instance-00000019:~# service oracle-xe start
Starting Oracle Net Listener.
Starting Oracle Database 11g Express Edition instance.

root@instance-00000019:~# service oracle-xe status

LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 28-DEC-2014 21:03:37

Copyright (c) 1991, 2011, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date                28-DEC-2014 21:03:21
Uptime                    0 days 0 hr. 0 min. 15 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Default Service           XE
Listener Parameter File   /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/instance-00000019/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=instance-00000019)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=instance-00000019)(PORT=8080))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "XE" has 1 instance(s).
  Instance "XE", status READY, has 1 handler(s) for this service...
Service "XEXDB" has 1 instance(s).
  Instance "XE", status READY, has 1 handler(s) for this service...
The command completed successfully
 

*******************************************
Actually start script may look like :-
*******************************************

#!/bin/bash
echo "192.168.1.171 instance-00000019" >> /etc/hosts
service oracle-xe start ;
service oracle-xe status ;
exit 0