Archive for March, 2018

How to install Oracle Database based on dockerfiles and images from Oracle

 

Download all the dockerfiles:

https://github.com/oracle/docker-images

Navigate to :

docker-images/OracleDatabase/SingleInstance/dockerfiles

Download Oracle Database (12.2.0.1) from www.oracle.com:

and copy it to the directory (12.2.0.1):


Result of "git clone https://github.com/oracle/docker-images.git"
/home/tteikhua/docker-images/OracleDatabase/SingleInstance>tree
.
├── COPYRIGHT
├── dockerfiles
│   ├── 11.2.0.2
│   │   ├── checkDBStatus.sh
│   │   ├── Checksum.xe
│   │   ├── Dockerfile.xe
│   │   ├── runOracle.sh
│   │   ├── setPassword.sh
│   │   └── xe.rsp
│   ├── 12.1.0.2
│   │   ├── checkDBStatus.sh
│   │   ├── checkSpace.sh
│   │   ├── Checksum.ee
│   │   ├── Checksum.se2
│   │   ├── createDB.sh
│   │   ├── dbca.rsp.tmpl
│   │   ├── db_inst.rsp
│   │   ├── Dockerfile.ee
│   │   ├── Dockerfile.se2
│   │   ├── installDBBinaries.sh
│   │   ├── installPerl.sh
│   │   ├── runOracle.sh
│   │   ├── runUserScripts.sh
│   │   ├── setPassword.sh
│   │   ├── setupLinuxEnv.sh
│   │   └── startDB.sh
│   ├── 12.2.0.1
│   │   ├── checkDBStatus.sh
│   │   ├── checkSpace.sh
│   │   ├── Checksum.ee
│   │   ├── Checksum.se2
│   │   ├── createDB.sh
│   │   ├── dbca.rsp.tmpl
│   │   ├── db_inst.rsp
│   │   ├── Dockerfile.ee
│   │   ├── Dockerfile.se2
│   │   ├── installDBBinaries.sh
│   │   ├── linuxx64_12201_database.zip
│   │   ├── runOracle.sh
│   │   ├── runUserScripts.sh
│   │   ├── setPassword.sh
│   │   ├── setupLinuxEnv.sh
│   │   └── startDB.sh
│   ├── 18.3.0
│   │   ├── checkDBStatus.sh
│   │   ├── checkSpace.sh
│   │   ├── Checksum.ee
│   │   ├── Checksum.se2
│   │   ├── createDB.sh
│   │   ├── dbca.rsp.tmpl
│   │   ├── db_inst.rsp
│   │   ├── Dockerfile.ee
│   │   ├── Dockerfile.se2
│   │   ├── installDBBinaries.sh
│   │   ├── runOracle.sh
│   │   ├── runUserScripts.sh
│   │   ├── setPassword.sh
│   │   ├── setupLinuxEnv.sh
│   │   └── startDB.sh
│   ├── buildDockerImage.sh
│   └── myoracle_docker.sh
├── FAQ.md
├── LICENSE
├── README.md
├── samples
│   ├── 12102-docker-compose
│   │   └── docker-compose.yml
│   ├── 12201-docker-compose
│   │   └── docker-compose.yml
│   ├── 1830-docker-compose
│   │   └── docker-compose.yml
│   ├── applypatch
│   │   ├── 12.1.0.2
│   │   │   ├── Dockerfile.ee
│   │   │   ├── Dockerfile.se2
│   │   │   └── patches
│   │   │   ├── 001
│   │   │   └── applyPatches.sh
│   │   ├── 12.2.0.1
│   │   │   ├── Dockerfile.ee
│   │   │   ├── Dockerfile.se2
│   │   │   └── patches
│   │   │   ├── 001
│   │   │   └── applyPatches.sh
│   │   ├── buildPatchedDockerImage.sh
│   │   └── README.md
│   ├── customdb
│   │   └── README.md
│   ├── customscripts
│   │   ├── 01_shellExample.sh
│   │   ├── 02_createUser.sql
│   │   ├── 03_addTable.sql
│   │   └── README.md
│   ├── plugpdb
│   │   └── README.md
│   ├── prebuiltdb
│   │   └── README.md
│   ├── README.md
│   ├── startersetcontainer
│   │   ├── README.md
│   │   └── starterset.sql
│   └── unplugpdb
│   └── README.md
└── tests
├── helperFunctions.sh
├── README.md
├── runAllTests.sh
├── runContainerTests112.sh
├── runContainerTests121.sh
├── runContainerTests122.sh
├── runContainerTests183.sh
├── runContainerTests.sh
└── runImageBuildTests.sh

view raw

gistfile1.txt

hosted with ❤ by GitHub

Noticed the file name “linuxx64_12201_database.zip” is given by Oracle, which the script will recognize.
This is the main command that start everything (-v is for version, -e is for Enterprise Edition):

bash buildDockerImage.sh  -v 12.2.0.1 -e

Output of installation is here (https://gist.github.com/tthtlc/d9825431eb13a4337c723411172b73da).

Upon completion of installation, a new docker image will be created:

docker images

REPOSITORY                       TAG                     IMAGE ID            CREATED             SIZE
oracle/database                  12.2.0.1-ee             49712d6a0946        3 hours ago         13.3 GB

And given the image ID above, we will connect via (and notice the password is given here):

docker run -it 49712d6a0946

ORACLE PASSWORD FOR SYS, SYSTEM AND PDBADMIN: anZERbg7P9k=1

LSNRCTL for Linux: Version 12.2.0.1.0 – Production on 30-MAR-2018 08:03:44

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

Starting /opt/oracle/product/12.2.0.1/dbhome_1/bin/tnslsnr: please wait…

TNSLSNR for Linux: Version 12.2.0.1.0 – Production
System parameter file is /opt/oracle/product/12.2.0.1/dbhome_1/network/admin/listener.ora
Log messages written to /opt/oracle/diag/tnslsnr/8f14eca8ba12/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
————————
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.2.0.1.0 – Production
Start Date                30-MAR-2018 08:03:46
Uptime                    0 days 0 hr. 0 min. 2 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/oracle/product/12.2.0.1/dbhome_1/network/admin/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/8f14eca8ba12/listener/alert/log.xml
Listening Endpoints Summary…
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
The listener supports no services
The command completed successfully
[WARNING] [DBT-10102] The listener configuration is not selected for the database. EM DB Express URL will not be accessible.
CAUSE: The database should be registered with a listener in order to access the EM DB Express URL.
ACTION: Select a listener to be registered or created with the database.
Copying database files
1% complete
13% complete
25% complete
Creating and starting Oracle instance
26% complete
30% complete
31% complete

It will continue to configure the database.

Checking the container ID:

docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                NAMES
8f14eca8ba12        49712d6a0946        “/bin/sh -c ‘exec …”   11 minutes ago      Up 11 minutes       1521/tcp, 5500/tcp   nostalgic_murdock

Connecting to it:

docker exec -it 8f14eca8ba12 bash

[oracle@8f14eca8ba12 ~]$ df
Filesystem     1K-blocks      Used Available Use% Mounted on
none           825567656 304142320 479465912  39% /
tmpfs           16478564         0  16478564   0% /dev
tmpfs           16478564         0  16478564   0% /sys/fs/cgroup
/dev/sda2      825567656 304142320 479465912  39% /etc/hosts
shm                65536         0     65536   0% /dev/shm
tmpfs           16478564         0  16478564   0% /sys/firmware

[oracle@8f14eca8ba12 ~]$ ps -ef|grep orac
oracle       1     0  0 08:03 ?        00:00:00 /bin/bash /opt/oracle/runOracle.sh
oracle      27     1  0 08:03 ?        00:00:00 /opt/oracle/product/LISTENER -inherit
oracle    2310     1  0 08:12 ?        00:00:00 ora_pmon_ORCLCDB
oracle    2312     1  0 08:12 ?        00:00:00 ora_clmn_ORCLCDB
oracle    2314     1  0 08:12 ?        00:00:00 ora_psp0_ORCLCDB
xxxxx
oracle    2818     1  0 08:12 ?        00:00:00 ora_qm02_ORCLCDB
oracle    2822     1  0 08:12 ?        00:00:00 ora_q002_ORCLCDB
oracle    2824     1  0 08:12 ?        00:00:00 ora_q003_ORCLCDB
oracle    2879     1  0 08:12 ?        00:00:00 tail -f /opt/oracle/diag/rdbms/orclcdb/ORCLCDB/trace/alert_ORCLCDB.log
oracle    2915     1  0 08:13 ?        00:00:00 ora_w002_ORCLCDB
oracle    2930     0  0 08:15 ?        00:00:00 bash
oracle    2949  2930  0 08:15 ?        00:00:00 ps -ef
oracle    2950  2930  0 08:15 ?        00:00:00 grep –color=auto orac

Finding out the TNS service name:

cd $ORACLE_HOME

cd network/admin/

cat tnsnames.ora

ORCLCDB=localhost:1521/ORCLCDB

ORCLPDB1=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORCLPDB1)
)
)

So “ORCLCDB” is the name.

sqlplus system/anZERbg7P9k=1@ORCLCDB

SQL*Plus: Release 12.2.0.1.0 Production on Fri Mar 30 08:17:29 2018

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

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

SQL> desc sys.tab$
Name                       Null?    Type
—————————————– ——– —————————-
OBJ#                       NOT NULL NUMBER
DATAOBJ#                        NUMBER
TS#                       NOT NULL NUMBER
FILE#                       NOT NULL NUMBER
BLOCK#                    NOT NULL NUMBER
BOBJ#                            NUMBER
TAB#                            NUMBER
COLS                       NOT NULL NUMBER
CLUCOLS                        NUMBER
PCTFREE$                   NOT NULL NUMBER
PCTUSED$                   NOT NULL NUMBER

SQL> select count(*) from sys.tab$;

COUNT(*)
———-
2149

Worked.

Now when you stop the container from another session:

Then the main session (which is this screen:   https://gist.github.com/tthtlc/8e0a04ff958e0d0a12b6395195579a1c) will automatically shutdown the database.

https://gist.github.com/tthtlc/930e4264c602f4b7eea027ab71a5fd77

But when you start up the stopped container, every Oracle processes will startup automatically.
docker ps -a
docker start 8f14eca8ba12
docker psCONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                NAMES
8f14eca8ba12        49712d6a0946        “/bin/sh -c ‘exec …”   27 minutes ago      Up 3 seconds        1521/tcp, 5500/tcp   nostalgic_murdockdocker exec -it 8f14eca8ba12 bash[oracle@8f14eca8ba12 ~]$ ps -ef|grep ora
oracle       1     0  0 08:30 ?        00:00:00 /bin/bash /opt/oracle/runOracle.sh
oracle      13     1  0 08:30 ?        00:00:00 /opt/oracle/product/LISTENER -inherit
oracle      20     1  0 08:31 ?        00:00:00 ora_pmon_ORCLCDB
oracle      22     1  0 08:31 ?        00:00:00 ora_clmn_ORCLCDB
oracle      24     1  0 08:31 ?        00:00:00 ora_psp0_ORCLCDB
oracle      26     1  0 08:31 ?        00:00:00 ora_vktm_ORCLCDB
oracle      30     1  0 08:31 ?        00:00:00 ora_gen0_ORCLCDB
oracle      32     1  5 08:31 ?        00:00:00 ora_mman_ORCLCDB

[oracle@8f14eca8ba12 ~]$ sqlplus system/anZERbg7P9k=1@ORCLCDB

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

SQL>

Successful.

And in case we may forget the password, let us just change it to default:

sqlplus system/anZERbg7P9k=1@ORCLCDB

SQL> show user
USER is “SYSTEM”
SQL> alter user system identified by manager;

User altered.

sqlplus sys/anZERbg7P9k=1@ORCLCDB as sysdba

SQL> show user
USER is “SYS”

SQL> alter user sys identified by manager;

User altered.

 Completed:

Parallella: booting up parabuntu

https://www.parallella.org/

https://www.parallella.org/wp-content/uploads/2014/11/parallella-board-22-609×400.jpg

https://www.parallella.org/wp-content/uploads/2014/11/P16000-01-A1_1024x10241-609×400.jpg

And manual:

https://www.parallella.org/docs/parallella_manual.pdf

Images ready for flashing to sdcard:

https://github.com/parallella/parabuntu/releases

Installing on the SD card (using “dd” command) and letting it run (output is captured in the UART through usb2serial ftdi cable):

The bootup log is here:

https://gist.github.com/tthtlc/c7e267d7fbf95d3d366146233b28554f

First install “openssh-server” on the device instead:

apt-get update

apt-get install openssh-server

And next is to plugin the network UTP cable into the RJ45 port and start downloading examples.

Downloading examples to try:

(https://www.parallella.org/2016/01/21/creating-an-fpga-accelerator-in-15-minutes/)

The following are needed:

apt-get install iverilog

apt-get install gtkwave

git clone https://github.com/parallella/oh

Setting up env:

source setenv.sh

and then running example “./run.sh accelerator”:

Another example source:

git clone https://github.com/parallella/parallella-examples.git
cat /proc/cpuinfo
 processor : 0
 model name : ARMv7 Processor rev 0 (v7l)
 BogoMIPS : 1332.01
 Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpd32
 CPU implementer : 0x41
 CPU architecture: 7
 CPU variant : 0x3
 CPU part : 0xc09
 CPU revision : 0

processor : 1
 model name : ARMv7 Processor rev 0 (v7l)
 BogoMIPS : 1332.01
 Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpd32
 CPU implementer : 0x41
 CPU architecture: 7
 CPU variant : 0x3
 CPU part : 0xc09
 CPU revision : 0

Hardware : Xilinx Zynq Platform
 Revision : 0003
 Serial : 0000000000000000

Accessing other CPUs will require some custom programming.

References:

https://www.parallella.org/2015/04/05/parallella-chronicles-part-six-moving-multiple-bytes-simply/

Kernel source code static analysis with clang: lots of false positive

Clicked the above to see the details (below):

Steps in compiling Linux kernel with LLVM scan-build/scan-view:

1. change the "Makefile" – all "gcc" should be replaced by "clang", and similarly for "g++" to "clang++".
2. copy .config from somewhere, (eg, Ubuntu) and "make oldconfig" to autogenerate the .config file.

3. then "make kernel" to make sure compilation completes fine.

4. then "make clean" and "scan-build make kernel" to building using clang.

5. view the output:

scan-view –allow-all-hosts –no-browser –debug /tmp/scan-build-2018-03-21-001413-5298-1

Just focusing on the memory leak:

So LLVM knows alloc_and_copy_xxx() allocate memory resources.

now how is the conclusion of leakage at 27 achieved?

since memory is always freed as the last line indicated, no leakage is possible.

So the reason is because free_ftrace_hash() is not associated with free() of memory as allocated earlier.

Looking at next one:

Similarly, kfree() is not known to do freeing of memory resources.

And the following is clearly wrong too:

(kfree() is deallocator).

References:

https://clang-analyzer.llvm.org/

https://clang-analyzer.llvm.org/scan-build.html

https://clang-analyzer.llvm.org/

http://btorpey.github.io/blog/2015/04/27/static-analysis-with-clang/

Vickblöm

Research scattered with thoughts, ideas, and dreams

Penetration Testing Lab

Offensive Techniques & Methodologies

Astr0baby's not so random thoughts _____ rand() % 100;

@astr0baby on Twitter for fresh randomness

The Data Explorer

playing around with open data to learn some cool stuff about data analysis and the world

Conorsblog

Data | ML | NLP | Python | R

quyv

Just a thought

IFT6266 - H2017 Deep Learning

A Graduate Course Offered at Université de Montréal

Deep Learning IFT6266-H2017 UdeM

Philippe Paradis - My solutions to the image inpainting problem

IFT6266 – H2017 DEEP LEARNING

Pulkit's thoughts on the course project

Thomas Dinsmore's Blog

No man but a blockhead ever wrote except for money -- Samuel Johnson

the morning paper

a random walk through Computer Science research, by Adrian Colyer

The Spectator

Shakir's Machine Learning Blog