精华内容
参与话题
问答
  • 数据库容灾

    2016-12-07 11:44:43
    数据是最重要的,所以定时备份是相当重要的,本文使用mysql,所以备份很有必要用到mysql的binlog,然后再结合linux的定时任务crontab进行导出数据库冷备份。可以敲命令,不过在图形化界面操作相对方便。可参考 一、...

    数据是最重要的,所以定时备份是相当重要的,本文使用mysql,所以备份很有必要用到mysql的binlog,然后再结合linux的定时任务crontab进行导出数据库冷备份。可以敲命令,不过在图形化界面操作相对方便。可参考

    一、备份日志,开启binlog(默认关闭):

    通过mysql> show variables like 'log_%';查看:

    如果binlog选项为OFF,则在配置文件加上log-bin=D:/Mysql/binlog/mysql-bin.log,注意window和linux配置文件不同、路径不同。

    二、冷备份:

    mysqldump导出备份数据(默认开启事务,锁定所有表,阻塞所有表操作),同时导出命令加上新起日志文件,就能保证新的binlog日志是从导出后开始记录。

    三、恢复:

    针对具体情况,比如先恢复冷备份的数据,然后在找具体备份之后的binlog日志,逐一恢复到指定位置即可。

     

    具体操作。待续...

     

    展开全文
  • 上海第一妇幼保健医院采用了和力记易数据库容灾解决方案,通过较低的成本解决了双机单柜架构上的单点故障问题,同时达到了双机双柜实现冗余架构的效果;从数据备份的角度考虑,由于采用了数据库保镖实时备份的方式,...
  • 数据库容灾方案

    2020-08-12 11:45:33
    也称数据库双活、数据库复制,即在本地或异地部署一个与生产库完全相同的灾备数据库,当生产库...进行数据库容灾需要考虑以下问题: 1 本地容灾还是异地容灾,异地容灾的网络带宽及稳定性。 2 灾备数据库是否需要在...

    也称数据库双活、数据库复制,即在本地或异地部署一个与生产库完全相同的灾备数据库,当生产库由于各种原因(错误操作、系统软件错误、病毒、硬件故障、断电、火灾、地震等)发生故障时,灾备数据库可以立刻接管原有应用,对外正常提供服务。进行数据库容灾需要考虑以下问题:

    1 本地容灾还是异地容灾,异地容灾的网络带宽及稳定性。

    2 灾备数据库是否需要在线查询,是否需要效验比对某些核心数据是否与生产库一致。

    3 RTO(恢复时间目标,指生产库发生故障到灾备库投入运行期望的时间)、RPO(数据恢复点目标,指生产系统所能容忍的数据丢失量)。

    4 备份模式选择,单向备份模式(active/standby)还是双向互备模式。其中双向互备模式又分为半双工和全双工,半双工在任一时间点依然是单向模式(active/standby),只有一个数据库接受业务请求,当主库故障时允许主备自动切换。全双工模式(active /active),用于双业务中心异地互备,两个数据库同时接受业务请求。对于全双工模式需要考虑数据是否存在主键冲突。

    5 部署及维护成本,灾备库是否支持异构(不同操作系统、不同数据库版本)、是否需要在主备库安装代理程序或在数据库额外创建对象、是否需要调整表结构等。应用系统升级是否需要重新配置备份过程,是否需要人工干预等。

    灵蜂数据库复制软件Beedup提供数据库(Oracle/SQL Server/DB2/MySQL/PostgreSQL)容灾功能,具备以下特点:

    1 Beedup采用TCP连接主从数据库,支持本地或异地容灾。软件读取解析主库归档或在线日志,还原其中的DDL及DML操作在备库执行,通过将软件部署到主库所属网络,可以在备份时有效降低网络负载。软件提供断点机制增量读取解析日志,可以忍受苛刻的网络条件。

    2 Beedup采用SQL接口向从库写入DML及DDL,从库实时在线可用。另外软件提供主从表的差异比对功能,可以随时效验主从数据一致性。

    3 Beedup采用事务单元复制主库变化到从库,主库事务提交后,软件立即读取解析事务并复制变化到从库,整个过程秒级完成。当主库发生故障时,可以直接修改从库IP为主库IP接管其上业务。

    4 Beedup支持active/standby和active /active备份模式,对于active /active模式的自增主键冲突,无需调整业务系统,Beedup提供自增值到目标库的重新计算并更新相关依赖信息的功能。

    5 Beedup采用JDBC读写主备数据库,对数据库运行平台及版本无要求,当生产库采用高性能设备时,备份库可以选择普通商用配置。软件部署灵活,既可部署于主服务器,也可部署于备份服务器,或者部署到可以TCP连通主备服务器的其它任意机器。软件对主库不需要任何写入操作,通过读取解析主库归档或在线日志复制事务到备份库,对于表结构、视图、存储过程、触发器等DDL操作均可自动备份,无需人工干预。

    展开全文
  • 随着IT系统在企业内部应用的深入,灾难备份在企业中已不是IT一个部门的问题,而是整个企业各业务部门与IT部门紧密合作的问题。其内容也不仅局限于数据的备份和应用的接管,还包含了网络的冗余、人员与组织架构的整理...
  • 目前,针对oracle数据库的远程复制、容灾主要有以下几种技术或解决方案:基于存储层的容灾复制方案;基于逻辑卷的容灾复制方案。如果不是数据量大的惊人,其他方式没办法做到同步,或者要同时对数据库和应用进行容灾...
  • DSG RealSync容灾解决方案通过对数据库系统的数据复制及灾难切换支持,为企业提供关键业务支撑系统更可靠、投资更低、结构更灵活、回报率更高的容灾解决方案。该技术与远程磁盘镜像技术的根本区别在于:RealSync是在...
  • java实现数据库容灾备份,可以集成定时任务去实时备份 或者定期备份,欢迎一起讨论
  • 进行数据库容灾需要考虑以下问题: 1 本地容灾还是异地容灾,异地容灾的网络带宽及稳定性。 2 灾备数据库是否需要在线查询,是否需要效验比对某些核心数据是否与生产库一致。 3 RTO(恢复时间目标,指生产库发生故障...

    也称数据库双活、数据库复制,即在本地或异地部署一个与生产库完全相同的灾备数据库,当生产库由于各种原因(错误操作、系统软件错误、病毒、硬件故障、断电、火灾、地震等)发生故障时,灾备数据库可以立刻接管原有应用,对外正常提供服务。进行数据库容灾需要考虑以下问题:

    1 本地容灾还是异地容灾,异地容灾的网络带宽及稳定性。

    2 灾备数据库是否需要在线查询,是否需要效验比对某些核心数据是否与生产库一致。

    3 RTO(恢复时间目标,指生产库发生故障到灾备库投入运行期望的时间)、RPO(数据恢复点目标,指生产系统所能容忍的数据丢失量)。

    4 备份模式选择,单向备份模式(active/standby)还是双向互备模式。其中双向互备模式又分为半双工和全双工,半双工在任一时间点依然是单向模式(active/standby),只有一个数据库接受业务请求,当主库故障时允许主备自动切换。全双工模式(active /active),用于双业务中心异地互备,两个数据库同时接受业务请求。对于全双工模式需要考虑数据是否存在主键冲突。

    5 部署及维护成本,灾备库是否支持异构(不同操作系统、不同数据库版本)、是否需要在主备库安装代理程序或在数据库额外创建对象、是否需要调整表结构等。应用系统升级是否需要重新配置备份过程,是否需要人工干预等。

    灵蜂数据库复制软件Beedup提供数据库(Oracle/SQL Server/DB2/MySQL/PostgreSQL)容灾功能,具备以下特点:

    1 Beedup采用TCP连接主从数据库,支持本地或异地容灾。软件读取解析主库归档或在线日志,还原其中的DDL及DML操作在备库执行,通过将软件部署到主库所属网络,可以在备份时有效降低网络负载。软件提供断点机制增量读取解析日志,可以忍受苛刻的网络条件。

    2 Beedup采用SQL接口向从库写入DML及DDL,从库实时在线可用。另外软件提供主从表的差异比对功能,可以随时效验主从数据一致性。

    3 Beedup采用事务单元复制主库变化到从库,主库事务提交后,软件立即读取解析事务并复制变化到从库,整个过程秒级完成。当主库发生故障时,可以直接修改从库IP为主库IP接管其上业务。

    4 Beedup支持active/standby和active /active备份模式,对于active /active模式的自增主键冲突,无需调整业务系统,Beedup提供自增值到目标库的重新计算并更新相关依赖信息的功能。

    5 Beedup采用JDBC读写主备数据库,对数据库运行平台及版本无要求,当生产库采用高性能设备时,备份库可以选择普通商用配置。软件部署灵活,既可部署于主服务器,也可部署于备份服务器,或者部署到可以TCP连通主备服务器的其它任意机器。软件对主库不需要任何写入操作,通过读取解析主库归档或在线日志复制事务到备份库,对于表结构、视图、存储过程、触发器等DDL操作均可自动备份,无需人工干预。

    ————————————————
    版权声明:本文为CSDN博主「wahahaman」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
    原文链接:https://blog.csdn.net/wahahaman/article/details/100030396

    展开全文
  • 《手麻系统》容灾部署配置 文章目录《手麻系统》容灾部署配置1. 生产环境2.... 备端配置3.1 listener.ora3.2 tnsnames.ora3.3 pfile.ora3.4 spfile.ora3.5 RMAN复制3.6 开闪回3.7 重启数据库4. 检查验证5. W

    《手麻系统》容灾部署配置

    1. 生产环境

    操作系统:Windows Server 2012 R2
    数据版本:Oracle 11.2.0.1
    业务段IP:10.10.1.36
    容灾段IP:192.168.10.29~182.168.10.30
    primary:primary
    standby:standby
    操作系统账户/密码:`administrator/123456
    数据库账户/密码:sys/oracle
    数据库实例:docare
    数据库闪回路径:D:\app\Administrator\fast_recovery_area
    数据库闪回大小:40G
    数据库路径:D:\app\Administrator\oradata\docare
    数据库监听路径:D:\app\Administrator\product\11.2.0\dbhome_1\NETWORK\ADMIN
    数据库spfile路径:D:\app\Administrator\product\11.2.0\dbhome_1\database
    端口开放:3306, 1433-1434, 27017-27019, 8300-8399

    2. 主库配置

    2.1 listener.ora

    # listener.ora Network Configuration File: D:\app\Administrator\product\11.2.0\dbhome_1\network\admin\listener.ora
    # Generated by Oracle configuration tools.
    
    SID_LIST_LISTENER =
      (SID_LIST =
        (SID_DESC =
          (SID_NAME = CLRExtProc)
          (ORACLE_HOME = D:\app\Administrator\product\11.2.0\dbhome_1)
          (PROGRAM = extproc)
          (ENVS = "EXTPROC_DLLS=ONLY:D:\app\Administrator\product\11.2.0\dbhome_1\bin\oraclr11.dll")
        )
        (SID_DESC =
          (GLOBAL_DBNAME = docare)
          (ORACLE_HOME = D:\app\Administrator\product\11.2.0\dbhome_1)
          (SID_NAME = docare)
          (ENVS = "EXTPROC_DLLS=ONLY:D:\app\Administrator\product\11.2.0\dbhome_1\bin\oraclr11.dll")
        )
      )
    
    LISTENER =
      (DESCRIPTION_LIST =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
          (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.29)(PORT = 1521))
    	  (ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.1.36)(PORT = 1521))
        )
      )
    
    ADR_BASE_LISTENER = D:\app\Administrator
    -----------------------------------------------------------------------
    # listener.ora Network Configuration File: D:\app\Administrator\virtual\product\12.2.0\dbhome_1\network\admin\listener.ora
    # Generated by Oracle configuration tools.
    
    SID_LIST_LISTENER =
      (SID_LIST =
        (SID_DESC =
          (SID_NAME = CLRExtProc)
          (ORACLE_HOME = D:\app\Administrator\virtual\product\12.2.0\dbhome_1)
          (PROGRAM = extproc)
          (ENVS = "EXTPROC_DLLS=ONLY:D:\app\Administrator\virtual\product\12.2.0\dbhome_1\bin\oraclr12.dll")
        )
        (SID_DESC =
          (GLOBAL_DBNAME = oracle12)
          (ORACLE_HOME = D:\app\Administrator\virtual\product\12.2.0\dbhome_1)
          (SID_NAME = oracle12)
          (ENVS = "EXTPROC_DLLS=ONLY:D:\app\Administrator\virtual\product\12.2.0\dbhome_1\bin\oraclr12.dll")
        )
      )
    
    LISTENER =
      (DESCRIPTION_LIST =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.103.19)(PORT = 1521))
          (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
        )
      )
    

    2.2 tnsnames.ora

    D:\app\Administrator\product\11.2.0\dbhome_1\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;D:\app\Administrator\product\instantclient_11_2;D:\Program Files\Microsoft SQL Server\110\DTS\Binn\;D:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;D:\Program Files\Microsoft SQL Server\110\Tools\Binn\;D:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\;D:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\VirtioDrivers\tools;C:\Program Files (x86)\qga\tools;%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin;
    
    
    # tnsnames.ora Network Configuration File: D:\runtime\oracle\product\11.2.0\dbhome_1\network\admin\tnsnames.ora
    # Generated by Oracle configuration tools.
    
    ORACLR_CONNECTION_DATA =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
        )
        (CONNECT_DATA =
          (SID = CLRExtProc)
          (PRESENTATION = RO)
        )
      )
      
    primary =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.29)(PORT = 1521))
        )
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = docare)
        )
      )
    
    standby =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.30)(PORT = 1521))
        )
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = docare)
        )
      )
    
    docare =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = TCP)(HOST = 110.10.1.36)(PORT = 1521))
        )
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = docare)
        )
      )
    --------------------------------------------------------------------------------------
    # tnsnames.ora Network Configuration File: D:\app\Administrator\virtual\product\12.2.0\dbhome_1\network\admin\tnsnames.ora
    # Generated by Oracle configuration tools.
    
    LISTENER_ORACLE12 =
      (ADDRESS = (PROTOCOL = TCP)(HOST = Temp-w16-orc12)(PORT = 1521))
    
    
    ORACLR_CONNECTION_DATA =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
        )
        (CONNECT_DATA =
          (SID = CLRExtProc)
          (PRESENTATION = RO)
        )
      )
    
    primary =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.103.19)(PORT = 1521))
        )
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = oracle12)
        )
      )
    
    standby =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.103.20)(PORT = 1521))
        )
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = oracle12)
        )
      )
    
    ORACLE12 =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.103.19)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = oracle12)
        )
      )
    

    2.3 pfile.ora

    # 创建一个pfile
    create pfile from spfile
    
    # 在INITorcl.ORA文件末尾追加
    *.db_unique_name='primary'
    *.fal_server='standby'
    *.log_archive_config='dg_config=(primary,standby)'
    *.log_archive_dest_1='location=use_db_recovery_file_dest valid_for=(all_logfiles, all_roles) db_unique_name=primary'
    *.log_archive_dest_2='service=standby lgwr async valid_for=(online_logfile,primary_role) db_unique_name=standby'
    *.log_archive_dest_state_1=ENABLE
    *.log_archive_dest_state_2=ENABLE
    *.standby_file_management='AUTO'
    *.db_file_name_convert='D:\app\Administrator\oradata\docare','D:\app\Administrator\oradata\docare'
    *.log_file_name_convert='D:\app\Administrator\oradata\docare','D:\app\Administrator\oradata\docare'
    ------------------------------------------------------------------------------------------------------
    oracle12.__data_transfer_cache_size=0
    oracle12.__db_cache_size=1879048192
    oracle12.__inmemory_ext_roarea=0
    oracle12.__inmemory_ext_rwarea=0
    oracle12.__java_pool_size=16777216
    oracle12.__large_pool_size=33554432
    oracle12.__oracle_base='D:\app\Administrator\virtual'#ORACLE_BASE set from environment
    oracle12.__pga_aggregate_target=872415232
    oracle12.__sga_target=2583691264
    oracle12.__shared_io_pool_size=134217728
    oracle12.__shared_pool_size=503316480
    oracle12.__streams_pool_size=0
    *.audit_file_dest='D:\app\Administrator\virtual\admin\oracle12\adump'
    *.audit_trail='db'
    *.compatible='12.2.0'
    *.control_files='D:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\ORACLE12\CONTROLFILE\O1_MF_HPJ4K63W_.CTL','D:\APP\ADMINISTRATOR\VIRTUAL\FAST_RECOVERY_AREA\ORACLE12\ORACLE12\CONTROLFILE\O1_MF_HPJ4K66T_.CTL'
    *.db_block_size=8192
    *.db_create_file_dest='D:\app\Administrator\virtual\oradata'
    *.db_name='oracle12'
    *.db_recovery_file_dest='D:\app\Administrator\virtual\fast_recovery_area\oracle12'
    *.db_recovery_file_dest_size=9546m
    *.diagnostic_dest='D:\app\Administrator\virtual'
    *.dispatchers='(PROTOCOL=TCP) (SERVICE=oracle12XDB)'
    *.enable_pluggable_database=true
    *.local_listener='LISTENER_ORACLE12'
    *.open_cursors=300
    *.pga_aggregate_target=819m
    *.processes=320
    *.remote_login_passwordfile='EXCLUSIVE'
    *.sga_target=2457m
    *.undo_tablespace='UNDOTBS1'
    
    *.db_unique_name='primary'
    *.fal_server='standby'
    *.log_archive_config='dg_config=(primary,standby)'
    *.log_archive_dest_1='location=use_db_recovery_file_dest valid_for=(all_logfiles, all_roles) db_unique_name=primary'
    *.log_archive_dest_2='service=standby lgwr async valid_for=(online_logfile,primary_role) db_unique_name=standby'
    *.log_archive_dest_state_1=ENABLE
    *.log_archive_dest_state_2=ENABLE
    *.standby_file_management='AUTO'
    *.db_file_name_convert='D:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\ORACLE12\DATAFILE','D:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\ORACLE12\DATAFILE','D:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\ORACLE12\3970E3485D9C4A1C91A4E0CCE622999E\DATAFILE','D:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\ORACLE12\3970E3485D9C4A1C91A4E0CCE622999E\DATAFILE'
    *.log_file_name_convert='D:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\ORACLE12\ONLINELOG','D:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\ORACLE12\ONLINELOG','D:\APP\ADMINISTRATOR\VIRTUAL\FAST_RECOVERY_AREA\ORACLE12\ORACLE12\ONLINELOG','D:\APP\ADMINISTRATOR\VIRTUAL\FAST_RECOVERY_AREA\ORACLE12\ORACLE12\ONLINELOG'
    

    2.4 PWDorcl.ora

    # 复制主库的密码文件到备库
    D:\app\Administrator\product\11.2.0\dbhome_1\database\PWDorcl.ora
    

    2.5 standby log file

    select group#,member from v$logfile;
    
    alter database add standby logfile group 4 'D:\APP\ADMINISTRATOR\VIRTUAL\FAST_RECOVERY_AREA\ORACLE12\ORACLE12\ONLINELOG\STANDBY_REDO04' size 200m;
    alter database add standby logfile group 5 'D:\APP\ADMINISTRATOR\VIRTUAL\FAST_RECOVERY_AREA\ORACLE12\ORACLE12\ONLINELOG\STANDBY_REDO05' size 200m;
    alter database add standby logfile group 6
    'D:\APP\ADMINISTRATOR\VIRTUAL\FAST_RECOVERY_AREA\ORACLE12\ORACLE12\ONLINELOG\STANDBY_REDO06' size 200m;
    alter database add standby logfile group 7 'D:\APP\ADMINISTRATOR\VIRTUAL\FAST_RECOVERY_AREA\ORACLE12\ORACLE12\ONLINELOG\STANDBY_REDO07' size 200m;
    
    
    select group#,archived,status from v$standby_log;
    

    2.6 检查强制、归档、闪回

    # 登入
    sqlplus / as sysdba
    
    # 查看权限
    show user;
    
    # 查看强制
    select force_logging from v$database;
    
    # 查看归档
    archive log list;
    
    # 查看闪回 
    select flashback_on from v$database;
    show parameter db_recovery_file_dest;
    

    2.7 配置闪回

    show parameter db_recovery_file_dest;
    alter system set db_recovery_file_dest_size='20G';
    alter system set db_recovery_file_dest='D:\app\Administrator\virtual\fast_recovery_area\oracle12';
    

    2.7 重启操作

    生产环境争分夺秒,务必先配置,在检查,再检查,后重启。

    # 重启监听
    lsnrctl stop
    lsnrctl start
    
    # 关闭数据库
    shutdown immediate;
    
    # 创建spfile
    create spfile from pfile;
    
    # 启动数据库mount模式
    startup mount;
    
    
    alter database archivelog;
    alter database flashback on;
    alter database force logging;
    alter database open;
    

    3. 备端配置

    3.1 listener.ora

    # listener.ora Network Configuration File: D:\app\Administrator\product\11.2.0\dbhome_1\network\admin\listener.ora
    # Generated by Oracle configuration tools.
    
    SID_LIST_LISTENER =
      (SID_LIST =
        (SID_DESC =
          (SID_NAME = CLRExtProc)
          (ORACLE_HOME = D:\app\Administrator\product\11.2.0\dbhome_1)
          (PROGRAM = extproc)
          (ENVS = "EXTPROC_DLLS=ONLY:D:\app\Administrator\product\11.2.0\dbhome_1\bin\oraclr11.dll")
        )
        (SID_DESC =
          (GLOBAL_DBNAME = docare)
          (ORACLE_HOME = D:\app\Administrator\product\11.2.0\dbhome_1)
          (SID_NAME = docare)
          (ENVS = "EXTPROC_DLLS=ONLY:D:\app\Administrator\product\11.2.0\dbhome_1\bin\oraclr11.dll")
        )
      )
    
    LISTENER =
      (DESCRIPTION_LIST =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
          (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.30)(PORT = 1521))
    	  (ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.1.36)(PORT = 1521))
        )
      )
    
    ADR_BASE_LISTENER = D:\app\Administrator
    --------------------------------------------------------------------------------------------
    # listener.ora Network Configuration File: D:\app\Administrator\virtual\product\12.2.0\dbhome_1\network\admin\listener.ora
    # Generated by Oracle configuration tools.
    
    SID_LIST_LISTENER =
      (SID_LIST =
        (SID_DESC =
          (SID_NAME = CLRExtProc)
          (ORACLE_HOME = D:\app\Administrator\virtual\product\12.2.0\dbhome_1)
          (PROGRAM = extproc)
          (ENVS = "EXTPROC_DLLS=ONLY:D:\app\Administrator\virtual\product\12.2.0\dbhome_1\bin\oraclr12.dll")
        )
        (SID_DESC =
          (GLOBAL_DBNAME = oracle12)
          (ORACLE_HOME = D:\app\Administrator\virtual\product\12.2.0\dbhome_1)
          (SID_NAME = oracle12)
          (ENVS = "EXTPROC_DLLS=ONLY:D:\app\Administrator\virtual\product\12.2.0\dbhome_1\bin\oraclr12.dll")
        )
      )
    
    LISTENER =
      (DESCRIPTION_LIST =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.103.20)(PORT = 1521))
          (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
        )
      )
    

    3.2 tnsnames.ora

    # tnsnames.ora Network Configuration File: D:\app\Administrator\product\11.2.0\dbhome_1\NETWORK\ADMIN\tnsnames.ora
    # Generated by Oracle configuration tools.
    
    ORACLR_CONNECTION_DATA =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
        )
        (CONNECT_DATA =
          (SID = CLRExtProc)
          (PRESENTATION = RO)
        )
      )
      
    primary =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.29)(PORT = 1521))
        )
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = docare)
        )
      )
    
    standby =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.30)(PORT = 1521))
        )
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = docare)
        )
      )
    
    docare =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = TCP)(HOST = 110.10.1.36)(PORT = 1521))
        )
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = docare)
        )
      )
    ---------------------------------------------------------------------------------------------
    
    

    3.3 pfile.ora

    # 修改从主库复制过来的pfile
    
    # 在INITorcl.ORA文件末尾追加
    *.db_unique_name='standby'
    *.fal_server='primary'
    *.log_archive_config='dg_config=(primary,standby)'
    *.log_archive_dest_1='location=use_db_recovery_file_dest valid_for=(all_logfiles, all_roles) db_unique_name=standby'
    *.log_archive_dest_2='service=primary lgwr async valid_for=(online_logfile,primary_role) db_unique_name=primary'
    *.log_archive_dest_state_1=ENABLE
    *.log_archive_dest_state_2=ENABLE
    *.standby_file_management='AUTO'
    *.db_file_name_convert='D:\app\Administrator\oradata\docare','D:\app\Administrator\oradata\docare'
    *.log_file_name_convert='D:\app\Administrator\oradata\docare','D:\app\Administrator\oradata\docare'
    ----------------------------------------------------------------------------------------------------
    oracle12.__data_transfer_cache_size=0
    oracle12.__db_cache_size=2013265920
    oracle12.__inmemory_ext_roarea=0
    oracle12.__inmemory_ext_rwarea=0
    oracle12.__java_pool_size=16777216
    oracle12.__large_pool_size=33554432
    oracle12.__oracle_base='D:\app\Administrator\virtual'#ORACLE_BASE set from environment
    oracle12.__pga_aggregate_target=872415232
    oracle12.__sga_target=2583691264
    oracle12.__shared_io_pool_size=0
    oracle12.__shared_pool_size=503316480
    oracle12.__streams_pool_size=0
    *.audit_file_dest='D:\app\Administrator\virtual\admin\oracle12\adump'
    *.audit_trail='db'
    *.compatible='12.2.0'
    *.control_files='D:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\ORACLE12\CONTROLFILE\O1_MF_HPJ4K63W_.CTL','D:\APP\ADMINISTRATOR\VIRTUAL\FAST_RECOVERY_AREA\ORACLE12\ORACLE12\CONTROLFILE\O1_MF_HPJ4K66T_.CTL'
    *.db_block_size=8192
    *.db_create_file_dest='D:\app\Administrator\virtual\oradata'
    *.db_name='oracle12'
    *.db_recovery_file_dest='D:\app\Administrator\virtual\fast_recovery_area\oracle12'
    *.db_recovery_file_dest_size=9546m
    *.diagnostic_dest='D:\app\Administrator\virtual'
    *.dispatchers='(PROTOCOL=TCP) (SERVICE=oracle12XDB)'
    *.enable_pluggable_database=true
    *.local_listener='LISTENER_ORACLE12'
    *.open_cursors=300
    *.pga_aggregate_target=819m
    *.processes=320
    *.remote_login_passwordfile='EXCLUSIVE'
    *.sga_target=2457m
    *.undo_tablespace='UNDOTBS1'
    
    *.db_unique_name='standby'
    *.fal_server='primary'
    *.log_archive_config='dg_config=(primary,standby)'
    *.log_archive_dest_1='location=use_db_recovery_file_dest valid_for=(all_logfiles, all_roles) db_unique_name=standby'
    *.log_archive_dest_2='service=primary lgwr async valid_for=(online_logfile,primary_role) db_unique_name=primary'
    *.log_archive_dest_state_1=ENABLE
    *.log_archive_dest_state_2=ENABLE
    *.standby_file_management='AUTO'
    *.db_file_name_convert='D:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\ORACLE12\DATAFILE','D:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\ORACLE12\DATAFILE','D:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\ORACLE12\3970E3485D9C4A1C91A4E0CCE622999E\DATAFILE','D:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\ORACLE12\3970E3485D9C4A1C91A4E0CCE622999E\DATAFILE'
    *.log_file_name_convert='D:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\ORACLE12\ONLINELOG','D:\APP\ADMINISTRATOR\VIRTUAL\ORADATA\ORACLE12\ONLINELOG','D:\APP\ADMINISTRATOR\VIRTUAL\FAST_RECOVERY_AREA\ORACLE12\ORACLE12\ONLINELOG','D:\APP\ADMINISTRATOR\VIRTUAL\FAST_RECOVERY_AREA\ORACLE12\ORACLE12\ONLINELOG'
    

    3.4 spfile.ora

    shutdown immediate;
    create spfile from pfile;
    startup nomount;
    

    3.5 RMAN复制

    # 登录(cmd)
    rman target sys/oracle@primary auxiliary sys/oracle@standby
    rman target sys/123456@primary auxiliary sys/123456@standby
    # 复制(rman)
    duplicate target database for standby from active database nofilenamecheck;
    

    3.6 开闪回

    注意:这个开闪回是给备库当切成主库时使用,建议事先开启。

    alter database flashback on;
    select flashback_on from v$database;
    

    3.7 重启数据库

    # 关闭数据库
    shutdown immediate;
    
    # 启动数据库
    startup;
    
    # 开启同步
    alter database recover managed standby database using current logfile disconnect from session;
    ## 注意:每次重启数据库,“DG同步”则需要手动命令开启。这里需要在WebUI上开发一个开启按钮。
    ## 使用命令select open_mode from v$database;查看同步模式
    ### 非同步中:READ ONLY
    ### 同步中:READ ONLY WITH APPLY
    

    4. 检查验证

    # 检查备库模式
    select status from v$instance;
    
    # 查看主备归档序号
    archive log list;
    alter system switch logfile;  ##//主库执行
    archive log list;
    
    # 查看主备库状态
    select switchover_status,database_role from v$database;
    
    # 查看备库DG进程
    select process,client_process,sequence#,status from v$managed_standby;
    
    # 查看备库保护模式
    select database_role,protection_mode,protection_level,open_mode from v$database;
    
    # 验证同步
    select sequence#, first_time, next_time,applied,deleted from v$archived_log where deleted='NO' order by sequence#;
    

    5. Win定时任务

    归档日志定时清理脚本,策略保留7天

    5.1 定时任务脚本

    # 1. 创建文件夹和文件
    cd D:\app\Administrator\oracle\
    mkdir clear_arch
    cd .\clear_arch
    echo '' >clear_arch.bat
    echo '' >clear_arch.ora
    
    ## 2. 添加bat脚本,用于定时任务
    D:\app\Administrator\oracle\clear_arch\clear_arch.bat
    set y=%date:~0,4%
    set m=%date:~5,2%
    set d=%date:~8,2%
    
    set /a th=%time:~0,2%
    if %th% LSS 10 (set hh=0%th%) else (set hh=%th%)
    set /a tm=%time:~3,2%
    if %tm% LSS 10 (set mm=0%tm%) else (set mm=%tm%)
    set /a ts=%time:~6,2%
    if %ts% LSS 10 (set ss=0%ts%) else (set ss=%ts%)
    
    set logname=%y%%m%%d%%hh%%mm%%ss%
    
    rman target / msglog=D:\app\Administrator\oracle\clear_arch\%logname%.log cmdfile=D:\runtime\oracle\clear_arch\clear_arch.ora
    ----
    
    
    # 3. 添加执行脚本,用于定时任务执行的脚本
    D:\app\Administratororacle\clear_arch\clear_arch.ora
    crosscheck archivelog all;
    delete noprompt expired archivelog all;
    delete noprompt archivelog all completed before 'sysdate - 7';
    exit;
    

    5.2 Win定时任务

    cmd 下 执行 taskschd.msc,打开定时任务管理器。

    1.依次“任务计划程序(本地)>任务计划程序库>Microsoft”,右击“Microsoft”新建文件夹,命名为“oracle”
    2.右击新文件夹“oracle”,创建基本任务,打开任务向导。输入“任务名”和“描述”下一步。
    3.选择执行频率“每天”
    4.设置开始执行时间:“4:00:00、每个1天发生一次”
    5.启动程序
    6.选择脚本
    7.勾选“当点击‘完成’时,打开此属性对话框”
    8.选择“不管用户是否登录都要运行”;勾选“不存储密码”;勾选“使用最高权限运行”
    9.测试运行,检查任务
    

    6. 应急预案

    6.1 手动拆解DG

    6.2 手动feilover切换

    6.3 手动switchover切换

    7. WebUI配置

    关于NDR的WebUi端口配置统一如下:

    项目 原端口 新端口 默认路径
    Web 8080 8300 C:\NDR\ndr-dashboard\ndr-uifront-end\conf\server.xml
    本地API 9090 8310 C:\NDR\ndr-dashboard\ndr-uifront-end\webapps\static\config.json
    信令传输 54321 8320 C:\NDR\ndr-dashboard\ndr-uiback-end\db.properties
    本端API 8080 8330 C:\NDR\ndr-dashboard\ndr-uiback-end\db.properties
    远端API 7070 8331 C:\NDR\ndr-dashboard\ndr-uiback-end\db.properties

    7.1 java环境配置

    主备配置相同

    项目 说明
    JAVA_HOME C:\NDR\jdk1.8.0_212 新增
    PATH %JAVA_HOME%\bin;%JAVA_HOME%\jre\bin; 追加
    CLASSPATH .;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar 新增

    7.2 tomcat启动

    • 主端配置:C:\NDR\ndr-dashboard\ndr-uifront-end\webapps\static\config.json
    {
      "BASE_URL": "http://192.168.10.29:8310"
    }
    
    • 备端配置:C:\NDR\ndr-dashboard\ndr-uifront-end\webapps\static\config.json
    {
      "BASE_URL": "http://192.168.10.30:8310"
    }
    
    • 注册启动服务
    # cmd 窗口执行
    cd C:\NDR\ndr-dashboard\ndr-uifront-end\bin
    .\service.bat install
    net start Ndr-uifront-end
    sc config  Ndr-uifront-end start=auto
    

    7.3 jar启动

    • 主端配置C:\NDR\ndr-dashboard\ndr-uiback-end\db.properties
    # jdbc 数据库驱动
    ## oracle 
    db_url_oracle=jdbc:oracle:thin:@192.168.10.29:1521:docare
    
    # oracle accout and password
    user=sys
    password=oracle
    
    # 信令配置
    socket_port = 8320
    socket_host = 192.168.10.30
    
    # 主备API配置
    ## 本端
    api_host = 192.168.10.29
    api_port = 8330
    api_host_system_version = windows 7 v1212
    
    ## 远端
    target_host = 192.168.10.30
    target_port = 8331
    target_host_system_version = windows 8 v1212
    
    target_socket_host = 172.0.0.1
    
    # Oracle dg is start
    enable_dg = True
    
    # WebUI的登录名和密码
    web_user = admin
    web_password = 123456
    
    • 备端配置C:\NDR\ndr-dashboard\ndr-uiback-end\db.properties
    # jdbc 数据库驱动
    ## oracle 
    db_url_oracle=jdbc:oracle:thin:@192.168.10.30:1521:docare
    
    # oracle accout and password
    user=sys
    password=oracle
    
    # 信令配置
    socket_port = 8320
    socket_host = 192.168.10.29
    
    # 主备API配置
    ## 本端
    api_host = 192.168.10.30
    api_port = 8330
    api_host_system_version = windows 7 v1212
    
    ## 远端
    target_host = 192.168.10.29
    target_port = 8331
    target_host_system_version = windows 8 v1212
    
    target_socket_host = 172.0.0.1
    
    # Oracle dg is start
    enable_dg = True
    
    # WebUI的登录名和密码
    web_user = admin
    web_password = 123456
    
    • 注册启动服务
    # cmd 窗口执行
    cd C:\NDR\ndr-dashboard\ndr-uiback-end
    .\ndr-server_ODB-3.1.0.exe install
    net start Ndr-uiback-end
    

    8. 文件同步

    同步目录:

    目录 说明
    C:\inetpub Windows IIS web服务路径
    D:\AnesICU 手麻应用程序
    D:\EMR 电子病历归档目录
    D:\MDSD 手麻安装文件
    D:\update 程序更新目录(FTP服务)

    8.1 安装MySQL

    项目
    安装程序 C:\NDR\mysql-5.5.62\mysql-5.5.62-winx64.msi
    安装至 C:\MySQL\MySQL Server 5.5\
    安装过程 (略)
    账户密码 root/123456(开通远程连接)

    8.2 创建数据库

    # 创建数据库、创建用户授权
    create database simon_sym charset utf8 collate utf8_general_ci; 
    grant all on simon_sym.* to simon@'%' identified by '123456';
    flush privileges;
    

    8.3 sym配置修改

    • 配置文件修改C:\NDR\ndr-server\engines\mysql-master.properties(主端)
    # service name
    engine.name=mysql-master
    
    # The class name for the JDBC Driver
    db.driver=com.mysql.jdbc.Driver
    
    # The JDBC URL used to connect to the database
    db.url=jdbc:mysql://localhost:3306/simon_sym?useUnicode=true&characterEncoding=utf8
    
    # The user to login as who can create and update tables
    db.user=simon
    
    # The password for the user to login as
    db.password=123456
    
    registration.url=
    sync.url=http://192.168.10.29:8340/sync/mysql-master
    
    # Do not change these for running the demo
    group.id=mysql-master
    external.id=101
    
    # Don't muddy the waters with purge logging
    job.purge.period.time.ms=7200000
    
    # This is how often the routing job will be run in milliseconds
    job.routing.period.time.ms=5000
    
    # This is how often the push job will be run.
    job.push.period.time.ms=10000
    
    # This is how often the pull job will be run.
    job.pull.period.time.ms=10000
    
    # Kick off initial load
    initial.load.create.first=true
    initial.load.delete.first=true
    
    #api on
    rest.api.enable=true
    create.table.without.foreign.keys=false
    
    # file sync
    file.sync.enable=true
    file.sync.fast.scan=false
    file.sync.lock.wait.ms=300000
    file.sync.prevent.ping.back=true
    
    job.file.sync.push.period.time.ms=5000
    job.file.sync.pull.period.time.ms=5000
    job.file.sync.tracker.cron=*/15 * * * * *
    
    file.pull.period.minimum.ms=2000
    file.push.period.minimum.ms=2000
    
    job.purge.outgoing.cron=0 0 */4 * * *
    job.refresh.cache.cron=0/30 * * * * *
    
    • 配置文件修改C:\NDR\ndr-server\engines\mysql-slave.properties(备端)
    # service name
    engine.name=mysql-slave
    
    # The class name for the JDBC Driver
    db.driver=com.mysql.jdbc.Driver
    
    # The JDBC URL used to connect to the database
    db.url=jdbc:mysql://localhost:3306/simon_sym?useUnicode=true&characterEncoding=utf8
    
    # The user to login as who can create and update tables
    db.user=simon
    
    # The password for the user to login as
    db.password=123456
    
    registration.url=http://192.168.10.29:8340/sync/mysql-master
    sync.url=http://192.168.10.30:8341/sync/mysql-slave
    
    # Do not change these for running the demo
    group.id=mysql-slave
    external.id=102
    
    # Don't muddy the waters with purge logging
    job.purge.period.time.ms=7200000
    
    # This is how often the routing job will be run in milliseconds
    job.routing.period.time.ms=5000
    
    # This is how often the push job will be run.
    job.push.period.time.ms=10000
    
    # This is how often the pull job will be run.
    job.pull.period.time.ms=10000
    
    # Kick off initial load
    initial.load.create.first=true
    initial.load.delete.first=true
    
    #api on
    rest.api.enable=true
    create.table.without.foreign.keys=false
    
    # file sync
    file.sync.enable=true
    file.sync.fast.scan=false
    file.sync.lock.wait.ms=300000
    file.sync.prevent.ping.back=true
    
    job.file.sync.push.period.time.ms=5000
    job.file.sync.pull.period.time.ms=5000
    job.file.sync.tracker.cron=*/15 * * * * *
    
    file.pull.period.minimum.ms=2000
    file.push.period.minimum.ms=2000
    
    job.purge.outgoing.cron=0 0 */4 * * *
    job.refresh.cache.cron=0/30 * * * * *
    

    8.4 初始化sym表

    # 主端cmd执行(注意:备端不需要执行)
    C:\NDR\ndr-server\bin\symadmin --engine mysql-master create-sym-tables
    
    C:\NDR\ndr-server\bin\symadmin --engine server create-sym-tables
    
    # 登入mysql
    mysql -uroot -p123456 simon_sym
    
    # 清除默认表数据
    delete from sym_trigger_router;
    delete from sym_trigger;
    delete from sym_trigger_hist;
    delete from sym_router;
    delete from sym_node_group_link;
    delete from sym_node_group;
    delete from sym_node_host;
    delete from sym_node_identity;
    delete from sym_node_security;
    delete from sym_node;
    
    # 添加节点组
    insert into sym_node_group (node_group_id, description) values ('mysql-master', '主站节点组');
    insert into sym_node_group (node_group_id, description) values ('mysql-slave', '备站节点组');
    
    
    insert into sym_node_group (node_group_id, description) values ('server', '主站节点组');
    insert into sym_node_group (node_group_id, description) values ('client', '备站节点组');
    
    # 定义同步方向(一般两种模式都定义)
    insert into sym_node_group_link (source_node_group_id, target_node_group_id, data_event_action) values ('mysql-master', 'mysql-slave', 'P');
    insert into sym_node_group_link (source_node_group_id, target_node_group_id, data_event_action) values ('mysql-slave', 'mysql-master', 'W');
    
    
    
    insert into sym_node_group_link (source_node_group_id, target_node_group_id, data_event_action) values ('server', 'client', 'P');
    insert into sym_node_group_link (source_node_group_id, target_node_group_id, data_event_action) values ('client', 'server', 'W');
    select * from sym_node_group_link;
    
    
    
    # 添加节点信息
    insert into sym_node (node_id, node_group_id, external_id, sync_enabled) values ('101', 'mysql-master', '101', 1);
    insert into sym_node (node_id, node_group_id, external_id, sync_enabled) values ('102', 'mysql-slave', '102', 1);
    
    
    insert into sym_node (node_id, node_group_id, external_id, sync_enabled) values ('101', 'mysql-master', '101', 1);
    insert into sym_node (node_id, node_group_id, external_id, sync_enabled) values ('102', 'mysql-slave', '102', 1);
    
    # 设置主节点
    insert into sym_node_identity values ('101');
    
    # 添加节点认证信息
    INSERT INTO sym_node_security (
    	node_id,
    	node_password,
    	registration_enabled,
    	registration_time,
    	initial_load_enabled,
    	initial_load_time,
    	initial_load_id,
    	initial_load_create_by,
    	rev_initial_load_enabled,
    	rev_initial_load_time,
    	rev_initial_load_id,
    	rev_initial_load_create_by
    )
    VALUES
    	(
    		'101',
    		'123456',
    		0,
    		CURRENT_TIMESTAMP,
    		0,
    		CURRENT_TIMESTAMP,
    		NULL,
    		NULL,
    		0,
    		NULL,
    		NULL,
    		NULL
    	);
    
    # 添加数据流向
    INSERT INTO sym_router (
    	router_id,
    	source_node_group_id,
    	target_node_group_id,
    	router_type,
    	create_time,
    	last_update_time
    )
    VALUES
    	(
    		'master_to_slave',
    		'mysql-master',
    		'mysql-slave',
    		'default',
    		CURRENT_TIMESTAMP,
    		CURRENT_TIMESTAMP
    	);
    

    8.5 启动sym系统

    # 注册备节点(主端执行)
    C:\NDR\ndr-server\bin\symadmin --engine mysql-master open-registration mysql-slave 102
    
    # 加载备节点(主端执行)
    C:\NDR\ndr-server\bin\symadmin --engine mysql-master reload-node 102
    
    # 启动服务,先启备后启主
    C:\NDR\ndr-server\bin\sym --engine mysql-slave --port 8341
    C:\NDR\ndr-server\bin\sym --engine mysql-master --port 8340
    

    8.6 添加同步任务

    8.6.1 同步C:\inetpub

    注意排除文件:C:\inetpub\AdminScripts\0804\adsutil.ini

    # 定义触发器
    INSERT INTO sym_file_trigger (
    	trigger_id,
    	channel_id,
    	reload_channel_id,
    	base_dir,
    	recurse,
    	last_update_time,
    	create_time
    )
    values (
    	'c_inetpub',
    	'filesync',
        'filesync_reload',
    	'C:\\inetpub',
    	1,
    	current_timestamp,
    	current_timestamp
    );
    
    # 关联触发器与路由
    insert into sym_file_trigger_router (
    	trigger_id,
    	router_id,
    	initial_load_enabled,
    	target_base_dir,
    	last_update_time,
    	create_time
    )
    values (
    	'c_inetpub',
        'master_to_slave',
    	'1',
    	'C:\\inetpub',
    	current_timestamp,
    	current_timestamp
    );
    
    8.6.2 同步D:\AnesICU
    # 定义触发器
    INSERT INTO sym_file_trigger (
    	trigger_id,
    	channel_id,
    	reload_channel_id,
    	base_dir,
    	recurse,
    	last_update_time,
    	create_time
    )
    values (
    	'd_AnesICU',
    	'filesync',
        'filesync_reload',
    	'D:\\AnesICU',
    	1,
    	current_timestamp,
    	current_timestamp
    );
    
    # 关联触发器与路由
    insert into sym_file_trigger_router (
    	trigger_id,
    	router_id,
    	initial_load_enabled,
    	target_base_dir,
    	last_update_time,
    	create_time
    )
    values (
    	'd_AnesICU',
        'master_to_slave',
    	'1',
    	'D:\\AnesICU',
    	current_timestamp,
    	current_timestamp
    );
    
    8.6.3 同步D:\EMR
    # 定义触发器
    INSERT INTO sym_file_trigger (
    	trigger_id,
    	channel_id,
    	reload_channel_id,
    	base_dir,
    	recurse,
    	last_update_time,
    	create_time
    )
    values (
    	'd_EMR',
    	'filesync',
        'filesync_reload',
    	'D:\\EMR',
    	1,
    	current_timestamp,
    	current_timestamp
    );
    
    # 关联触发器与路由
    insert into sym_file_trigger_router (
    	trigger_id,
    	router_id,
    	initial_load_enabled,
    	target_base_dir,
    	last_update_time,
    	create_time
    )
    values (
    	'd_EMR',
        'master_to_slave',
    	'1',
    	'D:\\EMR',
    	current_timestamp,
    	current_timestamp
    );
    
    8.6.4 同步D:\MDSD
    # 定义触发器
    INSERT INTO sym_file_trigger (
    	trigger_id,
    	channel_id,
    	reload_channel_id,
    	base_dir,
    	recurse,
    	last_update_time,
    	create_time
    )
    values (
    	'd_MDSD',
    	'filesync',
        'filesync_reload',
    	'D:\\MDSD',
    	1,
    	current_timestamp,
    	current_timestamp
    );
    
    # 关联触发器与路由
    insert into sym_file_trigger_router (
    	trigger_id,
    	router_id,
    	initial_load_enabled,
    	target_base_dir,
    	last_update_time,
    	create_time
    )
    values (
    	'd_MDSD',
        'master_to_slave',
    	'1',
    	'D:\\MDSD',
    	current_timestamp,
    	current_timestamp
    );
    
    8.6.5 同步D:\update
    # 定义触发器
    INSERT INTO sym_file_trigger (
    	trigger_id,
    	channel_id,
    	reload_channel_id,
    	base_dir,
    	recurse,
    	last_update_time,
    	create_time
    )
    values (
    	'd_update',
    	'filesync',
        'filesync_reload',
    	'D:\\update',
    	1,
    	current_timestamp,
    	current_timestamp
    );
    
    # 关联触发器与路由
    insert into sym_file_trigger_router (
    	trigger_id,
    	router_id,
    	initial_load_enabled,
    	target_base_dir,
    	last_update_time,
    	create_time
    )
    values (
    	'd_update',
        'master_to_slave',
    	'1',
    	'D:\\update',
    	current_timestamp,
    	current_timestamp
    );
    

    8.7 启动服务制作

    # 在cmd下执行
    C:\NDR\ndr-server\nssm\win64\nssm.exe install
    
    # 卸载服务
    C:\NDR\ndr-server\nssm\win64\nssm.exe remove ndr-mssql
    
    # 在弹出的串口添加
    Path:					C:\NDR\ndr-server\bin\sym.bat
    Startup directory: 	    C:\NDR\ndr-server\bin
    Arguments:  			--engine mysql-master --port 8340	<---注意主备端端口修改
    ServiceName:			Ndr-filesync-master
    
    Path:					C:\NDR\ndr-server\bin\sym.bat
    Startup directory: 	    C:\NDR\ndr-server\bin
    Arguments:  			--engine server --port 8340	<---注意主备端端口修改
    ServiceName:			ndr-mssql
    
    
    Path:					C:\NDR\ndr-server\bin\sym.bat
    Startup directory: 	    C:\NDR\ndr-server\bin
    Arguments:  			--engine client --port 8341	<---注意主备端端口修改
    ServiceName:			ndr-mssql
    # 启动服务
    net start Ndr-filesync-master
    net start Ndr-filesync-slave
    
    net start ndr-mssql
    
    ##备端的操作相同,但注意修改端口和名称
    --engine mysql-slave --port 8341
    Ndr-filesync-slave
    
    展开全文

空空如也

1 2 3 4 5 ... 20
收藏数 1,895
精华内容 758
关键字:

数据库容灾