现在的位置: 首页 > 综合 > 正文

如何修改SYSMAN密码

2013年12月10日 ⁄ 综合 ⁄ 共 5873字 ⁄ 字号 评论关闭

先说一下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 1160

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

emctl start dbconsole

 

----------------------------------------------我是华丽的分隔线-------------------------------------------------

 

sysman用户是dbconsole的owner.
如果单纯的修改sysman的密码,那么dbconsole就不能用了。
在数据库修改sysman的密码同时 必须用这个命令(emctl setpasswd dbconsole )去修改dbconsole的密码保持Enterprise Manager的密码和数据的密码一致。
客户修改了sysman的密码发现dbconsole不能用 于是就重建dbconsole,但是很不幸重建过程中出错了。
检查错误日志:
JVMDG304: Java core file written to /home/oracle/javacore1327168.1237815965.txt
JVMDG274: Dump Handler has Processed OutOfMemory.
JVMCI003
Exception in thread "main" java.lang.OutOfMemoryError
------------------------------------------修改java heap
size---------------------------------------------------------------------------
这是一个java 内存溢出的错误。
首先检查java pool 有220M,这个应该足够了。
到网上找了把资料,发现很多给出的意见是修改java heap size .
修改启动文件的emca的 java heap size.
cd $ORACLE_HOME/bin
backup the file emca
cp emca  $ORACLE_HOME/bin/emca.bak
vi emca
replace the line:
       ${JRE_JAVA} -DDISPLAY="${DISPLAY}" -DORACLE_HOME="${ORACLE_HOME}"
-DTNS_ADMIN="${TNS_ADMIN}" oracle.sysman.emcp.EMConfigAssistant $*

with
    ${JRE_JAVA} -Xms128m -Xmx256m -DDISPLAY="${DISPLAY}"
-DORACLE_HOME="${ORACLE_HOME}" -DTNS_ADMIN="${TNS_ADMIN}"
oracle.sysman.emcp.EMConfigAssistant $*

---------------------------------------------------------彻底删除
dbconsole---------------------------------------------------------------
如下的步骤是引用和参考metalink上一些重建em的docment.
Then rebuild EM  as follow operations  step by step.
首先要彻底删除以前的dbconsole,schema sysman 和mgmt_view,这个必须删除干净,不然重建会提示用户sysman已经建好,然后异常退出。
1. Drop and Recreate the DBControl:
+ To delete the dbconsole :
$ export ORACLE_SID=<SID of 10G db for which dbconsole has been configured>
$ cd $ORACLE_HOME/bin
$ emca -deconfig dbcontrol db -repos drop
At the end of this command, the following folders should be removed :
$ORACLE_HOME/<HOSTNAME_SID>
$ORACLE_HOME/oc4j/j2ee/<OC4J_DBConsole_HOSTNAME_SID>
If they are still present, please remove them manually before proceeding further.
+ Delete or move all the files under $ORACLE_HOME/cfgtoollogs/emca/<sid> directory.
+ Connect to the database as system(or a DBA user) user via sql*plus to drop
the repository schemas and objects :
- Drop the repository users -
SQL> drop user sysman cascade;
SQL> drop user mgmt_view cascade;
If the above emca command completed successfully, then these users would
have been dropped already.
- Drop the role mgmt_user :
SQL> drop role mgmt_user;
If the above emca command completed successfully, then this role would have
been dropped already.
- Drop all public synonyms on repository objects -
You can create a sql script to generate the drop statements and then
execute the script created -
SQL> set ver on
SQL> set echo off
SQL> set pages 999
SQL> set feed 0
SQL> set heading off
SQL> spool del_public_synonym_mgmt.sql
SQL> select 'Drop public synonym ' || synonym_name || ';' from dba_synonyms where synonym_name like 'MGMT%' OR synonym_
name like 'SMP_EMD%' OR synonym_name like 'SMP_MGMT%' OR synonym_name in
('SETEMVIEWUSERCONTEXT','DBMS_SHARED_POOL','EMD_MNTR' ,'ECM_UTIL');
SQL> spool off

Then execute the script del_public_synonym_mgmt.sql

- Exit sqlplus.
--------------------------------------------------------重建
dbconsole-----------------------------------------------------------------------------
这一步是正式的重建
+ To re-create the dbconsole:

$ export ORACLE_SID=<SID of 10G db for which dbconsole has to be configured>
$ cd $ORACLE_HOME/bin
$ emca -config dbcontrol db -repos create
Enter the required details to configure the dbconsole.
但是执行遇到错误:
INFO: Creating the EM repository (this may take a while) ...
Mar 27, 2009 10:05:36 AM oracle.sysman.emcp.EMReposConfig createRepository
CONFIG: ORA-28003: password verification for the specified password failed
ORA-20003: Password should contain at least one /
检查详细的日志发现创建用户MGMT_VIEW 时候发生的这个错误,
Create MGMT_VIEW user..

DECLARE
*
ERROR at line 1:
ORA-28003: password verification for the specified password failed
ORA-20003: Password should contain at least one digit, one character and one special char
~
密码不符合校验的要求,显然是调用了profile来限制密码的复杂性。
SELECT * FROM dba_profiles  WHERE profile = 'DEFAULT' AND   resource_type = 'PASSWORD';
--------------- ------------------------------ -------- --------------------
DEFAULT         FAILED_LOGIN_ATTEMPTS          PASSWORD 5
DEFAULT         PASSWORD_LIFE_TIME             PASSWORD 90
DEFAULT         PASSWORD_REUSE_TIME            PASSWORD 1800
DEFAULT         PASSWORD_REUSE_MAX             PASSWORD 12
DEFAULT         PASSWORD_VERIFY_FUNCTION       PASSWORD VERIFY_FUNCTION
DEFAULT         PASSWORD_LOCK_TIME             PASSWORD .0006
DEFAULT         PASSWORD_GRACE_TIME            PASSWORD 10

显然创建用户MGMT_VIEW 是创建dbconsole自动创建的,所以密码也是oracle来生成。(除非能找出建MGMT_VIEW的脚本然后修改它的创建密码)
------------------------------------------------------------禁用和启用passowrd verify function---------------------------------
所以只能暂时禁用下  PASSWORD_VERIFY_FUNCTION  .
alter profile DEFAULT limit password_verify_function null;
然后重新创建em,等EM创建完再改回去。
alter profile default limit PASSWORD_VERIFY_FUNCTION    VERIFY_FUNCTION;
这次创建成功。
Mar 27, 2009 12:35:53 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: >>>>>>>>>>> The Database Control
URL is http://hostname:5500/em
<<<<<<<<<<<
Enterprise Manager configuration completed successfully
FINISHED EMCA at Mar 27, 2009 12:35:53 PM
然后告诉客户说EM创建完成了
--------------------------------------------------------------修改dbconsole的端口----------------------------------------------------
但是客户说他以前用的端口是1158,现在端口变成了5500。说他的防火墙做了限制的,不能用5500.要改成1158.

没办法又只用去修改端口:
emca -reconfig ports -dbcontrol_http_port 1158

Enter the following information:
Database SID:
这个比较简单输入sid回车就修改完成。
(如果修改agent 就用emca -reconfig ports -agent_port 3940 )
检查端口修改过来了
emctl status dbconsole
Oracle Enterprise Manager 10g Database Control Release 10.2.0.3.0
Copyright (c) 1996, 2006 Oracle Corporation.  All rights reserved.

http://hostname:1158/em/console/aboutApplication

抱歉!评论已关闭.