简体   繁体   English

获取SQL Server Compact数据库的“备份”

[英]Take 'Backup' of SQL Server Compact database

是否可以使用备份SQL Server Compact数据库(即* .sdf)并恢复相同的数据库。

Just copy the file. 只需复制文件即可。 Done. 完成。

Quote from Maintaining Databases : 来自维护数据库的报价:

Because SQL Server Compact 3.5 is a file-based database system, you can accomplish many common database tasks such as backing up, restoring, and deleting a database by using the file system APIs. 由于SQL Server Compact 3.5是基于文件的数据库系统,因此您可以使用文件系统API完成许多常见的数据库任务,例如备份,还原和删除数据库。

To back up a database, close all connections to the database, and then copy the .sdf file. 要备份数据库,请关闭与数据库的所有连接,然后复制.sdf文件。 To restore a database, copy the .sdf file back to its regular working location. 要还原数据库,请将.sdf文件复制回其常规工作位置。 These operations work even if the database is set up for replication. 即使数据库已设置为进行复制,这些操作也会起作用。 To drop a database, delete the .sdf database file. 要删除数据库,请删除.sdf数据库文件。

我使用LINQ to SQL将紧凑型SQL数据库写入XML文件,并将其读回以恢复它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM