有的情况下比如在做DATA GUARD时备库的listener.ora需要配置静态注册。

1.listener.ora需要增加静态注册的相关语句:


[oracle@bys001 admin]$ cat listener.ora 

 # listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

 # Generated by Oracle configuration tools.


 LISTENER =

   (DESCRIPTION_LIST =

     (DESCRIPTION =

       (ADDRESS = (PROTOCOL = TCP)(
HOST = bys001.oel.com)(
PORT = 1521))

     )

   )

 SID_LIST_LISTENER=

   (SID_LIST =

      (SID_DESC =

       (
GLOBAL_DBNAME = bystest)

       (
ORACLE_HOME =/u01/app/oracle/product/11.2.0/dbhome_1)

       (
SID_NAME = bys1)

     )

   ) 

 ADR_BASE_LISTENER = /u01


2.查看监听状态--UNKNOW

[oracle@bys001 admin]$ lsnrctl start


 LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 05-SEP-2013 14:55:44


 Copyright (c) 1991, 2009, Oracle.  All rights reserved.


 Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...


 TNSLSNR for Linux: Version 11.2.0.1.0 - Production

 System parameter file is /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

 Log messages written to /u01/diag/tnslsnr/bys001/listener/alert/log.xml

 Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=bys001.oel.com)(PORT=1521)))


 Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=bys001.oel.com)(PORT=1521)))

 STATUS of the LISTENER

 ------------------------

 Alias                     LISTENER

 Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production

 Start Date                05-SEP-2013 14:55:44

 Uptime                    0 days 0 hr. 0 min. 0 sec

 Trace Level               off

 Security                  ON: Local OS Authentication

 SNMP                      OFF

 Listener Parameter File   /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

 Listener Log File         /u01/diag/tnslsnr/bys001/listener/alert/log.xml

 Listening Endpoints Summary...

   (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=bys001.oel.com)(PORT=1521)))

 Services Summary...

Service "bystest" has 1 instance(s).

   
Instance "bys1", status UNKNOWN, has 1 handler(s) for this service...

The command completed successfully


3 TNS文件的配置

[oracle@bys001 admin]$ cat tnsnames.ora 
 # tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
 # Generated by Oracle configuration tools.

bys1 =
   (DESCRIPTION =
     (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.211)(PORT = 1521))
     (CONNECT_DATA =
       (SERVER = DEDICATED)
       (SERVICE_NAME = bystest)
     )
   )

4.登陆测试:

使用普通账户登陆:ORACLE未打开,无法登陆。

[oracle@bys001 admin]$ sqlplus aa/aa@bys1

 SQL*Plus: Release 11.2.0.1.0 Production on Thu Sep 5 15:12:39 2013

 Copyright (c) 1982, 2009, Oracle.  All rights reserved.

 ERROR:
 ORA-01034: ORACLE not available
 ORA-27101: shared memory realm does not exist
 Linux Error: 2: No such file or directory
 Process ID: 0
 Session ID: 0 Serial number: 0


 Enter user-name: 
 ERROR:
 ORA-01017: invalid username/password; logon denied


 Enter user-name: 
 ERROR:
 ORA-01017: invalid username/password; logon denied


 SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
 [oracle@bys001 admin]$

使用SYSDBA账户可以登陆到空闲实例

[oracle@bys001 admin]$ sqlplus sys/oraclesys@bys1 as sysdba

 SQL*Plus: Release 11.2.0.1.0 Production on Thu Sep 5 15:12:54 2013

 Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to an idle instance.

 SYS@bys1>
 SYS@bys1>exit
 Disconnected