从远程sqlite数据库复制表? [英] Copy table from remote sqlite database?

查看:72
本文介绍了从远程sqlite数据库复制表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法将数据从一个远程 sqlite 数据库复制到另一个?我在两台服务器上完成了文件复制;但是,某些更改会记录在每个服务器本地的 sqlite 数据库中.为了让我的文件复制正常工作,我需要复制一张表的内容并将它们输入到对面系统上的表中.我知道 sqlite 数据库不适用于远程访问;但有什么办法可以做我需要的吗?我想我可以将表的内容写入文件,复制该文件,然后将内容添加到另一个数据库中.不过,这似乎不是最佳选择,因此我正在寻找其他解决方案.

Is there any way to copy data from one remote sqlite database to another? I have file replication done across two servers; however, some changes are recorded in an sqlite database local to each server. To get my file replication to work correctly, I need to copy the contents of one table and enter them into the table on the opposite system. I understand that sqlite databases are not meant for remote access; but is there any way to do what I need? I suppose I could write the contents of the table to a file, copy that file, then add the contents to the other database. This doesn't seem like the best option though, so I'm looking for another solution.

推荐答案

如果您有权访问其他数据库文件,您可以附加它:

If you have access to the other database file, you can ATTACH it:

ATTACH '/some/where/else/other.db' AS remote;
INSERT INTO MyTable SELECT * FROM remote.MyTable;

这篇关于从远程sqlite数据库复制表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆