Saturday, 17 February 2018

Upgrade Oracle Enterprise Manager Cloud Control 12c Release 5 (12cR5) to 13c Release 1 (13cR1)

This article describes a simple upgrade of Enterprise Manager Cloud Control 12c Release 5 (12cR5) to 13c Release 1 (13cR1).

◈ Software


Download the following software:

Enterprise Manager Cloud Control 13c Release 1 (13.1.0.0) (x86_64)

◈ Prerequisites


◈ Before you consider an upgrade, consider the following points.

◈ Cloud Control 13c is not supported on OL5/RHEL5. If your current installation is on OL5/RHEL5, you might be better doing a fresh installation and migrating your targets.
◈ The repository database must be version 12.1.0.2. If you have a database version prior to this, you will need to upgrade it before doing the upgrade of Cloud Control. In this case, turn off the OMS and agent, upgrade the database and turn the OMS and agent back on. Assuming you've not changed the listener port, the old version of the OMS should work fine after the upgrade.

Assuming your database version and OS version are OK, you will need to set the following parameters and restart the database before starting the Cloud Control upgrade.

ALTER SYSTEM SET COMPATIBLE='12.1.0.2.0' SCOPE=SPFILE
ALTER SYSTEM SET optimizer_adaptive_features=false SCOPE=SPFILE;

Make sure the privileges for the DBMS_RANDOM package are as described in the documentation. This should already be done as it was a requirement for the 12.1.0.5 installation, but it's worth checking.

export ORACLE_SID=emrep
export ORAENV_ASK=NO
. oraenv
export ORAENV_ASK=YES

sqlplus / as sysdba

GRANT EXECUTE ON dbms_random TO dbsnmp;
GRANT EXECUTE ON dbms_random TO sysman;
REVOKE EXECUTE ON dbms_random FROM public;

Make sure there are no invalid objects in the repository database.

SELECT owner, object_name, object_type
FROM   dba_objects
WHERE  status = 'INVALID'
AND    owner IN ('SYS', 'SYSTEM', 'SYSMAN', 'MGMT_VIEW', 'DBSNMP', 'SYSMAN_MDS');

If you have any, recompile them using the following commands. Only pick the schemas that have invalid objects though.

EXEC UTL_RECOMP.recomp_serial('SYS');
EXEC UTL_RECOMP.recomp_serial('DBSNMP');
EXEC UTL_RECOMP.recomp_serial('SYSMAN');

Copy the emkey using the following commands, adjust as required. You will have to enter the Cloud Control sysman password.

$ export OMS_HOME=/u01/app/oracle/oms12cr5/oms

$ $OMS_HOME/bin/emctl config emkey -copy_to_repos
Oracle Enterprise Manager Cloud Control 12c Release 5
Copyright (c) 1996, 2015 Oracle Corporation.  All rights reserved.
Enter Enterprise Manager Root (SYSMAN) Password :
The EMKey has been copied to the Management Repository. This operation will cause the EMKey to become unsecure.
After the required operation has been completed, secure the EMKey by running "emctl config emkey -remove_from_repos".
$

$ $OMS_HOME/bin/emctl status emkey
Oracle Enterprise Manager Cloud Control 12c Release 5
Copyright (c) 1996, 2015 Oracle Corporation.  All rights reserved.
Enter Enterprise Manager Root (SYSMAN) Password :
The EMKey  is configured properly, but is not secure. Secure the EMKey by running "emctl config emkey -remove_from_repos".
$

Stop the OMS and the agent.

export OMS_HOME=/u01/app/oracle/oms12cr5/oms
export AGENT_HOME=/u01/app/oracle/agent12c/agent_inst

$OMS_HOME/bin/emctl stop oms -all
$AGENT_HOME/bin/emctl stop agent

Create a directory for the new installation.

$ mkdir -p /u01/app/oracle/middleware

Backup your repository. In my case, Cloud Control runs on a VM, so a database backup was performed, as well as a whole VM backup.

For clarity, my starting 12cR5 installation had the following details.

HOSTNAME  : emcc.localdomain
DB Version: 12.1.0.2
ORACLE_SID: emrep
PORT      : 1521
URL       : https://emcc.localdomain:7802/em

◈ Cloud Control 13c Installation and Upgrade


Run the installer.

$ chmod u+x em13100_linux64.bin
$ ./em13100_linux64.bin

If you wish to receive support information, enter the required details, or uncheck the security updates checkbox and click the "Next" button. Click the "Yes" button the subsequent warning dialog.

Upgrade Oracle Enterprise Manager Cloud Control 12c, Oracle Database Tutorials and Materials, Oracle Database Certifications, Oracle Database Guides

If you wish to check for updates, enter the required details, or check the "Skip" option and click the "Next" button.

Upgrade Oracle Enterprise Manager Cloud Control 12c, Oracle Database Tutorials and Materials, Oracle Database Certifications, Oracle Database Guides

If you have performed the prerequisites as described, the installation should pass all prerequisite checks. Click the "Next" button. In this case I got a warning on the kernel parameters because my "ip_local_port_range" was larger than the required range. I ignored it by clicking the "Ignore" button, then the subsequent "OK" button, then the "Next" button.

Upgrade Oracle Enterprise Manager Cloud Control 12c, Oracle Database Tutorials and Materials, Oracle Database Certifications, Oracle Database Guides

Select the "Upgrade an existing Enterprise Manager System" option. Select the "One-System Upgrade" option. Select the OMS to be upgraded, then click the "Next" button.

Upgrade Oracle Enterprise Manager Cloud Control 12c, Oracle Database Tutorials and Materials, Oracle Database Certifications, Oracle Database Guides

Enter the new middleware home location, I used "/u01/app/oracle/middleware", then click the "Next" button.

Upgrade Oracle Enterprise Manager Cloud Control 12c, Oracle Database Tutorials and Materials, Oracle Database Certifications, Oracle Database Guides

Enter the passwords for the SYS and SYSMAN users and check both the check boxes, then click the "Next" button.

Upgrade Oracle Enterprise Manager Cloud Control 12c, Oracle Database Tutorials and Materials, Oracle Database Certifications, Oracle Database Guides

On the first warning dialog, click the "OK" button. The subsequent error screen should list things that can be fixed by by the installer.

Upgrade Oracle Enterprise Manager Cloud Control 12c, Oracle Database Tutorials and Materials, Oracle Database Certifications, Oracle Database Guides

If you have any additional warnings, check they don't look like show-stoppers, then click the "Yes" button to continue.

If you are happy with the plug-in upgrade information, click the "Next" button.

Upgrade Oracle Enterprise Manager Cloud Control 12c, Oracle Database Tutorials and Materials, Oracle Database Certifications, Oracle Database Guides

Select any additional plug-ins you want to deploy, then click the "Next" button.

Upgrade Oracle Enterprise Manager Cloud Control 12c, Oracle Database Tutorials and Materials, Oracle Database Certifications, Oracle Database Guides

Enter the WebLogic details, then click the "Next" button. Just add a number on to the end of the OMS Instance Base Location specified by default. I used "/u01/app/oracle/gc_inst1".

Upgrade Oracle Enterprise Manager Cloud Control 12c, Oracle Database Tutorials and Materials, Oracle Database Certifications, Oracle Database Guides

This is a simple installation, using just a single OMS, so I don't need a shared location for BI Publisher. As a result, I unchecked the "Configure a Shared Location for Oracle BI Publisher", but I left the "Enable Oracle BI Publisher" option checked. If you plan to use a multiple OMS setup, then configure shared storage, like NFS, and put the relevant paths in here. Click the "Next" button.

Upgrade Oracle Enterprise Manager Cloud Control 12c, Oracle Database Tutorials and Materials, Oracle Database Certifications, Oracle Database Guides

Accept the default ports by clicking the "Next" button.

Upgrade Oracle Enterprise Manager Cloud Control 12c, Oracle Database Tutorials and Materials, Oracle Database Certifications, Oracle Database Guides

If you are happy with the review information, click the "Upgrade" button.

Upgrade Oracle Enterprise Manager Cloud Control 12c, Oracle Database Tutorials and Materials, Oracle Database Certifications, Oracle Database Guides

Wait while the installation and configuration take place.

Upgrade Oracle Enterprise Manager Cloud Control 12c, Oracle Database Tutorials and Materials, Oracle Database Certifications, Oracle Database Guides

When prompted, run the root scripts, then click the "OK" button.

Upgrade Oracle Enterprise Manager Cloud Control 12c, Oracle Database Tutorials and Materials, Oracle Database Certifications, Oracle Database Guides

Make note of the URLs, then click the "Close" button to exit the installer. A copy of this information is available in the "/u01/app/oracle/middleware/install/setupinfo.txt" file.

Upgrade Oracle Enterprise Manager Cloud Control 12c, Oracle Database Tutorials and Materials, Oracle Database Certifications, Oracle Database Guides

Start the original agent. We will upgrade that in the next section.

$ export AGENT_HOME=/u01/app/oracle/agent12c/agent_inst
$ $AGENT_HOME/bin/emctl start agent

The login screen is available from a browser using the URL provided in the previous screen ("https://emcc.localdomain:7802/em"). Log in with the username "sysman" and the password you specified during your installation.

Upgrade Oracle Enterprise Manager Cloud Control 12c, Oracle Database Tutorials and Materials, Oracle Database Certifications, Oracle Database Guides

After accepting the licensing agreement, you are then presented with the startup screen you selected when the installed 12cR5.

Upgrade Oracle Enterprise Manager Cloud Control 12c, Oracle Database Tutorials and Materials, Oracle Database Certifications, Oracle Database Guides

The targets marked as down belong to the 12cR5 installation, so it is normal for these to be down. You can clean this up later by removing the targets.

◈ Agent Upgrade


Navigate to "Setup (cog icon) > Manage Cloud Control > Upgrade Agents".

Upgrade Oracle Enterprise Manager Cloud Control 12c, Oracle Database Tutorials and Materials, Oracle Database Certifications, Oracle Database Guides

Click the "+ Add" button, highlight any agents to upgrade, then click the "OK" button.

Upgrade Oracle Enterprise Manager Cloud Control 12c, Oracle Database Tutorials and Materials, Oracle Database Certifications, Oracle Database Guides

When you are happy with your selection, click the "Submit" button.

Upgrade Oracle Enterprise Manager Cloud Control 12c, Oracle Database Tutorials and Materials, Oracle Database Certifications, Oracle Database Guides

If you do not have "root" access or sudo configured to allow you to run the root scripts, click the "OK" on the warning message. The root scripts can be run after the installation completes.

Upgrade Oracle Enterprise Manager Cloud Control 12c, Oracle Database Tutorials and Materials, Oracle Database Certifications, Oracle Database Guides

Wait while the upgrade takes place. Once complete, click the "Done" button.

Upgrade Oracle Enterprise Manager Cloud Control 12c, Oracle Database Tutorials and Materials, Oracle Database Certifications, Oracle Database Guides

If you need to run any root scripts manually, do so now. They are located in the agent home on each monitored machines (AGENT_HOME/agent_13.1.0.0.0/root.sh).

The main body of the upgrade is now complete.

Navigate to the "Post Upgrade Tasks" screen (Setup > Manage Cloud Control > Post Upgrade Tasks). Highlight each of the tasks in the list and click the "Start" button. This just performs some final data migration.

◈ Startup/Shutdown


Cloud Control is set to auto-start using the "gcstartup" service. The "/etc/oragchomelist" file contains the items that will be started by the system. After the upgrade, it may list both OMS installations. If you want to use this auto-start, you will need to amend the contents of the file to make sure it is consistent with the new installation.

/u01/app/oracle/middleware

/u01/app/oracle/agent12c/agent_13.1.0.0.0:/u01/app/oracle/agent12c/agent_inst

The path to the agent is the same as that from the previous installation. Since the agent home originally included "agent12c", this is still in the path, which looks a little strange. It makes sense to never include a versions in the basic OMS and agent paths for new installations, to prevent this happening in future.

On a simple installation the default auto-start will cause a problem as Cloud Control will attempt to start before the database has started. The service can be disabled by commenting out (using #) all the contents of the "/etc/oragchomelist" file to prevent the auto-start and use start/stop scripts described below.

If the start/stop needs to be automated, you can do it in the usual way using Linux service that calls your start/stop scripts that include the database management.

Use the following commands to turn on all components installed by this article. If you have a startup/shutdown script, remember to amend it to take account of the new paths.

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

# Start everything
$ORACLE_HOME/bin/dbstart $ORACLE_HOME

$OMS_HOME/bin/emctl start oms

$AGENT_HOME/bin/emctl start agent

Use the following commands to turn off all components installed by this article.

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

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

$AGENT_HOME/bin/emctl stop agent

$ORACLE_HOME/bin/dbshut $ORACLE_HOME