Oracle-Backup and recovery

Source: Internet
Author: User

Zhang Qiwei
Date: April 21, 2017
Capabilities: Understanding Oracle's backup and recovery mechanisms

1. Archive mode and non-archive mode

The Oracle database requires at least two sets of online logs, which will continue to be written to the next set of online logs whenever a set of online logs fills up.

In the case of archive mode, log switching triggers the archive process (ARCn) to archive, generating archived logs, and Oracle guarantees that the online logs will not be overwritten until the archive is complete.
If non-archive mode, the archive action is not triggered.

Steps for non-archive mode to archive mode:

# Connect to DatabaseMkdir/backup/oracle_arc# Connect Oraclesqlplus/as sysdba#1. Close the databaseShutdown immediate;#2. Start the database to mount state startup Mount; #3. To modify the database archiving mode alter databases Archivelog;  #4. Start the database. ALTER databases open; #5. Define the save path for the archive location alter syste set_log_archive_dest_1 =  "Location=:/backup/oracle_arc"  #6. Verify that the configuration is in effect archive log list; Sql> archive log list;database log mode archive Modeautomatic Archival enabledarchive destination/u01/app/oracle/arch_logoldest online  Log sequence 82next log sequence to archive 84current log sequence 84 # 7. Turn on data alter DATABASE open;      
2. Oracle Backup

Oracle backups are divided into physical and logical backups.
Physical Backup: Copies the actual physical files from one place to another (possibly as-is or compressed), OS Backup, backup using Rman, cold backup, hot backup.
Logical backup: Use SQL to extract data from the database and save it to a file that can be re-imported to the database at a later time, or imported into another database. Oracle offers exp, IMP, EXPDP, IMPDP tools.

2.1 Physical Backups

Online hot spare and cold backup both properties physical backup
Online blood depending on the tool used, it is divided into user-managed backup (user-managed Backup) and Recovery Manager backup (RMAN, Recover Manager).

2.1.1 Cold backup

If the database is in non-archive mode, only cold backups can be used

# 1. 关闭数据库# 2. 备份所需文件,控制文件,数据文件,日志文件# 3. 启动数据库
2.1.2 Hot Backup-User management backup
# 1. 使用SQL的ALTER TABLESPACE ... BEGIN BACKUP 命令把表空间置为备份模式;# 2. 使用操作系统文件拷贝命令进行拷贝; # 3. 拷贝结束后,使用SQL的 ALTER TABLESPACE ... END BACKUP 结束备份
2.1.3 Hot Backup-recovery manager backup (Rman Backup)

RMAN, Recovery Manager is an Oracle utility that performs backup and recovery tasks on a database.

Rman reference Oracle Official Documentation:
"Backup and Recovery Basics"
Backup and Recovery Advanced User's Guide
"Backup and Recovery Reference"

Rman configuration Backup and recovery steps:

#1. Connecting to a database# Rman can connect to three types of databases#-Target Database#-Catalog Database#-Secondary Database# rman Target User/[email protected]rman target/recovery manager:release11.1.0.6.0-productionOn Sat APR2909:57:292017Copyright (c)1982,Oracle. All Rights reserved.connectedTo Target DATABASE:ORCL (dbid=1293792340)# 2. View existing configuration show all; Rman> Show All;Using target database control file insteadof recovery Catalogrman configuration parametersfor databaseWith Db_unique_name ORCL are:configure RETENTION POLICYTo redundancy1;# defaultconfigure BACKUP OptimizationOFF;# defaultconfigureDEFAULT DEVICE TYPEto DISK;# defaultconfigure Controlfile autobackupOn;# controlfile Autobakup automatic Backup to control files configure Controlfile autobackup FORMATFor DEVICE TYPE DISKTo'/quest_backup/autobackup/autobackup_control_%f '; CONFIGURE DEVICE type DISK BACKUP typeTo compressed BACKUPSET PARALLELISM1; CONFIGURE datafile BACKUP COPIESFor DEVICE TYPE DISKTo1;# defaultconfigure ARCHIVELOG BACKUP COPIESFor DEVICE TYPE DISKTo1;# defaultconfigure CHANNEL1 DEVICE TYPE DISK FORMAT'/quest_backup/autobackup/%u '; CONFIGURE maxsetsizeto UNLIMITED; CONFIGURE encryptionFor DATABASEOFF; CONFIGURE Encryption algorithm' AES128 '; CONFIGURE COMPRESSION algorithm' BZIP2 '; # defaultconfigure ARCHIVELOG deletion POLICY to NONE; # defaultconfigure SNAPSHOT controlfile NAME to '/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_orcl.f '; # Default# 3. Modify Configuration #-Enable control file backup #-Enable automatic backup, specify file storage location #-Snapshot storage location for configuration control files Configure Controlfile autobackup on ; Configure Controlfile autobackup format for device type disk to '/backup/autobackup/autobackup_control_% F '; Configure snapshot controlfile name to '/backup/s%u ';          

Oracle-Backup and recovery

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.