zoukankan      html  css  js  c++  java
  • Firebird shadow

    火鸟数据库的shadow,即实时镜像。

    主库发生变化,shadow也跟随变化,防止任何意外造成主库损坏无法使用,当然shadow可以有多个。

    1、创建shadow的准备:修改Firebird.conf配置文件,追加一个数据库目录 DatabaseAccess = Restrict db; shadow 

    我这里安装目录下db目录是数据库主目录,shadow目录作为镜像目录。这两个目录是平级的,不存在shadow目录必须放镜像的误导,

    只是目录命名为了放置镜像数据库。因为镜像shadow数据库不能随便指定目录。

    2、创建shadow镜像的脚本: create shadow 1 'C:Program FilesFirebirdFirebird_3_0shadow est.sd1'; 

    提交事务后,会在shadow目录下生成 test.sd1的镜像数据库文件,且和主库保持同步。

    可以根据需要生成多个镜像库。

    3、确认镜像库是激活状态:

    打开isql命令行,连接test数据库: connect test user sysdba password 1234; 

    连接成功后,输入命令显示当前数据库的信息: show database; 即显示以下,则说明镜像库test.sd1正常。

    Database: test
            Owner: SYSDBA
     Shadow 1: "C:PROGRAM FILESFIREBIRDFIREBIRD_3_0SHADOWTEST.SD1" auto
    PAGE_SIZE 16384
    Number of DB pages allocated = 8179
    Number of DB pages used = 180
    Number of DB pages free = 7999
    Sweep interval = 20000
    Forced Writes are ON
    Transaction - oldest = 22605
    Transaction - oldest active = 23455
    Transaction - oldest snapshot = 23455
    Transaction - Next = 23484
    ODS = 12.0
    Database not encrypted
    Default Character set: UTF8

    4、删除其中一个shadow镜像,若不能直接删除,提示进程占用,重启Firebird服务,或关掉服务,直接将镜像文件删除即可。

    再次用isql命令查看,镜像已经删除。

    5、将镜像库shadow恢复设定为可连接活动库。假设主库损坏,关掉Firebird服务,将主库删掉,再将shadow镜像库重命名为原来库名称,

    再次开启Firebird服务即可使用。这时防止意外,需要再次为其设定shadow镜像库。

    最后,根据官方文档,在将镜像库设定为生产库时,需要命令 gfix -ac[tivate] <shadow_file_name> ,即 gfix -ac test.sd1 

    这样做可以,不操作也可,估计是以前版本必须这样做,我测试版本是V3.0.4 。

    若执行了 gfix -ac test.sd1 命令,即原来正常的镜像库test.sd1就取消去shadow身份了,再次查看test库信息时,shadow就没有了。

    激活镜像库的命令要小心,否则镜像从库就不能实时同步主库信息了。

    注:gfix.exe 即在安装目录下。

  • 相关阅读:
    Python元组、列表、字典
    测试通过Word直接发布博文
    Python环境搭建(windows)
    hdu 4003 Find Metal Mineral 树形DP
    poj 1986 Distance Queries LCA
    poj 1470 Closest Common Ancestors LCA
    poj 1330 Nearest Common Ancestors LCA
    hdu 3046 Pleasant sheep and big big wolf 最小割
    poj 3281 Dining 最大流
    zoj 2760 How Many Shortest Path 最大流
  • 原文地址:https://www.cnblogs.com/jonney-wang/p/9996536.html
Copyright © 2011-2022 走看看