C:\>
emca -deconfig dbcontrol db
EMCA 开始于 2010-7-16 9:29:21
EM Configuration Assistant, 11.2.0.0.2 正式版 版权所有 (c) 2003, 2005, Oracle。保留所有权利。
输入以下信息:
数据库 SID: orcl
是否继续? [是(Y)/否(N)]: y
2010-7-16 9:29:28 oracle.sysman.emcp.EMConfig perform 信息: 正在将此操作记录到 C:\app\Administrator\cfgtoollogs\emca\orcl\emca_2010_07 _16_09_29_21.log。 2010-7-16 9:29:28 oracle.sysman.emcp.EMDBPreConfig performDeconfiguration 警告: 此数据库的 EM 尚未配置。无法执行特定于 EM 的操作。 已成功完成 Enterprise Manager 的配置 EMCA 结束于 2010-7-16 9:29:28
C:\>
emca -repos drop
EMCA 开始于 2010-7-16 9:30:15
EM Configuration Assistant, 11.2.0.0.2 正式版 版权所有 (c) 2003, 2005, Oracle。保留所有权利。
输入以下信息:
数据库 SID: orcl 监听程序端口号: 1521 SYS 用户的口令: SYSMAN 用户的口令: le SYSMAN 用户的口令: 是否继续? [是(Y)/否(N)]: y 2010-7-16 9:30:27 oracle.sysman.emcp.EMConfig perform 信息: 正在将此操作记录到 C:\app\Administrator\cfgtoollogs\emca\orcl\emca_2010_07 _16_09_30_15.log。 2010-7-16 9:30:28 oracle.sysman.emcp.EMReposConfig invoke 信息: 正在删除 EM 资料档案库 (此操作可能需要一段时间)... 2010-7-16 9:34:21 oracle.sysman.emcp.EMReposConfig invoke 信息: 已成功删除资料档案库 已成功完成 Enterprise Manager 的配置 EMCA 结束于 2010-7-16 9:34:21 C:\> emca -config dbcontrol db -repos create
EMCA 开始于 2010-7-16 9:37:21
EM Configuration Assistant, 11.2.0.0.2 正式版 版权所有 (c) 2003, 2005, Oracle。保留所有权利。
输入以下信息:
数据库 SID: orcl 监听程序端口号: 1521 监听程序 ORACLE_HOME [ C:\app\Administrator\product\11.2.0\dbhome_1 ]: SYS 用户的口令: DBSNMP 用户的口令: SYSMAN 用户的口令: SYSMAN 用户的口令: 通知的电子邮件地址 (可选): 通知的发件 (SMTP) 服务器 (可选): -----------------------------------------------------------------
已指定以下设置
数据库 ORACLE_HOME ................ C:\app\Administrator\product\11.2.0\dbhome_1
本地主机名 ................ 192.168.0.228 监听程序 ORACLE_HOME ................ C:\app\Administrator\product\11.2.0\dbhome _1 监听程序端口号 ................ 1521 数据库 SID ................ orcl 通知的电子邮件地址 ............... 通知的发件 (SMTP) 服务器 ...............
-----------------------------------------------------------------
是否继续? [是(Y)/否(N)]: y 2010-7-16 9:37:49 oracle.sysman.emcp.EMConfig perform 信息: 正在将此操作记录到 C:\app\Administrator\cfgtoollogs\emca\orcl\emca_2010_07 _16_09_37_21.log。 2010-7-16 9:37:51 oracle.sysman.emcp.EMReposConfig createRepository 信息: 正在创建 EM 资料档案库 (此操作可能需要一段时间)... 2010-7-16 9:50:00 oracle.sysman.emcp.EMReposConfig invoke 信息: 已成功创建资料档案库 2010-7-16 9:50:17 oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository 信息: 正在将配置数据上载到 EM 资料档案库 (此操作可能需要一段时间)... 2010-7-16 9:52:21 oracle.sysman.emcp.EMReposConfig invoke 信息: 已成功上载配置数据 2010-7-16 9:52:54 oracle.sysman.emcp.util.DBControlUtil configureSoftwareLib 信息: 软件库已配置成功。 2010-7-16 9:52:54 oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary 信息: 正在部署预配档案... 2010-7-16 9:53:53 oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary 信息: 预配档案部署成功。 2010-7-16 9:53:53 oracle.sysman.emcp.util.DBControlUtil secureDBConsole 信息: 正在保护 Database Control (此操作可能需要一段时间)... 2010-7-16 9:54:09 oracle.sysman.emcp.util.DBControlUtil secureDBConsole 信息: 已成功保护 Database Control。 2010-7-16 9:54:09 oracle.sysman.emcp.util.DBControlUtil startOMS 信息: 正在启动 Database Control (此操作可能需要一段时间)... 2010-7-16 9:55:45 oracle.sysman.emcp.EMDBPostConfig performConfiguration 信息: 已成功启动 Database Control 2010-7-16 9:56:15 oracle.sysman.emcp.EMDBPostConfig performConfiguration 信息: >>>>>>>>>>> Database Control URL 为 https://192.168.0.228:1158/em <<<<<<<< <<< 2010-7-16 9:56:19 oracle.sysman.emcp.EMDBPostConfig invoke 警告: ************************ WARNING ************************
管理资料档案库已置于安全模式下, 在此模式下将对 Enterprise Manager 数据进行加密。
加密密钥已放置在文件 C:/app/Administrator/product/11.2.0/dbhome_1/192.168.0.228_ orcl/sysman/config/emkey.ora 中。请务必备份此文件, 因为如果此文件丢失, 则加密数 据将不可用。
***********************************************************
已成功完成 Enterprise Manager 的配置 EMCA 结束于 2010-7-16 9:56:19
C:\>emctl status dbconsole
Environment variable ORACLE_UNQNAME not defined. Please set ORACLE_UNQNAME to da tabase unique name.
C:\>
set ORACLE_UNQNAME=orcl
C:\>
emctl status dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0 Copyright (c) 1996, 2010 Oracle Corporation. All rights reserved. https://192.168.0.228:1158/em/console/aboutApplication Oracle Enterprise Manager 11g is running. ------------------------------------------------------------------ Logs are generated in directory C:\app\Administrator\product\11.2.0\dbhome_1/192 .168.0.228_orcl/sysman/log
C:\>
不同情况下删除em往往不顺利,以下方法供参考
参考
http://www.blogjava.net/jinfeng_wang/archive/2009/10/20/299111.html
建议在windows环境中 增加系统环境变量
ORACLE_UNQNAME=orcl --全局唯一名 一般指实例名 ORACLE_HOSTNAME=localhost --侦听位置 一般是主机名或ip地址 我的机器设置为localhost了
我的机器侦听地址改为localhost了 ,当初em创建时,侦听主机名
卸载时 em会找原先的配置文件,所以需要有此目录 才不会提示遇到严重错误。
1) 卸载em
没有以下目录要改名 emca从这里面找些信息去清理(骗骗emca 详看日志C:\app\Administrator\cfgtoollogs\emca\orcl\XXX.log)
mkdir C:\app\Administrator\product\11.2.0\dbhome_1\WWW-E22C46B98BD_orcl mkdir C:\app\Administrator\product\11.2.0\dbhome_1\oc4j\j2ee\OC4J_DBConsole_WWW-E22C46B98BD_orcl
emca -deconfig dbcontrol db
设置环境变量 否则连接串老是不对
set ORACLE_HOSTNAME=localhost emca -repos drop 2) 清理em在数据库中的垃圾信息
drop user SYSMAN cascade;
drop user MGMT_VIEW cascade; drop role MGMT_USER; drop public synonym MGMT_TARGET_BLACKOUTS; drop public synonym SETEMVIEWUSERCONTEXT; drop user sysman cascade; drop public synonym MGMT_ADMIN; drop public synonym MGMT_AS_ECM_UTIL; drop public synonym MGMT_AVAILABILITY; drop public synonym MGMT_COLLECTION_PROPERTIES; drop public synonym MGMT_CREDENTIAL; drop public synonym MGMT_CURRENT_AVAILABILITY; drop public synonym MGMT_CURRENT_METRICS; drop public synonym MGMT_CURRENT_METRIC_ERRORS; drop public synonym MGMT_CURRENT_SEVERITY; drop public synonym MGMT_DELTA; drop public synonym MGMT_DELTA_ENTRY; drop public synonym MGMT_DELTA_ENTRY_VALUES; drop public synonym MGMT_DELTA_IDS; drop public synonym MGMT_DELTA_ID_VALUES; drop public synonym MGMT_DELTA_VALUE; drop public synonym MGMT_DELTA_VALUES; drop public synonym MGMT_GLOBAL; drop public synonym MGMT_GUID_ARRAY; drop public synonym MGMT_GUID_OBJ; drop public synonym MGMT_IP_TGT_GUID_ARRAY; drop public synonym MGMT_JOB; drop public synonym MGMT_JOBS; drop public synonym MGMT_JOB_EXECPLAN; drop public synonym MGMT_JOB_EXECUTION; drop public synonym MGMT_JOB_EXEC_SUMMARY; drop public synonym MGMT_JOB_OUTPUT; drop public synonym MGMT_JOB_PARAMETER; drop public synonym MGMT_JOB_SCHEDULE; drop public synonym MGMT_JOB_TARGET; drop public synonym MGMT_LOG; drop public synonym MGMT_LONG_TEXT; drop public synonym MGMT_MESSAGES; drop public synonym MGMT_METRICS;drop public synonym MGMT_METRICS_1DAY; drop public synonym MGMT_METRICS_1HOUR; drop public synonym MGMT_METRICS_COMPOSITE_KEYS; drop public synonym MGMT_METRICS_RAW; drop public synonym MGMT_METRIC_COLLECTIONS; drop public synonym MGMT_METRIC_ERRORS; drop public synonym MGMT_METRIC_THRESHOLDS; drop public synonym MGMT_NAME_VALUE; drop public synonym MGMT_NAME_VALUES; drop public synonym MGMT_PREFERENCES; drop public synonym MGMT_SEVERITY; drop public synonym MGMT_SEVERITY_ARRAY; drop public synonym MGMT_SEVERITY_OBJ; drop public synonym MGMT_STRING_METRIC_HISTORY; drop public synonym MGMT_TARGET; drop public synonym MGMT_TARGETS; drop public synonym MGMT_TARGET_BLACKOUTS; drop public synonym MGMT_TARGET_MEMBERSHIPS; drop public synonym MGMT_TARGET_PROPERTIES; drop public synonym MGMT_TYPE_PROPERTIES; drop public synonym MGMT_USER; drop public synonym MGMT_VIEW_UTIL; drop public synonym MGMT$DELTA_ORACLE_HOME; drop public synonym MGMT$DELTA_OS_COMPONENTS; drop public synonym MGMT$DELTA_OS_COMP_DETAILS; drop public synonym MGMT$DELTA_OS_KERNEL_PARAMS; drop public synonym MGMT$DELTA_PATCHSETS; drop public synonym MGMT$DELTA_PATCHSET_DETAILS; drop public synonym MGMT$DELTA_TABLESPACES; drop public synonym MGMT$DELTA_VENDOR_SW; drop public synonym MGMT$DELTA_VIEW; drop public synonym MGMT$DELTA_VIEW_DETAILS; drop public synonym MGMT$ECM_CURRENT_SNAPSHOTS; drop public synonym MGMT$ECM_VISIBLE_SNAPSHOTS; drop public synonym MGMT$GROUP_DERIVED_MEMBERSHIPS; drop public synonym MGMT$GROUP_FLAT_MEMBERSHIPS; drop public synonym MGMT$GROUP_MEMBERS; drop public synonym MGMT$HA_BACKUP; drop public synonym MGMT$HA_FILES; drop public synonym MGMT$HA_INFO; drop public synonym MGMT$HA_INIT_PARAMS; drop public synonym MGMT$HA_MTTR; drop public synonym MGMT$HA_RMAN_CONFIG; drop public synonym MGMT$HW_NIC; drop public synonym MGMT$METRIC_COLLECTION; drop public synonym MGMT$METRIC_CURRENT; drop public synonym MGMT$METRIC_DAILY; drop public synonym MGMT$METRIC_DETAILS; drop public synonym MGMT$METRIC_HOURLY; drop public synonym MGMT$MISSING_TARGETS; drop public synonym MGMT$MISSING_TARGETS_IN_GROUPS; drop public synonym MGMT$OS_COMPONENTS; drop public synonym MGMT$OS_FS_MOUNT; drop public synonym MGMT$OS_HW_SUMMARY; drop public synonym MGMT$OS_KERNEL_PARAMS; drop public synonym MGMT$OS_PATCHES; drop public synonym MGMT$OS_SUMMARY; drop public synonym MGMT$SOFTWARE_COMPONENTS; drop public synonym MGMT$SOFTWARE_COMPONENT_ONEOFF; drop public synonym MGMT$SOFTWARE_COMP_PATCHSET; drop public synonym MGMT$SOFTWARE_DEPENDENCIES; drop public synonym MGMT$SOFTWARE_HOMES; drop public synonym MGMT$SOFTWARE_ONEOFF_PATCHES; drop public synonym MGMT$SOFTWARE_OTHERS; drop public synonym MGMT$SOFTWARE_PATCHES_IN_HOMES; drop public synonym MGMT$SOFTWARE_PATCHSETS; drop public synonym MGMT$TARGET; drop public synonym MGMT$TARGET_COMPONENTS; drop public synonym MGMT$TARGET_COMPOSITE; drop public synonym MGMT$TARGET_PROPERTIES; drop public synonym MGMT$TARGET_TYPE; drop PUBLIC SYNONYM SMP_EMD_AVAIL_OBJ; drop public synonym EMD_MNTR; drop public synonym SMP_EMD_AVAIL_OBJ; drop public synonym SMP_EMD_DELETE_REC_ARRAY; drop public synonym SMP_EMD_INTEGER_ARRAY; drop public synonym SMP_EMD_INTEGER_ARRAY_ARRAY; drop public synonym SMP_EMD_NVPAIR; drop public synonym SMP_EMD_NVPAIR_ARRAY; drop public synonym SMP_EMD_STRING_ARRAY; drop public synonym SMP_EMD_STRING_ARRAY_ARRAY; drop public synonym SMP_EMD_TARGET_OBJ; drop public synonym SMP_EMD_TARGET_OBJ_ARRAY; drop public synonym ECM_UTIL; drop role mgmt_user;
DROP USER sysman CASCADE;
DROP USER mgmt_view CASCADE; DROP ROLE MGMT_USER; ALTER USER dbsnmp ACCOUNT UNLOCK; ALTER USER dbsnmp identified by dbsnmp; DROP PUBLIC SYNONYM SETEMVIEWUSERCONTEXT; DROP PUBLIC SYNONYM MGMT_TARGET_BLACKOUTS; DROP PUBLIC SYNONYM MGMT_AVAILABILITY; DROP PUBLIC SYNONYM MGMT_CURRENT_AVAILABILITY; DROP PUBLIC SYNONYM MGMT_SEVERITY_OBJ; DROP PUBLIC SYNONYM MGMT_SEVERITY_ARRAY; DROP PUBLIC SYNONYM MGMT_GUID_OBJ; DROP PUBLIC SYNONYM MGMT_GUID_ARRAY; DROP PUBLIC SYNONYM SMP_EMD_AVAIL_OBJ; DROP PUBLIC SYNONYM SMP_EMD_TARGET_OBJ; DROP PUBLIC SYNONYM SMP_EMD_TARGET_OBJ_ARRAY; DROP PUBLIC SYNONYM SMP_EMD_DELETE_REC_ARRAY; DROP PUBLIC SYNONYM MGMT_METRICS; DROP PUBLIC SYNONYM MGMT_TARGETS; DROP PUBLIC SYNONYM MGMT_TYPE_PROPERTIES; DROP PUBLIC SYNONYM MGMT_TARGET_PROPERTIES; DROP PUBLIC SYNONYM MGMT_METRICS_RAW; DROP PUBLIC SYNONYM MGMT_CURRENT_METRICS; DROP PUBLIC SYNONYM MGMT_STRING_METRIC_HISTORY; DROP PUBLIC SYNONYM MGMT_LONG_TEXT; DROP PUBLIC SYNONYM MGMT_METRICS_COMPOSITE_KEYS; DROP PUBLIC SYNONYM MGMT_METRICS_1HOUR; DROP PUBLIC SYNONYM MGMT_METRICS_1DAY; DROP PUBLIC SYNONYM MGMT_METRIC_ERRORS; DROP PUBLIC SYNONYM MGMT_CURRENT_METRIC_ERRORS; DROP PUBLIC SYNONYM EMD_MNTR; DROP PUBLIC SYNONYM MGMT_METRIC_COLLECTIONS; DROP PUBLIC SYNONYM MGMT_COLLECTION_PROPERTIES ; DROP PUBLIC SYNONYM MGMT_METRIC_THRESHOLDS; DROP PUBLIC SYNONYM SMP_EMD_NVPAIR; DROP PUBLIC SYNONYM SMP_EMD_NVPAIR_ARRAY; DROP PUBLIC SYNONYM SMP_EMD_STRING_ARRAY; DROP PUBLIC SYNONYM SMP_EMD_STRING_ARRAY_ARRAY; DROP PUBLIC SYNONYM SMP_EMD_INTEGER_ARRAY; DROP PUBLIC SYNONYM SMP_EMD_INTEGER_ARRAY_ARRAY; DROP PUBLIC SYNONYM MGMT_DELTA_IDS; DROP PUBLIC SYNONYM MGMT_DELTA_ID_VALUES; DROP PUBLIC SYNONYM MGMT_DELTA_ENTRY; DROP PUBLIC SYNONYM MGMT_DELTA_ENTRY_VALUES; DROP PUBLIC SYNONYM MGMT_DELTA_VALUE; DROP PUBLIC SYNONYM MGMT_DELTA_VALUES; DROP PUBLIC SYNONYM MGMT_NAME_VALUE; DROP PUBLIC SYNONYM MGMT_NAME_VALUES; DROP PUBLIC SYNONYM ECM_UTIL; DROP PUBLIC SYNONYM MGMT_DELTA; DROP PUBLIC SYNONYM MGMT_TARGET_MEMBERSHIPS; DROP PUBLIC SYNONYM MGMT_JOB; DROP PUBLIC SYNONYM MGMT_JOB_PARAMETER; DROP PUBLIC SYNONYM MGMT_JOB_TARGET; DROP PUBLIC SYNONYM MGMT_JOB_SCHEDULE; DROP PUBLIC SYNONYM MGMT_JOB_EXECPLAN; DROP PUBLIC SYNONYM MGMT_JOB_EXEC_SUMMARY; DROP PUBLIC SYNONYM MGMT_JOB_OUTPUT; DROP PUBLIC SYNONYM MGMT_JOB_EXECUTION; DROP PUBLIC SYNONYM MGMT_LOG; DROP PUBLIC SYNONYM MGMT_ADMIN; DROP PUBLIC SYNONYM MGMT_GLOBAL; DROP PUBLIC SYNONYM MGMT_TARGET; DROP PUBLIC SYNONYM MGMT_CREDENTIAL; DROP PUBLIC SYNONYM MGMT_JOBS; DROP PUBLIC SYNONYM MGMT_PREFERENCES; DROP PUBLIC SYNONYM MGMT_USER; DROP PUBLIC SYNONYM MGMT_SEVERITY; DROP PUBLIC SYNONYM MGMT_CURRENT_SEVERITY; DROP PUBLIC SYNONYM MGMT_PAF_PROCS_LATEST; DROP PUBLIC SYNONYM MGMT_PAF_JOBS; DROP PUBLIC SYNONYM MGMT_PAF$PROCEDURES; DROP PUBLIC SYNONYM MGMT_PAF$INSTANCES; DROP PUBLIC SYNONYM MGMT_PAF$STATES; DROP PUBLIC SYNONYM MGMT_PAF$APPLICATIONS; DROP PUBLIC SYNONYM MGMT_VIEW_UTIL; DROP PUBLIC SYNONYM MGMT_MESSAGES;
整理成一个sql文件dropem.sql 以便以后执行
sqlplus "/as sysdba" @c:\dropem.sql
3)重建em
C:\> emca -config dbcontrol db -repos create
EMCA 开始于 2010-9-8 17:10:37
EM Configuration Assistant, 11.2.0.0.2 正式版 版权所有 (c) 2003, 2005, Oracle。保留所有权利。
输入以下信息:
数据库 SID: orcl 监听程序端口号: 1521 监听程序 ORACLE_HOME [ C:\app\Administrator\product\11.2.0\dbhome_1 ]: SYS 用户的口令: DBSNMP 用户的口令: DBSNMP 用户的口令: 用户名/口令无效。 DBSNMP 用户的口令: SYSMAN 用户的口令: SYSMAN 用户的口令: 通知的电子邮件地址 (可选): 通知的发件 (SMTP) 服务器 (可选): -----------------------------------------------------------------
已指定以下设置
数据库 ORACLE_HOME ................ C:\app\Administrator\product\11.2.0\dbhome_1
本地主机名 ................ localhost 监听程序 ORACLE_HOME ................ C:\app\Administrator\product\11.2.0\dbhome _1 监听程序端口号 ................ 1521 数据库 SID ................ orcl 通知的电子邮件地址 ............... 通知的发件 (SMTP) 服务器 ...............
-----------------------------------------------------------------
是否继续? [是(Y)/否(N)]: y 2010-9-8 17:12:08 oracle.sysman.emcp.EMConfig perform 信息: 正在将此操作记录到 C:\app\Administrator\cfgtoollogs\emca\orcl\emca_2010_09 _08_17_10_36.log。 2010-9-8 17:12:10 oracle.sysman.emcp.EMReposConfig createRepository 信息: 正在创建 EM 资料档案库 (此操作可能需要一段时间)... 2010-9-8 17:24:11 oracle.sysman.emcp.EMReposConfig invoke 信息: 已成功创建资料档案库 2010-9-8 17:24:25 oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository 信息: 正在将配置数据上载到 EM 资料档案库 (此操作可能需要一段时间)... 2010-9-8 17:26:26 oracle.sysman.emcp.EMReposConfig invoke 信息: 已成功上载配置数据 2010-9-8 17:26:39 oracle.sysman.emcp.util.DBControlUtil configureSoftwareLib 信息: 软件库已配置成功。 2010-9-8 17:26:39 oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary 信息: 正在部署预配档案... 2010-9-8 17:27:34 oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary 信息: 预配档案部署成功。 2010-9-8 17:27:34 oracle.sysman.emcp.util.DBControlUtil secureDBConsole 信息: 正在保护 Database Control (此操作可能需要一段时间)... 2010-9-8 17:27:47 oracle.sysman.emcp.util.DBControlUtil secureDBConsole 信息: 已成功保护 Database Control。 2010-9-8 17:27:47 oracle.sysman.emcp.util.DBControlUtil startOMS 信息: 正在启动 Database Control (此操作可能需要一段时间)... 2010-9-8 17:28:24 oracle.sysman.emcp.EMDBPostConfig performConfiguration 信息: >>>>>>>>>>> Database Control URL 为 https://localhost:1158/em <<<<<<<<<<< 2010-9-8 17:28:29 oracle.sysman.emcp.EMDBPostConfig invoke 警告: ************************ WARNING ************************
管理资料档案库已置于安全模式下, 在此模式下将对 Enterprise Manager 数据进行加密。
加密密钥已放置在文件 C:/app/Administrator/product/11.2.0/dbhome_1/localhost_orcl /sysman/config/emkey.ora 中。请务必备份此文件, 因为如果此文件丢失, 则加密数据将 不可用。
***********************************************************
2010-9-8 17:28:29 oracle.sysman.emcp.EMDBPostConfig invoke
C:\>set ORACLE_UNQNAME=orcl
C:\>
emctl start dbconsole
https://localhost:1158/em/
修改访问端口(把5500改为1158)
重建em后可能端口被改为5500即
https://localhost:5500/em,如果需要修改访问端口为1158,执行:
C:\> emca -config dbcontrol db -DBCONTROL_HTTP_PORT 1158
最好先手工停止em. |