You are on page 1of 5

Oracle DBA Tips Corner Return to the Oracle DBA Tips Corner.

How to Recreate the Database Control Repository - (Oracle10g R1)


by Jeff Hunter, Sr. Database Administrator

Contents 1. 2. 3. 4. Overview On UNIX Systems On Windows Systems Further Reading

Overview This article provides steps-by-step details on how to remove and recreate the Database Control Repository in a 10g R1 database.

On UNIX Systems 1. Run the script $ORACLE_HOME/sysman/admin/emdrep/bin/RepManager to remove the Database Control Repository. NOTE: Type RepManager without any arguments to get a list of available options. NOTE: You will need to have the database passwords for SYS and SYSMAN to drop the Database Control Repository!
$ORACLE_HOME/sysman/admin/emdrep/bin/RepManager -connect TESTDB -action drop Enter SYS user's password : change_on_install Enter repository user name : SYSMAN Enter repository user password : sysman_password etting temporary tablespace from database... Found temporary tablespace: TEMP Checking SYS Credentials ... OK. Dropping the repository.. Quiescing DB ... Failed. Checking for Repos User ... Exists. Repos User exists.. Clearing EM Contexts ... OK. Dropping EM users ... Done. Dropping Repos User ... Done.

Dropping Roles/Synonymns/Tablespaces ... Done. Unquiescing DB ... Done. Dropped Repository Successfully.

2. After deleting the Database Control Repository, you will need to remove the configuration files. This is done by using the emca script with the -x option as shown in the following example:
3. emca -x TESTDB 4. 5. STARTED EMCA at Fri May 13 20:01:28 EDT 2005 6. May 13, 2005 8:01:28 PM oracle.sysman.emcp.EMConfig stopOMS 7. INFO: Stopping the DBConsole ... 8. Enterprise Manager configuration is completed successfully FINISHED EMCA at Fri May 13 20:01:35 EDT 2005

9. Finally, you can recreate both the Database Control schema objects and configuration files by running the emca utility and answering the prompts. For my example, the database is using Automatic Storage Management (ASM), so I will be using the -a option to emca: NOTE: You will need to have the database passwords for SYS and DBSNMP to create the Database Control Repository! NOTE: One of the prompts in the creation phase asked for the SYSMAN password. Whatever you type for this prompt is what the creation assistant will use when creating the SYSMAN database account. NOTE: Another popular type of OEM Database Control configuration is a RAC configuration that uses ASM. To generate this type of configuration, use the following:
emca -c -a 12. emca -a 13. 14. STARTED EMCA at Fri May 13 20:05:20 EDT 2005 15. Enter the following information about the database to be configured 16. Listener port number: 1521 17. Database SID: TESTDB 18. Service name: TESTDB.IDEVELOPMENT.INFO 19. Email address for notification: jhunter@idevelopment.info 20. Email gateway for notification: relay.idevelopment.info 21. ASM ORACLE_HOME [ /u01/app/oracle/product/10.1.0/db_1 ]: /u01/app/oracle/product/10.1.0/db_1 22. ASM SID [ +ASM ]: +ASM 23. ASM port [ 1521 ]: 1521 24. ASM user role [ SYSDBA ]: SYSDBA 25. ASM user name [ SYS ]: SYS 26. ASM user password: change_on_install 27. Password for dbsnmp: dbsnmp 28. Password for sysman: sysman 29. Password for sys: change_on_install 30. ----------------------------------------------------------31. 32. You have specified the following settings 33. 34. Database ORACLE_HOME ................ /u01/app/oracle/product/10.1.0/db_1 35. Enterprise Manager ORACLE_HOME ................ 36. /u01/app/oracle/product/10.1.0/db_1 37. 38. Database host name ................ linux3 39. Listener port number ................ 1521 40. Database SID ................ TESTDB 41. Service name ................ TESTDB.IDEVELOPMENT.INFO

42. Email address for notification ............... 43. 1.


jhunter@idevelopment.info Email gateway for notification ............... relay.pair.com ASM ORACLE_HOME ................ /u01/app/oracle/product/10.1.0/db_1 ASM SID ................ +ASM ASM port ................ 1521 ASM user role ................ SYSDBA ASM user name ................ SYS

44. 45. 46. 47. 48. 49. -----50. Do you wish to continue? [yes/no]: yes 51. May 13, 2005 8:06:37 PM oracle.sysman.emcp.EMConfig updateReposVars 1. INFO: Updating file /u01/app/oracle/product/10.1.0/db_1/sysman/emdrep/config/repository.vari ables ... 52. May 13, 2005 8:11:05 PM oracle.sysman.emcp.EMConfig createRepository 53. INFO: Creating repository ... 54. May 13, 2005 8:11:05 PM oracle.sysman.emcp.EMConfig perform 55. INFO: Repository was created successfully 56. May 13, 2005 8:11:09 PM oracle.sysman.emcp.EMConfig addPortEntries 57. INFO: Updating file /u01/app/oracle/product/10.1.0/db_1/install/portlist.ini 58. May 13, 2005 8:11:09 PM oracle.sysman.emcp.EMConfig updateEmdProps 59. INFO: Updating file /u01/app/oracle/product/10.1.0/db_1/sysman/config/emd.properties ... 60. May 13, 2005 8:11:09 PM oracle.sysman.emcp.EMConfig updateConfigFiles 61. INFO: targets.xml file is updated successfully 62. May 13, 2005 8:11:09 PM oracle.sysman.emcp.EMConfig updateEmomsProps 63. INFO: Updating file 64. /u01/app/oracle/product/10.1.0/db_1/sysman/config/emoms.properties ... 65. May 13, 2005 8:11:09 PM oracle.sysman.emcp.EMConfig updateConfigFiles 66. INFO: emoms.properties file is updated successfully 67. May 13, 2005 8:11:13 PM oracle.sysman.emcp.EMConfig startOMS 68. INFO: Starting the DBConsole ... 69. May 13, 2005 8:13:17 PM oracle.sysman.emcp.EMConfig perform 70. INFO: DBConsole is started successfully 71. May 13, 2005 8:13:17 PM oracle.sysman.emcp.EMConfig perform 72. INFO: >>>>>>>>>>> The Enterprise Manager URL is http://linux3:5500/em <<<<<<<<<<< 73. Enterprise Manager configuration is completed successfully 74. FINISHED EMCA at Fri May 13 20:13:17 EDT 2005 75. Access to the new repository is http://<Machine Name>:5500/em/ http://linux3.idevelopment.info:5500/em/

On Windows Systems The procedures for recreating the Database Control Repository in Windows is identical to that on UNIX platforms. 1. Run the script %ORACLE_HOME%\sysman\admin\emdrep\bin\RepManager to remove the Database Control Repository. NOTE: The RepManager script in 10.1.0.2.0 does not work correctly on Windows. For this reason, you will have to manually drop the SYSMAN schema and all management objects. The RepManager script should be fully functional in release 10.1.0.3.0

2. %ORACLE_HOME%\sysman\admin\emdrep\bin\RepManager -connect TESTDB -action drop <Answer screen prompts>

Logon SQL*Plus as user SYS or SYSTEM, and drop the SYSMAN account and mangement objects:
SQL> SQL> SQL> SQL> SQL> SQL> SHUTDOWN IMMEDIATE; STARTUP RESTRICT; EXEC sysman.emd_maintenance.remove_em_dbms_jobs; EXEC sysman.setEMUserContext('',5); REVOKE dba FROM sysman; 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; / SQL> DROP USER mgmt_view CASCADE; SQL> DROP ROLE mgmt_user; SQL> DROP USER sysman CASCADE; SQL> ALTER SYSTEM DISABLE RESTRICTED SESSION;

3. After deleting the Database Control Repository, you will need to remove the configuration files. This is done by using the emca script with the -x option as shown in the following example:
emca -x TESTDB

4. Finally, you can recreate both the Database Control schema objects and configuration files by running the emca utility and answering the prompts. NOTE: You will need to have the database passwords for SYS and DBSNMP to create the Database Control Repository! NOTE: One of the prompts in the creation phase asked for the SYSMAN password. Whatever you type for this prompt is what the creation assistant will use when creating the SYSMAN database account.
emca

5.

Access to the new repository is:

http://<Machine Name>:5500/em/

Further Reading

Additional information on emca command-line options can be found in the Oracle Enterprise Manager 10g Advanced Configuration Guide. This guide is available from OTN at the following address http://download-west.oracle.com/docs/pdf/B12013_01.pdf.
Copyright (c) 1998-2006 Jeffrey M. Hunter. All rights reserved. All articles, scripts and material located at the Internet address of http://www.idevelopment.info is the copyright of Jeffrey M. Hunter and is protected under copyright laws of the United States. This document may not be hosted on any other site without my express, prior, written permission. Application to host any of the material elsewhere can be made by contacting me at jhunter@idevelopment.info. I have made every effort and taken great care in making sure that the material included on my web site is technically accurate, but I disclaim any and all responsibility for any loss, damage or destruction of data or any other property which may arise from relying on it. I will in no case be liable for any monetary damages arising from such loss, damage or destruction. Last modified on Wednesday, 23-Aug-2006 18:36:08 EDT Page Count: 8934