An example of Database Backup

Source: Internet
Author: User

1. Change Database downtime to archive Mode
SQL> archive log list
SQL> shutdown immediate
SQL> startup mount
SQL> alter database archivelog;
SQL> alter database open;
 
2. Point the database archive to ASM
SQL> alter system set db_recovery_file_dest_size = 200G;
SQL> alter system set db_recovery_file_dest = '+ data ';
 
3. Set Database Backup Redundancy to 2, and set the backup file to a directory in/home.
RMAN> configure controlfile autobackup on; # Set the automatic backup control file
RMAN> configure retention policy to redundancy 2;
RMAN> configure channel device type disk format'/home/oracle/backup/% U', '+ data ';
Set a copy of the backup on both local and storage:
RMAN> configure datafile backup copies for device type disk to 2;
RMAN> configure archivelog backup copies for device type disk to 2;
 
4. Create a full backup every day, archive backups every day, or do not perform any operations. Only redundant archives and backups are deleted during full backup.
Use crontab to schedule scripts to implement regular backup of databases and delete archives.
# Crontab-l
0 0 ** 6 su-oracle backup. sh // full backup database at every week
#
# Su-oracle
$ Cat/home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/backup. sh
Rman target/recover file =/home/oracle/backup. rman log =/home/oracle/backup _ 'date + % Y % m % d % H % M % s'. log
$ Cat/home/oracle/backup. rman
Backup device type disk database plus archivelog delete all input;
Allocate channel for maintenance type disk;
Delete noprompt obsolete device type disk;
# Crontab-l
0 0 *** su-oracle backuparch. sh // backup and archive at every day
0 0 *** su-oracle dellog. sh // logs are processed at every day and only seven days of logs are saved.
#
# Su-oracle
$ Cat/home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/backuparch. sh
Rman target/partition file =/home/oracle/backuparch. rman log =/home/oracle/backuparch _ 'date + % Y % m % d % H % M % s'. log
$ Cat/home/oracle/backuparch. rman
Backup archivelog all delete input;
$ Cat/home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/dellog. sh
Find/home/oracle/backup *. log-mtime + 7-exec rm {}\;


Author "personal record"

Related Article

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.