Installing OEM 13.4 with 19c PDB as repository DB
Tags: oracle, oem, tutorial, database
Published: 2021-01-30 11:06:58

With the dead of Adobe Flash Player, I decided it was a good time to get a new OEM system so I can test OEM without flash and test couple of things on it.

With this guide just wanted to make sure I have all the details in case I need to make a new installation in the near future.

I just followed these 2 fantastic [Oracle-Base](https://oracle-base.com/) articles guides:
[Oracle Enterprise Manager Cloud Control 13c Release 4 (13.4) Silent Installation on Oracle Linux 7](https://oracle-base.com/articles/13c/cloud-control-13cr4-silent-installation-on-oracle-linux-7)
[Oracle Database 19c Installation On Oracle Linux 7 (OL7)](https://oracle-base.com/articles/19c/oracle-db-19c-installation-on-oracle-linux-7)

I had an issue in the middle of the configuration Phase (my fault, I was doing something else in the KVM host and ended up restarting the OEM VM :( ) so I added the steps I followed if a clean up is needed after a problem during Installation/Configuration phases

The OEM VM is running in KVM with 15G RAM and 12 CPUs. The end result, without any plugins/templates or targets added, was consuming around 70G of space, so make sure you have plenty of space in your system if you want to try it out.

To be honest, if you just want to "try it out" and don't care too much about the steps needed to create it, I recommend to use the VirtualBox Template Oracle offers i edelivery (didn't try this specific version, but it was great for 13.2) 
[Oracle VM VirtualBox for Oracle Enterprise Manager Cloud Control 13c Release 4 (13.4.0.0.0)](https://www.oracle.com/enterprise-manager/downloads/vm-templates-13c-release4.html#u28s3:~:text=software-,Oracle%20VM%20VirtualBox,Note%3A%20This%20VBox%20image%20is%20strictly%20for%20test%20EM%20setup%20or%20proof%20of%20concept%20(POC)%2C%20this%20should%20not%20be%20used%20for%20EM%20production%20site%20setup.)


## Actions List
  * [Repository Database Installation](#Repository-Database-Installation)
  * [OEM Installation Phase](#OEM-Installation-Phase)
  * [OEM Configuration Phase](#OEM-Configuration-Phase)
  * [All components start](#All-components-start)
  * [Repository DB Cleanup](#Repository-DB-Cleanup)

## Repository Database Installation <a name="Repository-Database-Installation"></a> 

During this part, we will install the Database repository and create the oracle user environment as well as create nice start/stop all components scripts.
Like everything else, I was just using [Oracle-Base](https://oracle-base.com/) articles
```bash
[root@oem13 ~]$ yum install -y oracle-database-preinstall-19c
Loaded plugins: ulninfo
ol7_UEKR5                                                       | 2.5 kB  00:00:00
ol7_latest                                                      | 2.7 kB  00:00:00
(1/5): ol7_UEKR5/x86_64/updateinfo                              |  51 kB  00:00:00
(2/5): ol7_latest/x86_64/group                                  | 660 kB  00:00:00
(3/5): ol7_latest/x86_64/updateinfo                             | 3.1 MB  00:00:03
(4/5): ol7_UEKR5/x86_64/primary_db                              | 9.4 MB  00:00:04
(5/5): ol7_latest/x86_64/primary_db                             |  32 MB  00:00:05
Resolving Dependencies
--> Running transaction check
[....]
Complete!

[root@oem13 ~]$ yum update -y
Loaded plugins: ulninfo
Resolving Dependencies
--> Running transaction check
[....]

Replaced:
  iwl7265-firmware.noarch 999:22.0.7.0-999.1.el7

Complete!
[root@oem13 ~]$

[root@oem13 ~]$ passwd oracle
Changing password for user oracle.
New password:
BAD PASSWORD: The password fails the dictionary check - it is based on a dictionary word
Retype new password:
passwd: all authentication tokens updated successfully.

[root@oem13 ~]$ grep SELINUX /etc/selinux/config
# SELINUX= can take one of these three values:
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
SELINUXTYPE=targeted
[root@oem13 ~]$

[root@oem13 ~]$ systemctl stop firewalld
[root@oem13 ~]$ systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@oem13 ~]$

[root@oem13 ~]$ mkdir -p /u01/app/oracle/product/19.0.0/dbhome_1
[root@oem13 ~]$ mkdir -p /u02/oradata
[root@oem13 ~]$ chown -R oracle:oinstall /u01 /u02
[root@oem13 ~]$ chmod -R 775 /u01 /u02
[root@oem13 ~]$ su - oracle
[oracle@oem13 ~]$ mkdir /home/oracle/scripts/


[oracle@oem13 ~]$ cat ~/scripts/start_all.sh
#!/bin/bash
. /home/oracle/scripts/setEnv.sh

export ORAENV_ASK=NO
. oraenv
export ORAENV_ASK=YES

dbstart $ORACLE_HOME

$OMS_HOME/bin/emctl start oms

$AGENT_HOME/bin/emctl start agent
[oracle@oem13 ~]$ cat ~/scripts/stop_all.sh
#!/bin/bash
. /home/oracle/scripts/setEnv.sh

export ORAENV_ASK=NO
. oraenv
export ORAENV_ASK=YES

# Stop everything
$OMS_HOME/bin/emctl stop oms -all

$AGENT_HOME/bin/emctl stop agent

dbshut $ORACLE_HOME
[oracle@oem13 ~]$

[oracle@oem13 ~]$ chown -R oracle:oinstall /home/oracle/scripts
[oracle@oem13 ~]$ chmod u+x /home/oracle/scripts/*.sh
[oracle@oem13 ~]$


[oracle@oem13 ~]$ cat ~/scripts/setEnv.sh
# Oracle Settings
export TMP=/tmp
export TMPDIR=$TMP

export ORACLE_HOSTNAME=oem13
export ORACLE_UNQNAME=emcdb
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=emcdb
export PDB_NAME=emrep
export DATA_DIR=/u02/oradata

export OMS_HOME=/u01/app/oracle/middleware
export AGENT_HOME=/u01/app/oracle/agent/agent_inst

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
[oracle@oem13 ~]$

[oracle@oem13 ~]$ echo ". /home/oracle/scripts/setEnv.sh" >> /home/oracle/.bash_profile
[oracle@oem13 ~]$ source /home/oracle/.bash_profile
[oracle@oem13 ~]$ cd /u01/app/oracle/product/19.0.0/dbhome_1
[oracle@oem13 dbhome_1]$ unzip -oq /tmp/LINUX.X64_193000_db_home.zip


[oracle@oem13 dbhome_1]$ export ORACLE_HOSTNAME=${HOSTNAME}
[oracle@oem13 dbhome_1]$ export ORACLE_BASE=/u01/app/oracle
[oracle@oem13 dbhome_1]$ export ORACLE_HOME=${ORACLE_BASE}/product/19.0.0/dbhome_1
[oracle@oem13 dbhome_1]$ export ORA_INVENTORY=/u01/app/oraInventory
[oracle@oem13 dbhome_1]$ ${ORACLE_HOME}/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_GB                                                \
>     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
Launching Oracle Database Setup Wizard...
[....]
You can find the log of this install session at:
 /tmp/InstallActions2021-01-20_08-23-07PM/installActions2021-01-20_08-23-07PM.log

As a root user, execute the following script(s):
        1. /u01/app/oraInventory/orainstRoot.sh
        2. /u01/app/oracle/product/19.0.0/dbhome_1/root.sh
[....]        
[oracle@oem13 dbhome_1]$

[root@oem13 ~]$ /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
[root@oem13 ~]$  /u01/app/oracle/product/19.0.0/dbhome_1/root.sh
Check /u01/app/oracle/product/19.0.0/dbhome_1/install/root_oem13_2021-01-20_20-58-55-213552315.log for the output of root script
[root@oem13 ~]$

[root@oem13 ~]$ yum install -y binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33.i686 gcc gcc-c++ glibc glibc.i686 glibc-devel libaio libaio-devel libgcc libgcc.i686 libstdc++ libstdc++.i686 libstdc++-devel dejavu-serif-fonts ksh make sysstat numactl numactl-devel motif motif-devel redhat-lsb redhat-lsb-core openssl
Loaded plugins: ulninfo
Package binutils-2.27-44.base.0.3.el7.x86_64 already installed and latest version
[....]
Complete!
[root@oem13 ~]$

[oracle@oem13 ~]$ export ORACLE_SID=emcdb
[oracle@oem13 ~]$ export SYS_PASSWORD="Welcome1"
[oracle@oem13 ~]$ export PDB_NAME="emrep"
[oracle@oem13 ~]$ export PDB_PASSWORD="Welcome1"
[oracle@oem13 ~]$ export DATA_DIR=/u02/oradata

[oracle@oem13 ~]$ lsnrctl start

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 20-JAN-2021 22:31:15

Copyright (c) 1991, 2019, Oracle.  All rights reserved.

Starting /u01/app/oracle/product/19.0.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Log messages written to /u01/app/oracle/diag/tnslsnr/oem13/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                20-JAN-2021 22:31:16
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/diag/tnslsnr/oem13/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle@oem13 ~]$


[oracle@oem13 ~]$
[oracle@oem13 ~]$ dbca -silent -createDatabase                                                 \
>   -templateName General_Purpose.dbc                                          \
>   -gdbname ${ORACLE_SID} -sid ${ORACLE_SID} -responseFile NO_VALUE           \
>   -characterSet AL32UTF8                                                     \
>   -sysPassword ${SYS_PASSWORD}                                               \
>   -systemPassword ${SYS_PASSWORD}                                            \
>   -createAsContainerDatabase true                                            \
>   -numberOfPDBs 1                                                            \
>   -pdbName ${PDB_NAME}                                                       \
>   -pdbAdminPassword ${PDB_PASSWORD}                                          \
>   -databaseType MULTIPURPOSE                                                 \
>   -memoryMgmtType auto_sga                                                   \
>   -totalMemory 2048                                                          \
>   -storageType FS                                                            \
>   -datafileDestination "${DATA_DIR}"                                         \
>   -redoLogFileSize 600                                                       \
>   -emConfiguration NONE                                                      \
>   -ignorePreReqs
Prepare for db operation
8% complete
[....]
100% complete
Database creation complete. For details check the logfiles at:
 /u01/app/oracle/cfgtoollogs/dbca/emcdb.
Database Information:
Global Database Name:emcdb
System Identifier(SID):emcdb
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/emcdb/emcdb.log" for further details.
[oracle@oem13 ~]$
```


```bash
[oracle@oem13 ~]$ sqlplus / as sysdba <<EOF
> alter system set db_create_file_dest='${DATA_DIR}';
> alter pluggable database ${PDB_NAME} save state;
>
> -- Recommended minimum settings.
> alter system set "_allow_insert_with_update_check"=true scope=both;
> alter system set session_cached_cursors=200 scope=spfile;
>
> -- Recommended: processes=600
> alter system set processes=600 scope=spfile;
>
> -- Recommended: pga_aggregate_target=1G
> alter system set pga_aggregate_target=450M scope=spfile;
>
> -- Recommended: sga_target=3G
> alter system set sga_target=3G scope=spfile;
> alter system set sga_max_size=3G scope=spfile;
>
> -- Recommended: shared_pool_size=600M
> --alter system set shared_pool_size=600M scope=spfile;
>
> -- For 12.1.0.2 set the following.
> --alter system set optimizer_adaptive_features=false scope=both;
>
> -- Should not be needed for 19c, but installer fails without them.
> alter system set "_optimizer_nlj_hj_adaptive_join"= FALSE scope=both sid='*';
> alter system set "_optimizer_strans_adaptive_pruning" = FALSE scope=both sid='*';
> alter system set "_px_adaptive_dist_method" = OFF scope=both sid='*';
> alter system set "_sql_plan_directive_mgmt_control" = 0 scope=both sid='*';
> alter system set "_optimizer_dsdir_usage_control" = 0 scope=both sid='*';
> alter system set "_optimizer_use_feedback" = FALSE scope=both sid='*';
> alter system set "_optimizer_gather_feedback" = FALSE scope=both sid='*';
> alter system set "_optimizer_performance_feedback" = OFF scope=both sid='*';
>
> SHUTDOWN IMMEDIATE;
> STARTUP;
>
> exit;
EOF


SQL*Plus: Release 19.0.0.0.0 - Production on Wed Jan 20 22:00:02 2021
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL>
System altered.

[....]
```

## OEM Installation Phase <a name="OEM-Installation-Phase"></a>
Now that we have the DB repository ready, we can start the OEM Installation.
This part, took around 20-30 minutes aprox. to complete

Obviously, check the variables if you want to replicate this yourself, and make sure all of them fits your configuration
```bash
[oracle@oem13 ~]$ mkdir -p /u01/app/oracle/middleware
[oracle@oem13 ~]$ mkdir -p /u01/app/oracle/agent
[oracle@oem13 ~]$ mkdir /u01/software

[oracle@oem13 software]$ ls -lrth
total 12G
-rw-r--r-- 1 oracle oinstall 1.6G Jan 21 15:16 em13400_linux64.bin
-rw-r--r-- 1 oracle oinstall 2.0G Jan 21 15:19 em13400_linux64-2.zip
-rw-r--r-- 1 oracle oinstall 2.0G Jan 21 15:20 em13400_linux64-4.zip
-rw-r--r-- 1 oracle oinstall 771M Jan 21 15:30 em13400_linux64-5.zip
-rw-r--r-- 1 oracle oinstall 1.8G Jan 21 15:37 em13400_linux64-7.zip
-rw-r--r-- 1 oracle oinstall 2.0G Jan 21 15:38 em13400_linux64-3.zip
-rw-r--r-- 1 oracle oinstall 2.0G Jan 21 15:39 em13400_linux64-6.zip
[oracle@oem13 software]$

[oracle@oem13 software]$ chmod +x em13400_linux64.bin
[oracle@oem13 software]$

# Changed both "hostname variables" to oem13

[oracle@oem13 software]$ # Set parameters.
[oracle@oem13 software]$ ORACLE_BASE=/u01/app/oracle
[oracle@oem13 software]$ UNIX_GROUP_NAME=oinstall
[oracle@oem13 software]$ ORA_INVENTORY=/u01/app/oraInventory
[oracle@oem13 software]$ MW_HOME=${ORACLE_BASE}/middleware
[oracle@oem13 software]$ ORACLE_HOSTNAME=oem13
[oracle@oem13 software]$ AGENT_BASE=${ORACLE_BASE}/agent
[oracle@oem13 software]$ WLS_USERNAME=weblogic
[oracle@oem13 software]$ WLS_PASSWORD=Welcome1
[oracle@oem13 software]$ GC_INST=${ORACLE_BASE}/gc_inst
[oracle@oem13 software]$ SOFTWARE_LIBRARY=${ORACLE_BASE}/swlib
[oracle@oem13 software]$ DATABASE_HOSTNAME=oem13
[oracle@oem13 software]$ LISTENER_PORT=1521
[oracle@oem13 software]$ PDB_NAME=emrep
[oracle@oem13 software]$ SYS_PASSWORD=Welcome1
[oracle@oem13 software]$ AGENT_PASSWORD=${WLS_PASSWORD}
[oracle@oem13 software]$ ORACLE_SID=emcdb
[oracle@oem13 software]$ DATA_DIR=/u02/oradata
[oracle@oem13 software]$ OMS_HOME=${MW_HOME}
[oracle@oem13 software]$ SYSMAN_PASSWORD=${WLS_PASSWORD}
[oracle@oem13 software]$ SOFTWARE_DIR=/u01/software
[oracle@oem13 software]$


[oracle@oem13 software]$ cat > /tmp/install.rsp <<EOF
> RESPONSEFILE_VERSION=2.2.1.0.0
> UNIX_GROUP_NAME=${UNIX_GROUP_NAME}
> INVENTORY_LOCATION=${ORA_INVENTORY}
> SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
> DECLINE_SECURITY_UPDATES=true
> INSTALL_UPDATES_SELECTION=skip
> ORACLE_MIDDLEWARE_HOME_LOCATION=${MW_HOME}
> ORACLE_HOSTNAME=${ORACLE_HOSTNAME}
> AGENT_BASE_DIR=${AGENT_BASE}
> WLS_ADMIN_SERVER_USERNAME=${WLS_USERNAME}
> WLS_ADMIN_SERVER_PASSWORD=${WLS_PASSWORD}
> WLS_ADMIN_SERVER_CONFIRM_PASSWORD=${WLS_PASSWORD}
> NODE_MANAGER_PASSWORD=${WLS_PASSWORD}
> NODE_MANAGER_CONFIRM_PASSWORD=${WLS_PASSWORD}
> ORACLE_INSTANCE_HOME_LOCATION=${GC_INST}
> CONFIGURE_ORACLE_SOFTWARE_LIBRARY=true
> SOFTWARE_LIBRARY_LOCATION=${SOFTWARE_LIBRARY}
> DATABASE_HOSTNAME=${DATABASE_HOSTNAME}
> LISTENER_PORT=${LISTENER_PORT}
> SERVICENAME_OR_SID=${PDB_NAME}
> SYS_PASSWORD=${SYS_PASSWORD}
> SYSMAN_PASSWORD=${SYSMAN_PASSWORD}
> SYSMAN_CONFIRM_PASSWORD=${SYSMAN_PASSWORD}
> DEPLOYMENT_SIZE=SMALL
> AGENT_REGISTRATION_PASSWORD=${AGENT_PASSWORD}
> AGENT_REGISTRATION_CONFIRM_PASSWORD=${AGENT_PASSWORD}
> PLUGIN_SELECTION={}
> b_upgrade=false
> EM_INSTALL_TYPE=NOSEED
> CONFIGURATION_TYPE=LATER
> CONFIGURE_SHARED_LOCATION_BIP=false
> MANAGEMENT_TABLESPACE_LOCATION=${DATA_DIR}/${ORACLE_SID^^}/${PDB_NAME}/mgmt.dbf
> CONFIGURATION_DATA_TABLESPACE_LOCATION=${DATA_DIR}/${ORACLE_SID^^}/${PDB_NAME}/mgmt_ecm_depot1.dbf
> JVM_DIAGNOSTICS_TABLESPACE_LOCATION=${DATA_DIR}/${ORACLE_SID^^}/${PDB_NAME}/mgmt_deepdive.dbf
EOF
[oracle@oem13 software]$

[oracle@oem13 oracle]# mkdir /u01/app/oracle/middleware
[oracle@oem13 oracle]# ${SOFTWARE_DIR}/em13400_linux64.bin -silent -responseFile /tmp/install.rsp
Launcher log file is /tmp/OraInstall2021-01-22_01-21-16PM/launcher2021-01-22_01-21-16PM.log.
Extracting the installer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Done
Checking swap space: must be greater than 512 MB.   Actual 8063 MB    Passed
Checking if this platform requires a 64-bit JVM.   Actual 64    Passed (64-bit not required)
Preparing to launch the Oracle Universal Installer from /tmp/OraInstall2021-01-22_01-21-16PM
====Prereq Config Location main=== 
/tmp/OraInstall2021-01-22_01-21-16PM/stage/prereq
EMGCInstaller args -scratchPath
EMGCInstaller args /tmp/OraInstall2021-01-22_01-21-16PM
EMGCInstaller args -sourceType
EMGCInstaller args network
EMGCInstaller args -timestamp
EMGCInstaller args 2021-01-22_01-21-16PM
EMGCInstaller args -paramFile
EMGCInstaller args /tmp/sfx_a5JZHL/Disk1/install/linux64/oraparam.ini
EMGCInstaller args -silent
EMGCInstaller args -responseFile
EMGCInstaller args /tmp/install.rsp
EMGCInstaller args -nocleanUpOnExit
DiskLoc inside SourceLoc/tmp
EMFileLoc:/tmp/OraInstall2021-01-22_01-21-16PM/oui/em/
ScratchPathValue :/tmp/OraInstall2021-01-22_01-21-16PM
EMGCInstallUpdatesInfoOnNext:: calling actionOnClickofNext
Now in EMGCInstallUpdatesInfoOnNext.actionsOnClickofNext
EMGCInstallUpdatesInfoOnNext:: End of actionOnClickofNext
The installer detected the host name as localhost, but you have changed it to oem13.
Session log file is /tmp/OraInstall2021-01-22_01-21-16PM/install2021-01-22_01-21-16PM.log
Installation in progress
[....]
Setup successful
Session log file is /tmp/OraInstall2021-01-22_01-21-16PM/install2021-01-22_01-21-16PM.log
Installation in progress

Install successful
Linking in progress

Link successful
Setup in progress

Setup successful
Agent OracleHome :/u01/app/oracle/agent/agent_13.4.0.0.0
OMS OracleHome :/u01/app/oracle/middleware
[....]
Warning: You must run the following configuration scripts as the "root" user.
  /u01/app/oracle/middleware/allroot.sh
To execute the configuration scripts:
 1. Open a new  terminal window. 
 2. Login in as "root". 
 3. Run the scripts. 

Successfully installed Enterprise Manager Cloud Control.
Logs successfully copied to /u01/app/oraInventory/logs.
[oracle@oem13 oracle]# 


[root@oem13 ~]# /u01/app/oracle/middleware/allroot.sh

Starting to execute allroot.sh ......... 

Starting to execute /u01/app/oracle/middleware/root.sh ......
Performing root user operation.

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/middleware

Enter the full pathname of the local bin directory: [/usr/local/bin]: 
The contents of "dbhome" have not changed. No need to overwrite.
The file "oraenv" already exists in /usr/local/bin.  Overwrite it? (y/n) 
[n]: n
The file "coraenv" already exists in /usr/local/bin.  Overwrite it? (y/n) 
[n]: n

Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
/etc exist
/u01/app/oracle/middleware

Finished product-specific root actions.
/etc exist
/u01/app/oracle/agent/agent_13.4.0.0.0
Finished execution of  /u01/app/oracle/middleware/root.sh ......


Starting to execute /u01/app/oracle/agent/agent_13.4.0.0.0/root.sh ......

Finished product-specific root actions.
/etc exist
/u01/app/oracle/agent/agent_13.4.0.0.0
Finished execution of  /u01/app/oracle/agent/agent_13.4.0.0.0/root.sh ......
[root@oem13 ~]# 
```

## OEM Configuration Phase <a name="OEM-Configuration-Phase"></a>

This process failed to me since I restarted the DB in the middle of the process (was doing something else in the system and made one of those mistakes...)

Be aware this phase can take very long. In my case, took around 3 hours, but I bet it has something to do with my VM configuration, since I didn't see the KVM Host doing much during that time, so I'm sure in a better system should take a lot less than that. 
In any case, make sure you use nohup or screen so you don't risk interrupting the process
```bash
[oracle@oem13 software]$ cat > /tmp/config.rsp <<EOF
> RESPONSEFILE_VERSION=2.2.1.0.0
> UNIX_GROUP_NAME=${UNIX_GROUP_NAME}
> INVENTORY_LOCATION=${ORA_INVENTORY}
> SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
> DECLINE_SECURITY_UPDATES=true
> INSTALL_UPDATES_SELECTION=skip
> ORACLE_MIDDLEWARE_HOME_LOCATION=${MW_HOME}
> ORACLE_HOSTNAME=${ORACLE_HOSTNAME}
> AGENT_BASE_DIR=${AGENT_BASE}
> WLS_ADMIN_SERVER_USERNAME=${WLS_USERNAME}
> WLS_ADMIN_SERVER_PASSWORD=${WLS_PASSWORD}
> WLS_ADMIN_SERVER_CONFIRM_PASSWORD=${WLS_PASSWORD}
> NODE_MANAGER_PASSWORD=${WLS_Poem13ASSWORD}
> NODE_MANAGER_CONFIRM_PASSWORD=${WLS_PASSWORD}
> ORACLE_INSTANCE_HOME_LOCATION=${GC_INST}
> CONFIGURE_ORACLE_SOFTWARE_LIBRARY=true
> SOFTWARE_LIBRARY_LOCATION=${SOFTWARE_LIBRARY}
> DATABASE_HOSTNAME=${DATABASE_HOSTNAME}
> LISTENER_PORT=${LISTENER_PORT}
> SERVICENAME_OR_SID=${PDB_NAME}
> SYS_PASSWORD=${SYS_PASSWORD}
> SYSMAN_PASSWORD=${SYSMAN_PASSWORD}
> SYSMAN_CONFIRM_PASSWORD=${SYSMAN_PASSWORD}
> DEPLOYMENT_SIZE=SMALL
> AGENT_REGISTRATION_PASSWORD=${AGENT_PASSWORD}
> AGENT_REGISTRATION_CONFIRM_PASSWORD=${AGENT_PASSWORD}
> PLUGIN_SELECTION={}
> b_upgrade=false
> EM_INSTALL_TYPE=NOSEED
> CONFIGURATION_TYPE=ADVANCED
> CONFIGURE_SHARED_LOCATION_BIP=false
> MANAGEMENT_TABLESPACE_LOCATION=${DATA_DIR}/${ORACLE_SID^^}/${PDB_NAME}/mgmt.dbf
> CONFIGURATION_DATA_TABLESPACE_LOCATION=${DATA_DIR}/${ORACLE_SID^^}/${PDB_NAME}/mgmt_ecm_depot1.dbf
> JVM_DIAGNOSTICS_TABLESPACE_LOCATION=${DATA_DIR}/${ORACLE_SID^^}/${PDB_NAME}/mgmt_deepdive.dbf
EOF
[oracle@oem13 software]$

# Made sure all hostnames variables are oem13:

[oracle@oem13 oracle]# cat /tmp/config.rsp
RESPONSEFILE_VERSION=2.2.1.0.0
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oraInventory
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
DECLINE_SECURITY_UPDATES=true
INSTALL_UPDATES_SELECTION=skip
ORACLE_MIDDLEWARE_HOME_LOCATION=/u01/app/oracle/middleware
ORACLE_HOSTNAME=oem13
AGENT_BASE_DIR=/u01/app/oracle/agent
WLS_ADMIN_SERVER_USERNAME=weblogic
WLS_ADMIN_SERVER_PASSWORD=Welcome1
WLS_ADMIN_SERVER_CONFIRM_PASSWORD=Welcome1
NODE_MANAGER_PASSWORD=Welcome1
NODE_MANAGER_CONFIRM_PASSWORD=Welcome1
ORACLE_INSTANCE_HOME_LOCATION=/u01/app/oracle/gc_inst
CONFIGURE_ORACLE_SOFTWARE_LIBRARY=true
SOFTWARE_LIBRARY_LOCATION=/u01/app/oracle/swlib
DATABASE_HOSTNAME=oem13
LISTENER_PORT=1521
SERVICENAME_OR_SID=emrep
SYS_PASSWORD=Welcome1
SYSMAN_PASSWORD=Welcome1
SYSMAN_CONFIRM_PASSWORD=Welcome1
DEPLOYMENT_SIZE=SMALL
AGENT_REGISTRATION_PASSWORD=Welcome1
AGENT_REGISTRATION_CONFIRM_PASSWORD=Welcome1
PLUGIN_SELECTION={}
b_upgrade=false
EM_INSTALL_TYPE=NOSEED
CONFIGURATION_TYPE=ADVANCED
CONFIGURE_SHARED_LOCATION_BIP=false
MANAGEMENT_TABLESPACE_LOCATION=/u02/oradata/EMCDB/emrep/mgmt.dbf
CONFIGURATION_DATA_TABLESPACE_LOCATION=/u02/oradata/EMCDB/emrep/mgmt_ecm_depot1.dbf
JVM_DIAGNOSTICS_TABLESPACE_LOCATION=/u02/oradata/EMCDB/emrep/mgmt_deepdive.dbf
[oracle@oem13 oracle]# 

# Configuration Phase

[oracle@oem13 ~]# nohup ${MW_HOME}/sysman/install/ConfigureGC.sh -silent -responseFile /tmp/config.rsp &
[1] 7258
[oracle@oem13 ~]# nohup: ignoring input and appending output to ‘nohup.out’

[oracle@oem13 ~]# 
[oracle@oem13 ~]# 
[oracle@oem13 ~]# tail -f nohup.out
List file is unreadable
List file is unreadable
List file is unreadable
List file is unreadable
List file is unreadable
List file is unreadable
13NGCHEKAGGREGATE  : oracle.sysman.top.agent
13NGCHEKAGGREGATE  : OuiConfigVariables
13NGCHEKAGGREGATE  : oracle.sysman.top.oms
13NGCHEKAGGREGATE  : encap_oms
13NGCHEKAGGREGATE  : OuiConfigVariables
2021-01-22_02-49-13PM: Configuration Assistant "Repository Configuration" is in progress.
[....]
2021-01-22_04-46-47PM: Configuration Assistant "BI Publisher Schema Configuration" has Succeeded.

2021-01-22_04-46-47PM: Configuration Assistant "OMS Configuration" is in progress.


 Executing the OMSCA command...

 Check the log files of the OMS Configuration Assistant at: /u01/app/oracle/middleware/cfgtoollogs/omsca
[....]
2021-01-22_05-02-26PM: Configuration Assistant "OMS Configuration" has Succeeded.

2021-01-22_05-02-26PM: Configuration Assistant "Plugins Deployment and Configuration" is in progress.

2021-01-22_05-15-24PM: Configuration Assistant "Plugins Deployment and Configuration" has Succeeded.

2021-01-22_05-15-24PM: Configuration Assistant "BI Publisher Configuration" is in progress.
[....]

Cloning of agent home completed successfully
Agent Configuration completed successfully
The following configuration scripts need to be executed as the "root" user. Root script to run : /u01/app/oracle/agent/agent_13.4.0.0.0/root.sh
AgentConfiguration:agent configuration finished with status = true

2021-01-22_05-36-26PM: Configuration Assistant "Agent Configuration Assistant" has Succeeded.

*** The Installation was Successful. ***



This information is also available at: 

    /u01/app/oracle/middleware/install/setupinfo.txt

See the following for information pertaining to your Enterprise Manager installation:


Use the following URL to access:

    1. Enterprise Manager Cloud Control URL: https://oem13:7803/em
    2. Admin Server URL: https://oem13:7102/console
    3. BI Publisher URL: https://oem13:9803/xmlpserver/servlet/home

The following details need to be provided while installing an additional OMS:

    1. Admin Server Host Name: oem13
    2. Admin Server Port: 7102

You can find the details on ports used by this deployment at : /u01/app/oracle/middleware/install/portlist.ini


 NOTE:
 An encryption key has been generated to encrypt sensitive data in the Management Repository. If this key is lost, all encrypted data in the Repository becomes unusable. 

 A backup of the OMS configuration is available in /u01/app/oracle/gc_inst/em/EMGC_OMS1/sysman/backup on host oem13. See Cloud Control Administrators Guide for details on how to back up and recover an OMS.

 NOTE: This backup is valid only for the initial OMS configuration. For example, it will not reflect plug-ins installed later, topology changes like the addition of a load balancer, or changes to other properties made using emctl or emcli. Backups should be created on a regular basis to ensure they capture the current OMS configuration. Use the following command to backup the OMS configuration:
/u01/app/oracle/middleware/bin/emctl exportconfig oms -dir <backup dir> 

Prompt for the allroot.sh


# As root user execute the 

[root@oem13 ~]# /u01/app/oracle/agent/agent_13.4.0.0.0/root.sh

Finished product-specific root actions.
/etc exist
[root@oem13 ~]#
```

## All components start <a name="All-components-start"></a> 

Tim also provided some scripts to Stop/Start all components that you can see in the DB repository installation part
I also needed to redirected the 7803 port of my KVM host (server) to the same port in the OEM VM so I could access to it from my local network
```bash
[oracle@oem13 ~]# start_all.sh 
The Oracle base remains unchanged with value /u01/app/oracle

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 22-JAN-2021 18:07:14

Copyright (c) 1991, 2019, Oracle.  All rights reserved.

Starting /u01/app/oracle/product/19.0.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Log messages written to /u01/app/oracle/diag/tnslsnr/oem13/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                22-JAN-2021 18:07:14
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/diag/tnslsnr/oem13/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
The listener supports no services
The command completed successfully
Processing Database instance "emcdb": log file /u01/app/oracle/product/19.0.0/dbhome_1/rdbms/log/startup.log
Oracle Enterprise Manager Cloud Control 13c Release 4  
Copyright (c) 1996, 2020 Oracle Corporation.  All rights reserved.
Starting Oracle Management Server...
WebTier Successfully Started
Oracle Management Server is still in the process of getting started.
Timed out waiting for Oracle Management Server to start.
Check error and log files.
Check EM Server log file for details: /u01/app/oracle/gc_inst/user_projects/domains/GCDomain/servers/EMGC_OMS1/logs/EMGC_OMS1.out
Oracle Management Server is Down
JVMD Engine is Down
Starting BI Publisher Server ...
BI Publisher Server Successfully Started
BI Publisher Server is Up
Oracle Enterprise Manager Cloud Control 13c Release 4  
Copyright (c) 1996, 2020 Oracle Corporation.  All rights reserved.
Agent is already running
[oracle@oem13 ~]# 

|=| server in ~ ○  ssh -g -L 7803:localhost:7803 -N -f oracle@oem

|=| server in ~ ○ →
```
And ***voilà!*** our OEM is ready

![OEM13_Security Warning](https://project42.site/wp-content/uploads/2021/01/OEM13_Security-Warning.png)

![OEM13_login](https://project42.site/wp-content/uploads/2021/01/OEM13_login.png)

## Repository DB Cleanup <a name="Repository-DB-Cleanup"></a> 
In case you need to restart the installation/Configuration phase, this is the cleanup process I followed:
Information from [How to clean EM12c repository after a failed installation or upgrade](https://orawiki.org/2016/05/18/how-to-clean-em12c-repository-after-a-failed-installation-or-upgrade/) and [13c Cloud Control Repository: How to Manually Drop Repository Database Objects in 13c Cloud Control (Doc ID 2107485.1)](https://support.oracle.com/epmos/faces/DocumentDisplay?&id=2107485.1))

```
[oracle@oem13 ~]# rm -rf /u01/app/oracle/agent/agent_13.4.0.0.0/
[oracle@oem13 ~]# rm -rf rm -rf /u01/app/oracle/middleware
[oracle@oem13 ~]# mkdir /u01/app/oracle/middleware


[oracle@oem13 ~]# lsnrctl start

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 22-JAN-2021 13:54:08

Copyright (c) 1991, 2019, Oracle.  All rights reserved.

Starting /u01/app/oracle/product/19.0.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Log messages written to /u01/app/oracle/diag/tnslsnr/oem13/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                22-JAN-2021 13:54:08
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/diag/tnslsnr/oem13/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle@oem13 ~]# 


[oracle@oem13 ~]# sqlplus / as sysdba

SQL> startup
ORACLE instance started.

Total System Global Area 3221223752 bytes
Fixed Size          9140552 bytes
Variable Size         553648128 bytes
Database Buffers     2650800128 bytes
Redo Buffers            7634944 bytes
Database mounted.
Database opened.
SQL> exit

## Cleanup PDB to make sure there is no previous installation objects



[oracle@oem13 ~]# sqlplus / as sysdba <<EOF

alter session set container=EMREP;

drop user sysman cascade;
drop user sysman_types cascade;
drop user sysman_stb cascade;
drop user sysman_opss cascade;
drop user sysman_biplatform cascade;
drop user sysman_bip cascade;
drop user sysmanupgr_opss cascade;
drop user sysman_apm cascade;
drop user sysman_ro cascade;
drop user sysman_mds cascade;
drop user cloud_engine_user cascade;
drop user cloud_swlib_user cascade;
drop user mgmt_view cascade;
drop user eus_engine_user cascade;
drop role mgmt_user;
-
- 2. Verify if there are any leftover synonyms:

spool synonyms.lst
select owner,synonym_name from dba_synonyms where table_owner in ('SYSMAN', 'SYSMAN_MDS', 'MGMT_VIEW', 'SYSMAN_BIP', 'SYSMAN_APM', 'SYSMAN_OPSS', 'SYSMAN_RO', 'SYSMAN_BIPLATFORM', 'SYSMANUPGR_OPSS', 'CLOUD_ENGINE_USER', 'CLOUD_SWLIB_USER', 'EUS_ENGINE_USER', 'SYSMAN_TYPES', 'SYSMAN_STB') ;
spool off
@synonyms.lst

-- If any synonyms listed, drop them using below syntax

-- DROP SYNONYM schema.synonym_name;

-- 3. Drop the tablespaces:

drop tablespace MGMT_ECM_DEPOT_TS including contents and datafiles;
drop tablespace MGMT_TABLESPACE including contents and datafiles;
drop tablespace MGMT_AD4J_TS including contents and datafiles;

-- Delete the entries from registry:

delete from SCHEMA_VERSION_REGISTRY where COMP_NAME='Metadata Services';
delete from SCHEMA_VERSION_REGISTRY where COMP_NAME='Authorization Policy Manager';
delete from SCHEMA_VERSION_REGISTRY where COMP_NAME='Oracle Platform Security Services';
delete from SCHEMA_VERSION_REGISTRY where COMP_NAME='OracleBI and EPM'
delete from SCHEMA_VERSION_REGISTRY where COMP_NAME='Service Table';
commit;

EOF
```