1、本机环境:
操作系统:Redhat 5.3 ,IP地址:192.168.1.111 ,ORACLE 10G
2、试图通过windows7 下TOAD软件连接Linux下的ORACLE DATABASE
3、在oracle用户下使用通过sqlplus命令登录数据库如下所示:
[oracle@localhost ~]$ sqlplus
SQL*Plus: Release 10.2.0.1.0 - Production on Sat Jun 2 01:14:00 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Enter user-name: scott
Enter password:
ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux Error: 2: No such file or directory
问题解决:
查阅了相关
ORA-27101 Shared memory realm does not exist
ORA-01034 ORACLE not available
的说明,解释为ORACLE_HOME或者ORACLE_SID设置不正确。
但检查bash_profile以后没有发现错误;
错误点,沒有开放oracle服务;
解决办法 如下所示:
lsnrctl start
sqlplus '/as sysdba'
sql> startup
emctl start dbconsole
isqlplusctl start
4、配置监听器,如下
4.1 使用netmgr图形化配置oracle数据库监听器
[oracle@rhel bin]$pwd
/usr/local/app/oracle/product/10.2.0/db_1/bin
[oracle@rhel bin]$netmgr
截图如下:
步骤:1、选中Listeners,点击左侧+添加监听器,如果存在监听器则不用添加
2、在添加的监听器中添加坚挺地址,协议TCP/IP,host为oracle数据库所在主机名称或ip地址,Port默认为1521,如下图所示
3、监听位置下拉框中选择数据库服务,配置相应全局数据库名及SID,如下图所示:
4、File->保存网络配置.
5、选中Service Naming,+添加网络服务名称(自定,建议使用数据库名称作为网络服务名)如下图所示:
6、一路next。最后可以点击Test 配置访问用户,测试是否可以通信。OK
7、File->保存网络配置.退出
8、[oracle@rhel bin]$lsnrctl start
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 07-AUG-2012 19:53:37
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Starting /usr/local/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /usr/local/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Log messages written to /usr/local/app/oracle/product/10.2.0/db_1/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rhel)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rhel)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 07-AUG-2012 19:53:37
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /usr/local/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /usr/local/app/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rhel)(PORT=1521)))
Services Summary...
Service "ezt" has 1 instance(s).
Instance "ezt", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
9、[oracle@rhel bin]$isqlplusctl start
iSQL*Plus 10.2.0.1.0
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Starting iSQL*Plus ...
iSQL*Plus started.
10、OK完成.使用浏览器输入地址http://oracle服务器地址:5560/isqlplus 测试isqlplus是否可以访问
4.2 备注基本内容如下:
[root@rhel admin]# cat listener.ora
# listener.ora Network Configuration File: /usr/local/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = ezt)
(SID_NAME = ezt)
(ORACLE_HOME = /usr/local/app/oracle/product/10.2.0/db_1)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.111)(PORT = 1521))
)
)
[root@rhel admin]# cat tnsnames.ora
# tnsnames.ora Network Configuration File: /usr/local/app/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
EZT =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.111)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ezt)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
以上两个文件的GLOBAL_DBNAME、SERVICE_NAME必须相同。SID_NAME改为自己的实例名称,Host改为linux系统ip地址。