Oracle 10g的DB Control包括三部分:
在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可以在DBCA创建数据库过程中同时创建,如果是手工创建数据库,或者像我一样,先创建个最小化的数据库,然后再一个功能一个功能的添加,那就需要掌握手工创建DB Control的方法了。
手工维护DB Control的主要命令就是emca,emca的语法规则如图示:
DB Control的配置包括两部分内容,一个是DB Control,也就是OC4J,另一个就是资料库Repository。因此,它的命令也是围绕这两个东东展开的。
上面的命令都是针对单实例的,如果是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 ....
[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
[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
[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
[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
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
[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.
[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.