Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 压缩后sqlite3文件已损坏_Python_Sqlite - Fatal编程技术网

Python 压缩后sqlite3文件已损坏

Python 压缩后sqlite3文件已损坏,python,sqlite,Python,Sqlite,在我处理完我的数据库文件之后 我试图使它成为tar文件,但在此之前,我看到了db文件的大小是3mb。在我将其压缩为tar文件后,原始文件变为10kb,压缩文件也变为10kb 这是我用来压缩文件的命令: tar cf users.db /root/Desktop/users.tar 我不知道发生了什么,但在文件的属性中 “STL 3D模型(二进制)(model/x.STL-binary)”应该是 “SQLite3数据库(应用程序/x-SQLite3)” 我尝试在sqlite3中使用.dump

在我处理完我的数据库文件之后 我试图使它成为tar文件,但在此之前,我看到了db文件的大小是3mb。在我将其压缩为tar文件后,原始文件变为10kb,压缩文件也变为10kb

这是我用来压缩文件的命令:

tar cf users.db /root/Desktop/users.tar  
我不知道发生了什么,但在文件的属性中 “STL 3D模型(二进制)(model/x.STL-binary)”应该是 “SQLite3数据库(应用程序/x-SQLite3)”

我尝试在sqlite3中使用.dump,但没有修复任何问题。它显示以下错误:

/**** ERROR: (26) file is not a database *****/

您对
tar
命令的参数不正确。语法是:

tar cf <archive to create> <files to add to the archive>
tarcf

由于您将
users.db
放在
位置,因此您已将
users.db
文件替换为空的
tar
存档。除非您有数据库的备份,否则它将丢失。

您对
tar
命令的参数不正确。语法是:

tar cf <archive to create> <files to add to the archive>
tarcf

由于您将
users.db
放在
位置,因此您已将
users.db
文件替换为空的
tar
存档。除非您有数据库的备份,否则它将消失。

在您写的评论中,您执行了以下命令:

tar cf users.db /root/Desktop/users.tar
使用tar的
f
选项时,下一个参数指定要创建的文件。您所做的是归档现有文件(/root/Desktop/users.tar),并覆盖users.db


运行该命令后,users.db中的任何内容都已被销毁。

在您编写的注释中,您执行了该命令:

tar cf users.db /root/Desktop/users.tar
使用tar的
f
选项时,下一个参数指定要创建的文件。您所做的是归档现有文件(/root/Desktop/users.tar),并覆盖users.db


运行该命令后,users.db中的内容已被销毁。

您的问题不清楚。你是说解压缩后,生成的文件被破坏了吗?您使用了什么命令“将其压缩到tar文件”?我使用了“tar cf users.db/root/Desktop/users.tar”您的问题不清楚。你是说解压缩后,生成的文件被破坏了吗?您使用了什么命令“将其压缩到tar文件”?我使用了“tar cf users.db/root/Desktop/users.tar”请不要说还有什么要做的尝试:/请不要说还有什么要做的尝试:/i意识到在我做了之后:/i意识到在我做了之后:/