em启动/关闭报错解决
[oracle@localhost ~]$ emctl start dbconsole
TZ set to PRC
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0
Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved.
http://localhost.localdomain:1158/em/console/aboutApplication
Timezone mismatch: The agentTZRegion value (US/Pacific) in
/home/oracle/oracle/product/10.2.0/db_1/localhost.localdomain_orclsid/sysman/config/emd.properties
does not match the current environment TZ setting(PRC).
The dbconsole cannot run with this mismatch.
If US/Pacific is the correct timezone, set your timezone environment variable to US/Pacific and repeat the 'emctl start dbconsole' operation.
If US/Pacific is not the correct timezone, make sure that the timezone in your environment is correct, and then run the following command in your local Oracle Home: 'emctl resetTZ agent'
The output of this command will include detailed instructions to follow, to correct the mismatch.
根据提示执行:
[oracle@localhost ~]$ emctl resetTZ agent
TZ set to PRC
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0
Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved.
Updating /home/oracle/oracle/product/10.2.0/db_1/localhost.localdomain_orclsid/sysman/config/emd.properties...
Time zone set to PRC.
To complete this process, you must either:
connect to the database served by this DBConsole as user 'sysman', and execute:
SQL> exec mgmt_target.set_agent_tzrgn('localhost.localdomain:3938','PRC')
-- or --
connect to the database served by this DBConsole as user 'sys', and execute:
SQL> alter session set current_schema = SYSMAN;
SQL> exec mgmt_target.set_agent_tzrgn('localhost.localdomain:3938','PRC')
用sysdba连接到oracle:
[oracle@localhost ~]$ sqlplus sys/lubinsu as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Sun Mar 31 16:43:05 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> alter session set current_schema = SYSMAN;
Session altered.
SQL> exec mgmt_target.set_agent_tzrgn('localhost.localdomain:3938','PRC');
PL/SQL procedure successfully completed.
OK,再重启一次,成功:
[oracle@localhost ~]$ emctl start dbconsole
TZ set to PRC
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0
Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved.
http://localhost.localdomain:1158/em/console/aboutApplication
Starting Oracle Enterprise Manager 10g Database Control ........................... started.
------------------------------------------------------------------
Logs are generated in directory /home/oracle/oracle/product/10.2.0/db_1/localhost.localdomain_orclsid/sysman/log
[oracle@localhost ~]$ cat /home/oracle/oracle/product/10.2.0/db_1/localhost.localdomain_orclsid/sysman/log
cat: /home/oracle/oracle/product/10.2.0/db_1/localhost.localdomain_orclsid/sysman/log: Is a directory
这里可以很直观地看到Oracle的性能分析,对数据库进行维护。
但是问题又来了,关闭dbconsole的时候接连报下面的错误:
[oracle@localhost log]$ emctl stop dbconsole
TZ set to PRC
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0
Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved.
http://localhost.localdomain:1158/em/console/aboutApplication
Stopping Oracle Enterprise Manager 10g Database Control ...
--- Failed to shutdown DBConsole Gracefully ---
failed.
查出含有oc4j和dbconsole的进程,将他们都kill掉
[oracle@localhost log]$ ps -ef | grep oc4j
oracle 9799 9774 4 16:44 pts/1 00:01:15 /home/oracle/oracle/product/10.2.0/db_1/jdk/bin/java -server -Xmx256M -XX:MaxPermSize=96m -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -DORACLE_HOME=/home/oracle/oracle/product/10.2.0/db_1 -Doracle.home=/home/oracle/oracle/product/10.2.0/db_1/oc4j -Doracle.oc4j.localhome=/home/oracle/oracle/product/10.2.0/db_1/localhost.localdomain_orclsid/sysman -DEMSTATE=/home/oracle/oracle/product/10.2.0/db_1/localhost.localdomain_orclsid -Doracle.j2ee.dont.use.memory.archive=true -Djava.protocol.handler.pkgs=HTTPClient -Doracle.security.jazn.config=/home/oracle/oracle/product/10.2.0/db_1/oc4j/j2ee/OC4J_DBConsole_localhost.localdomain_orclsid/config/jazn.xml -Djava.security.policy=/home/oracle/oracle/product/10.2.0/db_1/oc4j/j2ee/OC4J_DBConsole_localhost.localdomain_orclsid/config/java2.policy -Djava.security.properties=/home/oracle/oracle/product/10.2.0/db_1/oc4j/j2ee/home/config/jazn.security.props -DEMDROOT=/home/oracle/oracle/product/10.2.0/db_1/localhost.localdomain_orclsid -Dsysman.md5password=true -Drepapi.oracle.home=/home/oracle/oracle/product/10.2.0/db_1 -Ddisable.checkForUpdate=true -Djava.awt.headless=true -jar /home/oracle/oracle/product/10.2.0/db_1/oc4j/j2ee/home/oc4j.jar -config /home/oracle/oracle/product/10.2.0/db_1/oc4j/j2ee/OC4J_DBConsole_localhost.localdomain_orclsid/config/server.xml
oracle 17085 5048 0 17:10 pts/1 00:00:00 grep oc4j
[oracle@localhost log]$ ps -ef | grep dbconsole
oracle 9774 1 0 16:44 pts/1 00:00:00 /home/oracle/oracle/product/10.2.0/db_1/perl/bin/perl /home/oracle/oracle/product/10.2.0/db_1/bin/emwd.pl dbconsole /home/oracle/oracle/product/10.2.0/db_1/localhost.localdomain_orclsid/sysman/log/emdb.nohup
oracle 17105 5048 0 17:10 pts/1 00:00:00 grep dbconsole
[oracle@localhost log]$ kill -9 9774
[oracle@localhost log]$ ps -ef | grep dbconsole
oracle 17138 5048 0 17:10 pts/1 00:00:00 grep dbconsole
然后执行emctl stop agent和emctl stop dbconsole即可:
[oracle@localhost log]$ emctl stop agent
TZ set to PRC
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0
Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved.
Stopping agent ... stopped.
[oracle@localhost log]$ emctl stop dbconsole
TZ set to PRC
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0
Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved.
http://localhost.localdomain:1158/em/console/aboutApplication
Stopping Oracle Enterprise Manager 10g Database Control ...
... Stopped.