5

[svn: E155004]svn update报database is locked错误的解决办法

 3 years ago
source link: https://zhang.ge/4836.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
[svn: E155004]svn update报database is locked错误的解决办法
Jager · 12月21日 · 2014年linux · 操作系統 479次已读

今天突然发现项目更新脚本在拉代码的时候抛出了一个如下错误:

svn: E155004: Working copy '/home/svn/***/trunk/staticfiles' locked.
svn: E155004: '/home/svn/***/trunk/staticfiles' is already locked.
svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details)

根据错误提示,我先执行了一下svn cleanup,结果依然抛出错误(忘记记录错误信息)

那没办法,求谷歌,求百度了。

前人总结的方法大致如下:

cd /your project path/.svn
mv wc.db wc.db.old #先备份一份
sqlite3 wc.db.old #打开copy的数据库
sqlite> .backup main wc.db
sqlite> .exit

结果居然找不到 .backup这个命令?!使用 .help看了下:

linux-xh50:/tmp # sqlite3
SQLite version 3.6.4
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .help
.bail ON|OFF Stop after hitting an error. Default OFF
.databases List names and files of attached databases
.dump ?TABLE? ... Dump the database in an SQL text format
.echo ON|OFF Turn command echo on or off
.exit Exit this program
.explain ON|OFF Turn output mode suitable for EXPLAIN on or off.
.header(s) ON|OFF Turn display of headers on or off
.help Show this message
.import FILE TABLE Import data from FILE into TABLE
.indices TABLE Show names of all indices on TABLE
.mode MODE ?TABLE? Set output mode where MODE is one of:
csv Comma-separated values
column Left-aligned columns. (See .width)
html HTML <table> code
insert SQL insert statements for TABLE
line One value per line
list Values delimited by .separator string
tabs Tab-separated values
tcl TCL list elements
.nullvalue STRING Print STRING in place of NULL values
.output FILENAME Send output to FILENAME
.output stdout Send output to the screen
.prompt MAIN CONTINUE Replace the standard prompts
.quit Exit this program
.read FILENAME Execute SQL in FILENAME
.schema ?TABLE? Show the CREATE statements
.separator STRING Change separator used by output mode and .import
.show Show the current values for various settings
.tables ?PATTERN? List names of tables matching a LIKE pattern
.timeout MS Try opening locked tables for MS milliseconds
.timer ON|OFF Turn the CPU timer measurement on or off
.width NUM NUM ... Set column widths for "column" mode
sqlite>

这尼玛,哪有.backup啊?试了下网上分享的修复方法:

有的时候sqlite3数据库会损坏,使用的时候提示:sqlite3 disk image malformat,这个时候,如何恢复数据呢?

解决方法:

首先去下载sqlite3的命令行工具

http://www.sqlite.org/download.html

再执行命令行命令,将你的数据库中的数据导出为sql语句文件

sqlite3 my.db
sqlite>.output tmp.sql
sqlite>.dump
sqlite>.quit

最后导入到一个新库中

sqlite3 mynew.db
sqlite>.read tmp.sql
sqlite>.quit

结果,修复报错:

Error: malformed database schema (nodes_update_checksum_trigger) - near "OLD": syntax error

难道是这个数据库文件损坏了?那就有点麻烦了。

突然,想到这SUSE Linux下安装的sqlite3 没有 .backup命令,那我到Centos下试试,也许版本不一样呢!

最后,将wc.db弄到了centos系统,发现有.backup命令了!于是,重新导出一份数据。然后再移回之前的SUSE系统。继续svn up发现还是报错!我擦,这尼玛还真顽固啊!

试着执行了一下svn cleanup,发现居然没报错了!再试 svn up也正常了!原来 .backup还真是可以!


写这篇文章的目的就是分享一个经验,偶尔出现疑难杂症,一定不要钻进死胡同出不来!真的非常有可能是系统(软件)的问题!换个系统(软件)试试可能就柳暗花明了!

所以,本文标题提到的报错的解决办法,依然还是前人总结的 sqlite3+ .backup重新导出wc.db,当你发现没有 .backup命令时,很可能就是sqlite3的版本不对!这时候,你就可以升级sqlite3或者换一个服务器再试!

本文提到的sqlite3的版本如下,供参考:

①、有 .backup命令的sqlite3版本:

[root@test-host1 ~]# sqlite3
SQLite version 3.6.20
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>

②、没有 .backup命令的sqlite3版本:

zhangge@linux-xh50:~> sqlite3
SQLite version 3.6.4
Enter ".help" for instructions
Enter SQL statements terminated with a ";"

哦了,这个问题就写到这了!遇到问题切记不要钻死胡同,往往转个弯就能豁然开朗。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK