├── .gitignore ├── LICENSE.txt ├── README.md ├── Vagrantfile ├── data-with-flyway ├── README.md ├── flyway-SAMPLE.properties ├── pom.xml └── src │ └── main │ └── resources │ └── database │ └── migrations │ ├── V1__Create_person_table.sql │ ├── V2__Add_people.sql │ └── V3__Ms_Bar_name_change.sql ├── flyway.sh ├── manifests └── base.pp ├── modules └── oracle │ ├── files │ ├── 60-oracle.conf │ ├── S01shm_load │ ├── chkconfig │ ├── oracle-env.sh │ └── xe.rsp │ └── manifests │ └── init.pp └── oracle-jdbc ├── README.md └── pom.xml /.gitignore: -------------------------------------------------------------------------------- 1 | .project 2 | .vagrant 3 | 4 | flyway.properties 5 | 6 | modules/oracle/files/oracle-xe-11.2.0-1.0.x86_64.rpm.zip 7 | modules/java 8 | modules/maven 9 | modules/stdlib 10 | modules/wget 11 | 12 | oracle-jdbc/ojdbc6.jar 13 | 14 | target -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2012-2014 Hilverd Reker 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Oracle XE 11g on Ubuntu 12.04 using Vagrant 2 | 3 | This project enables you to install Oracle 11g XE in a virtual machine running Ubuntu 12.04, using 4 | [Vagrant] and [Puppet]. 5 | 6 | ## Acknowledgements 7 | 8 | This project was created based on the information in 9 | [Installing Oracle 11g R2 Express Edition on Ubuntu 64-bit] by Manish Raj, and the GitHub repository 10 | [vagrant-oracle-xe] by Stefan Glase. The former explains how to install Oracle XE 11g on Ubuntu 11 | 12.04, without explicitly providing a Vagrant or provisioner configuration. The latter has the same 12 | purpose as this project but uses Ubuntu 11.10. 13 | 14 | Thanks to André Kelpe, Brandon Gresham, Charles Walker, Chris Thompson, Jeff Caddel, Joe FitzGerald, 15 | Justin Harringa, Mark Crossfield, Matthew Buckett, Richard Kolb, and Steven Hsu for various 16 | contributions. 17 | 18 | ## Requirements 19 | 20 | * You need to have [Vagrant] installed. 21 | * The host machine probably needs at least 4 GB of RAM (I have only tested 8 GB of RAM). 22 | * As Oracle 11g XE is only available for 64-bit machines at the moment, the host machine needs to 23 | have a 64-bit architecture. 24 | * You may need to [enable virtualization] manually. 25 | 26 | ## Installation 27 | 28 | * Check out this project: 29 | 30 | git clone https://github.com/hilverd/vagrant-ubuntu-oracle-xe.git 31 | 32 | * Install [vbguest]: 33 | 34 | vagrant plugin install vagrant-vbguest 35 | 36 | * Download [Oracle Database 11g Express Edition] for Linux x64. Place the file 37 | `oracle-xe-11.2.0-1.0.x86_64.rpm.zip` in the directory `modules/oracle/files` of this 38 | project. (Alternatively, you could keep the zip file in some other location and make a hard link 39 | to it from `modules/oracle/files`.) 40 | 41 | * *Optional:* To get [Flyway](http://flywaydb.org/) integration, download `ojdbc6.jar` for JDK 1.6 from 42 | [Oracle Database 11g Release 2 11.2.0.4 JDBC Drivers](http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-112010-090769.html), 43 | and place it in the directory `oracle-jdbc` of this project. 44 | 45 | Migrations are in `data-with-flyway/src/main/resources/database/migrations`. 46 | See `data-with-flyway/README.md` for more instructions. 47 | Many thanks to [Nicholas Blair](https://github.com/nblair) for contributing this feature. 48 | 49 | * Run `vagrant up` from the base directory of this project. The first time this will take a while -- up to 30 minutes on 50 | my machine. Please note that building the VM involves downloading an Ubuntu 12.04 51 | [base box](http://docs.vagrantup.com/v2/boxes.html) which is 323MB in size. 52 | 53 | These steps are also shown in an [asciicast] made by Daekwon Kang: 54 | 55 | [![asciicast](https://asciinema.org/a/8438.png)](https://asciinema.org/a/8438) 56 | 57 | ## Connecting 58 | 59 | You should now be able to 60 | [connect](http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html) to 61 | the new database at `localhost:1521/XE` as `system` with password `manager`. For example, if you 62 | have `sqlplus` installed on the host machine you can do 63 | 64 | sqlplus system/manager@//localhost:1521/XE 65 | 66 | To make sqlplus behave like other tools (history, arrow keys etc.) you can do this: 67 | 68 | rlwrap sqlplus system/manager@//localhost:1521/XE 69 | 70 | You might need to add an entry to your `tnsnames.ora` file first: 71 | 72 | XE = 73 | (DESCRIPTION = 74 | (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)) 75 | (CONNECT_DATA = 76 | (SERVER = DEDICATED) 77 | (SERVICE_NAME = XE) 78 | ) 79 | ) 80 | 81 | ## Troubleshooting 82 | 83 | ### Errors when Unzipping 84 | 85 | If you get an error containing `/usr/bin/unzip -o oracle-xe-11.2.0-1.0.x86_64.rpm.zip returned 2` during `vagrant up`, then the zip file you have downloaded is probably corrupted. This can be fixed by re-downloading, replacing the corrupted file, and running `vagrant reload --provision`. 86 | 87 | ### Memory 88 | 89 | It is important to assign enough memory to the virtual machine, otherwise you will get an error 90 | 91 | ORA-00845: MEMORY_TARGET not supported on this system 92 | 93 | during the configuration stage. In the `Vagrantfile` 512 MB is assigned. Lower values may also work, 94 | as long as (I believe) 2 GB of virtual memory is available for Oracle, swap is included in this 95 | calculation. 96 | 97 | ### Concurrent Connections 98 | 99 | If you want to raise the limit of the number of concurrent connections, say to 200, then according 100 | to [How many connections can Oracle Express Edition (XE) handle?] you should run 101 | 102 | ALTER SYSTEM SET processes=200 scope=spfile 103 | 104 | and restart the database. 105 | 106 | ## Alternatives 107 | 108 | You may also want to consider a Docker-based solution such as 109 | [docker-oracle-xe-11g](https://github.com/alexei-led/docker-oracle-xe-11g). 110 | 111 | [Vagrant]: http://www.vagrantup.com/ 112 | 113 | [Puppet]: http://puppetlabs.com/ 114 | 115 | [Oracle Database 11g Express Edition]: https://www.oracle.com/database/technologies/xe-prior-releases.html 116 | 117 | [Oracle Database 11g EE Documentation]: http://docs.oracle.com/cd/E17781_01/index.htm 118 | 119 | [Installing Oracle 11g R2 Express Edition on Ubuntu 64-bit]: http://meandmyubuntulinux.blogspot.co.uk/2012/05/installing-oracle-11g-r2-express.html 120 | 121 | [vagrant-oracle-xe]: https://github.com/codescape/vagrant-oracle-xe 122 | 123 | [vbguest]: https://github.com/dotless-de/vagrant-vbguest 124 | 125 | [asciicast]: https://asciinema.org/a/8438 126 | 127 | [How many connections can Oracle Express Edition (XE) handle?]: http://stackoverflow.com/questions/906541/how-many-connections-can-oracle-express-edition-xe-handle 128 | 129 | [enable virtualization]: http://www.sysprobs.com/disable-enable-virtualization-technology-bios 130 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | Vagrant.configure("2") do |config| 5 | # All Vagrant configuration is done here. The most common configuration 6 | # options are documented and commented below. For a complete reference, 7 | # please see the online documentation at vagrantup.com. 8 | 9 | config.vm.box = "hashicorp/precise64" 10 | config.vm.box_url = "https://vagrantcloud.com/hashicorp/precise64" 11 | config.vm.hostname = "oracle" 12 | 13 | # share this project under /home/vagrant/vagrant-ubuntu-oracle-xe 14 | config.vm.synced_folder ".", "/home/vagrant/vagrant-ubuntu-oracle-xe", :mount_options => ["dmode=777","fmode=666"] 15 | 16 | # Forward Oracle port 17 | config.vm.network :forwarded_port, guest: 1521, host: 1521 18 | 19 | # Provider-specific configuration so you can fine-tune various backing 20 | # providers for Vagrant. These expose provider-specific options. 21 | config.vm.provider :virtualbox do |vb| 22 | # Use VBoxManage to customize the VM 23 | vb.customize ["modifyvm", :id, 24 | "--name", "oracle", 25 | # Oracle claims to need 512MB of memory available minimum 26 | "--memory", "512", 27 | # Enable DNS behind NAT 28 | "--natdnshostresolver1", "on"] 29 | end 30 | 31 | # This is just an example, adjust as needed 32 | config.vm.provision :shell, :inline => "echo \"America/New_York\" | sudo tee /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata" 33 | 34 | config.vbguest.auto_update = true 35 | 36 | $install_puppet_modules = <