问题:emctl start dbconsole不能启动
创新互联建站是一家专业提供凌源企业网站建设,专注与成都网站设计、做网站、成都外贸网站建设公司、HTML5、小程序制作等业务。10年已为凌源众多企业、政府机构等服务。创新互联专业网站制作公司优惠进行中。
1、 Lsnrctl监听程序正常启动
2、 emca -config dbcontrol db -repos recreate重建数据库出现如下报错:
但是也用export ORACLE_UNQNAME=orcl设置过
3、 查看日志error 111
[tom@004 log]$ pwd
/u01/app/tom/product/11.2.0/dbhome_1/localhost_orcl/sysman/log
[tom@004 log]$ more emdctl.trc
......
2014-06-28 01:32:03,320 Thread-3266332416 WARN http: nmehl_connect_internal: connect failed to (localhost:1158): 拒绝连接 (error = 111)
4、 包括环境变量、/etc/hosts、/etc/sysconfig/network设置也都正确
5、 [tom@004 log]$ emctl status dbconsole
OC4J Configuration issue. /u01/app/tom/product/11.2.0/dbhome_1/oc4j/j2ee/OC4J_DBConsole_0.0.0.4_orcl not found.
注意红色部分,我主机名是004,而查看emctl启动的时候,某些参数被解析成了.0.0.04
最终换个主机名zhou,问题得以解决。
问题:用Oracle SQL Developer连接数据库出现如下报错:
listener does not currently know of sid
1、 查看数据库实例名:
[tom@zhou ~]$ echo $ORACLE_SID
orcl
2、 查看相关配置文件
[tom@zhou admin]$ pwd
/u01/app/tom/product/11.2.0/dbhome_1/network/admin
[tom@zhou admin]$ ls
listener.ora samples shrept.lst sqlnet.ora tnsnames.ora
[tom@zhou admin]$ more tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/tom/product/11.2.0/dbhome_1/
network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
[tom@zhou admin]$ more listener.ora
# listener.ora Network Configuration File: /u01/app/tom/product/11.2.0/dbhome_1/
network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /u01/app/tom
红色部分应该是localohst,默认有可能是localhost.domain
一、环境变量:
[tom@zhou ~]$ cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
export ORACLE_SID=orcl
export ORACLE_HOME=/u01/app/tom/product/11.2.0/dbhome_1
export PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_HOSTNAME=localhost
[tom@zhou ~]$ hostname
zhou
二、Hosts文件:
[tom@zhou ~]$
[tom@zhou ~]$ cat /etc/hosts
127.0.0.1localhost.localdomainlocalhost.localdomainlocalhost4localhost4.localdomain4localhostzhou
::1localhost.localdomainlocalhost.localdomainlocalhost6localhost6.localdomain6 localhostzhou
三、主机名:
[tom@zhou ~]$ hostname
zhou
[tom@zhou ~]$ cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=zhou
设置主机名,最好用root用户使用setup工具进行修改,在这里修改主机名,系统自己都会把好几个地方的配置文件都会改好。