For linux/windows systems, the oracle Database supports simple cold backup synchronization and oracle cold backup

Source: Internet
Author: User

For linux/windows systems, the oracle Database supports simple cold backup synchronization and oracle cold backup

Simple cold backup synchronization for oracle databases in linux/windows

We have a financial system that focuses on the security of financial data. At the same time, we have two systems: a production environment (linux) and an emergency backup environment (windows ). The backup Environment implements real-time backup and synchronization for the production environment. There are also two backup methods: Hot Backup and cold backup. Oracle Hot Standby usually uses the oracle DG service, but the oracle DG service is charged separately, which is a small expense for the customer. So we adopt the oracle cold backup method. The basic process is: the database is exported in expdp mode at regular intervals, and then transmitted to the emergency backup environment through ftp. The emergency backup environment is then imported using impdp, in this way, cold backup can be completed.

 

I. linux oracle database:

1. Add crontab timing time

2. Write shell scripts to export Databases

#!/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/ods@dw1 directory=backup_db dumpfile=$f_dmp logfile=$1$f_log SCHEMAS=meta,ods,mid,app reuse_dumpfiles=y;"echo "exporting data ..."expdp ods/ods@dw1 directory=backup_db dumpfile=$f_dmp logfile=$1$f_log SCHEMAS=meta,ods,mid,app reuse_dumpfiles=y;echo "expdp user data success!"

 

Ii. use ftp to transmit dmp files in the emergency backup environment. Of course, the 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.txt echo prompt> autoftp.txt echo bin> autoftp.txt echo get/home/oracle/FDB _ % P_DATE %. dmp d: \ data_backup \ db \ DB _ % P_DATE %. DMP> autoftp.txt echo get/home/oracle/_ F % P_DATE %. log d: \ data_backup \ db \ _ F % P_DATE %. log> autoftp.txt echo mdel/home/oracle /*. DMP> autoftp.txt echo mdel/home/oracle/_ F *. LOG> autoftp.txt echo bye> autoftp.txt ftp-s: "autoftp.txt" 127.0.0.1 (IP address) exit

Ftp generally uses the ftp-s ftp.txt operator to execute the ftpoperation, and generate the corresponding ftp.txt text in the previous step.

oracleoraclepromptbinget /home/oracle/FDB_20140729.DMP D:\data_backup\db\DB_20140729.DMPget /home/oracle/_F20140729.LOG D:\data_backup\db\_F20140729.logmdel /home/oracle/*.DMPmdel /home/oracle/_F*.LOGbyeget /home/oracle/*.dmp C:\20141119.DMP

 

3. Since the dmp file is transmitted to the windows system, you can use impdp For the import operation. Of course, the import operation should also be started using the windows scheduled service.

@echo offREM REM  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%impdp ods/ods@dw directory=backup_db dumpfile=DB_%P_DATE%.dmp  SCHEMAS=meta,ods,mid,app  table_exists_action=REPLACEpause

This method has several obvious disadvantages:

1. Export exp and import may affect the database performance.

2. databases cannot be synchronized in real time, which is not applicable to high data synchronization requirements and high data security.

3. Export transmission and import. The time must be staggered. This time point is difficult to control.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.