---
title: "EM 配置"
author: "wrong1111"
date: "2013-09-08T00:52:29Z"
tags: []
categories: ["数据库"]
slug: "em"
draft: false
lastmod: "2013-09-08T00:52:29Z"
id: 1938542
url: "https://wrong1111.iteye.com/blog/1938542"
---

**以下文字 转自** [http://blog.csdn.net/zftang/article/details/6189760](http://blog.csdn.net/zftang/article/details/6189760)

**EM配置的一些命令**

 

   创建一个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 1158  
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

 

**2.EM遇到的一些问题**

 

 

CREATE PUBLIC SYNONYM MGMT\_AVAILABILITY FOR MGMT\_AVAILABILITY  
                      *  
第 1 行出现错误:  
ORA-00955: 名称已由现有对象使用

 

1，删除早期DBCONSOLE创建的用户：

drop role MGMT\_USER;  
drop user MGMT\_VIEW cascade;  
drop user sysman cascade;

2，删除早期DBCONSOLE创建的对象：  
drop PUBLIC SYNONYM MGMT\_TARGET\_BLACKOUTS;  
drop public synonym SETEMVIEWUSERCONTEXT;  
drop public synonym MGMT\_AVAILABILITY;  
drop public synonym MGMT\_CURRENT\_AVAILABILITY;  
drop public synonym MGMT\_SEVERITY\_OBJ

3，重新创建DBCONSOLE：

$emca -config dbcontrol db -repos recreate

 

Environment variable ORACLE\_UNQNAME not defined. Please set ORACLE\_UNQNAME to da  
tabase unique name.

-------- set oracle\_unqname=zftang;

严重: 监听程序未启动或数据库服务未注册到该监听程序。启动该监听程序并注册数据库服务, 然后重新

运行 EM Configuration Assistant。

-------- set ORACLE\_HOSTNAME=localhost