Experience: is what you get soon after you need it.

Experience: is what you get soon after you need it.

Rasul Allah (sal Allahu alaihi wa sallam) said: "Restore the trusts of those who trust you, and deal not falsely with him who deals falsely with you." [Abu Dawud, Tirmidhi]

Search This Blog

Sunday, September 20, 2015

Use Enterprise Manager Configuration Assistant(EMCA) utility

Use Enterprise Manager Configuration Assistant(EMCA) utility


Using Database Control, you can perform administrative tasks such as creating schema objects (tables, views, indexes, and so on), managing user security, managing database memory and storage, backing up and recovering your database, and importing and exporting data. You can also view performance and status information about your database.

Files that are common and shared among all instances of the database are stored in the following directory:
$ORACLE_HOME/sysman


Files that are unique to each instance of the database are stored in the following directory:

  • $ORACLE_HOME/hostname_dbuniquename/ (for a single-instance database)
  • $ORACLE_HOME/nodename_dbuniquename/ (for an Oracle Real Applications Cluster (Oracle RAC) database)

Ex:-

[oracle@collabn1 SHAIKPROD]$ ls -ld collabn1*

drwxr----- 3 oracle oinstall 4096 Sep  5 00:56 collabn1_orcl
drwxr----- 3 oracle oinstall 4096 Sep 20 11:34 collabn1_SHAIKDB
drwxr----- 3 oracle oinstall 4096 Aug  3 01:26 collabn1_SHAIKPRD
drwxr----- 3 oracle oinstall 4096 Aug  1 18:21 collabn1.shaiksameer_SHAIKPRD1


Directory Structure in the Management Service Home for Release 11g or Later

Screen Shot 2015-09-20 at 11.36.19 AM.png


Drop db control repository:


[oracle@collabn1 ~]$ emca -deconfig dbcontrol db -repos drop

STARTED EMCA at Sep 20, 2015 11:28:01 AM
EM Configuration Assistant, Version 11.2.0.0.2 Production
Copyright (c) 2003, 2005, Oracle.  All rights reserved.

Enter the following information:
Database SID: SHAIKDB
Listener port number: 1522
Password for SYS user:  
Password for SYSMAN user:  

Do you wish to continue? [yes(Y)/no(N)]: y
Sep 20, 2015 11:29:18 AM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/SHAIKDB/emca_2015_09_20_11_28_01.log.
Sep 20, 2015 11:29:18 AM oracle.sysman.emcp.EMDBPreConfig performDeconfiguration
WARNING: EM is not configured for this database. No EM-specific actions can be performed.
Sep 20, 2015 11:29:18 AM oracle.sysman.emcp.ParamsManager checkListenerStatusForDBControl
WARNING: Error initializing SQL connection. SQL operations cannot be performed
Sep 20, 2015 11:29:18 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Dropping the EM repository (this may take a while) ...
Sep 20, 2015 11:30:05 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully dropped
Enterprise Manager configuration completed successfully
FINISHED EMCA at Sep 20, 2015 11:30:05 AM



To create db control repository:

[oracle@collabn1 ~]$ emca -config dbcontrol db -repos create

STARTED EMCA at Sep 20, 2015 11:30:49 AM
EM Configuration Assistant, Version 11.2.0.0.2 Production
Copyright (c) 2003, 2005, Oracle.  All rights reserved.

Enter the following information:
Database SID: SHAIKDB
Listener port number: 1522
Listener ORACLE_HOME [ /u01/app/oracle/product/11.2.0.2/SHAIKPROD ]:
Password for SYS user:  
Password for DBSNMP user:  
Password for SYSMAN user:  
Email address for notifications (optional):
Outgoing Mail (SMTP) server for notifications (optional):
-----------------------------------------------------------------

You have specified the following settings

Database ORACLE_HOME ................ /u01/app/oracle/product/11.2.0.2/SHAIKPROD

Local hostname ................ collabn1.shaiksameer
Listener ORACLE_HOME ................ /u01/app/oracle/product/11.2.0.2/SHAIKPROD
Listener port number ................ 1522
Database SID ................ SHAIKDB
Email address for notifications ...............
Outgoing Mail (SMTP) server for notifications ...............

-----------------------------------------------------------------
Do you wish to continue? [yes(Y)/no(N)]: y
Sep 20, 2015 11:31:07 AM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/SHAIKDB/emca_2015_09_20_11_30_48.log.
Sep 20, 2015 11:31:08 AM oracle.sysman.emcp.EMReposConfig createRepository
INFO: Creating the EM repository (this may take a while) ...
Sep 20, 2015 11:34:04 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully created
Sep 20, 2015 11:34:06 AM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository
INFO: Uploading configuration data to EM repository (this may take a while) ...
Sep 20, 2015 11:34:32 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Uploaded configuration data successfully
Sep 20, 2015 11:34:33 AM oracle.sysman.emcp.util.DBControlUtil configureSoftwareLib
INFO: Software library configured successfully.
Sep 20, 2015 11:34:33 AM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary
INFO: Deploying Provisioning archives ...
Sep 20, 2015 11:34:47 AM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary
INFO: Provisioning archives deployed successfully.
Sep 20, 2015 11:34:47 AM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Securing Database Control (this may take a while) ...
Sep 20, 2015 11:35:08 AM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Database Control secured successfully.
Sep 20, 2015 11:35:08 AM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) ...
Sep 20, 2015 11:35:39 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: Database Control started successfully
Sep 20, 2015 11:35:39 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: >>>>>>>>>>> The Database Control URL is https://collabn1.shaiksameer:5501/em <<<<<<<<<<<
Sep 20, 2015 11:35:41 AM oracle.sysman.emcp.EMDBPostConfig invoke
WARNING:
************************  WARNING  ************************

Management Repository has been placed in secure mode wherein Enterprise Manager data will be encrypted.  The encryption key has been placed in the file: /u01/app/oracle/product/11.2.0.2/SHAIKPROD/collabn1_SHAIKDB/sysman/config/emkey.ora.   Please ensure this file is backed up as the encrypted data will become unusable if this file is lost.

***********************************************************
Enterprise Manager configuration completed successfully
FINISHED EMCA at Sep 20, 2015 11:35:41 AM



Using response files to create/drop the db control repository:


Create the responsefile:

[oracle@collabn1 sshaik]$ vi emca_drop.rsp
SID=SHAIKDB
SYS_PWD=test123
SYSMAN_PWD=test123
DBSNMP_PWD=test123
PORT=1522

[oracle@collabn1 sshaik]$ emca -deconfig dbcontrol db -repos drop -respfile ~/sshaik/emca_drop.rsp

STARTED EMCA at Sep 20, 2015 11:49:56 AM
EM Configuration Assistant, Version 11.2.0.0.2 Production
Copyright (c) 2003, 2005, Oracle.  All rights reserved.

Enter the following information:

Do you wish to continue? [yes(Y)/no(N)]: y
Sep 20, 2015 11:50:00 AM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/SHAIKDB/emca_2015_09_20_11_49_56.log.
Sep 20, 2015 11:50:00 AM oracle.sysman.emcp.util.DBControlUtil stopOMS
INFO: Stopping Database Control (this may take a while) ...
Sep 20, 2015 11:50:20 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Dropping the EM repository (this may take a while) ...
Sep 20, 2015 11:51:22 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully dropped
Enterprise Manager configuration completed successfully
FINISHED EMCA at Sep 20, 2015 11:51:23 AM


Create the em repository using response file:

Response file:

[oracle@collabn1 SHAIKPROD]$ cat ~/sshaik/emca_create_rsp
SID=SHAIKDB
SYS_PWD=test123
SYSMAN_PWD=test123
DBSNMP_PWD=test123
PORT=1522
LISTENER_OH=/u01/app/oracle/product/11.2.0.2/SHAIKPROD
ORACLE_HOME=/u01/app/oracle/product/11.2.0.2/SHAIKPROD

[oracle@collabn1 sshaik]$ emca -config dbcontrol db -repos create -silent -respfile ~/sshaik/emca_drop.rsp

STARTED EMCA at Sep 20, 2015 11:57:08 AM
EM Configuration Assistant, Version 11.2.0.0.2 Production
Copyright (c) 2003, 2005, Oracle.  All rights reserved.

Sep 20, 2015 11:57:09 AM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/SHAIKDB/emca_2015_09_20_11_57_08.log.
Sep 20, 2015 11:57:10 AM oracle.sysman.emcp.EMReposConfig createRepository
INFO: Creating the EM repository (this may take a while) ...
Sep 20, 2015 12:00:00 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully created
Sep 20, 2015 12:00:03 PM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository
INFO: Uploading configuration data to EM repository (this may take a while) ...
Sep 20, 2015 12:00:31 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Uploaded configuration data successfully
Sep 20, 2015 12:00:32 PM oracle.sysman.emcp.util.DBControlUtil configureSoftwareLib
INFO: Software library configured successfully.
Sep 20, 2015 12:00:32 PM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary
INFO: Deploying Provisioning archives ...
Sep 20, 2015 12:00:49 PM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary
INFO: Provisioning archives deployed successfully.
Sep 20, 2015 12:00:49 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Securing Database Control (this may take a while) ...
Sep 20, 2015 12:01:06 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Database Control secured successfully.
Sep 20, 2015 12:01:06 PM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) ...
Sep 20, 2015 12:01:39 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: Database Control started successfully
Sep 20, 2015 12:01:39 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: >>>>>>>>>>> The Database Control URL is https://collabn1.shaiksameer:5501/em <<<<<<<<<<<
Sep 20, 2015 12:01:40 PM oracle.sysman.emcp.EMDBPostConfig invoke
WARNING:
************************  WARNING  ************************

Management Repository has been placed in secure mode wherein Enterprise Manager data will be encrypted.  The encryption key has been placed in the file: /u01/app/oracle/product/11.2.0.2/SHAIKPROD/collabn1_SHAIKDB/sysman/config/emkey.ora.   Please ensure this file is backed up as the encrypted data will become unusable if this file is lost.

***********************************************************
Enterprise Manager configuration completed successfully
FINISHED EMCA at Sep 20, 2015 12:01:40 PM



Reconfigure the ports:

[oracle@collabn1 sshaik]$ emca -reconfig ports

STARTED EMCA at Sep 20, 2015 12:16:30 PM
EM Configuration Assistant, Version 11.2.0.0.2 Production
Copyright (c) 2003, 2005, Oracle.  All rights reserved.

Enter the following information:
Database SID: SHAIKDB
Password for SYS user:  

Do you wish to continue? [yes(Y)/no(N)]: y
Sep 20, 2015 12:16:46 PM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/SHAIKDB/emca_2015_09_20_12_16_30.log.
Sep 20, 2015 12:16:46 PM oracle.sysman.emcp.util.DBControlUtil stopOMS
INFO: Stopping Database Control (this may take a while) ...
Sep 20, 2015 12:17:06 PM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) ...
Sep 20, 2015 12:17:33 PM oracle.sysman.emcp.EMDBPostConfig performReconfiguration
INFO: Database Control started successfully
Sep 20, 2015 12:17:33 PM oracle.sysman.emcp.EMDBPostConfig performReconfiguration
INFO: >>>>>>>>>>> The Database Control URL is https://collabn1.shaiksameer:5502/em <<<<<<<<<<<
Enterprise Manager configuration completed successfully
FINISHED EMCA at Sep 20, 2015 12:17:33 PM


EMCA reads the emca.properties file and assigns the ports automatically:

cat /u01/app/oracle/product/11.2.0.2/SHAIKPROD/sysman/config/emca.properties

# EMCA Properties File

#Default Port Ranges

# Agent Port Ranges
AGENT_PORT_MIN=1830
AGENT_PORT_MAX=1849

# DB Control Agent Port assigned by IANA
AGENT_PORT_DEFAULT=3938

DBCONTROL_HTTP_PORT_MIN=5500
DBCONTROL_HTTP_PORT_MAX=5519

# DB Control Http Port assigned by IANA
DBCONTROL_HTTP_PORT_DEFAULT=1158

# RMI Port Ranges
RMI_PORT_MIN=5520
RMI_PORT_MAX=5539

# DB Control RMI Port assigned by IANA
RMI_PORT_DEFAULT=-1

# JMS Port Ranges
JMS_PORT_MIN=5540
JMS_PORT_MAX=5559


If you would like to provide the ports manually then create a response file and assign it:

[oracle@collabn1 sshaik]$ vi emca_ports.rsp
SID=SHAIKDB
SYS_PWD=test123
SYSMAN_PWD=test123
DBSNMP_PWD=test123
PORT=1522
LISTENER_OH=/u01/app/oracle/product/11.2.0.2/SHAIKPROD
ORACLE_HOME=/u01/app/oracle/product/11.2.0.2/SHAIKPROD
#Ports for db agent
JMS_PORT_MIN=3331
AGENT_PORT=3334
DBCONTROL_HTTP_PORT=3333
RMI_PORT=3335


[oracle@collabn1 sshaik]$ emca -reconfig ports -silent -respfile ~/sshaik/emca_ports.rsp

STARTED EMCA at Sep 20, 2015 12:26:08 PM
EM Configuration Assistant, Version 11.2.0.0.2 Production
Copyright (c) 2003, 2005, Oracle.  All rights reserved.


Sep 20, 2015 12:26:09 PM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/SHAIKDB/emca_2015_09_20_12_26_08.log.
Sep 20, 2015 12:26:09 PM oracle.sysman.emcp.util.DBControlUtil stopOMS
INFO: Stopping Database Control (this may take a while) ...
Sep 20, 2015 12:26:28 PM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) ...
Sep 20, 2015 12:26:55 PM oracle.sysman.emcp.EMDBPostConfig performReconfiguration
INFO: Database Control started successfully
Sep 20, 2015 12:26:55 PM oracle.sysman.emcp.EMDBPostConfig performReconfiguration
INFO: >>>>>>>>>>> The Database Control URL is https://collabn1.shaiksameer:3333/em <<<<<<<<<<<
Enterprise Manager configuration completed successfully
FINISHED EMCA at Sep 20, 2015 12:26:55 PM


[oracle@collabn1 sshaik]$ emctl status dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0
Copyright (c) 1996, 2009 Oracle Corporation.  All rights reserved.
https://collabn1.shaiksameer:3333/em/console/aboutApplication
Oracle Enterprise Manager 11g is running.
------------------------------------------------------------------
Logs are generated in directory /u01/app/oracle/product/11.2.0.2/SHAIKPROD/collabn1_SHAIKDB/sysman/log


Lets convert dbconsole to use non-ssl (http) or unsecure port:

[oracle@collabn1 sshaik]$ emctl unsecure dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0
Copyright (c) 1996, 2009 Oracle Corporation.  All rights reserved.
https://collabn1.shaiksameer:3333/em/console/aboutApplication
Configuring DBConsole for HTTP...   Done.
DBCONSOLE successfully stopped...   Done.
Agent is already stopped...   Done.
Unsecuring dbconsole...   Started.
DBConsole is now unsecured...  Done.
Unsecuring dbconsole...  Sucessful.
DBCONSOLE successfully restarted...   Done.



[oracle@collabn1 sshaik]$ emctl status dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0
Copyright (c) 1996, 2009 Oracle Corporation.  All rights reserved.
http://collabn1.shaiksameer:3333/em/console/aboutApplication
Oracle Enterprise Manager 11g is running.
------------------------------------------------------------------
Logs are generated in directory /u01/app/oracle/product/11.2.0.2/SHAIKPROD/collabn1_SHAIKDB/sysman/log

Access the URL and Verify you are able to login:



Documentation:
Database Administration → 10. Managing Oracle Enterprise Manager Database Control

No comments: