Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2716450
  • 博文数量: 416
  • 博客积分: 10220
  • 博客等级: 上将
  • 技术积分: 4193
  • 用 户 组: 普通用户
  • 注册时间: 2006-12-15 09:47
文章分类

全部博文(416)

文章存档

2022年(1)

2021年(1)

2020年(1)

2019年(5)

2018年(7)

2017年(6)

2016年(7)

2015年(11)

2014年(1)

2012年(5)

2011年(7)

2010年(35)

2009年(64)

2008年(48)

2007年(177)

2006年(40)

我的朋友

分类: Oracle

2017-10-30 15:44:17

测试环境:oracle12c+win10

用工具pl/sql developer ,以前连接好好的,现在突然不行了,经过多次测试,发现了问题所在
ORACLE_HOME变量对它的响应.
oracle client目录在D:\Program Files\oracle-client\ora90\
oracle安装在D:\app\orcl\product\12.1.0\dbhome_1\
A. 若用oracle工具,如配置监听什么的,将oracle_home改为oracle安装目录D:\app\orcl\product\12.1.0\dbhome_1,否则监听不正常
B. 若用pl/sql ,把oracle_home改为oracle client所在的目录D:\Program Files\oracle-client\ora90,不则报错误:Not logged on 

测试步骤:
1. 在服务中查看oracle后台数据库Listener是否正常启动.
2。测试监听是否正常:tnsping orcl
3. 连接数据库.

监听配置文件LISTENER.org:
# listener.ora Network Configuration File: D:\Program Files\oracle-client\orcl\listener.ora
# Generated by Oracle configuration tools.


SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = d:\app\orcl\product\12.1.0\dbhome_1)
      (PROGRAM = extproc)
      (ENVS = "EXTPROC_DLLS=ONLY:d:\app\orcl\product\12.1.0\dbhome_1\bin\oraclr12.dll")
    )
    //有时不配置它不行
    (SID_DESC =
    (GLOBAL_DBNAME = ORCL)
    (ORACLE_HOME = D:\app\orcl\oradata\orcl)
    (SID_NAME = ORCL)
    )
  )


SID_LIST_ORCL =
  (SID_LIST =    
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = D:\app\orcl\oradata\orcl)
      (PROGRAM = extproc)
    )
   (SID_DESC =
    (GLOBAL_DBNAME = ORCL)
    (ORACLE_HOME = D:\app\orcl\oradata\orcl)
    (SID_NAME = ORCL)
    )
  )


LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
    )
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )


ADR_BASE_LISTENER = d:\app\orcl\product\12.1.0\dbhome_1\log

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
  )


ADR_BASE_ORCL = d:\app\orcl\product\12.1.0\dbhome_1\log

////////////////////////////////////
tnsnames.ora
ORACLR_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
    (CONNECT_DATA =
      (SID = CLRExtProc)
      (PRESENTATION = RO)
    )
  )


ORCL =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )


TST =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.187)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = TST)
    )
  )


SAP =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.187)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = TST)
   )
  )
server: win2003+oracle9i
 client端配置监听sap, tst,时,若出现ERROR:
ORA-12504: TNS: 监听程序在 CONNECT_DATA 中未获得 SERVICE_NAME
需要将环境变量:
TNS_ADMIN=D:\Program Files\oracle-client\ora90 去掉.


阅读(2337) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~