Saturday 27 July 2013

Creating an 11g R2 (11.2.0.3.0) Oracle Management Repository Database for Use with OEM Cloud Control 12c (12.1.0.3.0)

Oracle Enterprise Manager Cloud Control 12c (OEM CC 12c) is a web-based application that stores and retrieves the metadata about all of the targets in the cloud infrastructure from its very own database called the Oracle Management Repository. The question that arises is that which Oracle database versions are supported by OEM CC 12c, so that one of these databases can be used as an Oracle Management Repository database.

In my tutorial below, I will demonstrate to you how to create an Oracle Management Repository database. I will also demonstrate in a subsequent tutorial as to how the database can be configured with OEM CC 12c.

To begin with, there are multiple Oracle database versions that are supported by OEM CC 12c (12.1.0.3.0) -

A. 11g Release 11.2.0.3.0
B. 11g Release 11.2.0.2.0
C. 11g Release 11.2.0.1.0
D. 11g Release 11.1.0.7.0
E. 10g Release 10.2.0.5.0

In my tutorial, I will be creating an Oracle 11g Release 11.2.0.3.0 database as the Oracle Management Repository database for OEM CC 12c.

Time Duration: 30 to 60 Minutes (45 Minutes on an Average!)

Prerequisites:
1. You need to install the Oracle Database 11g R2 (11.2.0.1.0) software on your Redhat Enterprise Linux Server available at the following website and apply the Patchset Update 10404530 available at My Oracle Support.

The Oracle Database 11g R2 (11.2.0.1.0) software is available at the following website:
http://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-linx8664soft-100572.html

The Patchset Update 10404530 is available at the following website:
https://updates.oracle.com/Orion/PatchDetails/process_form?patch_num=10404530

2. You need to ensure that the Oracle management repository database files will be created on a file system/disk having at least 50 GB of free space, since the repository database can consume between 5-50 GB of space.

3. You need to create a default listener for the database and start it up, or you will be forced to create one during the database creation process. In my tutorial, I have assumed that you have already created a default listener and have started it up before launching the database configuration assistant.


Database Creation Process:
Start the Database Configuration Assistant by firing the 'dbca' command at the shell prompt -
[oracle@oem12c ~]$ dbca

A splash screen will appear for a few seconds -

The splash screen will be followed by the 'Welcome' screen, which tells you about the capabilities of the Database Configuration Assistant Utility -

Click 'Next' once you finish reading this screen.

1. The next screen gives you the privilege to choose which operation you want to perform using the DBCA utility -

There are four options available -
A. Create a Database: This option allows you to create a new database.
B. Configure Database Options: This option allows you to reconfigure an existing database.
C. Delete a Database: This option allows you to drop an existing database.
D. Manage Templates: This option allows you to manage database templates.

Select 'Create a Database' and click 'Next'.

2. The next screen presents an existing list of database templates that may have been either provided by Oracle, or created by the DBA, or both -

Templates allow the DBA to create new databases in minutes, as opposed to hours. Templates may or may not include datafiles. Use templates without datafiles only when necessary, such as when you need to change attributes like block size, which cannot be altered after database creation. For creating a high performing and robust Oracle management repository database, we have to select the 'General Purpose or Transaction Processing' template.

Optionally, you may click 'Show Details' to check out the contents of the template, which can be saved as an HTML file for review -

Click 'Close' once you review the contents of the template and click 'Next' in order to progress with the process.

3. The next screen presents two fields that are important and mandatory -

They are as follows -
A. Global Database Name: It is a name used to uniquely identify your Oracle database on a network. By default, it follows the format SID.LocalDomainName.
B. SID: It stands for Oracle System Identifier, which is the name of the default instance used to access the database.

Enter the fields and click 'Next'.

4. The next screen presents the Enterprise Manager and Automatic Maintenance Tasks tabs -

Check out both the tabs for information ...


Ensure you disable all of the options in both the tabs, as they are not needed by the Oracle management repository database.

Click 'Next' once done.

5. The next screen presents the database credentials for the SYS and SYSTEM users -

You may set up different passwords for the SYS and SYSTEM database accounts, or may even share the same password between these accounts.

Click 'Next' once you set up the password(s).

6. The next screen presents the database storage type and location information -

There are two storage types available -
A. File System: It is the default storage type that allows the DBA to store the data files, control files and online redo log files in file systems at the OS level.
B. Automatic Storage Management: It is an optional storage type that automates the storage and management of data files, control files and online redo log files on disk groups selected by the DBA. To use ASM, you need to install Oracle Grid Infrastructure 11g R2 (11.2.0.3.0), and stamp/label existing RAW disks in ASM format. ASM provides many advanced features such as load balancing, file mirroring, data striping, online redistribution of data etc, by integrating its own file system and logical volume manager. For more information on ASM, kindly click the following link:
http://docs.oracle.com/cd/B28359_01/server.111/b31107/asmcon.htm

Similarly, there are multiple storage location options available -
A. Use Database File Locations from Template: It stores the database files in locations specified by the selected database template during database creation.
B. Use Common Location for All Database Files: It allows the DBA to specify a common location for storing all the database files. By default, it is {ORACLE_BASE}/oradata.
C. Use Oracle-Managed Files: It allows the DBA to use proprietary OMF naming and storage standards to simplify file management and administration by defining a 'Database Area' where only database files may reside. By default, it is {ORACLE_BASE}/oradata. It also allows the DBA to optionally multiplex the online redo log files and control files across up to five physically different locations.

We will select 'Use Database File Locations from Template' in order to simplify our process.

Click on the 'File Location Variables...' button in order to check the file location variables -

Ensure that the file location variables are correct and that there is an adequate amount of free space in the file locations. Click 'OK' and 'Next' once verified.

7. The next screen presents the available recovery options for the database -

There are two recovery options available -
A. Specify Fast Recovery Area: Until version 11g release 11.2.0.2.0, it was known as the 'Flash Recovery Area'. In version 11g release 11.2.0.3.0, it has been renamed as the 'Fast Recovery Area'. By default, it is located in {ORACLE_BASE}/fast_recovery_area and has a size of 4122 MB.
B. Enable Archiving: It is used to place the database in archive log mode for point-in-time recovery. It is highly recommended to select this option only if the database is part of a production setup, and/or the database needs to be backed up without a downtime. Optionally, you may even edit the archive mode parameters such as the default naming format used for generating archive log files etc.

Since my repository database is not part of a production setup, I have unchecked the 'Enable Archiving' option, as archive log files consume a large amount of space (over hundreds of gigabytes in production setups!). I have, however, specified the fast recovery area in order to perform offline RMAN backups of the repository database.

Click 'Next' once you select the desired recovery options for the database.

8. The next screen allows the DBA to select the sample schemas, which if selected, are included as part of a new tablespace called 'EXAMPLE', which is about 130 MB in size -

We need to deselect the 'Sample Schemas' option as it is not required.

The 'Custom Scripts' tab can be used to specify SQL scripts that will be executed on the database post creation -

We do not need to execute any SQL scripts after database creation, so we will select the 'No scripts to run' option and click 'Next'.

9. The next screen presents the memory, sizing, character sets and connection mode tabs -

We need to customize the memory options here -
Select memory management as 'Automatic Shared Memory Management', specify the SGA size as 2048 MB and the PGA size as 1024 MB, so that the total memory for Oracle sums up to 3072 MB.

The sizing tab contains the database block size and processes options -

Set the database block size to 8192 Bytes and the processes to 300.
Kindly note that 'processes' means the maximum number of OS user processes that can connect to the database simultaneously.

The character sets tab contains the database character set, national character set, default language and default territory options -

Use Unicode (AL32UTF8) as the database character set, UTF8 - Unicode 3.0 UTF-8 Universal character set as the national character set, and specify your default language and territory options.

The connection mode tab allows the DBA to select which mode the database must operate in -

There are two different connection modes available -
A. Dedicated Server Mode: It uses dedicated server processes.
B. Shared Server Mode: It uses shared server processes.

For more information regarding both the server process types, check the following link:
http://docs.oracle.com/cd/B28359_01/server.111/b28310/manproc001.htm

You may optionally check all the initialization parameters by clicking the 'All Initialization Parameters...' button.

Click 'Next' to continue ...

10. The next screen presents the database storage page where you can specify storage parameters for database creation -

Click on the 'Controlfile' option in the left pane to view the control file storage parameters -

Here, you can see the control file mirror images and the directories in which they are stored. By default, two control file mirror images are created - one in the same directory as the data files and another one in the fast recovery area. You may optionally create more images of the control files, if required, on this page. Leave the default options as they are.

The options tab allows you to specify the maximum data files, maximum redo log files and maximum redo log members in each redo log group -

By default, there can be a maximum of hundred data files, sixteen redo log files and three redo log members per redo log group for the database, i.e. Maximum Datafiles, Maximum Redo Log Files and Maximum Log Members, respectively, in the page. Leave the default options as they are.

Click on the 'Datafiles' option in the left pane for the data file related information -

There are five data files that are created by default for five tablespaces - SYSTEM, SYSAUX, UNDOTBS01, USERS and TEMP. Leave the default options as they are.

Click on the 'Redo Log Groups' option in the left pane for information related to the redo log groups and their redo log members -

By default, three redo log groups are created with one redo log member in each group.

Click on the group number in the left pane for detailed information regarding the redo log members -

By default, each redo log group has one redo log member of size 51200 KB (50MB).
We have to change the size of each redo log member of every group to 292969 KB and click 'Next'.

11. The next screen presents the database creation options -

There are three options available -
A. Create Database: It allows the DBA to create the database.
B. Save as a Database Template: It allows the DBA to save the current selection as a new database template.
C. Generate Database Creation Scripts: It allows the DBA to generate the database creation scripts, which are by default created in the {ORACLE_BASE}/admin/sid/scripts location.

We have to only select the 'Create Database' option on this screen and click 'Finish'.

A confirmation message will be displayed -

This message displays the create database - summary. Kindly go thoroughly through this message in order to spot mistakes and click 'OK' once done. You may optionally even save this message as an HTML file by clicking 'Save as an HTML file...'.

The database creation process will finally start -

After the database files are copied, the Oracle instance will be created and started -

Finally, all other pending tasks will be executed in order to complete the database creation process -

A dialog box will popup stating that the database creation has completed successfully -
Click on 'Password Management' to view the locked and unlocked database accounts -

By default, all database accounts are locked and expired, except for SYS and SYSTEM, which are needed for administering and managing the database. Here, we need to unlock the SYSMAN and DBSNMP database accounts and set up their respective passwords, as these accounts will be needed by OEM CC 12c. The SYSMAN account will be used by the DBA in order to use the OEM CC 12c application; whereas, the DBSNMP account will be used by the Oracle Management Agent 12c.

Click 'OK' and 'Exit' once done in order to quit from the DBCA utility.

So now we have created an Oracle database ready for use with OEM CC 12c. However, there are a few more initialization parameters that need to be tweaked manually before you start with the OEM CC 12c installation and configuration process.

Firstly, export the ORACLE_SID variable for your new database and drop the OEM 11g Database Control repository by firing the following commands:

[oracle@oem12c ~]$ export ORACLE_SID=<DATABASE-SID>
[oracle@oem12c ~]$ emca -deconfig dbcontrol db -repos drop -SYS_PWD <SYS-PASSWORD> -SYSMAN_PWD <SYSMAN-PASSWORD>
STARTED EMCA at Jul 25, 2013 12:11:28 AM
EM Configuration Assistant, Version 11.2.0.3.0 Production
Copyright (c) 2003, 2011, Oracle.  All rights reserved.
Enter the following information:
Database SID: oemrepo
Listener port number: 1521
----------------------------------------------------------------------
WARNING : While repository is dropped the database will be put in quiesce mode.
----------------------------------------------------------------------
Do you wish to continue? [yes(Y)/no(N)]: Y
Jul 25, 2013 12:11:47 AM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/oemrepo/emca_2013_07_25_00_11_28.log.
Jul 25, 2013 12:11:48 AM oracle.sysman.emcp.EMDBPreConfig performDeconfiguration
WARNING: EM is not configured for this database. No EM-specific actions can be performed. Some of the possible reasons may be:
 1) EM is configured with different hostname then physical host. Set environment variable ORACLE_HOSTNAME=<hostname> and re-run EMCA script
 2) ORACLE_HOSTNAME is set. Unset it and re-run EMCA script
Jul 25, 2013 12:11:48 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Dropping the EM repository (this may take a while) ...
Jul 25, 2013 12:13:44 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully dropped
Enterprise Manager configuration completed successfully
FINISHED EMCA at Jul 25, 2013 12:13:44 AM
[oracle@oem12c ~]$

Secondly, connect to the database using SQL*Plus with SYSDBA privilege and fire the following commands in BOLD -

[oracle@oem12c ~]$ sqlplus " /as sysdba"
SQL*Plus: Release 11.2.0.3.0 Production on Thu Jul 25 00:03:48 2013
Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> ALTER SYSTEM SET session_cached_cursors=200 SCOPE=SPFILE;
System altered.
SQL> ALTER SYSTEM SET shared_pool_size=600M SCOPE=SPFILE;
System altered.
SQL> ALTER SYSTEM SET job_queue_processes=20 SCOPE=SPFILE;
System altered.
SQL>ALTER DATABASE DATAFILE '/u01/app/oracle/oradata/sid/undotbs01.dbf' RESIZE 200M;
Database altered.
SQL> EXEC dbms_auto_task_admin.disable('auto optimizer stats collection',null,null);
PL/SQL procedure successfully completed.
SQL> SHUTDOWN IMMEDIATE;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> CREATE PFILE FROM SPFILE;
File created.
SQL> CREATE SPFILE FROM PFILE;
File created.
SQL> STARTUP;
ORACLE instance started.
Total System Global Area 2137886720 bytes
Fixed Size                  2230072 bytes
Variable Size             671090888 bytes
Database Buffers         1459617792 bytes
Redo Buffers                4947968 bytes
Database mounted.
Database opened.
SQL> EXIT;
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

You have finally made the Oracle database ready for use with OEM CC 12c ... Enjoy !

Hope you had a great time reading this article! :)

No comments:

Post a Comment