Oracle 10g的DB Control包括三部分:

  • DBConsole Management Service(OMS、DB Control)
  • DBConsole Management Agent
  • DBConsole Management Repository

在10.1的RAC环境中,每个节点上都会起动一个DBConsole Management Service,每个节点上的Agent都向同节点上的Management Service报告。

从10.2开始,为了降低负载和提高性能,RAC环境中只有一个Service,每个节点上的Agent只向这唯一的一个Service汇报。当然也可以配置多个Service,然后让每个Agent向多个Agent汇报。

11.2的RAC仍然是这种模式,因此在11.2RAC中,只有一个节点会运行DB Control,这个节点也被叫做主节点(Master Node)。仍然可以配置多个DB Control。

 

DB Control配置命令

DB Control可以在DBCA创建数据库过程中同时创建,如果是手工创建数据库,或者像我一样,先创建个最小化的数据库,然后再一个功能一个功能的添加,那就需要掌握手工创建DB Control的方法了。

手工维护DB Control的主要命令就是emca,emca的语法规则如图示:

emcaDB Control的配置包括两部分内容,一个是DB Control,也就是OC4J,另一个就是资料库Repository。因此,它的命令也是围绕这两个东东展开的。

 

  • 配置DB Control同时创建资料库
    emca -config dbcontrol db -repos create
  • 干掉DB Contole配置同时干掉资料库
    <ORACLE_HOME>/bin/emca -deconfig dbcontrol db -repos drop
  • 只配置DB Control(资料库已经有了,只配置DB Control,并把配置数据加载到资料库)
    <ORACLE_HOME>/bin/emca -config dbcontrol db
  • 只干掉DB Control,保留资料库
    <ORACLE_HOME>/bin/emca -deconfig dbcontrol db
  • 干掉已有的DB Control配置和资料库,然后重建
    <ORACLE_HOME>/bin/emca -config dbcontrol db -repos recreate

上面的命令都是针对单实例的,如果是RAC环境,每个命令后面还要加上个 -cluster。

 

实例

这是一个三节点组成的RAC,配置过程一波三折,特此记录,也给读者一点借鉴:

第一次配置

 

[oracle@indexserver1 bin]$ emca -config dbcontrol db -repos create -cluster

...
Jul 6, 2012 11:30:03 AM oracle.sysman.emcp.util.GeneralUtil initSQLEngineRemotely
WARNING: Error during db connection : ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
Jul 6, 2012 11:30:08 AM oracle.sysman.emcp.util.GeneralUtil initSQLEngineRemotely
WARNING: ORA-01031: insufficient privileges
....
第一次执行,以两个错误终止。
这里有两个ORA错误,一个是无法建立链接,一个是权限不够。我们依次解决这两个问题。
先来看无法建立链接问题(ORA-12514)
 
1、看监听器里注册了哪些服务
需要看两个监听器,一个VIP监听器,一个SCAN监听器。我们需要知道这两个监听器的名字:
[grid@indexserver1 ~]$ ps -ef|grep tnsl

grid       573 32420  0 11:16 pts/1    00:00:00 grep tnsl

grid      2896     1  0 Jul05 ?        00:00:01 /u01/app/11.2.0.2/grid/bin/tnslsnr LISTENER_SCAN3 -inherit

grid     16897     1  0 Jul05 ?        00:00:01 /u01/app/11.2.0.2/grid/bin/tnslsnr LISTENER –inherit
2、然后我们看SCAN监听器中的服务有哪些:
[grid@indexserver1 ~]$ lsnrctl status listener_scan3
LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 06-JUL-2012 11:16:51
Copyright (c) 1991, 2010, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN3)))
STATUS of the LISTENER
-----------------------
Alias                     LISTENER_SCAN3
Version                   TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date                05-JUL-2012 14:13:11
Uptime                    0 days 21 hr. 3 min. 40 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/11.2.0.2/grid/network/admin/listener.ora
Listener Log File         /u01/app/11.2.0.2/grid/log/diag/tnslsnr/indexserver1/listener_scan3/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN3)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.86)(PORT=1521)))
Services Summary...
Service "wxxrdb" has 3 instance(s).
  Instance "wxxrdb1", status READY, has 1 handler(s) for this service...
  Instance "wxxrdb2", status READY, has 1 handler(s) for this service...
  Instance "wxxrdb3", status READY, has 1 handler(s) for this service...
Service "wxxrdbXDB" has 3 instance(s).
  Instance "wxxrdb1", status READY, has 1 handler(s) for this service...
  Instance "wxxrdb2", status READY, has 1 handler(s) for this service...
  Instance "wxxrdb3", status READY, has 1 handler(s) for this service...
The command completed successfully
3、再和本地的VIP监听器对比一下,看看有什么区别:
[grid@indexserver1 ~]$ lsnrctl status listener
 

LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 06-JUL-2012 11:34:20
Copyright (c) 1991, 2010, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date                05-JUL-2012 13:11:46
Uptime                    0 days 22 hr. 22 min. 34 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/11.2.0.2/grid/network/admin/listener.ora
Listener Log File         /u01/app/grid/diag/tnslsnr/indexserver1/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.70)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.80)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM4", status READY, has 1 handler(s) for this service...
Service "wxxrdb" has 1 instance(s).
  Instance "wxxrdb3", status READY, has 1 handler(s) for this service...
Service "wxxrdbXDB" has 1 instance(s).
  Instance "wxxrdb3", status READY, has 1 handler(s) for this service...
The command completed successfully
很显然,SCAN监听器中缺少ASM服务的信息,这说明ASM没有注册到SCAN监听器中。
4、数据库的注册是和两个listener参数控制的,我们分别对比ASM实例和数据库实例的参数:
ASM实例
[grid@indexserver1 ~]$ export ORACLE_SID=+ASM4

[grid@indexserver1 ~]$ sqlplus " / as sysdba"

SQL*Plus: Release 11.2.0.2.0 Production on Fri Jul 6 11:36:00 2012
Copyright (c) 1982, 2010, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options

SQL> show parameter listener
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
listener_networks                    string
local_listener                       string      (DESCRIPTION=(ADDRESS_LIST=(AD
                                                 DRESS=(PROTOCOL=TCP)(HOST=192.
                                                 168.1.80)(PORT=1521))))
remote_listener                      string
5、再看数据库实例
SQL> show parameter listener
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
listener_networks                    string
local_listener                       string      (DESCRIPTION=(ADDRESS_LIST=(AD
                                                DRESS=(PROTOCOL=TCP)(HOST=192.
                                                 168.1.80)(PORT=1521))))
remote_listener                      string      indexgrid.wxxr.com.cn:1521
显然,ASM实例中的remote_listener配置有错误。
6、修改ASM参数
[grid@indexserver1 ~]$ sqlplus " / as sysdba"

SQL*Plus: Release 11.2.0.2.0 Production on Fri Jul 6 11:38:24 2012

 Copyright (c) 1982, 2010, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options

SQL> alter system set remote_listener='indexgrid.wxxr.com.cn:1521' scope=both sid='*';

System altered.
SQL> alter system register;
System altered.
7、再看SCAN监听器的状态,这次正常了:
[grid@indexserver1 ~]$ lsnrctl status listener_scan3

LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 06-JUL-2012 11:38:51

Copyright (c) 1991, 2010, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN3)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_SCAN3
Version                   TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date                05-JUL-2012 14:13:11
Uptime                    0 days 21 hr. 25 min. 40 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/11.2.0.2/grid/network/admin/listener.ora
Listener Log File         /u01/app/11.2.0.2/grid/log/diag/tnslsnr/indexserver1/listener_scan3/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN3)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.86)(PORT=1521)))
Services Summary...
Service "+ASM" has 4 instance(s).
  Instance "+ASM1", status READY, has 1 handler(s) for this service...
  Instance "+ASM2", status READY, has 1 handler(s) for this service...
  Instance "+ASM3", status READY, has 1 handler(s) for this service...
  Instance "+ASM4", status READY, has 1 handler(s) for this service...
Service "wxxrdb" has 3 instance(s).
  Instance "wxxrdb1", status READY, has 1 handler(s) for this service...
  Instance "wxxrdb2", status READY, has 1 handler(s) for this service...
  Instance "wxxrdb3", status READY, has 1 handler(s) for this service...
Service "wxxrdbXDB" has 3 instance(s).
  Instance "wxxrdb1", status READY, has 1 handler(s) for this service...
  Instance "wxxrdb2", status READY, has 1 handler(s) for this service...
  Instance "wxxrdb3", status READY, has 1 handler(s) for this service...

The command completed successfully
 
无法连接的问题应该解决了?是不是呢,我们再来做第二次配置。
 
oracle@indexserver1 bin]$ emca -config dbcontrol db -repos create -cluster
...

Jul 6, 2012 11:47:04 AM oracle.sysman.emcp.util.GeneralUtil initSQLEngineRemotely
WARNING: Error during db connection : ORA-01031: insufficient privileges
 
Jul 6, 2012 11:47:09 AM oracle.sysman.emcp.util.GeneralUtil initSQLEngineRemotely
WARNING: ORA-01031: insufficient privileges

Password validation failed. Some of the possible reasons may be:
1) Invalid username/password. 
2) Database is not up. 
3) Scan listener not up. 
4) Database service is not registered with scan listener. 
5) Password file may be missing or configured incorrectly.
果然,这次只剩下了一个权限不够的错误。
 
未完待续 ...