The rman backup script in the Oracle database is very practical.

Source: Internet
Author: User
The rman backup script in the Oracle database is very useful for querying the character set SQLgt; select * fromnls_database_parameters; NLS_CHARACTERSETAL32UTF8

The rman backup script in the Oracle database is very useful for querying the character set SQLgt; select * from nls_database_parameters; NLS_CHARACTERSETAL32UTF8

The rman backup script in the Oracle database is very practical.

Query character sets

SQL> select * from nls_database_parameters;

NLS_CHARACTERSET
AL32UTF8

Character Set is very important during backup, otherwise garbled characters will appear

1. Level 0 backup (full backup) Red is to be modified, based on the personal storage location.

[Oracle @ oracle122 script] $ cat db_bak0.rman
Run
{
Configure retention policy to recovery window of 8 days;
Configure controlfile autobackup on;
Configure controlfile autobackup format for device type disk to '/home/oracle/rmanbak/% F ';
Allocate channel specified device type disk format'/home/oracle/rmanbak/inc0 _ % d _ % s _ % p _ % u _ % T ';
Backup incremental level 0 tag = 'level 0' database skip inaccessible filesperset 10 plus archivelog filesperset 20;
Release channel identifier;
}
Allocate channel for maintenance device type disk;
Crosscheck backup;
Delete noprompt expired backup;
Delete noprompt obsolete;
Delete noprompt archivelog until time 'sysdate-30 ';

Level 0 running scripts

[Oracle @ oracle122 script] $ cat exec_0_level.sh
ORACLE_HOSTNAME = oracle122; export ORACLE_HOSTNAME
ORACLE_BASE =/u01/app; export ORACLE_BASE
ORACLE_HOME =/u01/app/oracle/product/11.2.0/dbhome_1; export ORACLE_HOME
ORACLE_SID = orcl; export ORACLE_SID
ORACLE_TERM = xterm; export ORACLE_TERM
PATH =/usr/sbin: $ PATH; export PATH
PATH = $ ORACLE_HOME/bin: $ PATH; export PATH
Export DATE = $ (date + % Y _ % m _ % d)
Export NLS_LANG = "Simplified Chinese_china". AL32UTF8

/U01/app/oracle/product/11.2.0/dbhome_1/bin/rman target sys/sys_admin folder file/home/oracle/rmanbak/script/db_bak0.rman log/home/oracle/rmanbak/script /log/rman _ $ DATE. log append

Ii. Level 1 backup (incremental)

[Oracle @ oracle122 script] $ cat db_bak1.rman
Run
{
Configure retention policy to recovery window of 8 days;
Configure controlfile autobackup on;
Configure controlfile autobackup format for device type disk to '/home/oracle/rmanbak/% F ';
Allocate channel specified device type disk format'/home/oracle/rmanbak/inc1 _ % d _ % s _ % p _ % u _ % T ';
Backup incremental level 1 tag = 'Level 1' database skip inaccessible filesperset 10 plus archivelog filesperset 20;
Release channel identifier;
}
Allocate channel for maintenance device type disk;
Crosscheck backup;
Delete noprompt expired backup;
Delete noprompt obsolete;
Delete noprompt archivelog until time 'sysdate-30 ';

1-level running script

[Oracle @ oracle122 script] $ cat exec_1_level.sh
ORACLE_HOSTNAME = oracle122; export ORACLE_HOSTNAME
ORACLE_BASE =/u01/app; export ORACLE_BASE
ORACLE_HOME =/u01/app/oracle/product/11.2.0/dbhome_1; export ORACLE_HOME
ORACLE_SID = orcl; export ORACLE_SID
ORACLE_TERM = xterm; export ORACLE_TERM
PATH =/usr/sbin: $ PATH; export PATH
PATH = $ ORACLE_HOME/bin: $ PATH; export PATH
Export DATE = $ (date + % Y _ % m _ % d)
Export NLS_LANG = "Simplified Chinese_china". AL32UTF8

/U01/app/oracle/product/11.2.0/dbhome_1/bin/rman target sys/sys_admin folder file/home/oracle/rmanbak/script/db_bak1.rman log/home/oracle/rmanbak/script /log/rman _ $ DATE. log append

Level 3 and level 2 backup (from level 0 to backup now)

[Oracle @ oracle122 script] $ cat db_bak2.rman
Run
{
Configure retention policy to recovery window of 8 days;
Configure controlfile autobackup on;
Configure controlfile autobackup format for device type disk to '/home/oracle/rmanbak/% F ';
Allocate channel specified device type disk format'/home/oracle/rmanbak/inc2 _ % d _ % s _ % p _ % u _ % T ';
Backup incremental level 2 tag = 'Level 2' database skip inaccessible filesperset 10 plus archivelog filesperset 20 delete all input;
Release channel identifier;
}
Allocate channel for maintenance device type disk;
Crosscheck backup;
Delete noprompt expired backup;
Delete noprompt obsolete;

2-level running script

[Oracle @ oracle122 script] $ cat exec_2_level.sh
ORACLE_HOSTNAME = oracle122; export ORACLE_HOSTNAME
ORACLE_BASE =/u01/app; export ORACLE_BASE
ORACLE_HOME =/u01/app/oracle/product/11.2.0/dbhome_1; export ORACLE_HOME
ORACLE_SID = orcl; export ORACLE_SID
ORACLE_TERM = xterm; export ORACLE_TERM
PATH =/usr/sbin: $ PATH; export PATH
PATH = $ ORACLE_HOME/bin: $ PATH; export PATH
Export DATE = $ (date + % Y _ % m _ % d)
Export NLS_LANG = "Simplified Chinese_china". AL32UTF8

/U01/app/oracle/product/11.2.0/dbhome_1/bin/rman target sys/sys_admin folder file/home/oracle/rmanbak/script/db_bak2.rman log/home/oracle/rmanbak/script /log/rman _ $ DATE. log append

Scheduled Backup: Zero-level backup on Sunday, two-level backup on Wednesday, and one-level Incremental backup at on Monday, Tuesday, Thursday, and Saturday

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.