zoukankan      html  css  js  c++  java
  • Installing OEM for second instance

            一台机器运行着从Oracle11.2.0.3的安装程序里的默认的数据库。这个实例名字叫做o1123。


            然后我手动创建了第二个实例(通过swingbenchcrdb.shslob的测试)而不是通过数据库配置助手(或许这是个错误),然后我想访问OEM。第二个实例名字是SOE60G(一个60GB的swingbench数据集数据库)。


            首先试着启动dbconsole:


    $ emctl start dbconsole
    OC4J Configuration issue.
     /home/oracle/oracle1123/product/oc4j/j2ee/OC4J_DBConsole_perf234-target1.delphix.com_SOE60G 
    #ff0000;">not found.
    OK, missing file. EM wasn’t configured for this database, make sense. Let’s configure it
    
    $ emca -config dbcontrol db -repos create
    ...
    #ff0000;">SEVERE: Dbcontrol Repository already exists.  
    Fix the error(s) and run EM Configuration Assistant again in standalone mode.
    Looks like there is already a repository, so lets configure EM with out making the repository
    
    # emca -config dbcontrol db
    #ff0000;">WARNING: ORA-00942: table or view does not exist
    SEVERE: The existing database you have specified has Grid Control repository. 
    This operation is not supported.
    Hmm, what table is missing? Put db in sql trace mode to see what SQL statement ran into the 942 error
    
    sqlplus / as sysdba
    alter database set sql_trace=true
    exit
    rerun and grep for 942 in trace files in user_dump_dest
    
    cd /home/oracle/oracle1123/diag/rdbms/soe60g/SOE60G/trace
    grep 942 *
    this show a dozen or so files.
    Open each one up and searched for 942 and found two distinct SQL queries:
    
    SELECT ATTRIBUTE,SCOPE,NUMERIC_VALUE,CHAR_VALUE,DATE_VALUE FROM #ff0000;">SYSTEM.PRODUCT_PRIVS
    WHERE (UPPER('SQL*Plus') LIKE UPPER(PRODUCT)) AND (USER LIKE USERID)
    
    select count(*) from #ff0000;">sysman.mgmt_versions where status > 0 and component_mode
    like 'SYSAUX' and component_name in ('DB','CORE')
    The first table is from not having run $ORACLE_HOME/sqlplus/admin/pupbld.sql
    Second is the problem emca was running into. Let’s look at sysman’s objects and see what’s there.
    
    sqlplus sysman/sys
    select object_name from user_objects;
    -> no rows returned
    OK, sysman looks empty , let’s drop it and recreated it
    
    sqlplus / as sysdba
    drop user sysman cascade;
    drop user MGMT_VIEW cascade;
    someone’s blog had suggested dropping the following but I didn’t
    
    # drop role MGMT_USER;
    # drop public synonym MGMT_TARGET_BLACKOUTS;
    # drop public synonym SETEMVIEWUSERCONTEXT;
    #                                                        host      port  SID
    # $ORACLE_HOME/sysman/admin/emdrep/bin/RepManager antarctic 2483 sprod -action drop
    # ./emca -repos create
    rerun emca
    
    $ emca -config dbcontrol db -repos create
    ....
    Do you wish to continue? [yes(Y)/no(N)]: y
    Apr 20, 2013 7:27:51 AM oracle.sysman.emcp.EMConfig perform
    INFO: This operation is being logged at 
    /home/oracle/oracle1123/cfgtoollogs/emca/SOE60G/emca_2013_04_20_07_27_38.log.
    Apr 20, 2013 7:27:51 AM oracle.sysman.emcp.ParamsManager checkListenerStatusForDBControl
    #ff0000;">WARNING: ORA-01031: insufficient privileges
    Apr 20, 2013 7:27:51 AM oracle.sysman.emcp.EMConfig perform
    SEVERE:
    Database connection through listener failed. Fix the error and run EM Configuration Assistant again.
    Some of the possible reasons may be:
    1) Listener port 1521 provided is incorrect. Provide the correct port.
    2) Listener is not up. Start the Listener.
    3) Database service SOE60G is not registered with listener. Register the database service.
    4) Listener is up on physical host and ORACLE_HOSTNAME environment variable is set to
     virtual host. Unset ORACLE_HOSTNAME environment variable.
    5) Listener is up on virtual host. Set environment variable ORACLE_HOSTNAME=.
    6) /etc/hosts does not have correct entry for hostname.
    Notice the ORA-01031. Hmm, I can connect as sqlplus / as sysdba but connecting as sysdba through the listener requires a password file.  Let’s see if password files are set up
    
    sqlplus / as sysdba
    show parameters remote_login_passwordfile
    remote_login_passwordfile            string      EXCLUSIVE
    that’s set correct, but is there a password file?
    
    cd $ORACLE_HOME/dbs
    ls orapw$ORACLE_SID
    ls: cannot access orapwdSOE60G: No such file or directory
    not there, let’s create it
    
    orapwd FILE=orapw$ORACLE_SID ENTRIES=30
    now emca works !
    
    Now what URL to I use to access OEM for the second database?
    It’s the same URL as the first database but with different port. We can find the ports for each database in the following file
    
    cat $ORACLE_HOME/install/portlist.ini
    Enterprise Manager Console HTTP Port (o1123) = 1158
    Enterprise Manager Agent Port #ff0000;">(o1123) = 3938
    Enterprise Manager Console HTTP Port (SOE60G) = 5500
    Enterprise Manager Agent Port #ff0000;">(SOE60G) = 1830
    Post script

            通过上述的步骤,当我能够在Chrome里访问OEM数据库页面时,一件奇怪的事情发生了,但是事还没完。进入OEM,首先要求我登录。我以system用户登录,我看见了数据库主页面,然后如果我点击性能标签,然后我得到提示要求我重新登录。我再次登录,回到数据库主页面。不管我点击哪个标签,我最终都在登录后回到数据库主页面。


            Firefox里,虽然我曾经登录,我可以进入任何一个标签,更神奇的是,它居然正常工作了!


            PS 当我运行emca时,我得到很多变量提示。不试这个,但是好像所有的参数都可以在命令行得到。


            参考

            http://dbataj.blogspot.com/2011/09/severe-dbcontrol-repository-already.html

     

            http://sheltong-appsdba.blogspot.com/2010/07/configuring-em-on-oracle-11g.html

     

            https://forums.oracle.com/forums/thread.jspa?threadID=1773883




    	Had a machine running the default database from the Oracle 11.2.0.3 installer. This instance was called o1123.
    I then created a second database by hand (with crdb.sh for swingbench and slob tests) instead of dbca (maybe that was a mistake) and then I wanted to acccess OEM. The second instance was called SOE60G ( a 60GB swingbench dataset database)
    
    First tried to start up dbconsole:
    
    $ emctl start dbconsole
    OC4J Configuration issue.
     /home/oracle/oracle1123/product/oc4j/j2ee/OC4J_DBConsole_perf234-target1.delphix.com_SOE60G 
    #ff0000;">not found.
    OK, missing file. EM wasn’t configured for this database, make sense. Let’s configure it
    
    $ emca -config dbcontrol db -repos create
    ...
    #ff0000;">SEVERE: Dbcontrol Repository already exists.  
    Fix the error(s) and run EM Configuration Assistant again in standalone mode.
    Looks like there is already a repository, so lets configure EM with out making the repository
    
    # emca -config dbcontrol db
    #ff0000;">WARNING: ORA-00942: table or view does not exist
    SEVERE: The existing database you have specified has Grid Control repository. 
    This operation is not supported.
    Hmm, what table is missing? Put db in sql trace mode to see what SQL statement ran into the 942 error
    
    sqlplus / as sysdba
    alter database set sql_trace=true
    exit
    rerun and grep for 942 in trace files in user_dump_dest
    
    cd /home/oracle/oracle1123/diag/rdbms/soe60g/SOE60G/trace
    grep 942 *
    this show a dozen or so files.
    Open each one up and searched for 942 and found two distinct SQL queries:
    
    SELECT ATTRIBUTE,SCOPE,NUMERIC_VALUE,CHAR_VALUE,DATE_VALUE FROM #ff0000;">SYSTEM.PRODUCT_PRIVS
    WHERE (UPPER('SQL*Plus') LIKE UPPER(PRODUCT)) AND (USER LIKE USERID)
    
    select count(*) from #ff0000;">sysman.mgmt_versions where status > 0 and component_mode
    like 'SYSAUX' and component_name in ('DB','CORE')
    The first table is from not having run $ORACLE_HOME/sqlplus/admin/pupbld.sql
    Second is the problem emca was running into. Let’s look at sysman’s objects and see what’s there.
    
    sqlplus sysman/sys
    select object_name from user_objects;
    -> no rows returned
    OK, sysman looks empty , let’s drop it and recreated it
    
    sqlplus / as sysdba
    drop user sysman cascade;
    drop user MGMT_VIEW cascade;
    someone’s blog had suggested dropping the following but I didn’t
    
    # drop role MGMT_USER;
    # drop public synonym MGMT_TARGET_BLACKOUTS;
    # drop public synonym SETEMVIEWUSERCONTEXT;
    #                                                        host      port  SID
    # $ORACLE_HOME/sysman/admin/emdrep/bin/RepManager antarctic 2483 sprod -action drop
    # ./emca -repos create
    rerun emca
    
    $ emca -config dbcontrol db -repos create
    ....
    Do you wish to continue? [yes(Y)/no(N)]: y
    Apr 20, 2013 7:27:51 AM oracle.sysman.emcp.EMConfig perform
    INFO: This operation is being logged at 
    /home/oracle/oracle1123/cfgtoollogs/emca/SOE60G/emca_2013_04_20_07_27_38.log.
    Apr 20, 2013 7:27:51 AM oracle.sysman.emcp.ParamsManager checkListenerStatusForDBControl
    #ff0000;">WARNING: ORA-01031: insufficient privileges
    Apr 20, 2013 7:27:51 AM oracle.sysman.emcp.EMConfig perform
    SEVERE:
    Database connection through listener failed. Fix the error and run EM Configuration Assistant again.
    Some of the possible reasons may be:
    1) Listener port 1521 provided is incorrect. Provide the correct port.
    2) Listener is not up. Start the Listener.
    3) Database service SOE60G is not registered with listener. Register the database service.
    4) Listener is up on physical host and ORACLE_HOSTNAME environment variable is set to
     virtual host. Unset ORACLE_HOSTNAME environment variable.
    5) Listener is up on virtual host. Set environment variable ORACLE_HOSTNAME=.
    6) /etc/hosts does not have correct entry for hostname.
    Notice the ORA-01031. Hmm, I can connect as sqlplus / as sysdba but connecting as sysdba through the listener requires a password file.  Let’s see if password files are set up
    
    sqlplus / as sysdba
    show parameters remote_login_passwordfile
    remote_login_passwordfile            string      EXCLUSIVE
    that’s set correct, but is there a password file?
    
    cd $ORACLE_HOME/dbs
    ls orapw$ORACLE_SID
    ls: cannot access orapwdSOE60G: No such file or directory
    not there, let’s create it
    
    orapwd FILE=orapw$ORACLE_SID ENTRIES=30
    now emca works !
    
    Now what URL to I use to access OEM for the second database?
    It’s the same URL as the first database but with different port. We can find the ports for each database in the following file
    
    cat $ORACLE_HOME/install/portlist.ini
    Enterprise Manager Console HTTP Port (o1123) = 1158
    Enterprise Manager Agent Port #ff0000;">(o1123) = 3938
    Enterprise Manager Console HTTP Port (SOE60G) = 5500
    Enterprise Manager Agent Port #ff0000;">(SOE60G) = 1830
    Post script
    
    After the above steps, one of the bizarre things I ran into was being able to  access OEM database page in Chrome but nothing else. Coming into OEM, I’m first asked for a login. I login as system, I see the database home page, then if I click on the performance tab, then I get prompted for the login again. I then  login again, and I’m back at the database home page. No matter what tab I click, I end up back at the database home page after giving login credentials.
    In Firefox, though once I login, I can go to any of the other tabs and it works!
    
     
    
    PS when running emca above I was prompted for a number of variables.  didn’t try this, but looks like all the arguments can be given in the command line
    
    emca -repos create -silent -ORACLE_HOSTNAME perf234-target1 -SID SOE60G 
    -SERVICE_NAME SOE60G -ORACLE_HOME /home/oracle/oracle1123/product
     -SYS_PWD sys -DBSNMP_PWD sys -SYSMAN_PWD sys 
    -HOST_USER oracle -HOST_USER_PWD  -PORT 1521
     
    
    references
    
    http://dbataj.blogspot.com/2011/09/severe-dbcontrol-repository-already.html
    
    http://sheltong-appsdba.blogspot.com/2010/07/configuring-em-on-oracle-11g.html
    
    https://forums.oracle.com/forums/thread.jspa?threadID=1773883
    


            http://www.oaktable.net/content/installing-oem-second-instance


    katoon Sina CSDN
    @Wentasy 博文仅供参考,欢迎大家来访。如有错误之处,希望批评指正。原创博文如需转载请注明出处,谢谢 :) [CSDN博客]
  • 相关阅读:
    021.day21 反射 Class类 反射常用操作
    020.day20 线程概述 多线程优缺点 线程的创建 线程常用方法 生命周期 多线程同步
    019.day19 缓冲流 对象流 标准输入输出流
    018.day18 map集合如何实现排序 File类 IO流 字节流 字符流 编码
    017.day17 Map接口 克隆 treeSet集合排重缺陷
    016.day16 HashSet TreeSet 比较器Comparable Comparator
    015.day15
    014.day14
    013.day13
    线程
  • 原文地址:https://www.cnblogs.com/jiangu66/p/3071976.html
Copyright © 2011-2022 走看看