環境:
作業系統:SUSE Linux9
資料庫: Oracle10gR2
1:更改主機host
[root@www ~]# hostname
linux
[root@www ~]# hostname test11
[root@www ~]# hostname
test11
[root@www ~]#
2:嘗試重啟監聽
oracle@linux:/> lsnrctl stop
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 29-11月-2006 16:51:09
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
The command completed successfully
oracle@linux:/> lsnrctl start
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 29-11月-2006 16:51:32
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Starting /free/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /free/oracle/product/10.2.0/db_1/network/admin/listener.ora
Log messages written to /free/oracle/product/10.2.0/db_1/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 29-11月-2006 16:51:32
Uptime 0 days 0 hr. 0 min. 42 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /free/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /free/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
可以看到,監聽啟動很慢,但是最後還是能啟動成功,其實這是假象,我們測試即可得知。
其實監聽在每次啟動時刻會去讀系統的主機名稱,然後根據主機名稱啟動lsnrctl。
3:測試監聽串連的有效性
下面的standby是本地目錄服務名。
oracle@linux:> sqlplus "sys/cicro@standby as sysdba"
SQL*Plus: Release 10.2.0.1.0 - Production on 星期三 11月 29 17:04:24 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.
ERROR:
ORA-12541: TNS:no listener
oracle@linux:> sqlplus "/as sysdba"
SQL*Plus: Release 10.2.0.1.0 - Production on 星期三 11月 29 17:07:32 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected.
SQL> shutdown immediate
ORA-24324: service handle not initialized
ORA-24323: value not allowed
ORA-00600: internal error code, arguments: [%s], [%s], [%s], [%s], [%s], [%s], [%s], [%s]
SQL>
SQL> select host_name from v$instance;
HOST_NAME
--------------------------------------------------------------------------------
linux
可以看到,此時關閉資料庫也報錯。資料庫 v$instance中記錄的hostname是linux,但是此時host name已經修改成了test11