从事IT基础架构多年,发现自己原来更合适去当老师……喜欢关注新鲜事物,不仅限于IT领域。
分类: Oracle
2009-09-07 10:05:00
:
395162.1
类型:
BULLETIN
上次修订日期:
21-JUL-2008
状态:
PUBLISHED
In this Document
For the purpose of this article, we will illustrate DB Control on the following configuration
Cluster RAC 10.2.0.2 on linux Redhat 3.0 cluster crs with 3 nodes:
- node1.mycompany.com
- node2.mycompany.com
- node3.mycompany.com
RAC Database 10.2.0.2 EM102 using ASM with 3 instances:
- EM1021 running on node1.mycompany.com
- EM1022 running on node2.mycompany.com
- EM1023 running on node3.mycompany.com
The RAC database has been created manually without using dbca, therefore emca has not been run and there is no DB Control repository created in the RAC database.
The RAC database is not the hosting database for a Grid Control repository
This can be checked running the following SQL statement connected as a DBA user to the database:
SQL> select username from DBA_USERS where username = 'SYSMAN';
If the SQL Statement returns 'SYSMAN', it means that there is already a DB Control repository or a Grid Control repository present in the database.
To distinguish a Grid Control repository and a DB Control repository, you need to check the tablespaces. A DB Control repository is created with objects in SYSAUX tablespace. A Grid Control repository is created with objects in MGMT_TABLESPACE and MGMT_ECM_DEPOT_TS.
If
SQL> select tablespace_name from dba_tablespaces order by 1;
Returns MGMT_TABLESPACE and MGMT_ECM_DEPOT_TS among the tablespaces listed, it means that this database hosts a Grid Control repository. Therefore you cannot create a DB Control for that database.
If a Grid Control repository or a DB Control repository already exists and if you want to drop the existing repository because you are sure that this repository is decommissioned, you can use the following process:
To drop a DB Control repository or a to drop a Grid Control repository:
Note: This can be done from any node of the cluster, connected to whichever instance you prefer.
$ ./RepManager repository_host repository_port repository_SID
-sys_password password_for_sys_account -action drop
$ emca -config dbcontrol db -repos create -cluster
Enter the following information:
- Database unique name -- If you're not sure of the values for Database unique name
and service name, execute the following statement
connected as a DBA user to any instance of the RAC database:
SQL> show parameter db_unique_name
- Listener port
- SYS password
- SYSMAN password
$emca -config dbcontrol db -repos create -cluster -si
lent -respfile /u01/app/oracle/admin/EM102/scripts/emca_configandrep.rsp
with content of file /u01/app/oracle/admin/EM102/scripts/emca_configandrep.rsp as follow:
CLUSTER_NAME=mycrsname -- if CLUSTER_NAME is not specified, will be the default cluster name (usually crs)
DB_UNIQUE_NAME=EM102
SERVICE_NAME=EM102
SYS_PWD=oracle
SYSMAN_PWD=oracle
DBSNMP_PWD=oracle
PORT=1521
This emca command will:
- create the DB Control repository in the RAC database
- configure the DB Control on the local node and deploy the DB Control on all nodes of the cluster
- start the DB Control on the local node (dbconsole and agent)
- start all the agents on all the other nodes of the cluster
The resulting sub-directories of the RDBMS ORACLE_HOME will be the same on each node of the cluster:
$ORACLE_HOME/node1.mycompany.com_EM1021
$ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole_node1.mycompany.com_EM1021
$ORACLE_HOME/node2.mycompany.com_EM1022
$ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole_node2.mycompany.com_EM1022
$ORACLE_HOME/node3.mycompany.com_EM1023
$ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole_node3.mycompany.com_EM1023
On the cluster node node1.mycompany.com, the "active" sub-directories will be
$ORACLE_HOME/node1.mycompany.com_EM1021
$ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole_node1.mycompany.com_EM1021
On the cluster node node2.mycompany.com, the "active" sub-directories will be
$ORACLE_HOME/node2.mycompany.com_EM1022
$ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole_node2.mycompany.com_EM1022
On the cluster node node3.mycompany.com, the "active" sub-directories will be
$ORACLE_HOME/node3.mycompany.com_EM1023
$ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole_node3.mycompany.com_EM1023
The other directories are just "witnesses" of the current DB Control configuration on the cluster.
Note: If you deploy another DB Control for another RAC database on the same cluster,
you will have as well on each node of the cluster a new set of directories created under the
RDBMS ORACLE_HOME.
The format of the sub-directories is always hostnamei_SIDi.
The active sub-directories on node i is always hostanmei_SIDi.
To check the configuration files, log files, targets.xml, contents of upload or recv directories
You must look only into the "active" directory.
This means that to check the file emd.properties of the agent on node1, you must login to node1 and look into $ORACLE_HOME/node1.mycompany.com_EM1021/sysman/config.
If you want to check the targets.xml of the agent on node3, you must login to node3 and look into or
Login to node3, set the environment variables
- ORACLE_HOME
- ORACLE_SID
- ORACLE_HOME and ORACLE_HOME/bin are set in the environment variable $PATH
- run
$ emctl config agent listtargets
$emca -displayConfig dbcontrol -cluster
INFO:
**************** Current Configuration ****************
INSTANCE NODE DBCONTROL_UPLOAD_HOST
---------- ---------- ---------------------
EM1021 node1 node1.mycompany.com
EM1022 node2 node1.mycompany.com
EM1023 node3 node1.mycompany.com
This does not really make sense for a 3 nodes RAC cluster, but it is possible to have several dbconsole running instead of one, and agents configured to report to different dbconsole.
For example we want to have a dbconsole running on node1 and node2 with agents on node1 reporting to the dbconsole on node1 and agent on node2 and node3 reporting to the dbconsole on node2.
This emca command can be run from any node in the cluster.
According to the documentation and the prompt help we would then run:
$ emca -reconfig dbcontrol -cluster -EM_NODE node2 -EM_SID_LIST EM1022,EM1023
$ emca -reconfig dbcontrol -cluster
Enter the following information:
Database unique name: EM102
Database Control node name (optional): node2
Agent SID list [comma separated] (optional): EM1022,EM1023
$ emca -reconfig dbcontrol -cluster -silent -respfile /u01/app/oracle/admin/EM102/scripts/emca_node2_23.rsp
With content of emca_node2_23.rsp as follow
DB_UNIQUE_NAME=EM102
EM_NODE=node2
EM_SID_LIST=EM1022,EM1023
$ emca -reconfig dbcontrol -cluster -EM_NODE node2 -EM_SID_LIST EM1022
$emca -displayConfig dbcontrol -cluster
INFO:
**************** Current Configuration ****************
INSTANCE NODE DBCONTROL_UPLOAD_HOST
---------- ---------- ---------------------
EM1021 node1 node1.mycompany.com
EM1022 node2 node2.mycompany.com
EM1023 node3 node1.mycompany.com
Then
$ emca -reconfig dbcontrol -cluster -EM_NODE node2 -EM_SID_LIST EM1023
$emca -displayConfig dbcontrol -cluster
INFO:
**************** Current Configuration ****************
INSTANCE NODE DBCONTROL_UPLOAD_HOST
---------- ---------- ---------------------
EM1021 node1 node1.mycompany.com
EM1022 node2 node2.mycompany.com
EM1023 node3 node2.mycompany.com
$ emca -deleteInst db
Enter the following information:
Node name: node2
Database unique name: EM102
Database SID: EM1022
The command will:
- update the repository to remove all rows related to the instance
- remove all sub-directories related to DB Control on the node specified in node name (node2 here)
- here the following sub-directories will be removed on node2
$ORACLE_HOME/node1.mycompany.com_EM1021
$ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole_node1.mycompany.com_EM1021
$ORACLE_HOME/node2.mycompany.com_EM1022
$ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole_node2.mycompany.com_EM1022
$ORACLE_HOME/node3.mycompany.com_EM1023
$ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole_node3.mycompany.com_EM1023
- remove all sub-directories related to the instance EM1022 on all the other nodes of the cluster
- here the following sub-directories will be removed on node1 and node3
$ORACLE_HOME/node2.mycompany.com_EM1022
$ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole_node2.mycompany.com_EM1022
- reconfigure the agents which were reporting to the dbconsole removed if needed. This is what happened in our example:
$emca -displayConfig dbcontrol -cluster
INFO:
**************** Current Configuration ****************
INSTANCE NODE DBCONTROL_UPLOAD_HOST
---------- ---------- ---------------------
EM1021 node1 node1.mycompany.com
EM1023 node3 node1.mycompany.com
$ emca -addInst db
Enter the following information:
Node name: node2
Database unique name: EM102
Database SID: EM1022
$emca -displayConfig dbcontrol -cluster
INFO:
**************** Current Configuration ****************
INSTANCE NODE DBCONTROL_UPLOAD_HOST
---------- ---------- ---------------------
EM1021 node1 node1.mycompany.com
EM1022 node2 node1.mycompany.com
EM1023 node3 node1.mycompany.com
Log files
The log files are only created on the local node (the node from which emca has been run).
emca log files for an instance operation (add instance) are logged in:
RDBMS $ORACLE_HOME/cfgtoollogs/emca/EM102/EM1022
A new sub-directory is created, if it does not exist, to log emca operations at instance level, named with the SID on which the operation was performed.
$ emca -deconfig dbcontrol db -cluster
Enter the following information:
- Database unique name
$ emca -deconfig dbcontrol db -repos drop -cluster
Enter the following information:
Database unique name: EM102
Listener port number: 1521
Password for SYS user:
Password for SYSMAN user:
- stop the DB Control (dbconsole, agent) on all nodes of the cluster
- remove all DB Control related directories on all nodes of the cluster
$ORACLE_HOME/node1.mycompany.com_EM1021
$ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole_node1.mycompany.com_EM1021
$ORACLE_HOME/node2.mycompany.com_EM1022
$ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole_node2.mycompany.com_EM1022
$ORACLE_HOME/node3.mycompany.com_EM1023
$ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole_node3.mycompany.com_EM1023
- drop the repository
The command (one line) launched by emca to drop the repository once the DB Control is dropped
is:
/oracle/app/oracle/product/10.2.0/db/sysman/admin/emdrep/bin/RepManager -connect (DESCRIPTION=
ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=node1vip)
(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=ukp79142vip)(PORT=1521))
(ADDRESS=(PROTOCOL=TCP)(HOST=node3vip)(PORT=1521))(LOAD_BALANCE=yes))
(CONNECT_DATA=(SERVICE_NAME=EM102)))
-repos_user SYSMAN -action drop -verbose
-output_file /oracle/app/oracle/product/10.2.0/db/cfgtoollogs/emca/EM102/emca_repos_drop_2006-10-13_01-03-03-PM.log