Oracle 11G R2 RAC 配置em时报错ORACLE_UNQNAME not defined

 

 

 

Oracle 11G R2 RAC 配置em时报错

Environment variable ORACLE_UNQNAME not defined. oracle ORACLE_UNQNAME

 

刚开始的时候报错

Environment variable ORACLE_UNQNAME not defined. oracle ORACLE_UNQNAME

 

第一部分:参照文档,安装失败

 

开始的时候以为是没有set ORACLE_UNQNAME的原因,但是在经过查找网络资料之后确认原来是因为EM需要重新建立的原因。开始的时候 参照

http://wzp85.blog.51cto.com/2041568/761944

  1. C:\>sqlplus /nolog
  2.  
  3. SQL*Plus: Release 11.2.0.1.0 Production on星期二 11 1 10:3
  4.  
  5. Copyright (c) 1982, 2010, Oracle. All rights reserved.
  6.  
  7. SQL> conn sys/admin as sysdba
  8. 已连接。
  9. SQL> alter user dbsnmp identified by admin
  10. 2 ;
  11.  
  12. 用户已更改。
  13.  
  14. SQL> drop role MGMT_USER;
  15.  
  16. 角色已删除。
  17.  
  18. SQL> drop user MGMT_VIEW cascade;
  19.  
  20. 用户已删除。
  21.  
  22. SQL> drop user sysman cascade;
  23.  
  24. 用户已删除。
  25.  
  26. SQL> drop PUBLIC SYNONYM MGMT_TARGET_BLACKOUTS;
  27.  
  28. 同义词已删除。
  29.  
  30. SQL> drop public synonym SETEMVIEWUSERCONTEXT;
  31.  
  32. 同义词已删除。
  33.  
  34. SQL> $emca -config dbcontrol db -repos create
  35.  
  36. EMCA 开始于 2011-11-1 11:15:57
  37. EM Configuration Assistant, 11.2.0.0.2 正式版
  38. 版权所有 (c) 2003, 2005, Oracle。保留所有权利。
  39.  
  40. 输入以下信息:
  41. 数据库 SID: ODSEXDB
  42. 已为数据库 ODSEXDB 配置了 Database Control
  43. 您已选择配置 Database Control, 以便管理数据库 ODSEXDB
  44. 此操作将移去现有配置和默认设置, 并重新执行配置
  45. 是否继续? [(Y)/(N)]: y
  46. 监听程序 ORACLE_HOME [ D:\app\Administrator\product\11.2.0\dbhome_1 ]: 1521
  47. SYS 用户的口令:
  48. DBSNMP 用户的口令:
  49. SYSMAN 用户的口令:
  50. 通知的电子邮件地址 (可选):
  51. 通知的发件 (SMTP) 服务器 (可选):
  52. -----------------------------------------------------------------
  53.  
  54. 已指定以下设置
  55.  
  56. 数据库 ORACLE_HOME ................ D:\app\Administrator\product\11.2.0\dbhome_1
  57.  
  58. 本地主机名 ................ 76481-640
  59. 监听程序 ORACLE_HOME ................ 1521
  60. 监听程序端口号 ................ 1521
  61. 数据库 SID ................ ODSEXDB
  62. 通知的电子邮件地址 ...............
  63. 通知的发件 (SMTP) 服务器 ...............
  64.  
  65. -----------------------------------------------------------------
  66. 是否继续? [(Y)/(N)]: y
  67. 2011-11-1 13:13:06 oracle.sysman.emcp.EMConfig perform
  68. 信息: 正在将此操作记录到 D:\app\Administrator\cfgtoollogs\emca\ODSEXDB\emca_2011_11_01_13_12_31.log
  69. 2011-11-1 13:13:08 oracle.sysman.emcp.EMReposConfig createRepository
  70. 信息: 正在创建 EM 资料档案库 (此操作可能需要一段时间)...
  71. 2011-11-1 13:28:25 oracle.sysman.emcp.EMReposConfig invoke
  72. 信息: 已成功创建资料档案库
  73. 2011-11-1 13:28:42 oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository
  74. 信息: 正在将配置数据上载到 EM 资料档案库 (此操作可能需要一段时间)...
  75. 2011-11-1 13:31:38 oracle.sysman.emcp.EMReposConfig invoke
  76. 信息: 已成功上载配置数据
  77. 2011-11-1 13:31:45 oracle.sysman.emcp.util.DBControlUtil configureSoftwareLib
  78. 信息: 软件库已配置成功。
  79. 2011-11-1 13:31:45 oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary
  80. 信息: 正在部署预配档案...
  81. 2011-11-1 13:31:56 oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary
  82. 信息: 预配档案部署成功。
  83. 2011-11-1 13:31:56 oracle.sysman.emcp.util.DBControlUtil secureDBConsole
  84. 信息: 正在保护 Database Control (此操作可能需要一段时间)...
  85. 2011-11-1 13:32:10 oracle.sysman.emcp.util.DBControlUtil secureDBConsole
  86. 信息: 已成功保护 Database Control
  87. 2011-11-1 13:32:10 oracle.sysman.emcp.util.DBControlUtil startOMS
  88. 信息: 正在启动 Database Control (此操作可能需要一段时间)...
  89. 2011-11-1 13:35:36 oracle.sysman.emcp.EMDBPostConfig performConfiguration
  90. 信息: 已成功启动 Database Control
  91. 2011-11-1 13:35:37 oracle.sysman.emcp.EMDBPostConfig performConfiguration
  92. 信息: >>>>>>>>>>> Database Control URL https://76481-640:5500/em <<<<<<<<<<<
  93. 2011-11-1 13:35:51 oracle.sysman.emcp.EMDBPostConfig invoke
  94. 警告:
  95. ************************ WARNING ************************
  96.  
  97. 管理资料档案库已置于安全模式下, 在此模式下将对 Enterprise Manager 数据进行加密。加密密钥已放置在文件
  98. D:/app/Administrator/product/11.2.0/dbhome_1/76481-640_ODSEXDB/sysman/config/emkey.ora 中。请务必备
  99. 份此文件, 因为如果此文件丢失, 则加密数据将不可用。
  100.  
  101. ***********************************************************
  102. 已成功完成 Enterprise Manager 的配置
  103. EMCA 结束于 2011-11-1 13:35:51

 

根据这个提示,我按照步骤执行,但是发现再次使用

emca -config dbcontrol db -repos create –cluster 创建EM的时候还是会报错。

 

第二部分,重新删除EM,再新建EM

于是根据下面这篇文字:

http://bbs.chinaunix.net/forum.php?mod=viewthread&tid=3643353

***********************************************************************

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.

 

 

首先使用

emca -config dbcontrol db -repos drop

删除EM

然后使用

emca -config dbcontrol db -repos create –cluster

创建EM成功。

posted @ 2013-03-04 22:46  静水流沙  阅读(8904)  评论(0编辑  收藏  举报