GithubHelp home page GithubHelp logo

nanxiao / docker-oracle12c Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bofm/docker-oracle12c

0.0 3.0 0.0 36 KB

Docker image for Oracle Database 12c

License: MIT License

Makefile 39.15% Shell 60.85%

docker-oracle12c's Introduction

Goals

  • Provide an easy way to build a lightweight Docker image for Oracle Database.
  • Just run a database and skip the complexity of installing software, creating and configuring database.

Features

  • docker run creates and starts up a new database or the existing database, if it is already created.
  • docker logs shows all the logs prefixed with log source (in the style of syslog).
  • Uses trap to handle signals and shutdown gracefully.
  • Data and logs go to /data, so that -v /data could be used.
  • Mounts 50% of total memory to /dev/shm as shared memory. Oracle instance uses 40% of total memory. Can be changed in entrypoint.sh and create_database.sh.
  • rlwrap can be installed by running bash /tmp/install/install_rlwrap.sh (+ 50 MB on disk).

Build

Optional: if you are using Vagrant, you can use this Vagrantfile for your build environment.

  1. download linuxamd64_12102_database_1of2.zip and linuxamd64_12102_database_2of2.zip from oracle.com and extract the archives to current directory.
  2. Execute the following lines in bash and wait ~15 minutes:
git clone https://github.com/bofm/docker-oracle12c.git
cd docker-oracle12c
make all

Usage

Note: In the following examples oracle_database is the name of the container.

  • Create or run database and listener

    • Daemon mode

      # Create and start
      docker run -d --privileged --name oracle_database -p 1521:1521 -v /data bofm/oracle12c
      # Stop
      docker stop -t 120 oracle_database
      # Start again
      docker start oracle_database

      Important: Always stop with -t, otherwise Docker will kill the database instance, if it doesn't shut down in 10 seconds.

    • Foreground mode

      # Start
      docker run -it --privileged --name oracle_database -p 1521:1521 -v /data bofm/oracle12c
      # `ctrl+c` (SIGINT) to stop
  • Create a gzipped tar archive suitable for docker load (an archive of the image with a created database and without volumes)

    It is recommended to use large (>=20GB, the default is 10GB) Docker base volume size, for which Vagrant with Vagrantfile can be used.

    # Build everything and save the created image to a file.
    #   This will echo something like this:
    #     Image saved to: /some/path/docker_img_oracle_database_created_YYYY-MM-DD.tgz
    make all docker-save
    
    # The saved image can be loaded from the file
    # The image will be loaded with tag bofm/oracle12c:created
    docker load < docker_img_oracle_database_created_YYYY-MM-DD.tgz
    
    # Run the image in the new container
    # Daemon
    docker run -d --privileged --name oracle_database -p 1521:1521 bofm/oracle12c:created
    # Foreground
    docker run -it --privileged --name oracle_database -p 1521:1521 bofm/oracle12c:created
  • Logs

    # Check all the logs in one place
    docker logs oracle_database
    
    # Check alert log
    docker logs oracle_database | grep alertlog:
    
    # Check listener log
    docker logs oracle_database | grep listener:
  • SQL*Plus, RMAN or any other program

    # Bash
    # as root
    docker exec -it oracle_database bash
    # as oracle
    docker exec -it oracle_database gosu oracle bash
    
    # Run sqlplus in the running container
    docker exec -it oracle_database gosu oracle sqlplus / as sysdba
    
    # Run rman in the running container
    docker exec -it oracle_database gosu oracle rman target /
    
    # Run sqlplus in a separate container and
    # connect to the database in the linked container
    docker run -it --rm --link oracle_database:oradb bofm/oracle12c sqlplus sys/sys@oradb/ORCL as sysdba
  • Start listener only (not sure if anybody needs it :) )

    docker run -d --name listener -p 1521:1521 bofm/oracle12c listener
    # Or link it to the running container
    docker run -d --name listener -p 1521:1521 --link <database_container> bofm/oracle12c listener

Limitations and Bugs

  • --privileged option is required to mount /dev/shm to use Oracle's automatic memory management.
  • Database options and sample schemas installation through DBCA is a mystery. In this repo dbca is run with -sampleSchema true and db_template.dbt contains this line <option name="SAMPLE_SCHEMA" value="true"/>, but nothing happens, the database is always created without sample schemas. Well, that's Oracle Database after 30+ years of development.

License

TODO

  • use spfile
  • EM DBconsole
  • Archivelog mode option?
  • syslog-ng or rsyslog, maybe?

docker-oracle12c's People

Contributors

bofm avatar nanxiao avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.