How to install and start Oracle Database Express Edition (XE) 18c on Fedora Linux with SQL-Developer IDE

4.3k views Asked by At

I have put together a comprehensive guide to installing and starting Oracle Database Express Edition on Fedora 33 Linux. I had to cobble this together from numerous sources, and it works. It's not just the installation, it's also getting the database to start with the listener after installation when the machine is rebooted, how to setup a non-system database user, and how to add a connection. I hope this guide is useful to whoever comes across it. There are precious few working guides for Fedora 33 Oracle DB XE 18c and SQLDeveloper setup. Here it is:

2

There are 2 answers

0
Nicholas Stommel On

INSTALLATION INSTRUCTIONS:

First install Fedora 33 Workstation Edition from a bootable key (to dual-boot, just leave an empty partition you want the OS to reside (recommend shrink space from Disk Management in Windows 10) and select"Automatic Partitioning" in the Fedora installer.

Install Oracle Database 18c Express Edition:

sudo dnf -y install http://mirror.centos.org/centos/7/os/x86_64/Packages/compat-libcap1-1.10-7.el7.x86_64.rpm

sudo dnf -y install http://mirror.centos.org/centos/7/os/x86_64/Packages/compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm

dnf -y install libnsl

curl -o oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm -L https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm

dnf -y install oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm

curl -o oracle-database-xe-18c-1.0-1.x86_64.rpm -L https://download.oracle.com/otn-pub/otn_software/db-express/oracle-database-xe-18c-1.0-1.x86_64.rpm

sudo dnf -y install oracle-database-xe-18c-1.0-1.x86_64.rpm

Configure the database by logging in as root then running:

sudo su
/etc/init.d/oracle-xe-18c

At the prompt, specify the same password for the SYS, SYSTEM, and PDBADMIN accounts. Include no special characters and do not place a number at the beginning of the password.

Install Java JDK11:

sudo dnf -y install java-11-openjdk-devel java-11-openjdk-jmods java-11-openjdk-src

Add the following lines to the bottom of the home user's .bashrc:

# User specific aliases and functions
export JAVA_HOME=$(dirname $(dirname $(readlink $(readlink $(which javac)))))
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/opt/oracle/product/18c/dbhomeXE
export ORACLE_SID=XE
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib

and use source .bashrc

Login as oracle user using:

sudo su oracle

Add the following to the end of oracle user's .bashrc:

# User specific aliases and functions
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/opt/oracle/product/18c/dbhomeXE
export ORACLE_SID=XE
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib

and type source ~/.bashrc

Exit and go to the following site and download sql-developer: https://www.oracle.com/tools/downloads/sqldev-downloads.html

Install the .rpm and run the setup script:

sudo dnf -y install sqldeveloper-20.4.1.407.0006-20.4.1-407.0006.noarch.rpm
cd /opt/sqldeveloper/
./sqldeveloper.sh

For HiDPI displays, append to /opt/oracle-sqldeveloper/sqldeveloper/bin/sqldeveloper.conf the following: AddVMOption -Dsun.java2d.uiScale=2

How to add a non-system database user (so you don't have to see system tables): In a terminal type: sqlplus sys as sysdba

Enter the lines:

SQL> alter session set "_ORACLE_SCRIPT"=true;

Create a local user called whatever you want. Type the password for the user in the following line after "identified by"

SQL> create user usernamehere identified by passwordhere;

Grant your user admin privileges:

SQL> grant all privileges to usernamehere;

Then exit the command prompt:

SQL> exit;

Now you can connect to your local database in the Oracle SQL Developer IDE. Search for sqldeveloper in the system shell menu. It should start up fine, now you want to add a connection to your local machine database. On the top left side of the IDE window, you should see a label called "Connections" with a green plus sign. Click on the plus sign and you will get a connection prompt. Under "Name" enter a suitable name for your local database. I called mine "LocalDatabase". Avoid using spaces or special characters besides the underscore when naming your database. For "Username" and "Password" enter the username and password you created for your non-system account in the SQL Plus command prompt. Check the "Save Password" box. Keep the Hostname (localhost), Port (1521), and SID (xe) the default values to connect to your local database. At the bottom of the Connection window, click "Test" and it should say Status: Success. Then click the "Save" button and you should see your connection added among those in the Connections window. Click "Connect" and the window will close and you will be successfully connected to the database on your local machine. Congratulations, now you can use Oracle SQL Plus on your own computer!

Restart your machine and follow the instructions at the below for reliably reconnecting to your database.

OPERATION INSTRUCTIONS (AFTER INSTALLATION):

If you have done installation steps already: First you want to start the database service. From your home user account in a terminal, type

sqlplus sys as sysdba

then enter your database password you assigned on installation. At the SQL prompt, enter

SQL> startup

Wait for the database to start, then exit with

SQL> exit

then login as oracle user:

sudo su oracle

And run:

lsnrctl start

Then for the status: lsnrctl status

Exit to home user then open sqldeveloper and connect successfully to your locally installed database!

That's it, I hope someone finds this useful! :)

2
iaskakho On

You cant create a user on the main db as you have it, you have to go into the xepdba1 in order to create a user / schema and then connect there to create tables and insert rows.

I had to install it twice because I had my ENV variables configured for previous software installed caused a mess.

Removed it and installed again, with correct ORACLE_HOME defined.