Re: emca (database control ) re-create repository always fail

From: De DBA <dedba_at_tpg.com.au>
Date: Mon, 17 Nov 2014 19:04:54 +1000
Message-ID: <5469BA36.2010108_at_tpg.com.au>



Hi Mostafa,

When the initial repository create fails, emca cannot succesfully drop the preliminary roles/users etc. it created. Because it checks for the existence of the same roles/users on subsequent invocations, it will always fail to create with the message

"SEVERE: Dbcontrol Repository already exists. Fix the error(s) and run EM Configuration Assistant again in standalone mode."

The only way to get around this is to manually drop them. I use the following script to drop and recreate a dbcontrol in 11.2.0.3:

---begin script
-- replace paths as required:
-- /u01/oracle/db/product/11.2.0.3/ - ORACLE_HOME
-- /u01/oracle/grid/product/11.2.0.3 - GRID_HOME

SET VERIFY OFF
define sysPassword=&&1
define systemPassword=&1
define sysmanPassword=&1
define asmPassword=&1
define dbsnmpPassword=&1

define HOST=<ip_address>
define HOSTNAME=<host_name>

col NAME new_value DBNAME
col DB_UNIQUE_NAME new_value DBUNQ_NAME

select name, db_unique_name from v$database;

spool &&DBNAME._&&DBUNQ_NAME.-emrecreate.log drop user sysman cascade;
drop user dmsnmp cascade;

host /bin/rm -rf $ORACLE_HOME/&&HOSTNAME._&&DBUNQ_NAME.

_at_/u01/oracle/db/product/11.2.0.3/sysman/admin/emdrep/sql/emreposcre.sql /u01/oracle/db/product/11.2.0.3 SYSMAN SYSMAN TEMP ON;

  • Recreate DBSNMP user with correct privileges etc. create user dbsnmp identified by &&dbsnmpPassword default tablespace sysaux temporary tablespace temp;

grant OEM_MONITOR, CREATE TABLE, SELECT ANY DICTIONARY, CREATE PROCEDURE, UNLIMITED TABLESPACE to dbsnmp; grant EXECUTE on SYS.DBMS_MANAGEMENT_PACKS to dbsnmp;

grant SELECT on APPQOSSYS.WLM_CLASSIFIER_PLAN to dbsnmp;
grant SELECT on APPQOSSYS.WLM_METRICS_STREAM to dbsnmp;
grant SELECT on APPQOSSYS.WLM_MPA_STREAM to dbsnmp;
grant SELECT on APPQOSSYS.WLM_VIOLATION_STREAM to dbsnmp;
grant EXECUTE on SYS.SYS_PLSQL_7945_835_1 to dbsnmp; grant SELECT on NEXTFARE_BRISBANE.SS_APPORTIONMENT_RULES to dbsnmp;
  • ensure that the sysman user has the correct password alter user sysman identified by &&sysmanPassword;
  • LISTENER runs from the GRID home
  • hostname does not resolve, so IP address must be used host /u01/oracle/db/product/11.2.0.3/bin/emca -config dbcontrol db -silent -repos create -ORACLE_HOST &&HOSTNAME -DB_UNIQUE_NAME &&DBUNQ_NAME -PORT 1521 -EM_HOME /u01/oracle/db/product/11.2.0.3 -LISTENER LISTENER -SERVICE_NAME &&DBNAME -SID &&DBNAME -ORACLE_HOME /u01/oracle/db/product/11.2.0.3 -HOST &&HOST -LISTENER_OH /u01/oracle/grid/product/11.2.0.3 -DBSNMP_PWD &&dbsnmpPassword -SYSMAN_PWD &&sysmanPassword -SYS_PWD &&sysPassword -LOG_FILE /u01/oracle/db/admin/&&DBNAME./scripts/log/emConfig.log -ASM_OH /u01/oracle/grid/product/11.2.0.3 -ASM_SID +ASM -ASM_USER_NAME ASMSNMP -ASM_USER_PWD &&asmPassword -ASM_PORT 1521;

---end script

I seem to remember that the role OEM_MONITOR can also be a problem in earlier versions, although in my 11.2.0.3 dbconsole recreate script I leave it alone. This is for an ASM instance, adapt as you need. I found that the emca commands must also be run through sqlplus "host ... " command, as they fail when run from the command prompt directly.. no idea why... (Solaris 10 & 11)

emca and friends also create loads of logfiles in many different places. It is often useful to follow the trail and check every logfile that is mentioned in the emca.log.

Hope this helps,
Tony

On 16/11/14 21:27, Mostafa Eletriby (Redacted sender m_etrib_at_yahoo.com for DMARC) wrote:
> Hello
> Kindly find log file for emca , please check.
> I like to ask if this drop & delay at recreate will affect database by any means.
>
> Thanks
>
>
> On Sunday, November 16, 2014 1:22 PM, Mostafa Eletriby <dmarc-noreply_at_freelists.org> wrote:
>
>
> Hello ,
> I had a problem at em database control & I dropped repository to re-cretae again.
>
> EM recreate repository always fail,
> I successfully drop the repository but couldn't create it.
> I used this statement:-
>
> *emca -deconfig dbcontrol db -repos drop*
> *
> *
> *emca -config dbcontrol db -repos recreate
> *
>
> Please advice.
> Regards,
>
>
> log file attached.
> -----------------------------------------------------
> Microsoft Windows [Version 6.1.7600]
> Copyright (c) 2009 Microsoft Corporation. All rights reserved.
>
> C:\Users\orasupport>SET ORACLE_HOSTNAME = localhost
>
> C:\Users\orasupport>echo %ORACLE_HOSTNAME%
> %ORACLE_HOSTNAME%
>
> C:\Users\orasupport>SET ORACLE_UNQNAME=pidb
>
> C:\Users\orasupport>emca -config dbcontrol db -repos recreate
>
> STARTED EMCA at Nov 16, 2014 1:11:05 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: pidb
> Listener port number: 1158
> Listener ORACLE_HOME [ D:\oradb\product\11.2.0\dbhome_1 ]: D:\oradb\product\11.2
> .0\dbhome_1
> Password for SYS user:
> Password for DBSNMP user:
> Password for SYSMAN 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 ................ D:\oradb\product\11.2.0\dbhome_1
>
> Local hostname ................ ENR-HP-PIDB-01.ENR.gov.eg
> Listener ORACLE_HOME ................ D:\oradb\product\11.2.0\dbhome_1
> Listener port number ................ 1158
> Database SID ................ pidb
> Email address for notifications ...............
> Outgoing Mail (SMTP) server for notifications ...............
>
> -----------------------------------------------------------------
> ----------------------------------------------------------------------
> WARNING : While repository is dropped the database will be put in quiesce mode.
> ----------------------------------------------------------------------
> Do you wish to continue? [yes(Y)/no(N)]: yes
> Nov 16, 2014 1:11:44 PM oracle.sysman.emcp.EMConfig perform
> INFO: This operation is being logged at D:\oradb\cfgtoollogs\emca\PIDB\emca_2014
> _11_16_13_11_05.log.
> Nov 16, 2014 1:11:45 PM oracle.sysman.emcp.util.FileUtil backupFile
> WARNING: Could not backup file D:\oradb\product\11.2.0\dbhome_1\sysman\config\em
> d.properties
> Nov 16, 2014 1:11:45 PM oracle.sysman.emcp.util.FileUtil backupFile
> WARNING: Could not backup file D:\oradb\product\11.2.0\dbhome_1\sysman\config\em
> oms.properties
> Nov 16, 2014 1:11:45 PM oracle.sysman.emcp.util.FileUtil backupFile
> WARNING: Could not backup file D:\oradb\product\11.2.0\dbhome_1\sysman\emd\targe
> ts.xml
> Nov 16, 2014 1:11:46 PM oracle.sysman.emcp.ParamsManager checkListenerStatusForD
> BControl
> WARNING: ORA-12541: TNS:no listener
>
> Nov 16, 2014 1:11:46 PM oracle.sysman.emcp.EMConfig perform
> SEVERE:
>
> Database connection through listener failed. Fix the error and run EM Configurat
> ion Assistant again.
>
> Some of the possible reasons may be:
>
> 1) Listener port 1158 provided is incorrect. Provide the correct port.
> 2) Listener is not up. Start the Listener.
> 3) Database service PIDB is not registered with listener. Register the database
> service.
> 4) Listener is up on physical host and ORACLE_HOSTNAME environment variable is s
> et to virtual host. Unset ORACLE_HOSTNAME environment variable.
> 5) Listener is up on virtual host. Set environment variable ORACLE_HOSTNAME=<vir
> tual host>.
> 6) /etc/hosts does not have correct entry for hostname.
>
> Refer to the log file at D:\oradb\cfgtoollogs\emca\PIDB\emca_2014_11_16_13_11_05
> .log for more details.
> Could not complete the configuration. Refer to the log file at D:\oradb\cfgtooll
> ogs\emca\PIDB\emca_2014_11_16_13_11_05.log for more details.
>
> C:\Users\orasupport>
>
>
>

--
http://www.freelists.org/webpage/oracle-l
Received on Mon Nov 17 2014 - 10:04:54 CET

Original text of this message