共计 1507 个字符,预计需要花费 4 分钟才能阅读完成。
安装好 Oracle 数据库后,总是需要配置一些文件。
listener.ora 和 tnsnames.ora 的文件地址:E:\oracle\product\10.2.0\db_1\network\ADMIN
listener.ora
//SinoCredit-PC 是我的计算机名称,这样配置,可以直接用 127.0.0.1 访问本地啦。
//orcl 是我的数据库安装时,填写的实例名
# listener.ora Network Configuration File: E:\oracle\product\10.2.0\db_1\NETWORK\ADMIN\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = orcl)
(ORACLE_HOME = E:\oracle\product\10.2.0\db_1)
(GLOBAL_DBNAME= orcl)
)
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = E:\oracle\product\10.2.0\db_1)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = SinoCredit-PC)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
)
tnsnames.ora
//SERVER_ORCL 配置的是我公司服务器数据库
//ORCL 配置的是我自己电脑上的数据库
# tnsnames.ora Network Configuration File: E:\oracle\product\10.2.0\db_1\NETWORK\ADMIN\tnsnames.ora
# Generated by Oracle configuration tools.
SERVER_ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 211.88.1.111)(PORT = 1522))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
)
(CONNECT_DATA =
(SID = ORCL)
(SERVICE_NAME = orcl)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
以上配置完了,就可以用 plsql 来访问数据库了,下面看例子:
访问本地:
访问公司服务器:
更多 Oracle 相关信息见 Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12
本文永久更新链接地址 :http://www.linuxidc.com/Linux/2017-05/144311.htm