DB安装完成后,可能会出现不能自动动态注册的情况。
此时通过口令身份验证时(即:sqlplus system/xxx@test登录时),会报出ora-12514的错误。
当然,此时可以设置静态注册来解决该问题。
静态注册:在listener.ora文件中添加下面的句子。
(SID_DESC =
(GLOBAL_DBNAME = test) -- dbname
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1) -- ORACLE_HOME的路径
(SID_NAME = test) -- SID的名字
)
本文介绍如何设置动态注册。
动态注册:设置实例参数local_listener
首先,查看tnsnames.ora文件中的相关实例的tns。
[oracle@OracleServer admin]$ cat ./tnsnames.ora
TEST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = TOracle)(PORT = 1521))
)
(HOST必须在/etc/hosts里有设置)
其次,用系统验证的方法(即:sqlplus / as sysdba)登录DB。
再次,修改系统,设置参数local_listener为TEST(tnsnames.ora里面的)。
[oracle@OracleServer admin]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0Production on Tue Dec 17 04:26:21 2013
Copyright (c) 1982, 2011,Oracle. All rights reserved.
Connected to:
Oracle Database 11g Release 11.2.0.3.0- 64bit Production
SQL> showuser;
USER is "SYS"
SQL> showparameter local
NAME TYPE VALUE
----------------------------------------------- ------------------------------
local_listener string
log_archive_local_first boolean TRUE
SQL> altersystem set local_listener=test;-- 会自动转换为大写
System altered.
SQL> showparameter local;
NAME TYPE VALUE
----------------------------------------------- ------------------------------
local_listener string TEST
log_archive_local_first boolean TRUE
SQL> exit
最后,重启监听器,重启实例。
[oracle@OracleServeradmin]$ lsnrctl status
LSNRCTLfor Linux: Version 11.2.0.3.0 - Production on 17-DEC-2013 04:47:11
Copyright(c) 1991, 2011, Oracle. All rightsreserved.
Connectingto (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=TOracle)(PORT=1521)))
STATUSof the LISTENER
------------------------
AliasLISTENER
VersionTNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start10-DEC-2013 22:18:19
Uptime6 days 6 hr. 28 min. 51 sec
TraceLevel off
SecurityON: Local OS Authentication
SNMPOFF
ListenerParameter File /u01/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
ListenerLog File /u01/oracle/product/11.2.0/dbhome_1/network/log/listener.log
ListeningEndpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=TOracle)(PORT=1521)))
ServicesSummary...
Service"test" has 1 instance(s).
Instance"test", status READY, has 1 handler(s) for this service...
Service"test_XPT" has 1 instance(s).
Instance"test", status READY, has 1 handler(s) for this service...
Thecommand completed successfully