#topicpath

Oracle Database には Database Control が付属してきまして
Enterprise Manager が使えますが、Grid Control で管理することもできます。

Grid Control のための Agent をインストールして一括管理するための設定を行います。

* 環境 [#if368ca4]

- em1 (192.168.1.224)
-- CentOS 5.3 (64bit)
-- Grid Control 10g 10.2.0.5.0
-- [[技術文書/Oracle/CentOS5.3(64bit)にGridControl10gR5をインストール]]
- ora1 (192.168.1.221)
-- CentOS 5.2 (64bit)
-- Database 11g 11.1.0.6.0
-- [[技術文書/Oracle/11g/CentOS5.2(64bit)にOracle11gR1をインストール]]

ora1 ではデータベースを作っておかなくても大丈夫ですが、
作った場合は Enterprise Manager の設定は入れないでください。
もし入れてしまった場合には emca で削除しましょう。

#pre{{
$ $ORACLE_HOME/bin/emca -deconfig dbcontrol db -repos drop
}}

この方法については詳しくは述べません。

* 必要なもの [#ic334855]

[[Oracle Enterprise Manager 10g Grid Control Management Agent:http://www.oracle.com/technology/software/products/oem/htdocs/agentsoft.html]]
からダウンロードしてきます。

- Agent Software for 64-bit Platforms
-- Linux x86-64
--- Linux_x86_64_Grid_Control_agent_download_10_2_0_5_0.zip

* ora1 に agent をインストール [#p320f100]

ora1 で zip ファイルを展開しておきます。
/home/oracle/GCagent/ 以下に展開しました。

runInstaller を起動します。
外からログインして X を飛ばしていると
フォントが化けるので、英語環境で起動しました。

#pre{{
[oracle@ora1 ~]$ export LANG=C
[oracle@ora1 ~]$ cd GCagent/linux_x64/agent
[oracle@ora1 agent]$ ./runInstaller 
}}

&ref(1.png);

&ref(2.png);

&ref(3.png);

&ref(4.png);

&ref(5.png);

&ref(6.png);

&ref(7.png);

&ref(8.png);

&ref(9.png);

&ref(10.png);

#pre{{
[root@ora1 ~]# /u01/app/oracle/product/agent10g/root.sh 
Running Oracle10 root.sh script...

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/product/agent10g

Enter the full pathname of the local bin directory: [/usr/local/bin]: 
The file "dbhome" already exists in /usr/local/bin.  Overwrite it? (y/n) 
[n]: 
The file "oraenv" already exists in /usr/local/bin.  Overwrite it? (y/n) 
[n]: 
The file "coraenv" already exists in /usr/local/bin.  Overwrite it? (y/n) 
[n]: 

Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
Finished product-specific root actions.
[root@ora1 ~]# 
}}

&ref(11.png);

&ref(12.png);

* agent の動作確認 [#fb9de03f]

agent から Grid Control へ放っておいても通信するようですが、
初回は登録という意味も込めて手動でやってみます。

#pre{{
[oracle@ora1 ~]$ export ORACLE_HOME=/u01/app/oracle/product/agent10g 
[oracle@ora1 ~]$ $ORACLE_HOME/bin/emctl upload agent
Oracle Enterprise Manager 10g Release 5 Grid Control 10.2.0.5.0.  
Copyright (c) 1996, 2009 Oracle Corporation.  All rights reserved.
---------------------------------------------------------------
EMD upload error: uploadXMLFiles skipped :: OMS version not checked yet..
}}

うまくいきません。

[[http://forums.oracle.com/forums/thread.jspa?messageID=2453352]]
http://forums.oracle.com/forums/thread.jspa?messageID=2453352
を参考にして、
一度初期化してやり直してみます。

#pre{{
[oracle@ora1 ~]$ $ORACLE_HOME/bin/emctl stop agent  
Oracle Enterprise Manager 10g Release 5 Grid Control 10.2.0.5.0.  
Copyright (c) 1996, 2009 Oracle Corporation.  All rights reserved.
Stopping agent ... stopped.
[oracle@ora1 ~]$ rm -rf $ORACLE_HOME/sysman/emd/upload/*
[oracle@ora1 ~]$ rm -rf $ORACLE_HOME/sysman/emd/state/*
[oracle@ora1 ~]$ $ORACLE_HOME/bin/emctl clearstate agent
Oracle Enterprise Manager 10g Release 5 Grid Control 10.2.0.5.0.  
Copyright (c) 1996, 2009 Oracle Corporation.  All rights reserved.
EMD clearstate completed successfully
[oracle@ora1 ~]$ $ORACLE_HOME/bin/emctl secure agent  
Enter Agent Registration Password :
Securing agent...   Successful.    
[oracle@ora1 ~]$ $ORACLE_HOME/bin/emctl start agent
Oracle Enterprise Manager 10g Release 5 Grid Control 10.2.0.5.0.
Copyright (c) 1996, 2009 Oracle Corporation.  All rights reserved.
Starting agent ...... started.  
}}

これで再度 upload を試してみます。

#pre{{
[oracle@ora1 ~]$ $ORACLE_HOME/bin/emctl upload agent
Oracle Enterprise Manager 10g Release 5 Grid Control 10.2.0.5.0.  
Copyright (c) 1996, 2009 Oracle Corporation.  All rights reserved.
---------------------------------------------------------------
EMD upload completed successfully
}}

うまくいきました。status も見てみます。

#pre{{
[oracle@ora1 ~]$ $ORACLE_HOME/bin/emctl status agent
Oracle Enterprise Manager 10g Release 5 Grid Control 10.2.0.5.0.  
Copyright (c) 1996, 2009 Oracle Corporation.  All rights reserved.
---------------------------------------------------------------
Agent Version     : 10.2.0.5.0
OMS Version       : 10.2.0.5.0
Protocol Version  : 10.2.0.5.0
Agent Home        : /u01/app/oracle/product/agent10g
Agent binaries    : /u01/app/oracle/product/agent10g
Agent Process ID  : 19782
Parent Process ID : 19766
Agent URL         : https://ora1.sugimura.homelinux.org:3872/emd/main/
Repository URL    : https://em1.sugimura.homelinux.org:1159/em/upload
Started at        : 2009-08-12 19:33:01
Started by user   : oracle
Last Reload       : 2009-08-12 19:34:01
Last successful upload                       : 2009-08-12 19:34:48
Total Megabytes of XML files uploaded so far :    11.97
Number of XML files pending upload           :        0
Size of XML files pending upload(MB)         :     0.00
Available disk space on upload filesystem    :     6.29%
Last successful heartbeat to OMS             : 2009-08-12 19:34:07
---------------------------------------------------------------
Agent is Running and Ready
}}

これで ora1 の情報は em1 の Grid Control に伝わるようになりました。

* DB の登録 [#he65fda9]

DB を Grid Control で管理できるようにします。

ここでは DBCA で DB を作りました。
途中で Grid Control を指定して管理するという画面が出てきます。

&ref(20.png,,70%);

Grid Control から見てみます。

&ref(21.png,,70%);

&ref(22.png,,70%);

「ターゲット」をクリックします。

&ref(23.png,,70%);

作ったインスタンスの orcl をクリックします。

&ref(24.png,,70%);

DB の中身を見ようとしますと認証を求められます。
あとは慣れた EM と同じです。

&ref(25.png,,70%);

* DB を後から追加する [#pc6c04d2]

DBCA 以外で作った DB を追加する方法についてまとめてみました。

まず、DBSNMP ユーザで接続できるようにします。
状態を確認してみると次のようになっていました。

#pre{{
SQL> select username, account_status from dba_users
  2  where username = 'DBSNMP';

USERNAME
--------------------------------------------------------------------------------
ACCOUNT_STATUS
--------------------------------------------------------------------------------
DBSNMP
EXPIRED & LOCKED
}}

直して使えるようにします。

#pre{{
SQL> alter user DBSNMP account unlock;

ユーザーが変更されました。

SQL> alter user DBSNMP identified by xxxxxxxx;

ユーザーが変更されました。

SQL>
}}

NetServices 経由で接続できることを確認します。

#pre{{
[oracle@ora1 ~]$ sqlplus dbsnmp/xxxxxxxx@orcl

SQL*Plus: Release 11.1.0.6.0 - Production on 土 8月 15 14:54:13 2009

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



Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
に接続されました。
SQL> quit
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing optionsと の接続が切断されました。
[oracle@ora1 ~]$ 
}}

必須なのかどうかはわかっていませんが、
あとは OMS 側で tnsnames.ora を書いておきます。

#pre{{
[oracle@em1 ~]$ export ORACLE_HOME=/u01/app/oracle/product/oms10g
[oracle@em1 ~]$ cd $ORACLE_HOME/network/admin
[oracle@em1 admin]$ cat tnsnames.ora 
orcl=
  (DESCRIPTION=
    (ADDRESS=(PROTOCOL=tcp)(HOST=ora1)(PORT=1521))
    (CONNECT_DATA=
      (SERVICE_NAME=orcl)))

[oracle@em1 admin]$ 
}}

tnsping して確認します。
OMS から対象のデータベースにつながるということです。

#pre{{
[oracle@em1 admin]$ $ORACLE_HOME/bin/tnsping orcl

TNS Ping Utility for Linux: Version 10.1.0.5.0 - Production on 15-AUG-2009 15:04:02

Copyright (c) 1997, 2003, Oracle.  All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=ora1)(PORT=1521)) (CONNECT_DATA= (SERVICE_NAME=orcl)))
OK (0 msec)
}}

Grid Control の画面からアクセスしてみます。

&ref(31.png);

「ターゲット」をクリックします。

&ref(32.png);

ora1 に DB インスタンスを追加しているのでそちらをクリック。

&ref(33.png,,70%);

まずはサーバとしての ora1 の情報が出てきます。
中の「ターゲット」をクリックします。

&ref(34.png);

新しく作ったインスタンスは orcl です。
「可用性」のところを見ると認識されているようです。

DB に付属の Enterprise Manager と同じような画面になりました。

&ref(35.png,,70%);

DB の情報を何か見ようとすると認証を求められます。
sys as sysdba でログインしてみます。

&ref(36.png,,70%);

これは表領域を見た例です。

&ref(37.png,,70%);

あとの使い方は同じです。

* 補足 [#f0c3041f]

[[Jeff Hunterさんの解説:http://www.idevelopment.info/data/Oracle/DBA_tips/Enterprise_Manager/OEM_12.shtml]] だと
インスタンスへに対して DBSNMP ユーザを使って接続して
構成する例があるんですが、うちの環境では接続しようとせずにエラーとなりました。

上記のように sys ユーザで接続して DB の中を管理するのは
普通にできるので、ここでは気にしないことにします。

----
#comment

トップ   差分 履歴 リロード   一覧 検索 最終更新   ヘルプ   最終更新のRSS