Cannot start Oracle Enterprise 13C after stopping OMS Oracle Software versions installed:

Oracle Grid infrastructure 12C release 2 [12.2.0.1]
Oracle Database 12C release 1 [12.1.0.2.0]
12.1.0.2.0_Database_Template_with_cdbpdb_for_EM13_2_0_0_0_Linux_x64.zip
Enterprise manager 13 [13.2.0.0 with plug-ins]


After successfully installing all of the above packages including the enterprise manager 13C, I decide to stop the enterprise manager services by running the below script:

#!/bin/bash
export ORACLE_HOME=/u01/app/oracle/product/12.2.0.1/db_1
export OMS_HOME=/u01/app/oracle/middleware
export AGENT_HOME=/u01/app/oracle/agent/agent_inst

# Stop everything
$OMS_HOME/bin/emctl stop oms -all
$AGENT_HOME/bin/emctl stop agent
$ORACLE_HOME/bin/dbshut $ORACLE_HOME


Once the enterprise manager 13C services has stopped, I decide to start it again and I get the below error messages:

Oracle Enterprise Manager Cloud Control 13c Release 2  
Copyright (c) 1996, 2016 Oracle Corporation.  All rights reserved.
Starting Oracle Management Server...
WebTier Successfully Started
Oracle Management Server Could Not Be Started
Check EM Server log file for details: /u01/app/oracle/gc_inst    /user_projects/domains/GCDomain/servers/EMGC_OMS1/logs/EMGC_OMS1.out
AdminServer Could Not Be Started
Check Admin Server log file for details: /u01/app/oracle/gc_inst/user_projects/domains/GCDomain/servers/EMGC_ADMINSERVER/logs/EMGC_ADMINSERVER.out
Oracle Management Server is Down
JVMD Engine is Down
Starting BI Publisher Server ...
BI Publisher Server Could Not Be Started. Check BIP Server log file for details.
BI Publisher Server Logs: /u01/app/oracle/gc_inst/user_projects/domains/GCDomain/servers/BIP/logs/
AdminServer Could Not Be Started
Check Admin Server log file for details: /u01/app/oracle/gc_inst/user_projects/domains/GCDomain/servers/EMGC_ADMINSERVER/logs/EMGC_ADMINSERVER.out
BI Publisher Server is Down
Oracle Enterprise Manager Cloud Control 13c Release 2  
Copyright (c) 1996, 2016 Oracle Corporation.  All rights reserved.
Starting agent ............................................. started.


All I did was stop the enterprise manager 13C Oracle Management Service, nothing else and for some reason I can't start the service again.

If anyone has come across this problem, please help.
After all the searching, I could not find any help, until I figured out the problem myself. In order to use enterprise manager, the pluggable database container must be accessible and open before starting the oracle management service.

This can be done through enterprise manager 12C:

Access your pluggable database containers shown below



You will see that container database is down by open-mode column. Click on actions and say open all or the one you want:



Choose the appropriate action(s) to open your PDB's



Or you could run the below query to open all pluggable databases from sqlplus [I tried it from sqlplus and it did not want to work for me]:

alter pluggable database ALL close IMMEDIATE ;
alter pluggable database ALL open read write;


If it works you should see the open-mode in green shown below in enterprise manager 12C:



After starting the PDB, you should be able to start the Enterprise manager 13C OMS as shown below:

#!/bin/bash
export ORACLE_HOME=/u01/app/oracle/product/12.2.0.1/db_1
export OMS_HOME=/u01/app/oracle/middleware
export AGENT_HOME=/u01/app/oracle/agent/agent_inst

# Start everything
$ORACLE_HOME/bin/dbstart $ORACLE_HOME

$OMS_HOME/bin/emctl start oms
$AGENT_HOME/bin/emctl start agent