Original Backup and recovery strategy for Oracle 12c

Source: Internet
Author: User

Oracle 12c Backup and recovery strategy (Rman Backup [Open Archive/control file/data File/Archive log]): Backup strategy: * Make a full backup of the database (including all data and read-only tablespace) every six months * once a week level 0 backup * One level backup per day * Set parameters for RMAN before backup: Configure Controlfile autobackup on; (rman> show all; view parameters)--crontab Scheduled tasks: 0 1 1 1,7 * oracle/bin/bash/data/ oracle/backup/rman_bak_full.sh >>/tmp/rman_backup.log 2>&10 1 * * 0 oracle/bin/bash/data/oracle/backup/ rman_bak_0.sh >>/tmp/rman_backup.log 2>&10 1 * * 1-6 oracle/bin/bash/data/oracle/backup/rman_bak_1.sh >>/tmp/rman_backup.log 2>&1======================================================================= ========================================= One, Backup: 1) Database full backup script: #cat/data/oracle/backup/rman_bak_full.sh#!/bin/ Bashexport oracle_sid=bieeocrlexport oracle_base=/data/oracle/app/oracleexport ORACLE_HOME= $ORACLE _base/product/ 12.1.0.2.0/dbhome_1export path= $ORACLE _home/bin: $PATHexport nls_date_format= ' yyyy-mm-dd HH24:MI:SS ' curr_t= ' DATE +% y%m%d%h%m%s ' echo '-------------------------------------------' | Tee >>/data/oracle/bAckup/bieeocrl/rman_bak_${curr_t}.logecho ' Start full Backup at ' Date +%y-%m-%d:%h:%m:%s ' | Tee >>/data/oracle/backup/bieeocrl/rman_bak_${curr_t}.logecho '------------------------------------------- ' | Tee >>/data/oracle/backup/bieeocrl/rman_bak_${curr_t}.logrman Target/nocatalog log/data/oracle/backup/ Bieeocrl/rman_bak_${curr_t}.log Append<<eof_rmanrun {Allocate channel C1 type disk;allocate channel C2 type disk; Allocate channel C3 type Disk;backup full tag ' dbfull ' format '/data/oracle/backup/bieeocrl/full_bak_%u_%s_%t ' as Compres SED backupset database include current CONTROLFILE;SQL ' alter system archive log current ', backup Archivelog all Delete INP UT tag= ' arch_bak ' format '/data/oracle/backup/bieeocrl/arch_%u_%s_%t '; backup current controlfile tag= ' ctl_bak ' format '/data/oracle/backup/bieeocrl/full_control_%u_%s_%t '; backup spfile tag= ' spfile_bak ' format '/data/oracle/backup/ Bieeocrl/spfile_%u_%s_%t '; #参数文件备份可选release channel c1;release channel C2;release ChanneL C3;} eof_rman2) script for Level 0 backup: #cat/data/oracle/backup/rman_bak_0.sh#!/bin/bashexport oracle_sid=bieeocrlexport ORACLE_BASE=/ Data/oracle/app/oracleexport oracle_home= $ORACLE _base/product/12.1.0.2.0/dbhome_1export PATH= $ORACLE _home/bin:$ Pathexport nls_date_format= ' yyyy-mm-dd HH24:MI:SS ' curr_t= ' DATE +%y%m%d%h%m%s ' echo '------------------------------- ------------' | Tee >>/data/oracle/backup/bieeocrl/rman_bak_${curr_t}.logecho ' Start level 0 backup at ' date +%y-%m-%d:%h:%m:%s ` | Tee >>/data/oracle/backup/bieeocrl/rman_bak_${curr_t}.logecho '------------------------------------------- ' | Tee >>/data/oracle/backup/bieeocrl/rman_bak_${curr_t}.logrman target/nocatalog Log "/data/oracle/backup/ Bieeocrl/rman_bak_${curr_t}.log "Append<<eof_rmanrun {Allocate channel C1 type disk;allocate channel C2 type disk; Allocate channel C3 type Disk;backup incremental level 0 tag ' db0 ' format '/data/oracle/backup/bieeocrl/db0_%u_%s_%t ' as C ompressed backupset database;sql ' alter SysteM archive log current ', backup archivelog all delete input tag= ' arch_bak ' format '/data/oracle/backup/bieeocrl/arch0_%u_% S_%t '; backup current controlfile tag= ' ctl_bak ' format '/data/oracle/backup/bieeocrl/db0_control_%u_%s_%t '; backup SPFile tag= ' spfile_bak ' format '/data/oracle/backup/bieeocrl/spfile0_%u_%s_%t '; #参数文件备份可选release channel C1;release Channel C2;release channel C3;} EOF_RMAN3) First-level backup script: #cat/data/oracle/backup/rman_bak_1.sh#!/bin/bashexport oracle_sid=bieeocrlexport ORACLE_BASE=/ Data/oracle/app/oracleexport oracle_home= $ORACLE _base/product/12.1.0.2.0/dbhome_1export PATH= $ORACLE _home/bin:$ Pathexport nls_date_format= ' yyyy-mm-dd HH24:MI:SS ' curr_t= ' DATE +%y%m%d%h%m%s ' echo '------------------------------- ------------' | Tee >>/data/oracle/backup/bieeocrl/rman_bak_${curr_t}.logecho ' Start level 1 backup at ' date +%y-%m-%d:%h:%m:%s ` | Tee >>/data/oracle/backup/bieeocrl/rman_bak_${curr_t}.logecho '------------------------------------------- ' | Tee >>/data/oracle/baCkup/bieeocrl/rman_bak_${curr_t}.logrman Target/nocatalog Log/data/oracle/backup/bieeocrl/rman_bak_${curr_t}.log Append<<eof_rmanrun {Allocate channel C1 type disk;allocate channel C2 type Disk;allocate channel C3 type Disk;backu P Incremental Level 1 tag ' db1 ' format '/data/oracle/backup/bieeocrl/db1_%u_%s_%t ' as compressed backupset database;sql ' A Lter System archive Log current ', backup archivelog all delete input tag= ' arch_bak ' format '/data/oracle/backup/bieeocrl/a Rch1_%u_%s_%t '; backup current controlfile tag= ' ctl_bak ' format '/data/oracle/backup/bieeocrl/db1_control_%u_%s_%t '; Backup SPFile tag= ' spfile_bak ' format '/data/oracle/backup/bieeocrl/spfile1_%u_%s_%t '; #参数文件备份可选release channel C1; Release channel C2;release channel C3;} Eof_rman If you follow the Oracle backup strategy above, the amount of data that needs to be backed up daily is only changed by one day. Restore up to a level 0 backup + six levels of backup. =============================================================================================================== = Two, the process of recovering the database: 1) rman target/nocatalog2) rman> startup nomount;3) Rman> Restore spfile from '/data/oracle/backup/bieeocrl/db0_%u_%s_%t '; 4) rman> shutdown immediate;5) rman> startup nomount;6) rman> restore controlfile from '/data/oracle/backup/bieeocrl/db0_control_%u_%s_%t '; 7) RMAN> Alter Database mount;8) rman> catalog start with '/data/oracle/backup/bieeocrl/arch0_%u_%s_%t '; 9) rman> Run{allocate Channel CH1 type Disk;restore database;recover database;release channel CH1;} rman> ALTER DATABASE open resetlogs;11) rman> shutdown immediate;12) rman> startup;======================== ========================================================================================

  

Original Backup and recovery strategy for Oracle 12c

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.