oracle監聽【非1521埠】動態註冊

jx_yu發表於2012-08-03
動態註冊
             Oracle9i起例項使用動態服務註冊來通知監聽程式有關其資料庫服務的資訊。
             服務註冊依賴PMON 程式向監聽程式註冊例項資訊 註冊間隔為1分鐘左右
             手動註冊命令 alter system register;
             無需在listener.ora 檔案中設定任何資訊 此檔案可以不存在,如下:
]$ rm -rf listener.ora
]$ lsnrctl start
....
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db1)(PORT=1521)))
The listener supports no services
The command completed successfully
]$ sql
SQL*Plus: Release 10.2.0.1.0 - Production on Sat Apr 2 15:59:20 2011
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor

Enter user-name:
]$  因為沒有註冊 所以不能連線
手動註冊一次
SQL> alter system register;
System altered.
SQL>
]$ sql
SQL*Plus: Release 10.2.0.1.0 - Production on Sat Apr 2 15:59:42 2011
Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> 連線成功
 
 
------------------------------------------------------------------------------

注意:

如果listener.ora中定義了監聽埠(1521)
此時還想使用動態註冊 需要設定local_listener引數[連線描述符]


如:

]$ lsnrctl start
......
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db1)(PORT=1522)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

 此時手動註冊無效  PMON預設只能註冊預設埠1521

SQL> alter system register;
System altered.
SQL>
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db1)(PORT=1522)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

修改引數local_listener 後註冊成功

SQL> alter system set local_listener=‘DBSM’;
--local_listener的值一定要在tnsname.ora中設定
System altered.
SQL> alter system register;
System altered.
SQL>

 ~]$ lsnrctl status
LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 03-AUG-2012 11:33:38
Copyright (c) 1991, 2007, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db1)(PORT=1522)))
.....................
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "dbsm" has 1 instance(s).
  Instance "dbsm", status READY, has 1 handler(s) for this service...
Service "dbsmXDB" has 1 instance(s).
  Instance "dbsm", status READY, has 1 handler(s) for this service...
Service "dbsm_XPT" has 1 instance(s).
  Instance "dbsm", status READY, has 1 handler(s) for this service...
The command completed successfully
 

local_listener的值一定要在tnsname.ora中設定 否則報錯

~]$ cat /oracle/ora10/product/10.2.0/db_1/network/admin/tnsnames.ora

# tnsnames.ora Network Configuration File: /oracle/ora10/product/10.2.0/db_1/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.

 

DBSM =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = TCP)(HOST = sdw0)(PORT = 1522))

    )

    (CONNECT_DATA =

      (SERVICE_NAME = dbsm)

    )

  )

 

EXTPROC_CONNECTION_DATA =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))

    )

    (CONNECT_DATA =

      (SID = PLSExtProc)

      (PRESENTATION = RO)

    )

  )

 

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/27000195/viewspace-739735/,如需轉載,請註明出處,否則將追究法律責任。

相關文章