Skip to content

Instantly share code, notes, and snippets.

@573
Last active September 14, 2015 12:24
Show Gist options
  • Save 573/32c5a47db8f4f908eeb0 to your computer and use it in GitHub Desktop.
Save 573/32c5a47db8f4f908eeb0 to your computer and use it in GitHub Desktop.
Howto for https://github.com/yasushiyy/vagrant-docker-oracle12c (after the oracle db is installed)

After following the guidelines in the README until the point before "dbca -silent -createDatabase -responseFile /vagrant/dbca.rsp" (in case you already installed the instance to you might revert it with dbca -silent -deleteDatabase orcl) you might ask how to persistently store all the changes to the oracle container then. For the most of you those familiar with docker this should be no problem at all. For the rest of us let me explain very basically: You can stop the oracle container and then commit the changes in the container to a new image. After you restarted the vagrant machine and having run a new container with the respective image you will have to start oracle again. Probably all that can be automated but that's really out of the scope of that gist, so here is very basic chain of manual commands implementing the former pattern:

# first let's get some info about the running/stopped container(s)
sudo docker ps -a
# let's say elated_wright is the name of the container with oracle installed, now we eventually stop that one
sudo docker stop elated_wright
# commit the changes to a new image hence the ":v1" suffix
sudo docker commit -m "oracle 12 installed w/o instance" -a "Your (the authors) Name" elated_wright yasushiyy/vagrant-docker-oracle12c:oracle
# then run a new container with this new image and an additional voulme to install the instance to (assume vagrant share /oradata pointing to some folder at vagrant host here and put through to /opt/oradata inside docker guest here)
sudo docker run --privileged -h db12c -p 11521:1521 -t -i -v /oradata:/opt/oradata -v /vagrant:/vagrant yasushiyy/vagrant-docker-oracle12c:oracle /bin/bash
# therein to prepare for running the oracle db
su - oracle
# you'll get an IO error w/o a listener so you'll need to:
/opt/oracle/product/12.1.0.2/dbhome_1/bin/lsnrctl start LISTENER
dbca -silent -createDatabase -responseFile /vagrant/dbca.rsp # this will also create a new folder orcl on the volume
sqlplus '/ as sysdba'

# finally on the sqlplus prompt type
startup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment