Oracle Install

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

How to install Oracle 11g XE on Windows

Visit https://www.oracle.com/database/technologies/xe-prior-release-downloads.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 in the subdirectory Disk1 to run the installation wizard. Continue clicking the Next button to complete the installation. Be sure to remember the administrator password you entered during the installation process.

On Windows, you cannot change the port used by Oracle XDB during the Oracle installation process. After installation, change the port used by XDB as follows:

C:\Users> sqlplus
Enter user-name: system
Enter password:
Connected.

SQL> Exec DBMS_XDB.SETHTTPPORT(9090);

PL/SQL procedure successfully completed.

SQL>

How to install Oracle 11g XE on Ubuntu

Ubuntu is not a Linux distribution officially supported by Oracle.

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

Visit https://www.oracle.com/database/technologies/xe-prior-release-downloads.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 unixodbc
sudo apt install libaio1
sudo apt install libaio1 fails in Ubuntu 24.04
Ubuntu 24.04 does not support libaio1.
Install libaio-dev instead.
sudo apt install libaio-dev
Oracle 11g XE still expecting libaio.so.1, so create the following symbolic link:
sudo ln -s /usr/lib/x86_64-linux-gnu/libaio.so.1t64 /usr/lib/x86_64-linux-gnu/libaio.so.1
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 the 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 doesn't 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 the 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 9090
  • 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]:9090

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 the 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