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

Oracle backup strategy

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

RMAN > CONFIGURE RETENTION POLICY TO REDUNDANCY 2

RMAN > CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 14 DAYS

Enable automatic backup of control files and backup location configuration

RMAN > configure controlfile autobackup on

View configuration information

RMAN > show all

-create a folder

$mkdir / home/oracle/backup

Mkdir / home/oracle/backup/script

Mkdir / home/oracle/backup/log

Mkdir / home/oracle/backup/export

-- backup destination

Mkdir / home/oracle/rman_backup

Create backup tablespace

Create tablespace rman_tbs datafile'/ u01 apprenticeship oracle.oradata.orcl11g Uniplicat.rmannailtbs01.dbf'

Size 1024M autoextend on next 50M maxsize 10240M

Extent management local segment space management auto

Create backup user

Create user rman identified by rman default tablespace rman_tbs temporary tablespace temp

Grant connect,resource, recovery_catalog_owner to rman

SQL > grant unlimited tablespace to rman

SQL > grant sysdba to rman

Rman catalog rman/rman

Create catalog tablespace rman_tbs

Connect target sys/Oracle123@orcl11g

Register database

Report schema

-- pour out RMAN user data script exp_rman.par (that is, backup catalog library)

Userid=rman/rman

File=/home/oracle/backup/export/rman.dmp

Log=/home/oracle/backup/log/rman.log

-- pour out RMAN data SHELL script exp_rman.sh

#! / bin/bash

Cd $HOME

. .bash _ profile

Cd $HOME/backup/script

Exp parfile=exp_rman.par

-

-Zero level backup RMAN script level0_backup.rcv

Connect catalog rman/rman

Connect target sys/Oracle123@orcl11g

Run {

Allocate channel d1 type disk

Allocate channel d2 type disk

Backup incremental level0 database format'/ home/oracle/rman_backup/level0_%d_%s_%p_%u.bak'

Tag='level 0' include current controlfile

Sql 'alter system archive log current'

Backup archivelog all format'/ home/oracle/rman_backup/arc_%d_%s_%p_%u.bak'

Release channel d2

Release channel d1

}

Crosscheck backup

Delete noprompt expired backup

Delete noprompt obsolete

Crosscheck archivelog all

Delete noprompt archivelog all completed before 'sysdate-15'

Resync catalog

-- level0_backup.sh of a zero-level backup SHELL script

#! / bin/bash

Backtime= `date + "% y%m%d%H" `

# cd $HOME

. / home/oracle/.bash_profile

Cd $HOME/backup/script

Rman cmdfile=level0_backup.rcv msglog=$HOME/backup/log/level0_$ {backtime} .log

. / home/oracle/backup/script/exp_rman.sh

First-level differential incremental backup RMAN script level1_backup.rcv

Connect catalog rman/rman

Connect target sys/Oracle123@orcl11g

Run {

Allocate channel d1 type disk

Backup incremental level1 format'/ home/oracle/rman_backup/level1_%d_%s_%p_%u.bak' tag = 'level1' cumulative database

Sql 'alter system archive log current'

Backup archivelog all format'/ home/oracle/rman_backup/log_%d_%s_%p_%u.bak'

Release channel d1

}

Crosscheck backup

Delete noprompt expired backup

Delete noprompt obsolete

Crosscheck archivelog all

Delete noprompt archivelog all completed before 'sysdate-15'

Resync catalog

-- first-level differential incremental backup SHELL script level1_backup.sh

#! / bin/bash

Backtime= `date + "% y%m%d%H" `

# cd $HOME

. / home/oracle/.bash_profile

Cd / home/oracle/backup/script

Rman cmdfile=level1_backup.rcv msglog=$HOME/backup/log/level1_$ {backtime} .log

. / home/oracle/backup/script/exp_rman.sh

Execute backup scripts regularly under linux

Crontab-e-u oracle

SHELL=/bin/bash-the following script is executed under bash

MAILTO=oracle-the execution log is mailed to oracle users and can be checked and collected under / var/spool/mail/oracle

5 12 * * 1 nohup / home/oracle/backup/script/level0_backup.sh > / home/oracle/backup/cron.log 2 > & 1 &

5 12 * 3 / home/oracle/backup/script/level1_backup.sh

5 12 * 5 / home/oracle/backup/script/level1_backup.sh

One-week differential backup strategy:

Backup target library and catalog library

Level 0 is complete on Monday and level 1 on Wednesday and Friday.

Backup starts at 12:05 every day

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