因为需求需要重建EM,重建时因为某些错误被迫停止,比如对象已存在、用户已经存在等,最终找出了创建必备的条件;
1.环境变量(Oracle和Grid在同一个用户下安装)
ORACLE_HOME 要设为DB路径;
ORACLE_UNQNAME 要设置;
2.删除em相关的同义词
select 'drop public synonym '||synonym_name||';' from dba_synonyms where regexp_like(synonym_name,'^MGMT_|^SMP_EMD|^EMD_') order by synonym_name;
3.删除em相关用户
drop user MGMT_VIEW; drop user SYSMAN cascade;
4.删除em相关role
drop role MGMT_USER;
5.检查em相关残留的对象,并删除
select * from dba_objects where status='INVALID' AND OBJECT_TYPE='SYNONYM';
6.重建em
em -config dbcontrol db -repos create