Linux orcle Database Incremental backup script _oracle

Source: Internet
Author: User
Orcle Database backup Strategy
1. Implement database Export and import by using the EXP and IMP commands.
There are three different modes:
A. User mode: Export (Import) All objects of the user and the data in the object;
B. Table mode: Export (import) All of the user's tables or specified tables;
C. Entire database: Export (import) All objects in the database.
Such as:
Normal export
A. Export a complete database
Exp System/manager file=f.dmp full=y
B. Exporting database definitions without exporting data
Exp System/manager file=f.dmp full=y rows=n
Normal import:
A. Full import
Imp System/manager file=f.dmp full=y
B. When the database structure exists, only data is imported
Imp System/manager file=f.dmp full=y ignore=y
2. Weekly database backup, in case the database is accidentally destroyed after the recovery of data
The arrangements are as follows:
Monday: Full backup (F1) exp xxx/xxx inctype=complete file=f1.dmp
Tuesday: Incremental backup (F2) exp xxx/xxx inctype=incremental file=f2.dmp
Wednesday: Incremental Backup (F3) exp xxx/xxx inctype=incremental file=f3.dmp
Thursday: Incremental backup (F4) exp xxx/xxx inctype=incremental file=f4.dmp
Friday: Cumulative Backup (F5) exp xxx/xxx inctype=cumulative file=f5.dmp
Saturday: Incremental backup (f6) exp xxx/xxx inctype=incremental file=f6.dmp
Sunday: Incremental backup (F7) exp xxx/xxx inctype=incremental file=f7.dmp
For example, the database was destroyed in Sunday and can be recovered in the following ways:
1. Create an empty database with the previous structure.
2.imp xxx/xxx Inctype=restore full=y file=f1.dmp
3.imp xxx/xxx Inctype=restore full=y file=f5.dmp
4.imp xxx/xxx Inctype=restore full=y file=f6.dmp
Description
Full export: Backup of the entire database
Incremental export: Is the data that was changed after the last full export of the backup.
Cumulative export: The data that has been changed since the last full export was backed up.
Backup Database under Example:linux
Backup_dir=/home/oracle/backups
if [!-D $BACKUP _dir]; Then
Mkdir-p $BACKUP _dir
Fi
days= (Sun Mon Tue Wed Thu Sat) #创建数组
Types= (Incremental complete incremental incremental incremental cumulative incremental)
day= ' Date +%w ' #取得本周天数, 0 on behalf of Sunday, 1 on Monday
day_name=${days[$day]} #取得数组的值
type=${types[$day]}
Date_name= ' Date +%f '
File_name=${date_name}-${day_name}-${type}.dmp #2008 -12-8-mon-complete.dmp
Exp xxx/xxx inctype= $TYPE file=${backup_dir}/${file_name} >/dev/null
Gzip ${backup_dir}/${file_name}
Find $BACKUP _dir-mtime +7-delete #删除七天前更改过的文件

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.