Oracle三种连接方式

一、 CONNECT_DATA 设置为 oracle 的全局数据库名

TOS =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(HOST = soho-ivgcrcy9al)(PORT = 1521))

)

(CONNECT_DATA =

(SERVICE_NAME = tos.lee.com)

)

)

假定数据库 init.ora 的参数设置为
db_name = tos

db_domain = lee.com

也可以直接指定 service_names = tos.lee.com

注意 ,service_names 是个动态参数, pmon 进程在动态的注册到 listener  时有延迟(大概几分钟)

二、设置 SERVICE_NAME    listener.ora 里的 GLOBAL_DBNAME 

tnsnames.ora

TOS =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(HOST = soho-ivgcrcy9al)(PORT = 1521))

)

(CONNECT_DATA =

(SERVICE_NAME = tos)

)

)

listener.ora

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(

GLOBAL_DBNAME = tos)

(ORACLE_HOME = D:oracleora92)

(SID_NAME = oracledb)

)

)

三、设置 sid listener.ora 里的 sid_name 

tnsnames.ora

TOS =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(HOST = soho-ivgcrcy9al)(PORT = 1521))

)

(CONNECT_DATA =

(sid = oracledb)

)

)

listener.ora

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(ORACLE_HOME = D:oracleora92)

(SID_NAME = oracledb)

)

)

其中后两种设置方式, listener.ora 中的   sid_name 必须和   instance_name  一致 .

你可能感兴趣的:(oracle)