简体   繁体   English

检查远程firebird备份文件是否存在

[英]Check if remote firebird backup file exists

I've found out how to perform a streamed backup from this post . 我从这篇文章中了解了如何执行流式备份。

Now, I'm facing the reverse problem - I want to perform a restore from a backup file. 现在,我面临着相反的问题-我想从备份文件执行还原。 It is quite easy when I have a local backup file - the problem is, how to check if the remote backup file exists? 当我有本地备份文件时,这很容易-问题是,如何检查远程备份文件是否存在?

Example: my connection string is as follows : datasource=192.168.1.123;database=D:/data/MyDatabase.FDB;... 示例:我的连接字符串如下: datasource=192.168.1.123;database=D:/data/MyDatabase.FDB;...

And I want to check if the file \\\\192.168.1.123/D:/data/MyDatabase.fbk exists before running the restore service. 我想在运行还原服务之前检查文件\\\\192.168.1.123/D:/data/MyDatabase.fbk存在。 Note that File.Exists(@"\\\\192.168.1.123/D:/data/MyDatabase.fbk") returns false. 请注意File.Exists(@"\\\\192.168.1.123/D:/data/MyDatabase.fbk")返回false。 I don't really know how to make sure the file exists before running the restore. 我真的不知道如何在运行还原之前确保文件存在。 Any idea? 任何想法?

Just perform the restore and Firebird will return an error if the backup file does not exist. 只需执行还原,如果备份文件不存在,Firebird将返回错误。 If the backup file does not exist, Firebird will return error: 如果备份文件不存在,Firebird将返回错误:

cannot open backup file <backup-path> 无法打开备份文件<backup-path>
Exiting before completion due to errors 由于错误而在完成前退出

Alternatively, you need to have some form of remote access to the other system to check its filesystem. 或者,您需要对另一系统进行某种形式的远程访问,以检查其文件系统。 Firebird itself doesn't offer such an option (apart from just trying the restore and see if it works). Firebird本身不提供此类选项(除了尝试还原并查看其是否有效)。

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

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