ORACLE OEM重建

一、Oracle OEM开启失败---环境变量ORACLE_UNQNAME未定义问题

登陆https://h1:1158/em 之后,看到数据库实例都是关闭的.启动不了
(1)查看dbconsole状态:emctl status dbconsole

显示:Environment variable ORACLE_UNQNAME not defined. Please define it.

解决方法:

在启动的时候先设置一下oracle_unqname

set oracle_unqname=$ORACLE_SID

如果还是失败,在环境变量中添加:

[oracle@h1 ~]$  vi ~/.bash_profile

    在最后添加:export  ORACLE_UNQNAME=$ORACLE_SID   

[oracle@h1 ~]$ source  ./bash_profile 

    使环境变量生效

 

2.emctl   start  dbconsole

如果还出现上述的错误:删除dbconsole重新配置

[oracle@h1 ~]$ emca -deconfig dbconsole db -repos drop

STARTED EMCA at Mar 14, 2013 9:06:48 PM
EM Configuration Assistant, Version 11.2.0.0.2 Production
Copyright (c) 2003, 2005, Oracle.  All rights reserved.

Enter the following information:
Database SID: bitc
Listener port number: 1522
Password for SYS user: 
Password for SYSMAN user: 

Do you wish to continue? [yes(Y)/no(N)]: Y
Mar 14, 2013 9:07:05 PM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /app/oracle/cfgtoollogs/emca/ORCL/emca_2013_03_14_21_06_47.log.
Mar 14, 2013 9:07:05 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Dropping the EM repository (this may take a while) ...
Mar 14, 2013 9:08:35 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully dropped
Enterprise Manager configuration completed successfully
FINISHED EMCA at Mar 14, 2013 9:08:35 PM

 

3.如果删除失败,则旧数据清除

[oracle@h1 ~]$ sqlplus "/as SYSDBA"

SQL*Plus: Release 11.2.0.1.0 Production on Thu Mar 14 21:08:54 2013

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

#(1)进入数据库删除dbconsole以前的用户,并且修改DBSNMP密码

SQL> alter user dbsnmp identified by manager;

 

 

#(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

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

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

完成。

 

5.emca 命令的日志在

/app/oracle/cfgtoollogs/emca/ORCL/

日志有两个,一个是概况,一个是明细

 

6.OEM开启

[oracle@h1 ~]$ emctl start dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0
Copyright (c) 1996, 2009 Oracle Corporation.  All rights reserved.
https://h1:5501/em/console/aboutApplication
- An instance of Oracle Enterprise Manager 11g Database Control is already running.
[oracle@h1 ~]$ emctl status dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0
Copyright (c) 1996, 2009 Oracle Corporation.  All rights reserved.
https://h1:5501/em/console/aboutApplication
Oracle Enterprise Manager 11g is running.
------------------------------------------------------------------
Logs are generated in directory /app/oracle/product/11.2.0/dbhome_2/h1_ORCL/sysman/log

 

7.OEM常用的命令

(1)创建一个EM资料库 -

emca –repos create -

(2)删除一个EM资料库 -

emca –repos drop -

(4)配置数据库的DatabaseControl -

emca –config dbcontrol db -

(5)删除数据库的DatabaseControl配置 -

emca –deconfig dbcontrol db -

(6)重新配置db control的端口,默认端口在1158 -

emca –reconfig ports -

emca –reconfig ports -dbcontrol_http_port 1160 -

emca -reconfigports -agent_port 3940 -

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

emctl start dbconsole -

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

emctl stop dbconsole -

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

emctl status dbconsole -

(10)配置dbconsole的步骤 -

emca -reposcreate -

emca -configdbcontrol db -

emctl start dbconsole -

(11)重新配置dbconsole的步骤 -

emca –repos drop -

emca –repos create -

emca –config dbcontrol db -

emctl start dbconsole

你可能感兴趣的:(oracle,OEM开启失败,OEM目录重建)