别想万里,要把一只脚放到另一脚的前边
分类: Oracle
2013-07-29 19:38:09
创建一个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
One mistake can lead to a lot of work. When you’ve installed Oracle Database 11g, you can’t change the
Windows Hostname without reinstalling Oracle Enterprise Manager.
These are the steps:
1. Change the %ORACLE_HOME%\network\admin\listener.ora file from an IP number to machine name.
2. Change the %ORACLE_HOME%\network\admin\tnsnames.ora file from an IP number to a machine name.
3. Change the C:\WINDOWS\System32\drivers\etc\hosts file by adding this line beneath the default
localhost line (for the new Hostname value):
127.0.0.1 localhost
172.16.113.128 mclaughlin11g mclaughlin11g.techtinker.com
4. Change the Windows hostname by navigating: Start > Control Panel > System (classic view) from the
random assignment of VMWare Fusion.
5. Reboot the machine, and then drop the em configuration with the following commands:
C:\Data> set ORACLE_SID=orcl
C:\Data> emca -deconfig dbcontrol db -repos drop
6. You’ll receive the following prompts, enter the Oracle SID and Port number without double quotes but you
must enter all passwords with double quotes (at least in Oracle Database 11g):
STARTED EMCA at Jul 13, 2008 8:26:42 AM
EM Configuration Assistant, Version 11.1.0.5.0 Production
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Enter the following information:
Database SID: orcl
Listener port number: 1521
Password for SYS user:
Password for SYSMAN user:
Password for SYSMAN user:
Do you wish to continue? [yes(Y)/no(N)]: y
7. You should then drop the SYSMAN user manually because it doesn’t happen without your assistance (or, it
didn’t happen when I did it). If you don’t drop the SYSMAN schema, you’ll raise an error when you try to
recreate it:
CONFIG: ORA-20001: SYSMAN already EXISTS..
ORA-06512: at line 17
oracle.sysman.assistants.util.sqlEngine.SQLFatalErrorException: ORA-20001: SYSMAN already EXISTS..
ORA-06512: at line 17The Java stack trace will look like this, more or less based on version and release:
at oracle.sysman.assistants.util.sqlEngine.SQLEngine.executeImpl(SQLEngine.java:1530)
at oracle.sysman.assistants.util.sqlEngine.SQLEngine.executeScript(SQLEngine.java:880)
at oracle.sysman.assistants.util.sqlEngine.SQLPlusEngine.executeScript(SQLPlusEngine.java
at oracle.sysman.assistants.util.sqlEngine.SQLPlusEngine.executeScript(SQLPlusEngine.java
at oracle.sysman.emcp.EMReposConfig.createRepository(EMReposConfig.java:492)
at oracle.sysman.emcp.EMReposConfig.invoke(EMReposConfig.java:218)
at oracle.sysman.emcp.EMReposConfig.invoke(EMReposConfig.java:147)
at oracle.sysman.emcp.EMConfig.perform(EMConfig.java:222)
at oracle.sysman.emcp.EMConfigAssistant.invokeEMCA(EMConfigAssistant.java:535)
at oracle.sysman.emcp.EMConfigAssistant.performConfiguration(EMConfigAssistant.java:1215)
at oracle.sysman.emcp.EMConfigAssistant.statusMain(EMConfigAssistant.java:519)
at oracle.sysman.emcp.EMConfigAssistant.main(EMConfigAssistant.java:468)
Drop the user and dependent on version a few other objects, like:
DROP USER sysman CASCADE;
DROP PUBLIC SYNONYM setemviewusercontext;
DROP ROLE mgmt_user;
DROP PUBLIC SYNONYM mgmt_target_blackouts;
DROP USER mgmt_view;8. You can then create the em environment with the following syntax:
C:\Data> emca -config dbcontrol db -repos create
9. Again, you’ll receive the following prompts, enter the Oracle SID and Port number without double quotes but
you must enter all passwords with double quotes (at least in Oracle Database 11g):
STARTED EMCA at Jul 13, 2008 8:28:48 AM
EM Configuration Assistant, Version 11.1.0.5.0 Production
Copyright (c) 2003, 2005, Oracle. ALL rights reserved.
Enter the following information:
DATABASE SID: orcl
Listener port NUMBER: 1521
Password FOR SYS USER:
Password FOR DBSNMP USER:
Password FOR SYSMAN USER:
Password FOR SYSMAN USER: Email address FOR notifications (optional):
Outgoing Mail (SMTP) server FOR notifications (optional):
-----------------------------------------------------------------
You have specified the following settings
DATABASE ORACLE_HOME ................ C:\app\Administrator\product\11.1.0\db_1
LOCAL hostname ................ mclaughlin11g
Listener port NUMBER ................ 1521
DATABASE SID ................ orcl
Email address FOR notifications ...............
Outgoing Mail (SMTP) server FOR notifications ...............
-----------------------------------------------------------------
Do you wish TO continue? [yes(Y)/no(N)]: y
A note to me, remember haste makes waste. I’m just glad that rebuilding the MarkLogic server was easy.
当安装oracle的机器变了机器名,或者变了ip地址。那么原来的dbconsole就起不来了。当在dos下运行:emctl start dbconsole 的时候报错。
解决办法:
1. 修改DBSNMP密码:
重新配置DBCONSOLE,需要输入DBSNMP密码,但任何密码都会显示错误,需要预先修改。密码为字符开头的字符数字组合。
sql>alter user dbsnmp identified by xxx;
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系统]命令提示符下输入:
c:\>emca
[Linux系统]输入:
$ emctl stop dbconsole
$ emca -repos recreate
//开始录入以下交互信息:
MCA 开始于 Mon Jan 14 10:30:44 CST 2008
输入以下有关要配置的数据库的信息
监听程序端口号: 1521
数据库 SID: 根据实际
服务名: 根据实际
通知的电子邮件地址: 可不填
通知的电子邮件网关:可不填
dbsnmp 口令:刚才改的xxx(sql>alter user dbsnmp identified by xxx;)
sysman 口令:自己输一个
sys 口令:据实
然后输入一堆“是”系统开始自动创建。
5. 创建成功后,检查状态 emctl status dbconsole。
6. 服务已经启动了。如果想手动重起:
emctl stop dbconsole
emctl start dbconsole
打开浏览器输入机器名:端口/em不能访问,而用可以访问
则需要更改本机hosts文件,增加IP映射.
最好用机器名:端口/em方式进行登陆,用访问有些服务可能会出错.