Oracle Install

To learn JDBC, you need to install a relational database on your system. Let's install Oracle 11g XE. --XE stands for Express Edition--

License Terms for Oracle Database Express Edition
https://www.oracle.com/downloads/licenses/database-11g-express-license.html

How to install Oracle 11g XE on Windows

Visit https://www.oracle.com/database/technologies/xe-prior-releases.html and download Oracle Database 11gR2 Express Edition for your Windows. If you are not a member of the Oracle website, you must register and log in to download the Oracle 11g XE.

Windows is an Oracle supported operating system, So you can install Oracle easily.
Unzip the downloaded file.
Run setup.exe to run the installation wizard.
Continue clicking the Next button to complete the installation.

How to install Oracle 11g XE on Ubuntu

Ubuntu is not a Linux distribution officially supported by Oracle.

Oracle Database XE Requirements: Operating system
  • Oracle Enterprise Linux 4 Update 7
  • Oracle Enterprise Linux 5 Update 2
  • Red Hat Enterprise Linux 4 Update 7
  • Red Hat Enterprise Linux 5 Update 2
  • SUSE Linux Enterprise Server 10 SP2
  • SUSE Linux Enterprise Server 11
https://docs.oracle.com/cd/E17781_01/install.112/e18802/toc.htm#XEINL103

With a few tricks, you can install Oracle 11g XE on Ubuntu.
Origin: http://meandmyubuntulinux.blogspot.kr/2012/05/installing-oracle-11g-r2-express.html

Visit https://www.oracle.com/database/technologies/xe-prior-releases.html.
For 64-bit systems, choose Oracle Database Express Edition 11g Release 2 for Linux x64.
You need to log in to download the file. --Sign up if you are not a member of the Oracle website-- When you log in to the site, the download begins.
After downloading, go to the directory where the file exists and execute the following command.

unzip oracle-xe-11.2.0-1.0.x86_64.rpm.zip
sudo apt install alien libaio1 unixodbc
cd Disk1
sudo alien --scripts -d oracle-xe-11.2.0-1.0.x86_64.rpm

Create a /sbin/chkconfig file.

sudo nano /sbin/chkconfig

Copy and Paste the following into the file.

#!/bin/bash
# Oracle 11gR2 XE installer chkconfig hack for Ubuntu
file=/etc/init.d/oracle-xe
if [[ ! `tail -n1 $file | grep INIT` ]]; then
echo >> $file
echo '### BEGIN INIT INFO' >> $file
echo '# Provides: OracleXE' >> $file
echo '# Required-Start: $remote_fs $syslog' >> $file
echo '# Required-Stop: $remote_fs $syslog' >> $file
echo '# Default-Start: 2 3 4 5' >> $file
echo '# Default-Stop: 0 1 6' >> $file
echo '# Short-Description: Oracle 11g Express Edition' >> $file
echo '### END INIT INFO' >> $file
fi
update-rc.d oracle-xe defaults 80 01

Save above file and provide appropriate execute privilege.

sudo chmod 755 /sbin/chkconfig

Set the Kernel parameters.

sudo nano /etc/sysctl.d/60-oracle.conf

Copy the following. Paste it into the file.

# Oracle 11g XE kernel parameters  
fs.file-max=6815744  
net.ipv4.ip_local_port_range=9000 65000  
kernel.sem=250 32000 100 128 
kernel.shmmax=536870912

Check the swap memory.

free -m
             total       used       free     shared    buffers     cached
Mem:          3942       3809        133        947         50       1571
-/+ buffers/cache:       2186       1756
Swap:         4083        378       3705

Unlike the above, if Swap does not exceed 4000, do the following.

sudo ln -s /usr/bin/awk /bin/awk
sudo mkdir /var/lock/subsys
sudo touch /var/lock/subsys/listener

Verify the kernel parameters.

sudo cat /etc/sysctl.d/60-oracle.conf

Load kernel parameters

sudo service procps restart

Verify.
(In my case it came out differently from the set value, but I was able to complete the installation)

sudo sysctl -q fs.file-max

Go to the Disk1 directory and run following commands:

sudo dpkg --install oracle-xe_11.2.0-2_amd64.deb
sudo /etc/init.d/oracle-xe configure
  • Specify the HTTP port that will be used for Oracle Application Express: Set a value other than 8080 like 8989
  • Specify a port the database listener: (just hit Enter)
  • Set passwords for administrator accounts SYS and SYSTEM: Password for Oracle administrators, you specified
  • Do you want Oracle Database 11g Express Edition to be started on boot: (just hit Enter)
Oracle Database 11g Express Edition Configuration
-------------------------------------------------
This will configure on-boot properties of Oracle Database 11g Express 
Edition.  The following questions will determine whether the database 
should be starting upon system boot, the ports it will use, and 
the passwords that will be used for database accounts.  
Press Enter to accept the defaults. 
Ctrl-C will abort.

Specify the HTTP port that will be used 
	for Oracle Application Express [8080]:8989

Specify a port that will be used for the database listener [1521]:

Specify a password to be used for database accounts.
Note that the same password will be used for SYS and SYSTEM.
Oracle recommends the use of different passwords 
for each database account.
This can be done after 
initial configuration: **********
Confirm the password: **********

Do you want Oracle Database 11g Express Edition to be started 
on boot (y/n) [y]:

Starting Oracle Net Listener...Done
Configuring database...Done
Starting Oracle Database 11g Express Edition instance...Done
Installation completed successfully.

Set up the environmental variables.

nano ~/.bashrc

Add following lines to your .bashrc:

export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
export ORACLE_SID=XE
export NLS_LANG=`$ORACLE_HOME/bin/nls_lang.sh`
export ORACLE_BASE=/u01/app/oracle
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export PATH=$ORACLE_HOME/bin:$PATH

Execute the following command to load the changes:

source ~/.bashrc

Start the Oracle.

sudo service oracle-xe start