启用监听器动态注册后,根据$ORACLE_HOME/network/admin/samples目录,有tnsnames.ora配置示例,运行:
sqlplus
sys/system@orcl as sysdba报如题错误
查看此文件的相关说明及使用后,修正如下:
-bash-3.2$ pwd
/oracle/product/10.2.0/db_1/network/admin
-bash-3.2$ more tnsnames.ora
# This file contains the syntax information for
# the entries to be put in any tnsnames.ora file
# The entries in this file are need based.
# There are no defaults for entries in this file
# that Sqlnet/Net3 use that need to be overridden
#
# Typically you could have two tnsnames.ora files
# in the system, one that is set for the entire system
# and is called the system tnsnames.ora file, and a
# second file that is used by each user locally so that
# he can override the definitions dictated by the system
# tnsnames.ora file.
/oracle/product/10.2.0/db_1/network/admin
-bash-3.2$ more tnsnames.ora
# This file contains the syntax information for
# the entries to be put in any tnsnames.ora file
# The entries in this file are need based.
# There are no defaults for entries in this file
# that Sqlnet/Net3 use that need to be overridden
#
# Typically you could have two tnsnames.ora files
# in the system, one that is set for the entire system
# and is called the system tnsnames.ora file, and a
# second file that is used by each user locally so that
# he can override the definitions dictated by the system
# tnsnames.ora file.
# The entries in tnsnames.ora are an alternative to using
# the names server with the onames adapter.
# They are a collection of aliases for the addresses that
# the listener(s) is(are) listening for a database or
# several databases.
# the names server with the onames adapter.
# They are a collection of aliases for the addresses that
# the listener(s) is(are) listening for a database or
# several databases.
# The following is the general syntax for any entry in
# a tnsnames.ora file. There could be several such entries
# tailored to the user's needs.
# a tnsnames.ora file. There could be several such entries
# tailored to the user's needs.
orcl= #如果有多个description,这儿本身有个description_list节,因为我们只 边一个主机上面的数据库,所有不用 description_list
# one or more descriptions
# If there is just one description, unnecessary ]
(DESCRIPTION=
# Can take values between 512 and 32K
# one or more addresses
# If there is just one address, unnecessary ]
# one or more descriptions
# If there is just one description, unnecessary ]
(DESCRIPTION=
# Can take values between 512 and 32K
# one or more addresses
# If there is just one address, unnecessary ]
#同上,本身也有一个address list节,如有多个address的话
(ADDRESS=
(PROTOCOL=tcp)
(HOST=192.168.19.155)
(PORT=1521)
)
(ADDRESS=
(PROTOCOL=tcp)
(HOST=192.168.19.155)
(PORT=1521)
)
#连接到哪个数据库(sid及global_name)
(CONNECT_DATA=
(SID=orcl)
(GLOBAL_NAME=orcl)
)
)
-bash-3.2$
(SID=orcl)
(GLOBAL_NAME=orcl)
)
)
-bash-3.2$
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9240380/viewspace-665509/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/9240380/viewspace-665509/