[20141128]目錄/var/tmp/oracle.txt
[20141128]目錄/var/tmp/oracle.txt
--昨天幫別人解決監聽問題,使用者整理機器,刪除了/var/tmp/oracle目錄裡面的檔案(估計已經刪除很久了),導致執行lsnrctl status報錯。
--我自己以前也遇到一次,記憶比較深刻,今天在自己機器上測試重複錯誤。
SYS@test> @ver1
PORT_STRING VERSION BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.3.0 Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
# lsof | grep /var/tmp/.oracle
tnslsnr 18430 oracle11g 10u unix 0x000001002550d680 53579 /var/tmp/.oracle/s#18430.1
tnslsnr 18430 oracle11g 11u unix 0x000001002550d380 53581 /var/tmp/.oracle/sEXTPROC1521
tnslsnr 18430 oracle11g 12u unix 0x000001002576c980 53583 /var/tmp/.oracle/s#18430.2
--可以發現監聽使用這些檔案。
$ cd /var/tmp/.oracle
$ mkdir laji
$ ls -l
total 4
drwxr-xr-x 2 oracle11g oinstall 4096 2014-11-28 11:22:01 laji
srwxrwxrwx 1 oracle11g oinstall 0 2014-09-09 11:38:28 s#18430.1
srwxrwxrwx 1 oracle11g oinstall 0 2014-09-09 11:38:28 s#18430.2
srwxrwxrwx 1 oracle11g oinstall 0 2014-07-15 09:33:42 s#5027.1
srwxrwxrwx 1 oracle11g oinstall 0 2014-07-15 09:33:42 s#5027.2
srwxrwxrwx 1 oracle11g oinstall 0 2014-09-09 11:38:28 sEXTPROC1521
-- 對比前面的發現s#5027.*這兩個檔案,可能是某一次當機或者斷電,沒有清除留下的檔案。據對方講裡面很多檔案,使用版本10.2.0.3,監聽
-- 中斷了許多次,估計是遇到bug之類的問題。
--首先移動檔案。
$ mv s* laji/
# lsof | grep /var/tmp/.oracle
tnslsnr 18430 oracle11g 10u unix 0x000001002550d680 53579 /var/tmp/.oracle/s#18430.1
tnslsnr 18430 oracle11g 11u unix 0x000001002550d380 53581 /var/tmp/.oracle/sEXTPROC1521
tnslsnr 18430 oracle11g 12u unix 0x000001002576c980 53583 /var/tmp/.oracle/s#18430.2
bash 18634 oracle11g cwd DIR 8,3 4096 472369 /var/tmp/.oracle
--奇怪,這些檔案並沒有標識delete。
--這個時候外面的使用者是可以連上資料庫的。
$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 28-NOV-2014 11:28:52
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=hisdg)(PORT=1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 2: No such file or directory
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 2: No such file or directory
--可以發現報錯。
$ lsnrctl stop
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 28-NOV-2014 11:29:46
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=hisdg)(PORT=1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 2: No such file or directory
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 2: No such file or directory
--執行lsnrctl stop也一樣。
--執行跟蹤看看。
$ strace -f -o /tmp/aaa.txt lsnrctl status
--檢視跟蹤可以發現:
$ grep '\/var\/tmp/\.oracle' /tmp/aaa.txt
20352 access("/var/tmp/.oracle", F_OK) = 0
20352 chmod("/var/tmp/.oracle", 01777) = 0
20352 access("/var/tmp/.oracle/s#18430.2", F_OK) = -1 ENOENT (No such file or directory)
20352 access("/var/tmp/.oracle/sEXTPROC1521", F_OK) = -1 ENOENT (No such file or directory)
$ grep "No such file or directory" /tmp/aaa.txt
20352 connect(5, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
20352 connect(5, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
20352 access("/var/tmp/.oracle/s#18430.2", F_OK) = -1 ENOENT (No such file or directory)
20352 access("/var/tmp/o/s#18430.2", F_OK) = -1 ENOENT (No such file or directory)
20352 access("/var/tmp/.oracle/sEXTPROC1521", F_OK) = -1 ENOENT (No such file or directory)
20352 access("/var/tmp/o/sEXTPROC1521", F_OK) = -1 ENOENT (No such file or directory)
--很明顯就是這些檔案給刪除了。如何解決呢?
1.方法1:
直接kill -9 tnslsnr 程式,在重啟監聽就可以了。
2.方法2:
$ file laji/s#18430.1
laji/s#18430.1: socket
--這個是socker型別檔案,能否重新建立呢?查詢相關文件。必須使用root使用者建立
# cd /var/tmp/.oracle
# mksock sEXTPROC1521
# mksock s#18430.2
# mksock s#18430.1
# ls -l
total 4
drwxr-xr-x 2 oracle11g oinstall 4096 2014-11-28 11:27:34 laji
srwxr-xr-x 1 root root 0 2014-11-28 11:48:30 s#18430.1
srwxr-xr-x 1 root root 0 2014-11-28 11:47:09 s#18430.2
srwxr-xr-x 1 root root 0 2014-11-28 11:46:56 sEXTPROC1521
# chown oracle:oinstall s*
# chmod 777 s*
# ls -l
total 4
drwxr-xr-x 2 oracle11g oinstall 4096 2014-11-28 11:27:34 laji
srwxrwxrwx 1 oracle oinstall 0 2014-11-28 11:48:30 s#18430.1
srwxrwxrwx 1 oracle oinstall 0 2014-11-28 11:47:09 s#18430.2
srwxrwxrwx 1 oracle oinstall 0 2014-11-28 11:46:56 sEXTPROC1521
$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 28-NOV-2014 11:50:09
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=hisdg)(PORT=1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
--依舊不行。
# lsof | grep /var/tmp/.oracle --加一個head
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
tnslsnr 18430 oracle11g 10u unix 0x000001002550d680 53579 /var/tmp/.oracle/s#18430.1
tnslsnr 18430 oracle11g 11u unix 0x000001002550d380 53581 /var/tmp/.oracle/sEXTPROC1521
tnslsnr 18430 oracle11g 12u unix 0x000001002576c980 53583 /var/tmp/.oracle/s#18430.2
--很明顯方法2不行。應該這些檔案與原來建立聯絡,自己建立的沒有關聯。移動回來。
$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 28-NOV-2014 12:03:25
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=hisdg)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date 09-SEP-2014 11:38:28
Uptime 80 days 0 hr. 24 min. 56 sec
Trace Level off
Security ON: Password or Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle11g/product/11.2.0/db_2/network/admin/listener.ora
Listener Log File /u01/app/oracle11g/diag/tnslsnr/hisdg/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=xxxxx)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "b.com" has 1 instance(s).
Instance "test", status READY, has 1 handler(s) for this service...
Service "test.com" has 2 instance(s).
Instance "test", status UNKNOWN, has 1 handler(s) for this service...
Instance "test", status READY, has 1 handler(s) for this service...
Service "testXDB.com" has 1 instance(s).
Instance "test", status READY, has 1 handler(s) for this service...
Service "test_DGB.com" has 2 instance(s).
Instance "test", status UNKNOWN, has 1 handler(s) for this service...
Instance "test", status READY, has 1 handler(s) for this service...
Service "test_DGMGRL.com" has 1 instance(s).
Instance "test", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
--看來以後刪除檔案,要先使用lsof確定這些檔案是否處於開啟狀態。比如有些開啟的檔案,如果你刪除了,這些空間並不會回收。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-1350026/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 注意放在/tmp目錄下的檔案
- Last_Error:Unabletouseslave'stemporarydirectory/var/tmpASTError
- linux /tmp 目錄檔案清理規則Linux
- centos7怎麼進去tmp目錄並清除垃圾?centos7系統清除tmp目錄的垃圾方法CentOS
- 8.var目錄下的檔案和目錄詳解
- tmp目錄刪除和tmpwatch命令的使用
- CentOS系統下/tmp目錄臨時檔案清理CentOS
- 【Linux】/var/spool/clientmqueue 佔滿根目錄LinuxclientMQ
- Linux--/tmp目錄檔案重啟後自動刪除Linux
- linux系統/var/log目錄下的資訊詳解Linux
- iPhone越獄後找不到目錄 var/root/Media/cydia/autoinstalliPhone
- Linux中/usr和/var目錄詳解 -- 轉自網路Linux
- Linux下的一些重要目錄/proc, /sys, /SElinux, /bin, /usr/lib, /usr/local, /var, /tmp/etcLinux
- /var/spool/clientmqueue/目錄下存在大量檔案的原因及解決方法clientMQ
- 【目錄】JVM目錄JVM
- 虛擬機器linux 安裝oracle10g 寫入目錄/tmp 時出錯虛擬機LinuxOracle
- 【目錄】集合框架目錄框架
- tmp
- 【目錄】JUC鎖框架目錄框架
- Incorrect key file for table '/tmp/....'錯誤的解決--記錄
- 目錄:SpringBoot學習目錄Spring Boot
- Nginx虛擬目錄alias和root目錄Nginx
- /opt目錄和/usr目錄的區別
- VUE - 配置根目錄(用@代表src目錄)Vue
- E: 無法獲得鎖 /var/cache/apt/archives/lock - open (11: 資源暫時不可用) E: 無法對目錄 /var/cache/apt/archives/ 加鎖APTHive
- 【機器學習】目錄機器學習
- ORACLE目錄Oracle
- ~ 家目錄
- 目錄管理
- 活動目錄
- 目錄操作
- 電視劇目錄
- 儲存目錄的SMB目錄共享問題
- 刪除目錄及目錄下所有檔案與子目錄 (轉)
- DiscuzX2.5完整目錄結構【模板目錄template】
- linux 壓縮目錄並排除某個目錄Linux
- 0001-HTML中上一級目錄、上上級目錄、下一級目錄、下下級目錄中的頁面的相互引用HTML
- 坑人的/tmp/.oracleOracle