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

  • 时间:
  • 浏览:13
  • 来源:福佳博客 - 专注共享爱家博客技术

今天老是发现项目更新脚本在拉代码的日后抛出了一个 如下错误:

svn: E1511504: Working copy '/home/svn/***/trunk/staticfiles' locked.
svn: E1511504: '/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-xh150:/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版本:

[[email protected] ~]# sqlite3 
SQLite version 3.6.20
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>

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

[email protected]linux-xh150:~> sqlite3 
SQLite version 3.6.4
Enter ".help" for instructions
Enter SQL statements terminated with a ";"

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