Oracle automatic backup case on Linux platform (using exp tool)

Source: Internet
Author: User
A friend asked me to back up the database with exp at every night to the specified directory and automatically delete the data backed up one week ago.

A friend asked me to back up the database with exp at every night to the specified directory and automatically delete the data backed up one week ago.

A friend asked me to back up the database with exp at every night to a specified directory and automatically delete the data backed up one week ago, record and share the process only.

For the case of Oracle automatic backup on Linux (using RMAN), see


Environment:
Operating System: RHEL5.4
Database: Oracle 10.2.0
Related variable values:
ORACLE_BASE =/u01/app/oracle
ORACLE_HOME =/u01/app/oracle/product/10.2.0/db_1
Backup solution name: MAI
Target backup Directory:/backup


The implementation process is as follows:
Prepare the directory:
Mkdir/backup
Chown oracle: oinstall/backup
Chmod 755/backup


Switch to the oracle user, create the bin directory under the oracle Home directory, and create the on_time_backup.sh file.
Mkdir bin
Cd bin
Touch on_time_backup.sh
Chmod 755 on_time_backup.sh
Edit the on_time_backup.sh file and add the following content:
#! /Bin/bash
Source/home/oracle/. bash_profile
/U01/app/oracle/product/10.2.0/db_1/bin/exp userid = mai/mai file =/backup/BACKUP_SCHEMA_MAI _ 'date + % Y % m % d % H % M '. dmp log =/backup/BACKUP_SCHEMA_MAI _ 'date + % Y % m % d % H % M '. log
/Usr/bin/find/backup-mtime + 7-exec rm-rf {}\;


Use oracle users to add routine tasks:
Crontab-e
Add the following content to the new window:
0 24 ***/home/oracle/bin/on_time_backup.sh
(*/1 *****/home/oracle/bin/on_time_backup.sh)
Note: The brackets can be used for testing. A backup is performed every minute.


You can check whether the script is executed by monitoring the/var/log/cron file. If the script is executed, check whether the corresponding backup file exists under the/backup directory:
-Rw-r -- 1 oracle oinstall 16384 Jul 5 BACKUP_SCHEMA_MAI_201207051333.dmp
-Rw-r -- 1 oracle oinstall 1800 Jul 5 BACKUP_SCHEMA_MAI_201207051333.log
-Rw-r -- 1 oracle oinstall 16384 Jul 5 BACKUP_SCHEMA_MAI_201207051335.dmp
-Rw-r -- 1 oracle oinstall 1800 Jul 5 BACKUP_SCHEMA_MAI_201207051335.log
-Rw-r -- 1 oracle oinstall 16384 Jul 5 BACKUP_SCHEMA_MAI_201207051336.dmp
-Rw-r -- 1 oracle oinstall 1800 Jul 5 BACKUP_SCHEMA_MAI_201207051336.log
-Rw-r -- 1 oracle oinstall 16384 Jul 5 BACKUP_SCHEMA_MAI_201207051337.dmp
-Rw-r -- 1 oracle oinstall 1800 Jul 5 BACKUP_SCHEMA_MAI_201207051337.log
-Rw-r -- 1 oracle oinstall 16384 Jul 5 BACKUP_SCHEMA_MAI_201207051338.dmp
-Rw-r -- 1 oracle oinstall 1800 Jul 5 BACKUP_SCHEMA_MAI_201207051338.log

Recommended reading:

Basic Oracle tutorial-copying a database through RMAN

Reference for RMAN backup policy formulation

RMAN backup learning notes

Oracle Database Backup encryption RMAN Encryption

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.