Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize exp incremental backup of oracle

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how to achieve oracle exp incremental backup", the content of the article is simple and clear, easy to learn and understand, now please follow the editor's ideas slowly in depth, together to study and learn "how to achieve oracle exp incremental backup"!

Oracle exp incremental backup experiment

Https://blog.csdn.net/sinat_16741503/article/details/72876092

There are three standard backup methods for Oracle databases, which are export / import (EXP/IMP, EXPDP/IMPDP), hot backup, and cold backup.

The exported spare is a logical backup, and the cold backup and hot backup are physical backups.

Exp supports incremental backups, while expdp does not.

Exp/imp incremental export is a commonly used method of data backup, which can only be implemented for the entire database and must be exported as SYSTEM.

During this export, the system does not require any questions to be answered. The export file name is export.dmp by default. If you do not want your output file to be named

Export.dmp, you must indicate the file name to be used on the command line.

Incremental exports include three types: full backup, cumulative backup, and incremental backup.

The following conditions must be met to perform an incremental backup:

1. Valid only for full database backups, and the full=y parameter is required for the first time, and the inctype=incremental parameter is required later.

two。 The user must have the system role of EXP_FULL_DATABASE.

Here are three simple uses and differences for backups:

1, full backup: as the name implies, export all data in the entire database

Exp system/oracle inctype=complete file=full.dmp log=full.log

2. Cumulative backup: export information about changes in the database since the last "full backup"

Exp system/oracle inctype=cumulative file=cumulative_1.dmp log=sys_cumulative_1.log

3. Incremental backup: back up the information that has changed since the last "backup"

Exp system/oracle inctype=incremental file=sys_cumulative_3.dmp log=sys_cumulative_3.log

For example, I set an oracle backup policy:

Saturday: full backup

Sunday: incremental backup

Monday: incremental backup

Tuesday: incremental backup

Wednesday: cumulative backup

Thursday: incremental backup

Friday: incremental backup

So when my database was corrupted on Saturday (before backup), the process of restoring the database was:

First, regenerate the database structure with the command CREATE DATABASE.

Second, create an additional segment that is large enough.

Third, full backup import (Saturday)

Imp system/oracle inctype=RESTORE FULL=y FILE= fully backs up files on Saturday

Fourth, cumulative backup import (Wednesday)

Impsystem/oracle inctype=RESTORE FULL=y FILE= accumulated backup files on Wednesday

Fifth, incremental backup import (Thursday)

Impsystem/oracle inctype=RESTORE FULL=y FILE= accumulated backup files on Thursday

Sixth, incremental backup import (Friday)

Impsystem/oracle inctype=RESTORE FULL=y FILE= accumulated backup files on Friday

Note: one drawback of backing up the oracle database in this way is that the data will be lost before the last backup to the database goes down.

-- the following is a full backup strategy script written by the blogger. After cumulative backup and incremental backup, you can modify some parameters:

#! / bin/bash

# script for oracle database backup, which backs up the whole database and executes at 1:00 every Saturday

# #

# # author-***###

# #

If [- f ~ / .bash_profile]; then

. ~ / .bash_profile

Fi

Set-e

Last_day= `date-d "- 7 day" +% Y% m% d`

# Last data backup time

Stime= `date +% s`

Echo `date + "% F% T" `# start full library backup #

Cd / mnt/sd02/oracle_bak_68/

# backup data storage directory

/ data/app/oracle/product/11.2.0/dbhome_1/bin/exp system/oracle inctype=complete

File=sys_all_ `date +% Y% m% d`.dmp log=sys_all_ `date +% Y% m% d`.log

# declare the exp path. In some environments, the command cannot be found if an error is reported in a scheduled task.

Rm sys_all_$ {last_day} .dmp

Rm sys_all_$ {last_day} .log

# Delete last week's full backup file

Etime= `date +% s`

S = `echo "scale=0; ($etime-$stime)% 60" | bc`

M = `echo "scale=0; ($etime-$stime) / 60% 60" | bc`

H = `echo "scale=0; ($etime-$stime) / 60 + 60" | bc`

Echo `date + "% F% T" `# end of full library backup #

Echo `date + "% F% T" `end script execution time $h hours $m minutes $s seconds

-- the backup policy settings in scheduled tasks are as follows:

# script for full library backup, which is executed at one o'clock every Saturday morning

01 01 * * 6 sh / home/oracle/zcb/oracle_all_bak.sh > > / home/oracle/zcb/log/oracle_a

Ll_ `date + "\% Y\% m\% d" `.log 2 > & 1

# incremental backup scripts are executed every Sunday, Monday, Tuesday, Thursday and Friday

00 01 * * 0 sh / home/oracle/zcb/oracle_incremental_bak.sh > > / home/oracle/zcb/log/oracle_in

Cremental_ `date + "\% Y\% m\% d" `.log 2 > & 1

00 01 * * 1 sh / home/oracle/zcb/oracle_incremental_bak.sh > > / home/oracle/zcb/log/oracle_in

Cremental_ `date + "\% Y\% m\% d" `.log 2 > & 1

00 01 * * 2 sh / home/oracle/zcb/oracle_incremental_bak.sh > > / home/oracle/zcb/log/oracle_in

Cremental_ `date + "\% Y\% m\% d" `.log 2 > & 1

00 02 * * 4 sh / home/oracle/zcb/oracle_incremental_bak.sh > > / home/oracle/zcb/log/oracle_in

Cremental_ `date + "\% Y\% m\% d" `.log 2 > & 1

00 01 * * 5 sh / home/oracle/zcb/oracle_incremental_bak.sh > > / home/oracle/zcb/log/oracle_in

Cremental_ `date + "\% Y\% m\% d" `.log 2 > & 1

# Cumulative backup scripts are executed every Wednesday

00 01 * * 3 sh / home/oracle/zcb/oracle_cumulative_bak.sh > > / home/oracle/zcb/log/oracle_cu

Mulative_ `date + "\% Y\% m\% d" `.log 2 > & 1

Thank you for reading, the above is the content of "how to achieve exp incremental backup of oracle". After the study of this article, I believe you have a deeper understanding of how to achieve exp incremental backup of oracle, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report