一、启动监听时出TNS-12546错
症状:
$lsnrctl start
LSNRCTL for Solaris: Version 10.2.0.1.0 - Production on 19-APR-2007 16:38:17
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Starting /opt/oracle/oracle10/app/oracle10/product/10.2.0/Db_1/bin/tnslsnr: please wait...
TNSLSNR for Solaris: Version 10.2.0.1.0 - Production
System parameter file is /opt/oracle/oracle10/app/oracle10/product/10.2.0/Db_1/network/admin/listener.ora
Log messages written to /opt/oracle/oracle10/app/oracle10/product/10.2.0/Db_1/network/log/listener.log
Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
TNS-12546: TNS:permission denied
TNS-12560: TNS:protocol adapter error
TNS-00516: Permission denied
Solaris Error: 13: Permission denied
Listener failed to start. See the error message(s) above...
产生原因和解决办法:
The Unix permissions for the hidden directory /tmp/.oracle should be:
Owner = the Oracle user who performed the database install,
Group = the dba group of the Oracle user,
and the directory's Unix permissions should be drwxrwxrwx
Change the permissions on the .oracle directory:
1) cd /var/tmp(on Solaris) or /tmp(on Hp and IBM)
2) Change the ownership and group of the ".oracle" directory to "oracle/dba":
# chown -R oracle10:dba .oracle
or
3) Change the permissions on the directory:
# chmod 777 .oracle
二、通过sqlplus登陆出ORA-12514错
症状:
$ sqlplus wacos/oss@orcl10
SQL*Plus: Release 10.2.0.1.0 - Production on Thu Apr 19 17:03:30 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
产生原因和解决办法:
$ lsnrctl status
...
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
发现并没有启动orcl10的监听,然后查看监听文件:
$ cd $ORACLE_HOME/network/admin
$ more listener.ora
...
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /opt/oracle/oracle10/app/oracle10/product/10.2.0/Db_1)
(PROGRAM = extproc)
)
)
...
发现SID_LIST_LISTENER段并没有包含实例orcl10的相关信息:
$ vi listener.ora
修改SID_LIST_LISTENER成以下这样:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /opt/oracle/oracle10/app/oracle10/product/10.2.0/Db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = orcl10)
(ORACLE_HOME = /opt/oracle/oracle10/app/oracle10/product/10.2.0/Db_1)
(PROGRAM = orcl10)
)
)
然后重启监听并查看验证:
$ lsnrctl stop
$ lsnrctl start
$ lsnrctl status
...
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl10" has 1 instance(s).
Instance "orcl10", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
实例orcl10的监听也起来了。
现在可以登陆了:
$ sqlplus wacos/oss@orcl10
SQL*Plus: Release 10.2.0.1.0 - Production on Thu Apr 19 17:19:51 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL>
三、Oracle10g EM Database Console显示信息错误,和真实信息不一致
症状:
进入EM控制台(http://172.19.111.38:1158/em)后,没有输入用户名和密码就直接登陆并显示数据库状态信息;
另外刚开始数据库监听没有起来,所以EM控制台显示信息也是说监听没有起来,后来监听起来了,EM控制台还是显示旧信息,刷新页面也那样。
问题原因和解决办法:
重启控制台服务后也没有效果:
$ emctl status dbconsole
$ emctl stop dbconsole
$ emctl start dbconsole
可能时原先监听未成功启动过,或者由于我修改过监听端口(1521改成1528)造成的。
重建em资料库:
$ emctl stop dbconsole
$ emca -repos recreate
...
Enter the following information:
Database SID: orcl10
Listener port number: 1528
Password for SYS user: oracle10
Password for SYSMAN user: oracle10
Do you wish to continue? [yes(Y)/no(N)]: y
...
INFO: Repository successfully created
Enterprise Manager configuration completed successfully
FINISHED EMCA at Apr 19, 2007 6:20:22 PM
配置dbcontrol:
$ emca -config dbcontrol db
Enter the following information:
Database SID: orcl10
Database Control is already configured for the database orcl10
You have chosen to configure Database Control for managing the database orcl10
This will remove the existing configuration and the default settings and perform a fresh configuration
Do you wish to continue? [yes(Y)/no(N)]: y
Listener port number: 1528
Password for SYS user: oracle10
Password for DBSNMP user: oracle10
Password for SYSMAN user: oracle10
Email address for notifications (optional):
Outgoing Mail (SMTP) server for notifications (optional):
...
Do you wish to continue? [yes(Y)/no(N)]: y
...
Enterprise Manager configuration completed successfully
FINISHED EMCA at Apr 19, 2007 6:27:44 PM
然后再进入 http://172.19.111.38:1158/em 查看正常了。
附emca和emctl常用的命令语法:
Oracle10G的EM采用了web方式,并且分成了2个产品,database control和grid control。Grid control需要下载单独的光盘安装。在用DBCA建库的时候,可以选择是否启用dbcontrol,启用的话需要在数据库中建立一个sysman的schema,用于保存EM的一些数据,这个就是EM的资料库(repository)。使用命令行工具emca可以创建,修改,重建或者删除dbcontrol的配置。
由于要在数据库中建EM资料库,数据库和监听都必须已经启动并正常工作。
emca -repos create 创建一个EM资料库
emca -repos recreate 重建一个EM资料库
emca -repos drop 删除一个EM资料库
emca -config dbcontrol db 配置数据库的 Database Control
emca -deconfig dbcontrol db 删除数据库的 Database Control配置
emca -reconfig ports 重新配置db control和agent的端口
emctl start console 启动EM console服务,使用前需要先设置ORACLE_SID环境变量
emctl stop console 停止EM console服务,使用前需要先设置ORACLE_SID环境变量
注:通过查看$ORACLE_HOME/install/portlist.ini 文件可以知道当前dbcontrol正在使用的端口,默认dbcontrol http端口1158,agent端口3938。如果要重新配置端口,可以使用如下命令:
emca -reconfig ports -dbcontrol_http_port 1159
emca -reconfig ports -agent_port 3939
使用命令行工具emctl可以启动/停止console服务,察看服务状态等。