Red hat AS oracle11g 手工创建OEM

来源:互联网 发布:ai mac版 编辑:程序博客网 时间:2024/05/01 02:04

环境:

Red Hat Enterprise Linux Server release 5.3 (Tikanga)+oracle 11.2.0.3

1.检查密码文件   
  /u01/app/oracle/product/11.2.0/dbs/orapwocm

[oracle@mydb ~]$ cd  /u01/app/oracle/product/11.2.0/dbs/
[oracle@mydb dbs]$ ls -l
total 20
-rw-rw---- 1 oracle oinstall 1544 Oct 10 15:34 hc_ocp.dat
-rw-r--r-- 1 oracle oinstall 2851 May 15  2009 init.ora
-rw-r----- 1 oracle oinstall   24 Oct 10 15:40 lkOCP
-rw-r----- 1 oracle oinstall 1536 Oct 10 21:36 orapwocp
-rw-r----- 1 oracle oinstall 1536 Oct 10 21:29 spfileocp.ora

2.检查hostname

[oracle@mydb dbs]$ hostname
mydb

3.检查system表空间

SQL> select b.tablespace_name,round(sum(b.bytes)/1024/1024,0) sum_MB, round(sum(nvl(a.bytes,0))/1024/1024,0) 
  2       free_MB,round((sum(b.bytes)-sum(nvl(a.bytes,0)))/sum(b.bytes),4)*100 use_precent
  3       from (select tablespace_name,file_id,sum(bytes) bytes from dba_free_space group by tablespace_name,file_id ) a,dba_data_files b
  4      where a.file_id(+)=b.file_id and a.tablespace_name(+)=b.tablespace_name
  5      group by b.tablespace_name;


TABLESPACE_NAME                    SUM_MB    FREE_MB USE_PRECENT
------------------------------ ---------- ---------- -----------
SYSAUX                                325        248       23.69
USERS                                  50         49           2
UNDOTBS                               200         48       76.25
SYSTEM                                500        244        51.2


4.检查监听lsnrctl status

[oracle@mydb dbs]$ lsnrctl status


LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 10-OCT-2013 23:23:12


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


Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date                10-OCT-2013 21:20:53
Uptime                    0 days 2 hr. 2 min. 18 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/diag/tnslsnr/mydb/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=mydb)(PORT=1521)))
Services Summary...
Service "ocp" has 1 instance(s).
  Instance "ocp", status READY, has 1 handler(s) for this service...
The command completed successfully


5.查用户DBSNMP/SYSMAN

SQL> select username from dba_users;


USERNAME
------------------------------
OUTLN
SYS
SYSTEM
GYJ
APPQOSSYS
DBSNMP
DIP
ORACLE_OCM


SQL> CREATE USER sysman IDENTIFIED BY oracle;

User created.

SQL> grant dba to sysman;

Grant succeeded.



6.export  ORACLE_HOSTNAME=mydb     --hostname



7.删除 emca -config dbcontrol db -repos  drop

8.新建 emca -config dbcontrol db -repos create


9.重建 emca -config dbcontrol db -repos  recreate

[oracle@mydb ocp]$ emca -config dbcontrol db -repos  recreate


STARTED EMCA at Oct 10, 2013 9:35:22 PM
EM Configuration Assistant, Version 11.2.0.3.0 Production
Copyright (c) 2003, 2011, Oracle.  All rights reserved.


Enter the following information:
Database SID: ocp
Listener port number: 1521
Listener ORACLE_HOME [ /u01/app/oracle/product/11.2.0 ]: /u01/app/oracle/product/11.2.0 
Password for SYS user:  
Password for DBSNMP 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 ................ /u01/app/oracle/product/11.2.0


Local hostname ................ mydb
Listener ORACLE_HOME ................ /u01/app/oracle/product/11.2.0
Listener port number ................ 1521
Database SID ................ ocp
Email address for notifications ............... 
Outgoing Mail (SMTP) server for notifications ............... 


-----------------------------------------------------------------
----------------------------------------------------------------------
WARNING : While repository is dropped the database will be put in quiesce mode.
----------------------------------------------------------------------
Do you wish to continue? [yes(Y)/no(N)]: y
Oct 10, 2013 9:36:50 PM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/ocp/emca_2013_10_10_21_35_22.log.
Oct 10, 2013 9:36:51 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Dropping the EM repository (this may take a while) ...
Oct 10, 2013 9:36:51 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully dropped
Oct 10, 2013 9:36:52 PM oracle.sysman.emcp.EMReposConfig createRepository
INFO: Creating the EM repository (this may take a while) ...
Oct 10, 2013 9:47:47 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully created
Oct 10, 2013 9:47:55 PM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository
INFO: Uploading configuration data to EM repository (this may take a while) ...
Oct 10, 2013 9:49:16 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Uploaded configuration data successfully
Oct 10, 2013 9:49:18 PM oracle.sysman.emcp.ParamsManager getLocalListener
WARNING: Error retrieving listener for mydb
Oct 10, 2013 9:49:21 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Securing Database Control (this may take a while) ...
Oct 10, 2013 9:49:31 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Database Control secured successfully.
Oct 10, 2013 9:49:31 PM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) ...
Oct 10, 2013 9:50:34 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: Database Control started successfully
Oct 10, 2013 9:50:34 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: >>>>>>>>>>> The Database Control URL is https://mydb:1158/em <<<<<<<<<<<
Oct 10, 2013 9:50:37 PM oracle.sysman.emcp.EMDBPostConfig invoke
WARNING: 
************************  WARNING  ************************


Management Repository has been placed in secure mode wherein Enterprise Manager data will be encrypted.  The encryption key has been placed in the file: /u01/app/oracle/product/11.2.0/mydb_ocp/sysman/config/emkey.ora. Ensure this file is backed up as the encrypted data will become unusable if this file is lost. 


***********************************************************
Enterprise Manager configuration completed successfully
FINISHED EMCA at Oct 10, 2013 9:50:37 PM

10.查看状态
[oracle@mydb ocp]$ emctl status dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.3.0 
Copyright (c) 1996, 2011 Oracle Corporation.  All rights reserved.
https://mydb:1158/em/console/aboutApplication
Oracle Enterprise Manager 11g is running. 
------------------------------------------------------------------
Logs are generated in directory /u01/app/oracle/product/11.2.0/mydb_ocp/sysman/log 



8.删除 emca -config dbcontrol db -repos  drop

9.新建 emca -config dbcontrol db -repos create