ITPub博客

首页 > 数据库 > Oracle > emca和emctl的日常用法及实例(经验保存)

emca和emctl的日常用法及实例(经验保存)

Oracle 作者:ericwen2015 时间:2016-03-02 14:16:32 0 删除 编辑
环境:redhat 5.8-64bit
db: oracle 11.2.0.4- 64bit

准备继续学习下ocp的相关知识点,在vm中创建oem,其中一些emca、emctl用法和在操作中出错的情景,详细如下:
=====1、emca和emctl用法

1,修改DBSNMP密码:

重新配置DBCONSOLE,需要输入DBSNMP密码,但任何密码都会显示错误,需要预先修改。

sql>alter user dbsnmp identified by xxx;

2,删除早期DBCONSOLE创建的用户:

sql>drop role MGMT_USER;

sql>drop user MGMT_VIEW cascade;

sql>drop user sysman cascade;

3,删除早期DBCONSOLE创建的对象:

sql>drop PUBLIC SYNONYM MGMT_TARGET_BLACKOUTS;

sql>drop public synonym SETEMVIEWUSERCONTEXT;

4,重新创建DBCONSOLE:(如果是在windows下,要先到注册表删除DBCONSOLE的服务,重启电脑)

$emca -config dbcontrol db -repos create

如果此命令还是失败,可直接利用重建命令:

$emca -config dbcontrol db -repos recreate

根据提示,先输入SID,再输入Y继续;

输入端口1521,输入SYS密码,输入DBSNMP密码,输入SYSMAN 密码,输入Y继续

完成。

5,检查状态 emctl status dbconsole。

 

附emca常用命令:

创建一个EM资料库

emca -repos create

 

重建一个EM资料库

emca -repos recreate

 

删除一个EM资料库

emca -repos drop

 

配置数据库的 Database Control

emca -config dbcontrol db

 

删除数据库的 Database Control配置

emca -deconfig dbcontrol db

 

重新配置db control的端口,默认端口在1158

emca -reconfig ports

emca -reconfig ports -dbcontrol_http_port 1160

emca -reconfig ports -agent_port 3940

 

先设置ORACLE_SID环境变量后,启动EM console服务

emctl start dbconsole

先设置ORACLE_SID环境变量后,停止EM console服务

emctl stop dbconsole

先设置ORACLE_SID环境变量后,查看EM console服务的状态

emctl status dbconsole

 

 

配置dbconsole的步骤

emca -repos create

emca -config dbcontrol db

emctl start dbconsole

 

重新配置dbconsole的步骤

emca -repos drop

emca -repos create

emca -config dbcontrol db

emctl start dbconsole

-------------------------------------------------------------------------------------------------------------------------

Oracle 10G重建EM DB Control.

1.drop configuration files and repository run :

emca -deconfig dbcontrol db -repos drop

2. Logon SQLPLUS as user SYS or SYSTEM, and drop the sysman account and mangement objects:

a. drop user sysman cascade;

b. drop role MGMT_USER;

c. drop user MGMT_VIEW cascade;

d. drop public synonym MGMT_TARGET_BLACKOUTS;

e. drop public synonym SETEMVIEWUSERCONTEXT;

3.Create configuration files and repository run

emca -config dbcontrol db -repos create

创建EM时,提示的端口号,应为实例的断口号,比如1521,不是EM的端口号(比如1158)

EM的端口号在这个文件中可以查到10.2.0\db_1\sysman\config\emca.properties

然后,进行em后,界面出来了,但报了一个错:

Java.lang.Exception: Exception in sending Request :: null

很多功能不能用,提示重新登录.

在Oracle论坛上查到了解决办法:

http://forums.oracle.com/forums/thread.jspa?threadID=320574&tstart=0&messageID=1374397

找到下面的文件

10.2.0\db_1\ZYKNET_ORC2\sysman\config\emd.properties

其中的agentTZRegion缺省是GMT,改为你所在的时区即可,例如:

agentTZRegion=Asia/Chungking

关于时区的列表参考:10.2.0\db_1\sysman\admin\supportedtzs.lst

然后,重启OracleDBConsole<SID>


=====2、操作时出错的情景

1.  emca: 按要求配置了.bash_profile中的环境变量

点击(此处)折叠或打开

  1. ORACLE_UNQNAME=orcl; export ORACLE_UNQNAME
  2. ORACLE_HOSTNAME=srv1; export ORACLE_HOSTNAME
  ORACLE_HOMENAME配置时,开始配置了localhost
   EM Configuration issue. /u01/app/oracle/product/10.2.0/db_1/localhost_orcl not found. 

2. emca配置用户locked问题
srv1:/home/oracle> emca -config dbcontrol db -repos create

STARTED EMCA at Feb 25, 2015 10:55:33 AM
EM Configuration Assistant, Version 11.2.0.3.0 Production
Copyright (c) 2003, 2011, Oracle.  All rights reserved.


Enter the following information:
Database SID: orcl      
Listener port number: 1521
Listener ORACLE_HOME [ /u01/app/oracle/product/10.2.0/db_1 ]: 
Password for SYS user:  
Password for DBSNMP user:  
Feb 25, 2015 10:56:17 AM oracle.sysman.emcp.util.GeneralUtil initSQLEngineLoacly
WARNING: ORA-28000: the account is locked

这个地方 DBSNMP用户被locked了,需要解锁
sysdba用户: alter user sysman account unlock;即可



3. 由于开始时配置ORACLE_HOSTNAME=localhost,导致出错,只能用命令emca -config dbcontrol db -repos recreate重新创建下

点击(此处)折叠或打开

  1. srv1:/home/oracle> emca -config dbcontrol db -repos recreate
  2. STARTED EMCA at Feb 25, 2015 10:58:39 AM
  3. EM Configuration Assistant, Version 11.2.0.3.0 Production
  4. Copyright (c) 2003, 2011, Oracle. All rights reserved.
  5. Enter the following information:
  6. Database SID: orcl
  7. Listener port number: 1521
  8. Listener ORACLE_HOME [ /u01/app/oracle/product/10.2.0/db_1 ]:
  9. Password for SYS user:
  10. Password for DBSNMP user:
  11. Password for SYSMAN user:
  12. Email address for notifications (optional):
  13. Outgoing Mail (SMTP) server for notifications (optional):
  14. -----------------------------------------------------------------
  15. You have specified the following settings
  16. Database ORACLE_HOME ................ /u01/app/oracle/product/10.2.0/db_1
  17. Local hostname ................ srv1
  18. Listener ORACLE_HOME ................ /u01/app/oracle/product/10.2.0/db_1
  19. Listener port number ................ 1521
  20. Database SID ................ orcl
  21. Email address for notifications ...............
  22. Outgoing Mail (SMTP) server for notifications ...............
  23. -----------------------------------------------------------------
  24. ----------------------------------------------------------------------
  25. WARNING : While repository is dropped the database will be put in quiesce mode.
  26. ----------------------------------------------------------------------
  27. Do you wish to continue? [yes(Y)/no(N)]: Y
  28. Feb 25, 2015 10:58:59 AM oracle.sysman.emcp.EMConfig perform
  29. INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/orcl/emca_2015_02_25_10_58_38.log.
  30. Feb 25, 2015 10:59:01 AM oracle.sysman.emcp.EMReposConfig invoke
  31. INFO: Dropping the EM repository (this may take a while) ...
  32. Feb 25, 2015 11:03:13 AM oracle.sysman.emcp.EMReposConfig invoke
  33. INFO: Repository successfully dropped
  34. Feb 25, 2015 11:03:15 AM oracle.sysman.emcp.EMReposConfig createRepository
  35. INFO: Creating the EM repository (this may take a while) ...
  36. Feb 25, 2015 11:15:06 AM oracle.sysman.emcp.EMReposConfig invoke
  37. INFO: Repository successfully created
  38. Feb 25, 2015 11:15:23 AM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository
  39. INFO: Uploading configuration data to EM repository (this may take a while) ...
  40. Feb 25, 2015 11:17:37 AM oracle.sysman.emcp.EMReposConfig invoke
  41. INFO: Uploaded configuration data successfully
  42. Feb 25, 2015 11:17:45 AM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
  43. INFO: Securing Database Control (this may take a while) ...
  44. Feb 25, 2015 11:18:06 AM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
  45. INFO: Database Control secured successfully.
  46. Feb 25, 2015 11:18:06 AM oracle.sysman.emcp.util.DBControlUtil startOMS
  47. INFO: Starting Database Control (this may take a while) ...
  48. Feb 25, 2015 11:20:37 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration
  49. INFO: Database Control started successfully
  50. Feb 25, 2015 11:20:37 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration
  51. INFO: >>>>>>>>>>> The Database Control URL is https://srv1:1158/em <<<<<<<<<<<
  52. Feb 25, 2015 11:20:52 AM oracle.sysman.emcp.EMDBPostConfig invoke
  53. WARNING:
  54. ************************ WARNING ************************
  55. Management Repository has been placed in secure mode wherein Enterprise Manager data will be encrypted. The encryption key has been placed in the file: /u01/app/oracle/product/10.2.0/db_1/srv1_orcl/sysman/config/emkey.ora. Ensure this file is backed up as the encrypted data will become unusable if this file is lost.
  56. ***********************************************************
  57. Enterprise Manager configuration completed successfully
  58. FINISHED EMCA at Feb 25, 2015 11:20:52 AM
创建完毕,成功!!
注意::用360浏览器打开  
https://srv1:1158/em时,无法登陆,用firefox没有问题,,这里对360浏览器吐槽下!!!!


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/30373825/viewspace-2024028/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2015-07-26

  • 博文量
    41
  • 访问量
    24837