ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 记录一次EM故障修复过程

记录一次EM故障修复过程

原创 Linux操作系统 作者:realkid4 时间:2012-11-27 19:31:49 0 删除 编辑

Oracle Enterprise ManagerOEM)是Oracle提供的进行数据库管理、性能监控和运维的重要组件。在10g之后,Oracle推出了基于Web应用服务器的OEM。在安装Oracle服务器的时候,OEM会作为一个单独的组件安装,提供给客户端访问。

 

在实际中,OEM配置和安装过程会遇到很多问题。特别是Windows版本的OEM,会有很多错误场景出现。本篇介绍笔者进行OEM配置中错误的解决修复过程。

 

1、故障问题

 

在安装Oracle 10g ASM服务器的最后一步,Oracle需要进行OEM的配置,其中包括很多网络、端口的信息配置。提示信息如下:

 

 (请参见本文页底贴图)

 

 

报错内容简单可以归纳为:在进行OEM配置的时候出现错误,主要原因是OEM的各个核心组件分配服务器端口的时候,发现不能分配。Oracle建议解决问题之后,重新调用emca创建OEM资料库。

 

数据库成功创建,监听器也可以正常工作,只是OEM没有配置完成。下面我们逐步解决问题。

 

2、创建日志挖掘

 

我们首先查看一下数据库能否正常启动,包括ASM实例。

 

--Oracle实例启动正常

[oracle@bspdev10g bdump]$ sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 - Production on Tue Nov 27 15:51:19 2012

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

 

SQL> conn / as sysdba

Connected to an idle instance.

SQL> startup

ORACLE instance started.

 

Total System Global Area  536870912 bytes

Fixed Size                  1220432 bytes

Variable Size             155189424 bytes

Database Buffers          377487360 bytes

Redo Buffers                2973696 bytes

Database mounted.

Database opened.

 

 

解决OEM问题,检查报错信息中的日志信息至关重要。我们到指定目录位置去查看错误日志。

 

 

[oracle@bspdev10g ora10gasm]$ pwd

/u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/dbca/ora10gasm

[oracle@bspdev10g ora10gasm]$ ls -l

total 6956

-rw-r----- 1 oracle oinstall    1621 Nov 27 05:48 cloneDBCreation.log

-rw-r----- 1 oracle oinstall     739 Nov 27 05:45 CloneRmanRestore.log

-rw-r----- 1 oracle oinstall   23450 Nov 27 05:50 emConfig.log

-rw-r----- 1 oracle oinstall     145 Nov 27 05:48 lockAccount.log

-rw-r----- 1 oracle oinstall     763 Nov 27 05:52 postDBCreation.log

-rw-r----- 1 oracle oinstall       8 Nov 27 05:48 postScripts.log

-rw-r----- 1 oracle oinstall    2058 Nov 27 05:43 rmanRestoreDatafiles.sql

-rw-r----- 1 oracle oinstall 7061504 Nov 27 05:45 tempControl.ctl

 

 

在日志中,我们检查故障异常出现的第一个点。

 

 

[oracle@bspdev10g ora10gasm]$ tail -n 100 emConfig.log

Nov 27, 2012 5:50:03 AM oracle.sysman.emcp.util.DBControlUtil isDBConsoleConfigured

CONFIG: Sid: ora10gasm Host: bspdev10g Node: bspdev10g OH: /u01/app/oracle/product/10.2.0/db_1 isDBC: false

(篇幅原因,省略部分内容……)

CONFIG: No value was set for the parameter AGENT_PORT.

Nov 27, 2012 5:50:04 AM oracle.sysman.emcp.util.OUIInventoryUtil setOUILoc

CONFIG: Setting oracle.installer.oui_loc to /u01/app/oracle/product/10.2.0/db_1/oui

Nov 27, 2012 5:50:04 AM oracle.sysman.emcp.util.OUIInventoryUtil getInstallInventory

CONFIG: Error accessing inventory.

oracle.sysman.oii.oiii.OiiiInventoryDoesNotExistException: The inventory pointer location /etc/oraInst.loc is either not readable or does not exist

        at oracle.sysman.oii.oiii.OiiiInstallAreaControl.initAreaControl(OiiiInstallAreaControl.java:1698)

        at oracle.sysman.oii.oiic.OiicStandardInventorySession.initSession(OiicStandardInventorySession.java:282)

(篇幅原因,省略部分内容……)

Nov 27, 2012 5:50:04 AM oracle.sysman.emcp.EMConfig perform

SEVERE: Failed to allocate port(s) in the specified range(s) for the following process(es): JMS [5540-5559],RMI [5520-5539],Database Control [5500-5519],EM Agent [3938] | [1830-1849]

Refer to the log file at /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/dbca/ora10gasm/emConfig.log for more details.

Nov 27, 2012 5:50:04 AM oracle.sysman.emcp.EMConfig perform

CONFIG: Stack Trace:

oracle.sysman.emcp.exception.EMConfigException: Failed to allocate port(s) in the specified range(s) for the following process(es): JMS [5540-5559],RMI [5520-5539],Database Control [5500-5519],EM Agent [3938] | [1830-1849]

        at oracle.sysman.emcp.EMDBPreConfig.checkPorts(EMDBPreConfig.java:2266)

 

 

我们使用日志进行错误诊断,有一个基本原则就是“从第一条错误开始入手,逐步解决”。Oracle是一个复杂的组合体,一个环节的小错误可能引起后面环节的大故障。定位第一个异常点是我们必须要做的内容。从解决第一个错误开始,一个个的解决。

 

在日志上我们定位的第一个错误就是关于/etc/oraInst.loc目录的。oraInst.ora文件是在运行脚本时创建的文件,用于记录Oracle全局Inventory目录位置和Group名称。错误内容是说,Oracle无法访问到这个文件。

 

那么,我们切实使用Oracle用户去访问一下看看。

 

 

[oracle@bspdev10g ora10gasm]$ cat /etc/oraInst.loc

cat: /etc/oraInst.loc: Permission denied

[oracle@bspdev10g ora10gasm]$ su - root

Password:

[root@bspdev10g ~]# cat /etc/oraInst.loc

inventory_loc=/u01/app/oracle/oraInventory

inst_group=oinstall

[root@bspdev10g ~]# cd /etc

[root@bspdev10g etc]# ls -l | grep oraInst.loc

-rwxr-x---  1 root   root         63 Nov 27 05:36 oraInst.loc

 

 

确实是无法访问,笔者尝试手工修改权限内容。在不改变root所有的前提下,授予777权限。

 

 

[root@bspdev10g etc]# chmod 777 oraInst.loc

[root@bspdev10g etc]# ls -l | grep oraInst.loc

-rwxrwxrwx  1 root   root         63 Nov 27 05:36 oraInst.loc

 

 

下面,我们需要重新删除和创建OEM库。

 

3、创建删除OEM故障错误

 

问题没有彻底解决。我们尝试删除OEM资源库。

 

 

--删除OEM命令

[oracle@bspdev10g ~]$ emca -deconfig dbcontrol db -repos drop

 

STARTED EMCA at Nov 27, 2012 4:11:47 PM

EM Configuration Assistant, Version 10.2.0.1.0 Production

Copyright (c) 2003, 2005, Oracle.  All rights reserved.

 

Enter the following information:

Database SID: ora10gasm

Listener port number: 1521

Password for SYS user: 

Password for SYSMAN user: 

 

Do you wish to continue? [yes(Y)/no(N)]: y

Nov 27, 2012 4:12:18 PM oracle.sysman.emcp.EMConfig perform

INFO: This operation is being logged at /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/emca/ora10gasm/emca_2012-11-27_04-11-47-PM.log.

Nov 27, 2012 4:12:19 PM oracle.sysman.emcp.EMDBPreConfig performDeconfiguration

WARNING: EM is not configured for this database. No EM-specific actions can be performed.

Nov 27, 2012 4:12:19 PM oracle.sysman.emcp.EMReposConfig dropRepository

INFO: Dropping the EM repository (this may take a while) ...

Nov 27, 2012 4:15:29 PM oracle.sysman.emcp.util.PlatformInterface executeCommand

WARNING: Error executing /u01/app/oracle/product/10.2.0/db_1/sysman/admin/emdrep/bin/RepManager -connect (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=bspdev10g)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=ora10gasm))) -repos_user SYSMAN -action drop -verbose -output_file /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/emca/ora10gasm/emca_repos_drop_2012-11-27_04-12-19-PM.log

Nov 27, 2012 4:15:29 PM oracle.sysman.emcp.EMReposConfig invoke

SEVERE: Error dropping the repository

(篇幅原因,省略部分内容)

Could not complete the configuration. Refer to the log file at /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/emca/ora10gasm/emca_2012-11-27_04-11-47-PM.log for more details.

 

 

报错,依然找日志,定位错误。

 

 

[oracle@bspdev10g ~]$ tail -n 200 /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/emca/ora10gasm/emca_2012-11-27_04-11-47-PM.log

 

(篇幅原因,省略部分内容)

Nov 27, 2012 4:12:19 PM oracle.sysman.emcp.util.PlatformInterface executeCommand

CONFIG: Starting execution: /u01/app/oracle/product/10.2.0/db_1/sysman/admin/emdrep/bin/RepManager -connect (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=bspdev10g)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=ora10gasm))) -repos_user SYSMAN -action drop -verbose -output_file /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/emca/ora10gasm/emca_repos_drop_2012-11-27_04-12-19-PM.log

Nov 27, 2012 4:15:29 PM oracle.sysman.emcp.util.PlatformInterface executeCommand

CONFIG: Exit value of 50

Nov 27, 2012 4:15:29 PM oracle.sysman.emcp.util.PlatformInterface executeCommand

CONFIG: Enter SYS user's password :

Enter repository user password :

Getting temporary tablespace from database...

Could not connect to SYS/(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=bspdev10g)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=ora10gasm))): ORA-12170: TNS:Connect timeout occurred (DBD ERROR: OCIServerAttach)

 

Nov 27, 2012 4:15:29 PM oracle.sysman.emcp.util.PlatformInterface executeCommand

CONFIG: stty: standard input: Invalid argument

stty: standard input: Invalid argument

stty: standard input: Invalid argument

stty: standard input: Invalid argument

(篇幅原因,省略部分内容)

        at oracle.sysman.emcp.EMConfigAssistant.statusMain(EMConfigAssistant.java:463)

        at oracle.sysman.emcp.EMConfigAssistant.main(EMConfigAssistant.java:412)

 

 

本质问题在于,在执行创建删除脚本的时候,OEM客户端没法连接到。比较怀疑的点有两个,一个是服务器名称bspdev10g名称ip是否正确,另一个是数据库服务名ora10gasm是否能够联通。

 

先检查bspdev10g的名称,是检查/etc/hosts文件。

 

 

[oracle@bspdev10g ~]$ cat /etc/hosts

# Do not remove the following line, or various programs

# that require network functionality will fail.

10.1.39.69              bspdev10g  bspdev10g.localdomain –错误(新IP192.168.137.92

127.0.0.1               bspdev10g.localdomain bspdev10g localhost.localdomain localhost

::1             localhost6.localdomain6 localhost6

 

 

修复。

 

 

[oracle@bspdev10g ~]$ ping bspdev10g

PING bspdev10g (10.1.39.69) 56(84) bytes of data.

 

--- bspdev10g ping statistics ---

7 packets transmitted, 0 received, 100% packet loss, time 5999ms

 

[oracle@bspdev10g ~]$ su - root

Password:

[root@bspdev10g ~]# vi /etc/hosts

 

# Do not remove the following line, or various programs

# that require network functionality will fail.

192.168.137.92              bspdev10g  bspdev10g.localdomain

127.0.0.1               bspdev10g.localdomain bspdev10g localhost.localdomain localhost

::1             localhost6.localdomain6 localhost6

~

 

 

ora10gasm名称tnsping也有一些问题。

 

 

[oracle@bspdev10g ~]$ tnsping ora10gasm

TNS Ping Utility for Linux: Version 10.2.0.1.0 - Production on 27-NOV-2012 16:31:42

 

Copyright (c) 1997, 2005, Oracle.  All rights reserved.

Used parameter files:

TNS-03505: Failed to resolve name

 

 

修复之后。

 

 

[oracle@bspdev10g ~]$ tnsping ora10gasm

TNS Ping Utility for Linux: Version 10.2.0.1.0 - Production on 27-NOV-2012 16:42:41

 

Copyright (c) 1997, 2005, Oracle.  All rights reserved.

 

Used parameter files:

 

Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = bspdev10g)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = ora10gasm)))

OK (0 msec)

 

 

4、删除和重新创建OEM

 

最后,我们尝试重新创建OEM。先删除内容。

 

 

[oracle@bspdev10g ~]$ emca -deconfig dbcontrol db -repos drop

 

STARTED EMCA at Nov 27, 2012 4:43:13 PM

EM Configuration Assistant, Version 10.2.0.1.0 Production

Copyright (c) 2003, 2005, Oracle.  All rights reserved.

 

Enter the following information:

Database SID: ora10gasm

Listener port number: 1521

Password for SYS user: 

Password for SYSMAN user: 

 

Do you wish to continue? [yes(Y)/no(N)]: y

Nov 27, 2012 4:43:31 PM oracle.sysman.emcp.EMConfig perform

INFO: This operation is being logged at /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/emca/ora10gasm/emca_2012-11-27_04-43-12-PM.log.

Nov 27, 2012 4:43:31 PM oracle.sysman.emcp.EMDBPreConfig performDeconfiguration

WARNING: EM is not configured for this database. No EM-specific actions can be performed.

Nov 27, 2012 4:43:31 PM oracle.sysman.emcp.EMReposConfig dropRepository

INFO: Dropping the EM repository (this may take a while) ...

Nov 27, 2012 4:46:29 PM oracle.sysman.emcp.EMReposConfig invoke

INFO: Repository successfully dropped

Enterprise Manager configuration completed successfully

FINISHED EMCA at Nov 27, 2012 4:46:29 PM

 

 

删除成功,再进行创建。

 

 

[oracle@bspdev10g ~]$ emca -config dbcontrol db -repos create

 

STARTED EMCA at Nov 27, 2012 4:48:07 PM

EM Configuration Assistant, Version 10.2.0.1.0 Production

Copyright (c) 2003, 2005, Oracle.  All rights reserved.

 

Enter the following information:

Database SID: ora10gasm

Listener port number: 1521

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/oracle/product/10.2.0/db_1 ]:

ASM SID [ +ASM ]: +ASM

ASM port [ 1521 ]:

ASM user role [ SYSDBA ]:

ASM username [ SYS ]:

ASM user password: 

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

 

You have specified the following settings

 

Database ORACLE_HOME ................ /u01/app/oracle/product/10.2.0/db_1

 

Database hostname ................ bspdev10g

Listener port number ................ 1521

Database SID ................ ora10gasm

Email address for notifications ...............

Outgoing Mail (SMTP) server for notifications ...............

ASM ORACLE_HOME ................ /u01/app/oracle/product/10.2.0/db_1

ASM SID ................ +ASM

ASM port ................ 1521

ASM user role ................ SYSDBA

ASM username ................ SYS

 

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

Do you wish to continue? [yes(Y)/no(N)]: y

Nov 27, 2012 4:49:00 PM oracle.sysman.emcp.EMConfig perform

INFO: This operation is being logged at /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/emca/ora10gasm/emca_2012-11-27_04-48-07-PM.log.

Nov 27, 2012 4:49:01 PM oracle.sysman.emcp.EMReposConfig createRepository

INFO: Creating the EM repository (this may take a while) ...

Nov 27, 2012 4:53:55 PM oracle.sysman.emcp.EMReposConfig invoke

INFO: Repository successfully created

Nov 27, 2012 4:53:59 PM oracle.sysman.emcp.ParamsManager getLocalListener

WARNING: Error retrieving listener for bspdev10g

Nov 27, 2012 4:54:03 PM oracle.sysman.emcp.util.DBControlUtil startOMS

INFO: Starting Database Control (this may take a while) ...

Nov 27, 2012 4:55:44 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration

INFO: Database Control started successfully

Nov 27, 2012 4:55:44 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration

INFO: >>>>>>>>>>> The Database Control URL is http://bspdev10g:1158/em <<<<<<<<<<<

Enterprise Manager configuration completed successfully

FINISHED EMCA at Nov 27, 2012 4:55:44 PM

 

 

OEM修复成功验证。

 

 

--状态检查

[oracle@bspdev10g ~]$ emctl status dbconsole

TZ set to PRC

Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0 

Copyright (c) 1996, 2005 Oracle Corporation.  All rights reserved.

http://bspdev10g:1158/em/console/aboutApplication

Oracle Enterprise Manager 10g is running.

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

Logs are generated in directory /u01/app/oracle/product/10.2.0/db_1/bspdev10g_ora10gasm/sysman/log

 

--停止OEM

[oracle@bspdev10g ~]$ emctl stop dbconsole

TZ set to PRC

Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0 

Copyright (c) 1996, 2005 Oracle Corporation.  All rights reserved.

http://bspdev10g:1158/em/console/aboutApplication

Stopping Oracle Enterprise Manager 10g Database Control ...

 ...  Stopped.

 

--启动OEM

[oracle@bspdev10g ~]$ emctl start dbconsole

TZ set to PRC

Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0 

Copyright (c) 1996, 2005 Oracle Corporation.  All rights reserved.

http://bspdev10g:1158/em/console/aboutApplication

Starting Oracle Enterprise Manager 10g Database Control  .......... .....................  started.

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

Logs are generated in directory /u01/app/oracle/product/10.2.0/db_1/bspdev10g_ora10gasm/sysman/log

 

 

5、结论

 

OEMOracle提供的管理工具平台。在官方的OCP教材中,已经将OEM作为官方管理工具进行介绍。OEM因为其特殊性,故障比较难调整,安装过程中问题也较多。

 

无标题.jpg

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

请登录后发表评论 登录
全部评论
求道~

注册时间:2010-11-30

  • 博文量
    545
  • 访问量
    7814734