Linux/windows System Oracle Database simple Cold standby synchronization
We have a financial system that values the security of financial data, while we have two systems, one production environment (Linux), and one Emergency backup environment (Windows). Backup environment in the production environment to implement real-time backup synchronization, there are two ways of backup: Hot standby cold standby. Oracle Hot spares are typically used with Oracle DG Services, but Oracle DG Services are charged separately, which is a big expense for customers. So we use the Oracle cold approach, the basic process is: database timing through the EXPDP way to export, and then through FTP to the emergency backup environment, the emergency backup environment and then perform IMPDP import, so that can complete the cold standby.
One, the Linux Oracle database side:
1. Add Crontab Timing Time
2, write the shell script, realize the database export
#!/bin/Bashyy= ' Date +%Y ' mm= ' Date +%m ' DD= ' Date +%d ' time=$yy $mm$ddoracle_base=/oracle/app/Oracle;export oracle_base;oracle_home= $ORACLE _base/product/11.2; export oracle_home; PATH= $ORACLE _home/bin: $PATH; export Path;f_dmp="Fdb_${time}. DMP"F_log="_f${time}. LOG"Echo"EXPDP ods/[email protected] directory=backup_db dumpfile= $f _dmp logfile=$1$f_log Schemas=meta,ods,mid,app reuse_ dumpfiles=y;"Echo"Exporting Data ..."EXPDP ODS/[email protected] directory=backup_db dumpfile= $f _dmp logfile=$1$f _log Schemas=meta,ods,mid,app reuse_dumpfiles=Y;echo"EXPDP User Data success!"
Second, the Emergency backup environment using FTP to transfer DMP files, of course, production environment Linux must support FTP
@echo off SET p_year=%date:~0,4%SET P_month=%date:~5,2%SET P_day=%date:~8,2%SET p_date=%p_year%%p_month%%p_day%Echo Oracle>Autoftp.txtecho Oracle>>Autoftp.txtecho Prompt>>Autoftp.txtecho bin>>Autoftp.txtechoGet/home/oracle/fdb_%p_date%. DMP D:\data_backup\db\DB_%P_DATE%. Dmp>>Autoftp.txtechoGet/home/oracle/_f%p_date%. LOG d:\data_backup\db\_f%p_date%.log>>Autoftp.txtecho Mdel/home/oracle/*. Dmp>>autoftp.txtecho mdel/home/oracle/_f*. Log>>autoftp.txtecho bye>> autoftp.txtftp-s: "Autoftp.txt" 127.0.0.1 (IP address) exit
FTP typically uses Ftp-s ftp.txt text to perform FTP operations, and the above actions generate corresponding Ftp.txt text based on the current period
Oracleoraclepromptbin get /home/oracle/fdb_20140729.dmp D:\data_backup\db\DB_20140729.DMPget /home/oracle/ /home/oracle/*. dmpmdel/home/oracle/_f*. Logbyeget/home/oracle/*.dmp C:\20141119.DMP
Third, since the DMP file is transferred to the Windows system, you can use IMPDP to import, and of course, the import operation with the Windows Timer service to start
@echo Offrem REM Set p_year=%date:~0,4set P_month=%date:~5,2set P_day =%date:~8,2SET p_date=%p_year%%p_month%%p_day%IMPDP ODS/[email Protected] directory=backup_db dumpfile=db_%p_date%.dmp schemas=meta,ods,mid,app table_exists_action= Replacepause
There are several obvious drawbacks to this approach:
1, Exp export, import on the database performance will have a certain impact
2, the database can not be synchronized in real time, high data synchronization requirements and high data security is not suitable for nature
3, export transmission import, time points need to stagger, this time point is not good control
Linux/windows System Oracle Database simple Cold standby synchronization