Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2074290
  • 博文数量: 354
  • 博客积分: 4955
  • 博客等级: 上校
  • 技术积分: 4579
  • 用 户 组: 普通用户
  • 注册时间: 2009-07-21 11:46
文章分类

全部博文(354)

文章存档

2015年(1)

2013年(4)

2012年(86)

2011年(115)

2010年(67)

2009年(81)

我的朋友

分类: Oracle

2011-12-28 14:48:48

$emca -config dbcontrol db -repos recreate
EMCA 开始于 2007-10-12 11:16:40
EM Configuration Assistant 10.2.0.1.0 正式版
版权所有 (c) 2003, 2005, Oracle。保留所有权利。
输入以下信息:
数据库 SID: orcl
已为数据库 orcl 配置了 Database Control
您已选择配置 Database Control, 以便管理数据库 orcl
此操作将移去现有配置和默认设置, 并重新执行配置
是否继续? [yes(Y)/no(N)]: y
监听程序端口号: 1521
SYS 用户的口令:
DBSNMP 用户的口令:
SYSMAN 用户的口令:
SYSMAN 用户的口令: 通知的电子邮件地址 (可选):
通知的发件 (SMTP) 服务器 (可选):
-----------------------------------------------------------------
已指定以下设置
数据库 ORACLE_HOME ................ e:\oracle\product\10.2.0\db_1
数据库主机名 ................ hailang.mshome.net
监听程序端口号 ................ 1521
数据库 SID ................ orcl
通知的电子邮件地址 ...............
通知的发件 (SMTP) 服务器 ...............
-----------------------------------------------------------------
是否继续? [yes(Y)/no(N)]: y
2007-10-12 11:17:32 oracle.sysman.emcp.EMConfig perform
信息: 正在将此操作记录到 e:\oracle\product\10.2.0\db_1\cfgtoollogs\emca\orcl\emca_2007-
2007-10-12 11:17:37 oracle.sysman.emcp.util.DBControlUtil stopOMS
信息: 正在停止 Database Control (此操作可能需要一段时间)...
2007-10-12 11:17:40 oracle.sysman.emcp.EMReposConfig dropRepository
信息: 正在删除 EM 资料档案库 (此操作可能需要一段时间)...
2007-10-12 11:24:23 oracle.sysman.emcp.EMReposConfig invoke
信息: 已成功删除资料档案库
2007-10-12 11:24:24 oracle.sysman.emcp.EMReposConfig createRepository
信息: 正在创建 EM 资料档案库 (此操作可能需要一段时间)...
2007-10-12 11:34:36 oracle.sysman.emcp.EMReposConfig invoke
信息: 已成功创建资料档案库
2007-10-12 11:35:15 oracle.sysman.emcp.util.DBControlUtil startOMS
信息: 正在启动 Database Control (此操作可能需要一段时间)...
2007-10-12 11:36:56 oracle.sysman.emcp.EMDBPostConfig performConfiguration
信息: 已成功启动 Database Control
2007-10-12 11:36:56 oracle.sysman.emcp.EMDBPostConfig performConfiguration
警告: 无法创建 Database Control 快捷方式
2007-10-12 11:36:56 oracle.sysman.emcp.EMDBPostConfig performConfiguration
信息: >>>>>>>>>>> Database Control URL 为 <<<<<<<<<<<
已成功完成 Enterprise Manager 的配置
在10g 中,我们可能会经常遇到OEM不能正常使用的问题,但导致问题的原因不尽相同,最后绝大多数问题可以通过emca 这个命令来解决,详细的说明可以查看连机帮助,下面给出一些常用的命令,及实例步骤.

创建一个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方式进行登陆,用访问有些服务可能会出错.

阅读(5828) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~