安装好oracle数据库后,总是需要配置一些文件。
listener.ora和tnsnames.ora的文件地址:E:\oracle\product\10.2.0\db_1\network\ADMIN
前言:今天2016年11月11日,双十一啊,光棍节啊,购物节啊。
其实嘛,对于我而且,意义更加重要。
哈哈。3周年纪念日啊。其余不谈了。
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来访问数据库了,下面看例子:
访问本地:
访问公司服务器: