Oracle RMAN backup method

Source: Internet
Author: User
1. Switch to the server archive mode. skip this step if the archive mode is already used: % sqlplusnolog (start sqlplus) SQLgt; connassysdba (connect as DBA)

1. Switch to the server archive mode. skip this step if you already have archive mode: % sqlplus/nolog (start sqlplus) SQLgt; conn/as sysdba (connect as DBA)

1. Switch the server archive mode. skip this step if the archive mode is already used:
% Sqlplus/nolog (start sqlplus)
SQL> conn/as sysdba (connect to the database as DBA)
SQL> shutdown immediate; (close the database immediately)
SQL> startup mount (start the instance and load the database, but do not open it)
SQL> alter database archivelog; (change the database to archive Mode)
SQL> alter database open; (open the database)
SQL> alter system archive log start; (enable automatic archiving)
SQL> exit (exit)

2. Create a recovery catalog db database

A. Create a catalog database and a catalog tablespace.
SQL> create tablespace tbs_rman datafile 'd:/Oracle/product/10.1.0/oradata/wind/rman. dbf' size 200 M;

B. Create the rman user for managing catalog and grant recovery_catalog_owner the following permissions:
SQL> create user rmanuser identified by rmanuser
Temporary tablespace TEMP
Default tablespace tbs_rman
Quota unlimited on tbs_rman;

C. Assign Permissions
SQL> grant recovery_catalog_owner to rmanuser;


3. Create a catalog

# Sometimes directly using rman linux will consider it as its own command, so it is safer to add full path.
> $ ORACLE_HOME/bin/rman

RMAN> connect catalog rmanuser/rmanuser @ rman_db;

RMAN> create catalog; # assign the default tablespace of userrman to catrman;

RMAN> create catalog tablespace tbs_catalog; # This statement is not required if user_rman has a default tablespace.

# If you want to delete a catalog, you can use RMAN> drop catalog;

Register the target database to catalog
RMAN> register database;


4. Configure NFS

Check whether the nfs service starts the nfs status.
Start nfs service nfs start

Vim/etc/exports

/Oracle/rmanbak 10.1.50.81 (rw, no_root_squash)

Mount the remote backup directory on the target server
The mount point of the backup path is required, and the parameters are also required as follows. It is mounted to the $ ORACLE_HOME directory and its parent directory.

Mount-o rw, bg, intr, hard, timeo = 600, wsize = 32768, rsize = 32768-t nfs 10.1.50.80:/oracle/rmanbak/home/oracle/rmanbak


5. Start backup

Make a full database backup

Run {
Allocate channel d1 type disk;
Backup as compressed backupset
Format = '/home/oracle/rmanbak/full _ % d _ % u _ % s _ % P'
Tag = 'fullbak'
Channel = d1
Database plus archivelog delete input;
Release channel d1;
}


Incremental Backup 0
Run {
Allocate channel d1 device type disk;
Backup as compressed backupset
Incremental level = 0
Format = '/home/oracle/rmanbak/inc0 _ % d _ % u _ % s _ % P'
Tag = 'inc'
Channel = d1
Database plus archivelog delete input;
Release channel d1;
}

Incremental Backup 1
Run {
Allocate channel d1 device type disk;
Backup as compressed backupset
Incremental level = 1
Format = '/home/oracle/rmanbak/inc1 _ % d _ % u _ % s _ % P'
Tag = 'inc1'
Channel = d1
Database plus archivelog delete input;
Release channel d1;
}


Tablespace
Run {
Allocate channel d1 device type disk;
Backup as compressed backupset
Format = '/home/oracle/rmanbak/tbs _ % d _ % u _ % s _ % P'
Tag = 'tbs'
Channel = d1
Tablespace users;
Release channel d1;
}


//


///
Crontab

// Delete expired copy
// List backup by files;
// Umount-l/mnt/rmanbak
// Crosscheck backupset
// Validate backupset
// Delete expixed backupset
// Delete backupset of database device type disk completed between 'sysdate-1' and 'sysdate + 1
// Delete noprompt obsolete recovery window of 0 days
//
Set limit channel ''readrate
Set limit channel ''kbytes

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.