Run SQLd360 in Docker Container
A few weeks ago, I needed to run SQLd360, but didn’t have access to the database server, and I was working from a Windows box. That combination is not the best. Normally, I would have used VirtualBox with a Linux OS and handled things from there. This time I decided to see what could be done with Docker.
In a few simple steps, I was up an running, so let’s get to it shall we?
Configure SQLd360 in Docker
- Download SQLd360 from the github repository. This .zip file will need to be on your local machine.
- Create the following Dockerfile in the same directory as the SQLd360-master.zip
ADD sqld* .
RUN yum -y install tar* gcc* gcc-c++ unzip zip openssh* libaio* make curl \
&& unzip sqld360*.zip \
&& yum clean all
Before building the image, take note that this Dockerfile uses the Oracle Database Instant Client from the Docker Store. You will need to create an account to access these images.
Build the Docker image
- Build the Docker image: docker build -t <username>/<image> .
Here is an example of what I did.
$ docker build -t dbaontap/sqld360 .
Docker will now build the image and install a number of packages and add and unzip the SQLd360-Master.zip file.
Deploy Docker image and run SQLd360
- Deploy the image to a container and run sh
- Connect to the database
- Run sqld360
$ docker run --name sqld360 -ti dbaontap/sqld360 /bin/sh
sh-4.2# cd sqld360-master
sh-4.2# sqlplus sys/<password>@<hostname or ip address>:1521/<sid> as sysdba
SQL*Plus: Release 22.214.171.124.0 Production on Sat Aug 26 03:43:39 2017
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Oracle Database 12c Enterprise Edition Release 126.96.36.199.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics, Real Application Testing
and Unified Auditing options
SQL> @sqld360.sql <sqlid> T
If SQLd360 disconnects right after this message it means the user executing it
owns a table called PLAN_TABLE that is not the Oracle seeded GTT plan table
owned by SYS (PLAN_TABLE$ table with a PUBLIC synonym PLAN_TABLE).
SQLd360 requires the Oracle seeded PLAN_TABLE, consider dropping the one in this schema.
PL/SQL procedure successfully completed.
From here, just let sqld360 run. You will see two errors at the end related to tkprof. This is because tkprof is trying to run from the database server and since we are on a remote machine, that file is not available to the Docker image.
Hopefully this will give you another option to run SQLd360.
Originally published at dbaonTap.