2013-05-09 49 views
1

我在我的系統中遇到了一個大問題。一些如何,整個sqlite系統被鎖定。我不是在談論單個數據庫,而是在談論系統中的每個數據庫。在整個系統中鎖定的sqlite

[email protected]:~$ touch new.sqlite3 
[email protected]:~$ sqlite3 new.sqlite3 
SQLite version 3.7.3 
Enter ".help" for instructions 
Enter SQL statements terminated with a ";" 
sqlite> .tables 
Error: database is locked 
sqlite> 

即使firefox無法正常打開,因爲同樣的問題。 我不知道爲什麼發生這種情況。 該服務器是一個debian服務器,我的團隊使用它來開發一些帶有導軌的站點。我們把這些東西集中在一個外部的git倉庫中,這樣每個人都可以和他自己的用戶一起工作,並擁有自己的副本。

另一項測試:

[email protected]:~/agendador/db$ lsof test.sqlite3 
[email protected]:~/agendador/db$ fuser test.sqlite3 
[email protected]:~/agendador/db$ strace -e fcntl sqlite3 test.sqlite3 .tables 
fcntl(3, F_GETFD) = 0 
fcntl(3, F_SETFD, FD_CLOEXEC) = 0 
fcntl(4, F_GETFD) = 0x1 (flags FD_CLOEXEC) 
fcntl(3, F_SETLK, {type=F_RDLCK, whence=SEEK_SET, start=1073741824, len=1}) = -1 ENOLCK (No locks available) 
Error: database is locked 

沒有人使用該數據庫。同樣的情況發生,以清空新的。

============================================== =============================

更多信息:

[email protected]:~# cd /home/ladb08/agendador/db/    
[email protected]:/home/ladb08/agendador/db# sqlite3 test.sqlite3 
SQLite version 3.7.3 
Enter ".help" for instructions 
Enter SQL statements terminated with a ";" 
sqlite> .tables 
Error: database is locked 
sqlite> .exit 

的問題,像往常一樣。

[email protected]:~# cd /root   
[email protected]:~# cp /home/ladb08/agendador/db/test.sqlite3 ./ 
[email protected]:~# sqlite3 test.sqlite3 
SQLite version 3.7.3 
Enter ".help" for instructions 
Enter SQL statements terminated with a ";" 
sqlite> .tables 
agendamentos    prefeituras    tipo_atendimentos  
bloqueios     profissionais    tipo_situacoes   
cidadaos     schema_migrations   tmibges     
escalas     tcbos      tufibges    
orgaos     tconselhos    
orgaos_tipo_atendimentos tipo_acoes    

在nfs分區之外,同一文件沒有問題。

[email protected]:~# mount 
(...) 
rootfs on/type rootfs (rw) 
urquell.home2:/home2/home-newcastle on /home type nfs (rw,v3,addr=10.17.116.3) 
fusectl on /sys/fs/fuse/connections type fusectl (rw) 
+0

的可能重複[我如何解開一個SQLite數據庫?(http://stackoverflow.com/questions/151026/how-do-i-unlock- a-sqlite-database) – woz 2013-05-09 13:46:56

+0

我看了那篇文章。 我們嘗試重新啓動系統,但沒有解決任何問題。 fuser不說任何關於使用該文件的任何人。 – Techmago 2013-05-09 13:53:35

+0

'strace -e fcntl sqlite3 test.sqlite3 .tables'的輸出是什麼? – 2013-05-09 18:25:56

回答

1

當內核內存用完了鎖(不太可能在你的情況下),或者當過像NFS遠程文件系統鎖定操作失敗,錯誤代碼ENOLCK返回。

顯然,您的文件服務器被配置爲不支持文件鎖定。
(不管這將是一個不錯的主意is debatable

+0

我忘記了這一點。該服務器是一個虛擬服務器,並且該磁盤是一個nfs磁盤。 – Techmago 2013-05-10 12:58:18

+0

對此,我注意到問題是與NFS有關。 – Techmago 2013-05-10 18:48:01