Oracle-RMAN backup (1)

Source: Internet
Author: User

Oracle-RMAN backup (1) I. concepts related to RMAN backup 1. in RMAN backup, The tablespace does not need to be in backup mode. It backs up data files, archive log files, control files, spfiles, and backup sets, but does not back up online redo log files, temporary files and password files. 2. the backup set consists of one or more backup slices. The size of the backup file is related to the operating system. The maximum file size of a 32-bit operating system is 4 GB. 3. data file backup sets support both full and Incremental backup, that is, only used blocks are backed up, which is not supported by archived log file backup sets. 4. Run the common view command in RMAN. show all is used to view the default backup parameters, report schema is used to view the data table space and data file information, and list back is used to view the information of the backup file. In show all, there is a default control file backup problem. The control file backup is not backed up by default, and configure controlfile autobackup off; # default if the system tablespace file is backed up, whether it is off or on, the control file is automatically backed up. 5. common parameters: maxpiecesize specifies the size of the backup piece and the size of the maxsetsize backup set. filesperset indicates the number of input files contained in a backup set, % U = % u _ % p _ % c to generate a unique name. 6. In RMAN backup, you can divide the backup file into two parts, one is the data file backup set, the other is the archive log file, and the control file and the spfile are compressed and packaged together. II. RMAN backup method 1. in non-archive mode, consistent backup is required. To perform RMAN consistent backup, the database must be in load mode and shut down cleanly. The backup can be complete or incremental. 2. in archive mode, you can perform consistent or non-consistent backup. archive log files must be backed up in non-consistent backup. The backup can be all, partial, complete, or incremental. Backup can be divided into full, local, complete, or Incremental backup. Only RMAN can implement Incremental backup. Iii. RMAN backup of various files (I) backup data file Report schema to view information about various tablespaces and data files. RMAN> report schema; report of database schema for database with db_unique_name WILSONList of Permanent Datafiles =====================file size (MB) tablespace RB segs Datafile Name ---- -------- hour ------- hour 1 760 SYSTEM ***/u01/oradata/wilson/system01.dbf2 580 SYSAUX ***/u01/oradata/wilson/sysaux01.dbf3 135 UNDOTBS1 * **/u01/oradata/wilson/undotbs01.d Bf4 28 USERS ***/u01/oradata/wilson/users01.dbf5 100 EXAMPLE ***/u01/oradata/wilson/example01.dbf6 20 PAUL ***/u01/oradata/wilson/paul01.dbf7 20 SUN ***/u01/oradata/wilson/sun01.dbf8 2 SMALLUNDO ***/u01/oradata/wilson/smallundo1.dbf9 100 ASSM ***/u01/oradata/wilson/assm_1.dbf10 100 MSSM ***/u01/oradata/wilson/mssm_1dbf11 10 PAUL ***/u01/oradata/wilson/paul02.dbfList of Temporary Files ==== ========================= File Size (MB) Tablespace Maxsize (MB) tempfile Name ---- -------- temperature ----------- ---------------- 1 29 TEMP 32767/u01/oradata/wilson/temp01.dbf2 100 MYTEMP 100/u01/oradata/wilson/mytemp01.dbf or SQL * plus> select file #, name from v $ datafile; FILE # NAME ---------- ----------------------------------- 1/u01/oradata/wilson/system01.dbf 2/u01/oradata/wilso N/Jun 3/u01/oradata/wilson/Jun 4/u01/oradata/wilson/users01.dbf 5/u01/oradata/wilson/example01.dbf 6/u01/oradata/wilson/paul01.dbf 7 /u01/oradata/wilson/sun01.dbf 8/u01/oradata/wilson/Jun 9/u01/oradata/wilson/assm_1.dbf 10/u01/oradata/wilson/mssm_1dbf 11/u01/oradata /wilson/paul02.dbf11 rows selected. use the following command to back up data successfully. RMAN> backup datafile 4 format = '/u01/backup/m D _ % U'; or RMAN> backup datafile '/u01/oradata/wilson/users01.dbf' format ='/u01/backup/md _ % U '; starting backup at specified channel ORA_DISK_1channel ORA_DISK_1: starting full datafile backup setchannel ORA_DISK_1: specifying datafile (s) in backup setinput datafile file number = 00004 name =/u01/oradata/wilson/specified ORA_DISK_1: starting piece 1 at 23-AUG-13channel ORA_DISK_1: finished Piece 1 at 23-AUG-13piece handle =/u01/backup/container tag = TAG20130823T202948 comment = NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00: 00: 01 Finished backup at 23-AUG-13 (II) the same as the backup data file, the report schema is used to view the tablespace information. Only commands are slightly different. The following RMAN> backup tablespace sun format = '/u01/backup/ts _ % U'; Starting backup at 23-AUG-13using channel ORA_DISK_1channel ORA_DISK_1: starting full datafile backup setchannel ORA_DISK_1: specifying datafile (s) in backup setinput datafile file number = 00007 name =/u01/oradata/wilson/Email ORA_DISK_1: starting piece 1 at 23-AUG-13channel ORA_DISK_1: finished piece 1 at 23-AUG-13piece h Andle =/u01/backup/export tag = TAG20130823T203407 comment = NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00: 00: 01 Finished backup at 23-AUG-13 (iii) backup control file 1. enable automatic backup control file RMAN> show all; RMAN configuration parameters for database with db_unique_name WILSON are: configure controlfile autobackup off; # defaultCONFIGURE controlfile autobackup format for device type disk to '/u01/backup/ctl _ % F ';...... The default value is off. Change it to on, RMAN> configure controlfile autobackup on; new RMAN configuration parameters: configure controlfile autobackup on; new RMAN configuration parameters are successfully stored and check again. RMAN> show all; RMAN configuration parameters for database with db_unique_name WILSON are: configure controlfile autobackup on; configure controlfile autobackup format for device type disk to '/u01/backup /Ctl _ % F'; for configure controlfile autobackup format for device type disk to '/u01/backup/ctl _ % F '; command to control the file backup to the required address. This automatic backup control file will also back up the spfile together. 2. direct backup, but it does not back up spfile. The command is as follows: RMAN> backup current controlfile; Starting backup at 23-AUG-13using channel ORA_DISK_1channel ORA_DISK_1: starting full datafile backup setchannel ORA_DISK_1: specifying datafile (s) in backup setincluding current control file in backup setchannel ORA_DISK_1: starting piece 1 at 23-AUG-13channel ORA_DISK_1: finished piece 1 at 23-AUG-13piece handle =/tmp/back/1joi1unc_1_1 ta G = TAG20130823T205612 comment = NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00: 00: 04 Finished backup at 23-AUG-13 3. you can add backups when backing up data files or tablespaces, but it does not back up spfiles. The command is as follows: RMAN> backup datafile 4 include current controlfile; or RMAN> backup tablespace sun include current controlfile; (4) The backup spfile will be automatically backed up when the automatic backup control file is enabled. You can also run the following command to back up the backup: RMAN> backup spfile format '/u01/backup/sp _ % U'; Starting backup at 23-AUG-13allocated channel: ORA_DISK_1channel ORA_DISK_1: SID = 44 device type = DISKchannel ORA_DISK_1: starting full datafile backup setchannel ORA_DISK_1: specifying datafile (s) in backup setincluding current SPFILE in backup setchannel ORA_DISK_1: starting piece 1 at 23-AUG-13channel ORA_DISK_1: finished piece 1 at 23-AUG -13 piece handle =/u01/backup/sp_1qoi23po_1_1 tag = TAG20130823T222247 comment = NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00: 00: 01 Finished backup at 23-AUG-13Starting Control File and SPFILE Autobackup at 23-AUG-13piece handle =/u01/backup/ctl_c-3925834152-20130823-0a comment = NONEFinished Control File and SPFILE Autobackup at 23-AUG-13 can be seen although the command is just backup spfile, however, the control file is also backed up. (5) backing up archive log files the archive log file copies all the content. The command is as follows, RMAN> backup archivelog all format = '/u01/backup/ac _ % U' delete all input; delete all input deletes the original archive log file. When executing this command, the system will check whether the archive log file is damaged. If the archive log file in one place is damaged, the system will automatically read the archive log file in another place, if all data is damaged, the backup is rejected. To ensure consistency of archived logs, perform the following operations when backing up archived log files: 1. after the BACKUP command starts, run the alter system archive log current command to copy the online redo log file to the archive log file. 2. Back up archive log files or back up data files together with archive log files. 3. run the alter system archive log current command again (because the previous step may take a long time, this time period will generate redo information, so you need to copy the online redo log file to the archived log file ). 4. back up the archived log file again or run the following command to backup archivelog sequence between 139 and 141 thread 1 delete (all) input. You can select the backup range of sequence; or backup archivelog from time "sysdate-15" until time "sysdate-7"; you can select a time range to back up archive log files; or back up archive log files together when backing up data files, backup database plus archivelog format = '/u01/backup/db _ % U '.

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.