Skip to main content

Oracle Database 19c EE

Download the following software:

OS setup

Install Oracle Linux 7. Select Server with a GUI. or Minimal.

As the root user, configure the OS and create the directory structure.

yum install -y oracle-database-preinstall-19c wget
mkdir -p /u01/app/oracle/product/19.0.0/dbhome_1
mkdir -p /u02/oradata
chown -R oracle:oinstall /u01 /u02
chmod -R 775 /u01 /u02

Database installation.

As the oracle user:

Make a scripts folder

mkdir /home/oracle/scripts

Create an environment script. This will hold all of the settings.

cat > /home/oracle/scripts/setEnv.sh <<EOF
# Oracle Settings
export TMP=/tmp
export TMPDIR=\$TMP
export ORACLE_HOSTNAME=ora19c.core.example.com
export ORACLE_UNQNAME=cdb1
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=\$ORACLE_BASE/product/19.0.0/dbhome_1
export ORA_INVENTORY=/u01/app/oraInventory
export ORACLE_SID=cdb1
export PDB_NAME=pdb1
export DATA_DIR=/u02/oradata
export PATH=/usr/sbin:/usr/local/bin:\$PATH
export PATH=\$ORACLE_HOME/bin:\$PATH
export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=\$ORACLE_HOME/jlib:\$ORACLE_HOME/rdbms/jlib
EOF

Add the contents of setEnv.sh to Oracle's .bash_profile.

echo ". /home/oracle/scripts/setEnv.sh" >> /home/oracle/.bash_profile

Create a start script.

cat > /home/oracle/scripts/start_all.sh <<EOF
#!/bin/bash
. /home/oracle/scripts/setEnv.sh

export ORAENV_ASK=NO
. oraenv
export ORAENV_ASK=YES

dbstart \$ORACLE_HOME
EOF

Create a stop script.

cat > /home/oracle/scripts/stop_all.sh <<EOF
#!/bin/bash
. /home/oracle/scripts/setEnv.sh

export ORAENV_ASK=NO
. oraenv
export ORAENV_ASK=YES

dbshut \$ORACLE_HOME
EOF

Set the owner and folder and execute on the scripts.

chown -R oracle:oinstall /home/oracle/scripts
chmod u+x /home/oracle/scripts/*.sh

Load the environment.

source /home/oracle/.bash_profile

Unzip the installer.

cd $ORACLE_HOME
unzip -oq /tmp/LINUX.X64_193000_db_home.zip

Run the installer.

./runInstaller -ignorePrereq -waitforcompletion -silent                        \
    -responseFile ${ORACLE_HOME}/install/response/db_install.rsp               \
    oracle.install.option=INSTALL_DB_SWONLY                                    \
    ORACLE_HOSTNAME=${ORACLE_HOSTNAME}                                         \
    UNIX_GROUP_NAME=oinstall                                                   \
    INVENTORY_LOCATION=${ORA_INVENTORY}                                        \
    SELECTED_LANGUAGES=en,en_US                                                \
    ORACLE_HOME=${ORACLE_HOME}                                                 \
    ORACLE_BASE=${ORACLE_BASE}                                                 \
    oracle.install.db.InstallEdition=EE                                        \
    oracle.install.db.OSDBA_GROUP=dba                                          \
    oracle.install.db.OSBACKUPDBA_GROUP=dba                                    \
    oracle.install.db.OSDGDBA_GROUP=dba                                        \
    oracle.install.db.OSKMDBA_GROUP=dba                                        \
    oracle.install.db.OSRACDBA_GROUP=dba                                       \
    SECURITY_UPDATES_VIA_MYORACLESUPPORT=false                                 \
    DECLINE_SECURITY_UPDATES=true

As a root user, execute the following:

/u01/app/oraInventory/orainstRoot.sh
/u01/app/oracle/product/19.0.0/dbhome_1/root.sh

As the oracle user:

Start the listener

lsnrctl start

Create the first database.

dbca -silent -createDatabase                                                   \
     -templateName General_Purpose.dbc                                         \
     -gdbname ${ORACLE_SID} -sid  ${ORACLE_SID} -responseFile NO_VALUE         \
     -characterSet AL32UTF8                                                    \
     -sysPassword Som3bTt3rpwd                                                 \
     -systemPassword Som3bTt3rpwd                                              \
     -createAsContainerDatabase true                                           \
     -numberOfPDBs 1                                                           \
     -pdbName ${PDB_NAME}                                                      \
     -pdbAdminPassword Som3bTt3rpwd                                            \
     -databaseType MULTIPURPOSE                                                \
     -automaticMemoryManagement false                                          \
     -totalMemory 2000                                                         \
     -storageType FS                                                           \
     -datafileDestination "${DATA_DIR}"                                        \
     -redoLogFileSize 50                                                       \
     -emConfiguration NONE                                                     \
     -ignorePreReqs

Edit the "/etc/oratab" file setting the restart flag for each instance to 'Y'.
Example:

cdb1:/u01/app/oracle/product/19.0.0/db_1:Y

Enable Oracle Managed Files and make the PDB start when the instance starts

sqlplus / as sysdba <<EOF
alter system set db_create_file_dest='/u02/oradata';
alter pluggable database pdb1 save state;
exit;
EOF

APEX

As the oracle user:

Make the apex directory and unzip the apex files.

mkdir -p /home/oracle/apex
unzip /tmp/apex_20.*.zip -d /home/oracle
chown -R oracle:oinstall /home/oracle/apex
cd /home/oracle/apex

Create an ACL script. This will be needed later.

cat > apex_acl.sql << EOF
BEGIN
  BEGIN
    dbms_network_acl_admin.drop_acl(acl => 'all-network-PUBLIC.xml');
  EXCEPTION
    WHEN OTHERS THEN
      NULL;
  END;
  dbms_network_acl_admin.create_acl(acl         => 'all-network-PUBLIC.xml',
                                    description => 'Allow all network traffic',
                                    principal   => 'PUBLIC',
                                    is_grant    => TRUE,
                                    privilege   => 'connect');
  dbms_network_acl_admin.add_privilege(acl       => 'all-network-PUBLIC.xml',
                                       principal => 'PUBLIC',
                                       is_grant  => TRUE,
                                       privilege => 'resolve');
  dbms_network_acl_admin.assign_acl(acl  => 'all-network-PUBLIC.xml',
                                    host => '*');
END;
/
sho err
COMMIT;
/
EOF

Connect to the database

sqlplus /nolog

Change roles

CONN pdb1 AS SYSDBA
 alter session set container=PDB1;

Run the script to install a full development environment

@apexins.sql SYSAUX SYSAUX TEMP /i/

Create an instance administrator user and set their password

@apxchpwd.sql

Configure REST Data Services

@apex_rest_config.sql

Run the ACL setup script created earlier.

@apex_acl.sql

Unlock APEX users

ALTER USER APEX_PUBLIC_USER ACCOUNT UNLOCK;
ALTER USER APEX_PUBLIC_USER IDENTIFIED BY "Som3bTt3rpwd";
ALTER USER APEX_REST_PUBLIC_USER IDENTIFIED BY "Som3bTt3rpwd" ACCOUNT UNLOCK;
ALTER USER APEX_LISTENER IDENTIFIED BY "Som3bTt3rpwd" ACCOUNT UNLOCK;