Oracle EM重建及案例说明

Oracle Enterprise Manager:OEM

仅限于Database Control

OEM常用的命令

emca -repos create  #创建EM资料库
emca -repos recreate #重建EM资料库
emca -repos drop #删除EM资料库

emca -config dbcontrol db #配置数据库的Database Control
emca -deconfig dbcontrol db #删除数据库的Database Control

#重新配置db control的端口,默认端口在1158
emca -reconfig ports
emca -reconfig ports -dbcontrol_http_port 1159
emca -reconfig ports -agent_port 3950

#先设置ORACLE_SID环境变量
emctl start dbconsole #启动服务
emctl stop dbconsole #停止服务
emctl status dbconsole  #查询服务的状态

配置db console的步骤

  • emca -repos create
  • emca -config dbcontrol db
  • emctl start dbconsole

—————————————-无敌分割线————————————————–

重新配置dbconsole的步骤

  • emca -repos drop ­
  • emca -repos create
  • emca -config dbcontrol db
  • emctl start dbconsole
emca -repos drop ­
[oracle@ocm bin]$ ./emca -repos drop

STARTED EMCA at Apr 27, 2013 9:49:03 PM
EM Configuration Assistant, Version 11.2.0.3.0 Production
Copyright (c) 2003, 2011, Oracle.  All rights reserved.

Enter the following information:
Database SID: ocm
Listener port number: 1521
Password for SYS user:  
Password for SYSMAN user:  

----------------------------------------------------------------------
WARNING : While repository is dropped the database will be put in quiesce mode.
----------------------------------------------------------------------
Do you wish to continue? [yes(Y)/no(N)]: y
Apr 27, 2013 9:49:16 PM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/ocm/emca_2013_04_27_21_49_03.log.
Apr 27, 2013 9:49:16 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Dropping the EM repository (this may take a while) ...

Apr 27, 2013 9:51:11 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully dropped
Enterprise Manager configuration completed successfully
FINISHED EMCA at Apr 27, 2013 9:51:11 PM
emca -repos create ­
[oracle@ocm bin]$ ./emca -repos create

STARTED EMCA at Apr 27, 2013 9:52:12 PM
EM Configuration Assistant, Version 11.2.0.3.0 Production
Copyright (c) 2003, 2011, Oracle.  All rights reserved.

Enter the following information:
Database SID: ocm
Listener port number: 1521
Password for SYS user:  
Password for SYSMAN user:  

Do you wish to continue? [yes(Y)/no(N)]: y
Apr 27, 2013 9:52:27 PM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/ocm/emca_2013_04_27_21_52_11.log.
Apr 27, 2013 9:52:28 PM oracle.sysman.emcp.EMReposConfig createRepository
INFO: Creating the EM repository (this may take a while) ...

Apr 27, 2013 9:57:42 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully created
Enterprise Manager configuration completed successfully
FINISHED EMCA at Apr 27, 2013 9:57:42 PM
emca -config dbcontrol db ­
[oracle@ocm bin]$ ./emca -config dbcontrol db

STARTED EMCA at Apr 27, 2013 9:59:27 PM
EM Configuration Assistant, Version 11.2.0.3.0 Production
Copyright (c) 2003, 2011, Oracle.  All rights reserved.

Enter the following information:
Database SID: ocm
Database Control is already configured for the database ocm
You have chosen to configure Database Control for managing the database ocm
This will remove the existing configuration and the default settings and perform a fresh configuration
Do you wish to continue? [yes(Y)/no(N)]: y
Listener ORACLE_HOME [ /u01/app/11.2.0/grid ]: 
Password for SYS user:  
Password for DBSNMP user:  
Password for SYSMAN user:  
Email address for notifications (optional): 
Outgoing Mail (SMTP) server for notifications (optional): 
ASM ORACLE_HOME [ /u01/app/11.2.0/grid ]: 
ASM SID [ +ASM ]: 
ASM port [ 1521 ]: 
ASM username [ ASMSNMP ]: 
ASM user password:  
-----------------------------------------------------------------

You have specified the following settings

Database ORACLE_HOME ................ /u01/app/oracle/product/11.2

Local hostname ................ ocm.oracle.com
Listener ORACLE_HOME ................ /u01/app/11.2.0/grid
Listener port number ................ 1521
Database SID ................ ocm
Email address for notifications ............... 
Outgoing Mail (SMTP) server for notifications ............... 
ASM ORACLE_HOME ................ /u01/app/11.2.0/grid
ASM SID ................ +ASM
ASM port ................ 1521
ASM user role ................ SYSDBA
ASM username ................ ASMSNMP

-----------------------------------------------------------------
Do you wish to continue? [yes(Y)/no(N)]: 
Do you wish to continue? [yes(Y)/no(N)]: y
Apr 27, 2013 10:01:01 PM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/ocm/emca_2013_04_27_21_59_27.log.
Apr 27, 2013 10:01:02 PM oracle.sysman.emcp.util.DBControlUtil stopOMS
INFO: Stopping Database Control (this may take a while) ...
Apr 27, 2013 10:01:07 PM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository
INFO: Uploading configuration data to EM repository (this may take a while) ...
Apr 27, 2013 10:02:41 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Uploaded configuration data successfully
Apr 27, 2013 10:02:45 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Securing Database Control (this may take a while) ...
Apr 27, 2013 10:02:55 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Database Control secured successfully.
Apr 27, 2013 10:02:55 PM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) ...
Apr 27, 2013 10:04:04 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: Database Control started successfully
Apr 27, 2013 10:04:06 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: >>>>>>>>>>> The Database Control URL is https://ocm.oracle.com:1158/em <<<<<<<<<<<
Apr 27, 2013 10:04:14 PM oracle.sysman.emcp.EMDBPostConfig invoke
WARNING: 
************************  WARNING  ************************

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/11.2/ocm.oracle.com_ocm/sysman/config/emkey.ora. Ensure this file is backed up as the encrypted data will become unusable if this file is lost. 

***********************************************************
Enterprise Manager configuration completed successfully
FINISHED EMCA at Apr 27, 2013 10:04:14 PM

创建完毕后直接emctl start dbconsole就可以了

在执行命令时可能会出现如下错误:

 [oracle@ocm ~]$ emca -repos drop ­

STARTED EMCA at Apr 27, 2013 8:33:26 PM
EM Configuration Assistant, Version 11.2.0.3.0 Production
Copyright (c) 2003, 2011, Oracle.  All rights reserved.

Enter the following information:
Database SID: ocm
Listener port number: 1521
Password for SYS user:  
Apr 27, 2013 8:33:39 PM oracle.sysman.emcp.util.GeneralUtil initSQLEngineLoacly
WARNING: ORA-09925: Unable to create audit trail file

Invalid username/password.
Password for SYS user:

实际上是可能环境变量配置的问题,最简单的解决办法:

cd /$ORACLE_HOME/bin

在此目录下执行相关的命令就可以解决。

—————————————-无敌分割线————————————————–

 

 

打开EM的时候,页面显示如下错误:

503 Service Unavailable
Service is not initialized correctly. The Em Key is not configured properly. Run "emctl status emkey" for more details.

初步判断是因为emkey文件失效,可能是因为之前导入数据的时候导致的此错误。

按照提示做如下操作:

[oracle@ocm ~]$ emctl status emkey
Oracle Enterprise Manager 11g Database Control Release 11.2.0.3.0 
Copyright (c) 1996, 2011 Oracle Corporation.  All rights reserved.
Please enter repository password: 

The Em Key is not configured properly or is corrupted in the file system and does not exist in the Management Repository. To correct the problem:
1) Copy the emkey.ora file from another OMS or backup machine to the OH/sysman/config directory.
2) Configure the emkey.ora file by running "emctl config emkey -emkeyfile <emkey.ora file location>".

按照2)的方法做,实际上是需要有备份存在

[oracle@ocm bin]$ emctl config emkey -emkeyfile /u01/app/oracle/product/11.2/ocm.oracle.com_ocm/sysman/config/emkey.ora -force -sysman_pwd oracle
Oracle Enterprise Manager 11g Database Control Release 11.2.0.3.0 
Copyright (c) 1996, 2011 Oracle Corporation.  All rights reserved.

The Em Key could not be configured. /u01/app/oracle/product/11.2/ocm.oracle.com_ocm/sysman/config/emkey.ora is corrupted or contains an invalid Em Key.

还有一个方法就是重建EM,方法如之前所示。

————————————————————

ORA-12519: TNS: 没有找到适用的服务处理程序 (DBD ERROR: OCIServerAttach)

实际上是超过最大的processes

 

 

 

 

 

 

发表评论

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据