Configure DBConsole as Active/passive

Sometimes Database Configured as Active/Passive ( Cluster ) Which mean one node working/time and regarding to this if the failover happened on 2nd node the customer will expected that everything will be the same as it was on node 1 include to this Dbconsole.

To do this follow the below steps :-

  • Database should be configured on VIP.
  • Listener should be configured on VIP.
  • Database , Configuration should be installed on Shared Storage
  • inventory Files should be on shared storage as well.
  • ORACLE_HOSTNAME Should be set to VIP Hostname.
Listener example :-

LISTENER  =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = VIP-HOST )(PORT = 1521))
)

Don’t forget to set the LOCAL_LISTENER Parameter :-

SQL> alter system set local_listener=’LISTENER’;

Or

SQL> alter system set local_listener='(ADDRESS = (PROTOCOL = TCP)(HOST = VIP-HOST )(PORT = 1521)) ‘;

Now

export ORACLE_HOSTNAME=VIP-HOSTNAME
emca -config dbcontrol db -repos create

Test the failover on node #2

if for some reason when you try to start emctl and the error still asking for oc4j then export ORACLE_HOSTNAME is bash_profile.

It should work

Cheers
Osama 

Most Common Dbcontrol issue

After while on Different oracle Forums, I notice that people Facing lot of issues with dbcontrol/dbconsole, Today i will post the most common Issue about dbcontrol and how to solve it.

Notice that sometime the Solution will be different Regarding to DB version and OS Version I will Post Some MOS notes that could help you. Sometimes you need to apply Patch and on other hand there’s Workaround.

Error #1 : 

Exception in thread “main” oracle.sysman.emcp.exception.DatabaseUnavailableException: Database instance unavailable

Solution :

  1. -Make Sure you Database is Up and Running.
  2. -Set/export ORACLE_SID.
  3. -Check if Database registered with Listener.

You can get back to this MOS note :
EMCA fails with “SEVERE: Database instance unavailable” [ID 750697.1]

EMCA fails with Database Instance is unavailable. Fix the ORA error thrown and run EM Configuration Assistant again. [ID 1511262.1]

Creating dbconsole 11.2 fails with “Exception in thread “main” oracle.sysman.emcp.exception.DatabaseUnavailableException: Database instance unavailable” on Windows [ID 1332546.1]

Error #2:

Running EMCA fails with “SEVERE: Invalid username/password”

Solution :

  1. -Make Sure You Insert Correct Password.
  2. -In Some Version you can use “Password” 
  3. -Recreate Password File.

You can Get back to this MOS note :
Problem: Running EMCA fails with “SEVERE: Invalid username/password” [ID 744176.1]

EMCA fails with SEVERE: Invalid username/password or database/scan listener not up or database service is not registered with scan listener. [ID 1330272.1]

Error  #3:

WARNING: ORA-01031: insufficient privileges

Solution

You need to check the logs, different error could be appear.

Failed to unlock all EM-related accounts

Alter User Identified By

Also Check MOS Notes :
Troubleshooting the ‘ORA-01031: insufficient privileges’ error when using EMCA to Create or Drop DBconsole [ID 358201.1]

Error #4:

SEVERE: Listener is not up or database service is not registered with it. Start the Listener and register database service and run EM Configuration Assistant again .

Solution :

  1. – set/export ORACLE_SID
  2. -Check your Listener.
  3. -Check if Database Registered.

Check the below MOS note :

Troubleshooting the EMCA Error “ORA-12514” “Listener is not up. Start the Listener and run EM Configuration Assistant again” When Creating or Dropping DBConsole [ID 368591.1]

EMCA Fails With Error “ORA-12541: TNS:no listener” and “Listener is not up. Start the Listener and run EM Configuration Assistant again” [ID 975024.1]

Drop DB Control Repository

I know that i post this topic before , you use emca to drop dbcontrol but what if this command fails 

what should i do ? I post This Topic to show second way to drop dbcontrol let Start :
 
emca
should be used to drop DB Control repository as follows:
emca -deconfig dbcontrol db -repos drop

Steps :

1.Shutdown database

 SHUTDOWN IMMEDIATE;

2.Remove EM job

EXEC sysman.emd_maintenance.remove_em_dbms_jobs;

3.Revoke DBA privilages from SYSMAN user

REVOKE dba FROM sysman;

4.Run 

DECLARE
  CURSOR c1 IS
  SELECT owner, synonym_name name
  FROM dba_synonyms
  WHERE table_owner = 'SYSMAN';
BEGIN
  FOR r1 IN c1 LOOP
    IF r1.owner = 'PUBLIC' THEN
      EXECUTE IMMEDIATE 'DROP PUBLIC SYNONYM '||r1.name;
    ELSE
      EXECUTE IMMEDIATE 'DROP SYNONYM '||r1.owner||'.'||r1.name;
    END IF;
  END LOOP;
END;
/

 5.Drop MGMT_VIEW user.

DROP USER MGMT_VIEW CASCADE;

6.Drop MGMT_VIEW role

DROP ROLE mgmt_user;

7.Drop SYSMAN user

DROP USER sysman CASCADE;

8.Disable restricted mode

ALTER SYSTEM DISABLE RESTRICTED SESSION;

 Thank you
Osama

    ORA-01034: ORACLE not available When Create DBCONSOLE

    ORA-01034: ORACLE not available When Create DBCONSOLE / DBCONTROL

    If you are using the following Command :

        $ emca -deconfig dbcontrol db -repos drop

        $ emca -config dbcontrol db -repos create

    Try Use


    emca -config dbcontrol db -repos recreate -ORACLE_HOSTNAME “Hostname”
      -SID “SID” -PORT “PortNumber” -ORACLE_HOME $ORACLE_HOME -DBDNMP_PWD  “Password”

    It Should be Work

    Thank you
    Osama mustafa

    DBCONSOLE For Real Application Cluster

    Drop DBCONSOLE FOR RAC (Uninstall) : 



    we will user the following command :

    emca -deconfig dbcontrol db -repos drop -cluster

    Make sure you have the below information :

    • Database unique name
    • Listener port number
    • Password for SYS user
    • Password for SYSMAN user

    Create DBCONSOLE FOR RAC ( Install) : 

    In this case you have more than one choice you can use what you want depend on your requirements :

    1-

    emca -config dbcontrol db -repos create -cluster

    2-

     emca -reconfig dbcontrol –cluster –EM_NODE node1 -EM_NODE_LIST node2,node3,node4

    emca -reconfig dbcontrol –cluster –EM_NODE node5 -EM_NODE_LIST node6,node7,node8

     The below Information for installing DBCONSOLE :

    • The Database unique name
    • The Listener port number
    • The Cluster name
    • The Password for SYS user
    • The Password for DBSNMP user
    • The Password for SYSMAN user
    • The Email address for notifications (optional)
    • The Outgoing Mail (SMTP) server for notifications (optional)
    • The ASM ORACLE_HOME e.g. /u01/app/asm/product/10.2.0
    • The ASM port e.g. 1521
    • The ASM user role e.g. SYSDBA
    • The ASM username e.g. SYS
    • The ASM user password

    Note : Sometimes you need to put the password between “” . 
    Thank you
    Osama mustafa

    Change Enterprise manager password for 11g

    For the DB Control Release 11.2 and higher, you need to set the environment variable ORACLE_UNQNAME to the value of the DB_UNIQUE_NAME database parameter.

    Steps :

    1.Stop the DB Control
    On Unix
    $ emctl stop dbconsole

    On Windows
    Open a Command Window and type
    **> emctl stop dbconsole

    2.Check that the DB Control is stopped
     On Unix
    $ emctl status dbconsole
     

    On Windows
    Open a Command Window and type
     **>emctl status dbconsole

    3.Connect to the database as a user with DBA privilege with SQL*Plus and execute:

    SQL> alter user sysman identified by ;
     
    4.Check the new password
    SQL> connect sysman/[@database_alias]
     
    5.From the database directory $ORACLE_HOME/bin, execute:
    On Unix

    $ emctl setpasswd dbconsole
    Provide the new SYSMAN password
     
    On Windows

    **>: emctl setpasswd dbconsoleProvide the new SYSMAN password
     
    6.Restart the DB Control
    On Unix
    $ emctl start dbconsole
     
    On Windows
    Open a DOS Command Window and type
    **>: emctl start dbconsole
     

    Thank you 

    Osama Mustafa

    Change Oracle Enterprise Manager 10g Password

    How to change the password of the Database User SYSMAN when the database is hosting a DB Control Repository. 

    1.Stop the DB Control
    On Unix
    $ emctl stop dbconsole

    On Windows
    Open a Command Window and type
    **> emctl stop dbconsole

    2.Check that the DB Control is stopped
    On Unix

    $ emctl status dbconsole

    On Windows
    Open a DOS Command Window and type
    **> emctl status dbconsole


    3.Connect to the database as a user with DBA privilege with SQL*Plus and execute:

    SQL> alter user sysman identified by ;

    4.Check the new password 

    SQL> connect sysman/[@database_alias]
     

    5.Go to $ORACLE_HOME/host_sid/sysman/config do the following :

      1. Save the file emoms.properties to emoms.properties.orig
      2. Edit the file emoms.properties
        1. Search for the line beginning with:
          oracle.sysman.eml.mntr.emdRepPwd=
          Replace the encrypted value by the new password value
          Example:
          oracle.sysman.eml.mntr.emdRepPwd=rainbow
        2. Search for the line:
          oracle.sysman.eml.mntr.emdRepPwdEncrypted=TRUE
          Replace TRUE by FALSE

    6.Restart the DB Control
    On Unix

    $ emctl start dbconsole
     
    Open a DOS Command Window and type
    **> emctl start dbconsole
     
     
    7.Check that the password has been encrypted
    1. Edit the file $ORACLE_HOME/host_sid/sysman/config/emoms.properties
      1. Search for the line beginning with:
        oracle.sysman.eml.mntr.emdRepPwd=
        Check that the password is encrypted
      2. Search for the line beginning with:
        oracle.sysman.eml.mntr.emdRepPwdEncrypted=
        Check that the value is TRUE

    I Publish the same lesson but on 11g .

      Thank you 
    Osama mustafa  

     

    Create Enterprise manager for RAC (Real Application Cluster)

    Hi All ,

    Sometimes we need to create enterprise manager for Rac Environment , its the same way for One instance with different Command . 

    We are here talk about 10g , 11g database .
    you follow the below steps to create or recreate enterprise manager LET’S START :

    if you already have RAC – enterprise manager and you need to recreate then start from here

    **Stop Dbconsole for the both nodes :

    Commands :

    On Node-1
    emctl stop dbconsole .
    On Node 2 :
    emctl stop dbconsole .

    **Drop dbconsole with re posterity from node 1 :

    Command :

    $emca -deconfig dbcontrol db -repos drop -cluster

    “you will wait for while until repos been dropped”.

    **recreate dbconsole with re posterity from node 1 “if you don’t have EM for your Rac start from here”
    Command :

    $emca -config dbcontrol db -repos create -cluster 

    “follow the instsruction and fill the information such as DB SID,Listener Port , Crs Name”

    To know your CRS NAME :
    $CRS_HOME/bin/cemutlo -n

    the output will be your crs name .

    Thank you
    Osama mustafa 

    OC4J issue in Enterprise Manager

    Hi Friends, recently i tried to configure Oracle enterprise manager in one of my database and issued below command

    $ emctl status dbconsole

    i got the following ouput
    OC4J Configuration issue. /opt/oracle/oracle/product/10.2.0/DB/oc4j/j2ee/OC4J_DBConsole_iss.dk_PAS not found.
    Then i found that we need to have a directory in the specified location with specified name and i found a directory called OC4J_DBConsole. Then i renamed it to OC4J_DBConsole_iss.dk_PAS which solved the issue.
    Hope this may help you and in next post i will present different EM commands.
    maybe you need to kill the process :

    1-ps -ef | grep oc4j
    2-Kill -9 PID

    Oracle Enterprise Manager 10.2.0.4 Unable to start

    Hi All

    we gonna talk about Bug in oracle 10.2.0.4 , 10.2.0.5 since its unable to start enterprise manager after run
    “emctl start dbconsole”

    CONFIG: Oracle Enterprise Manager 10g Database Control Release 10.2.0.4.0
    Copyright (c) 1996, 2007 Oracle Corporation. All rights reserved.
    https://myhost:5501/em/console/aboutApplication
    Starting Oracle Enterprise Manager 10g Database Control
    ................................................ failed

    This error appear because the SSL certification has been end .
    But the question is what can i do ?

    Forget Enterprise manager and start using command line

    Not just kidding

    What if we try to recreate it again ?

    emca -config dbcontrol db -repos recreate

    STARTED EMCA at Jan 11, 2011 4:11:01 PM
    EM Configuration Assistant, Version 10.2.0.1.0 Production
    Copyright (c) 2003, 2005, Oracle. All rights reserved.

    Enter the following information:
    Database unique name: catest
    Database Control is already configured for the database catest
    You have chosen to configure Database Control for managing the database catest

    This will remove the existing configuration and the default settings and perform a fresh configuration
    Do you wish to continue? [yes(Y)/no(N)]: Y
    Listener port number: 1521
    Cluster name: mycluster
    Password for SYS user:
    Password for DBSNMP user:
    Password for SYSMAN user:
    Email address for notifications (optional):
    Outgoing Mail (SMTP) server for notifications (optional):

    ........

    Jan 11, 2011 4:18:05 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
    INFO: Securing Database Control (this may take a while) ...
    Jan 11, 2011 4:19:31 PM oracle.sysman.emcp.util.DBControlUtil startOMS
    INFO: Starting Database Control (this may take a while) ...
    Jan 11, 2011 4:28:38 PM oracle.sysman.emcp.EMConfig perform
    SEVERE: Error starting Database Control
    Refer to the log file at /myhost/oracle/product/10.2.0/db_1/cfgtoollogs/emca/catest/emca_2011-01-11_
    04-11-01-PM.log for more details.
    Could not complete the configuration. Refer to the log file at /myhost/oracle/product/10.2.0/db_
    1/cfgtoollogs/emca/catest/emca_2011-01-11_04-11-01-PM.log for more details.

    So what can i do in this case ? i try to recreate what more i can do ?

    ./emctl status dbconsole

    Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0
    Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved.
    https://myhost:1158/em/console/aboutApplication
    Oracle Enterprise Manager 10g is not running.

    ./emctl status agent

    Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0
    Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved.
    ---------------------------------------------------------------
    Agent is Not Running

    Refer to Oracle Metlink Doc [1222603.1]

    we need to do the following :

    1- Ignore any errors and continue with the installation or upgrade. The database will be created without errors.

    2- Apply Patch 8350262 to your Oracle Home installation using OPatch

    To apply the patch :
    A-change to Patch directory .
    B-export ORACLE_SID = ORCL
    C-export ORACLE_HOME= /u01/oracle/product/10.2.0/db_1/
    D-$ORACLE_HOME/OPatch/Opatch apply

    Invoking OPatch 10.2.0.4.2

    Oracle Interim Patch Installer version 10.2.0.4.2
    Copyright (c) 2007, Oracle Corporation. All rights reserved.

    Oracle Home : /myhost
    Central Inventory : /scratch/pchebrol/oraInventory
    from : /etc/oraInst.loc
    OPatch version : 10.2.0.4.2
    OUI version : 10.2.0.4.0
    OUI location : /myhost/oui
    Log file location : /myhost/cfgtoollogs/opatch/opatch2011-01-02_11-00-00AM.log

    ApplySession applying interim patch '8350262' to OH '/myhost'

    Running prerequisite checks...

    OPatch detected non-cluster Oracle Home from the inventory and will patch the local system only.

    Backing up files and inventory (not for auto-rollback) for the Oracle Home
    Backing up files affected by the patch '8350262' for restore. This might take a while...
    Backing up files affected by the patch '8350262' for rollback. This might take a while...

    Patching component oracle.sysman.agent.core, 10.2.0.4.0a...
    Updating jar file "/myhost/sysman/jlib/emCORE.jar" with
    "/sysman/jlib/emCORE.jar/oracle/sysman/eml/sec/fsc/FSWalletUtil.class"
    Updating jar file "/myhost/sysman/jlib/emCORE.jar" with
    "/sysman/jlib/emCORE.jar/oracle/sysman/eml/sec/rep/RepWalletUtil.class"
    Updating jar file "/myhost/sysman/jlib/emCORE.jar" with
    "/sysman/jlib/emCORE.jar/oracle/sysman/eml/sec/util/RootCert.class"
    Updating jar file "/myhost/sysman/jlib/emCORE.jar" with
    "/sysman/jlib/emCORE.jar/oracle/sysman/eml/sec/util/SecConstants.class"
    Updating jar file "/myhost/sysman/jlib/emd_java.jar" with "/sysman/jlib/emd_
    java.jar/oracle/sysman/eml/sec/fsc/FSWalletUtil.class"
    Updating jar file "/myhost/sysman/jlib/emd_java.jar" with "/sysman/jlib/emd_
    java.jar/oracle/sysman/eml/sec/rep/RepWalletUtil.class"
    Updating jar file "/myhost/sysman/jlib/emd_java.jar" with "/sysman/jlib/emd_
    java.jar/oracle/sysman/eml/sec/util/RootCert.class"
    Updating jar file "/myhost/sysman/jlib/emd_java.jar" with "/sysman/jlib/emd_
    java.jar/oracle/sysman/eml/sec/util/SecConstants.class"
    ApplySession adding interim patch '8350262' to inventory

    Verifying the update...
    Inventory check OK: Patch ID 8350262 is registered in Oracle Home inventory with proper meta-data.
    Files check OK: Files from Patch ID 8350262 are present in Oracle Home.

    OPatch succeeded.

    3-If you using linux you need to kill all dbconsole process by “KillDbconsole” you will find it in the same patch directory , if you are using windows no need to kill anything .

    $ /killDBConsole
    ORACLE_HOME=/myhost/db_1
    ORACLE_SID=caem31
    State directory = /myhost/db_1/staxd10_caem31
    WatchDog PID = 802932
    DBconsole PID = 577716
    EMAgent PID = 512156
    Killing WatchDog (pid=802932) ...
    Successfully killed process 802932
    Killing DBConsole (pid=577716) ...
    Successfully killed process 577716
    Killing EMAgent (pid=512156) ...
    Successfully killed process 512156

    4-This not optional steps you need to do it :

    ./emctl secure dbconsole -reset

    Oracle Enterprise Manager 10g Database Control Release 10.2.0.4.0
    Copyright (c) 1996, 2007 Oracle Corporation. All rights reserved.
    https://myhost:5501/em/console/aboutApplication
    Enter Enterprise Manager Root Password :
    DBCONSOLE already stopped... Done.
    Agent is already stopped... Done.
    Securing dbconsole... Started.
    Checking Repository... Done.
    Checking Em Key... Done.
    Checking Repository for an existing Enterprise Manager Root Key...
    WARNING! An Enterprise Manager Root Key already exists in
    the Repository. This operation will replace your Enterprise
    Manager Root Key.
    All existing Agents that use HTTPS will need to be
    reconfigured if you proceed. Do you wish to continue and
    overwrite your Root Key
    (Y/N) ?
    Y
    Are you sure ? Reset of the Enterprise Manager Root Key
    will mean that you will need to reconfigure each Agent
    that is associated with this OMS before they will be
    able to upload any data to it. Monitoring of Targets
    associated with these Agents will be unavailable until
    after they are reconfigured.
    (Y/N) ?
    Y
    Generating Enterprise Manager Root Key (this takes a minute)... Done.Fetching Root Certificate from
    the Repository... Done.
    Updating HTTPS port in emoms.properties file... Done.
    Generating Java Keystore... Done.
    Securing OMS ... Done.
    Generating Oracle Wallet Password for Agent.... Done.
    Generating wallet for Agent ... Done.
    Copying the wallet for agent use... Done.
    Storing agent key in repository... Done.
    Storing agent key for agent ... Done.
    Configuring Agent...
    Configuring Agent for HTTPS in DBCONSOLE mode... Done.
    EMD_URL set in /myhost/myhost/sysman/config/emd.properties
    Done.
    Configuring Key store.. Done.
    Securing dbconsole... Sucessful.

    Sometimes reset secure its not enough the same error will be appear , I know its lot of steps but i told you use command line Ok Ok what i can do just recreate enterprise manager again :

    emca -config dbcontrol db -repos recreate

    Ok are you sure its working ??!!

    emctl status dbconsole
    Oracle Enterprise Manager 10g Database Control Release 10.2.0.4.0
    Copyright (c) 1996, 2007 Oracle Corporation. All rights reserved.
    https://localhost:1158/em/console/aboutApplication
    Oracle Enterprise Manager 10g is running.
    ——————————————————————
    Logs are generated in directory N:\oracle\product\10.2.0\db/klpdbscph601.klpcph.local_KLPSTAGE01/sys
    man/log

    Thank you all
    hope this topic will be useful .