Oracle backup policy

Source: Internet
Author: User

The control file is of great significance in backup. We recommend that you back up it separately each time. If the database version permits, you should set it to the control file for automatic backup. Increase the value of the initialization parameter control_file_record_keep_time as much as possible. So that the backup information can be retained for a longer period of time.
A complete backup plan should be developed. Otherwise, a gap in the backup plan may cause a disaster to the system. Remember, "errors may occur ".
Familiar with the RMAN internal backup mechanism, which is helpful for dbms_backup_restore usage.
The backup script should be redirected to the log and saved so as to find useful information in case of an error.
----------------------------------------------
Optimization related to RMAN backup
To back up data, follow these steps:
1. read data from the disk
2. process data blocks in memory
3. Write Data to disk or tape
The preceding read/write operations can be completed synchronously or asynchronously. In synchronous I/O operations, only one Io operation is allowed at a time, but in asynchronous I/O operations, multiple I/O operations are allowed at a time. Therefore, backup and recovery optimization is mainly focused on the following aspects:

1 ,?? Improves synchronous or asynchronous I/O operations
In an operating system that supports asynchronous operations, you can set tape_aysnch_io, disk_asynch_io, and backup_type_io_slaves to support asynchronous operations and improve the write capability.
2 ,?? Improve disk read capability
After the BACKUP command, you can set diskratio to ensure that data is read from multiple disks and continuous data streams are ensured.
3 ,?? Correctly set the buffer and parameter values
Set large_pool_size to enable continuous buffer pools for backup. You can increase the utilization of the buffer zone by setting db_fil_direct_io_count. If you use tape backup, you can also set backup_type_io_slaves to improve the write capability of the tape.
4 ,?? Parallel backup
Multiple channels can be opened for parallel backup and recovery
??
Iii. Back up the RMAN Database
RMAN databases also need to be backed up, but they are small and do not change frequently. Therefore, after each RMAN backup, you can use the following script to back up the RMAN database.
Exp pafile = exprman. SQL
Exprman. SQL is
Userid = RMAN/RMAN
Buffer= 32768
Owner = RMAN
File = RMAN. dmp
Rows = y
Grants = y
Compress = y
Consistent = y
Iv. Enable Automatic Database Backup
Automatic database backup is similar to the following three methods:
? ??? Job plan in Windows (AT command)
? ??? Crontab in UNIX
? ??? Third-party tools such as viritas
Among the three methods above, viritas is a third-party tool, which many people may not have access to. It mainly talks about the Windows Task Plan and the Unix Cron
1. Generate a script file, such as backup. RCV.
Assume that the file content is as follows:
$> CAT backup. RCV
Connect target sys/password rcvcat RMAN/RMAN @ localname;
Run {
Allocate channel C1 type disk;
Allocate channel C2 type disk;
Allocate channel C3 type disk;
Backup fileaperset 3 format'/u01/oradata/backup/arch % u _ % S _ % p '??
Archivelog all Delete input ;? ?
Release Channel C1;
Release Channel C2;
Release Channel C3;
}
? ? 2. generate an execution File
Generate backup_archive.bat on Windows, including
RMAN recovery file = backup. RCV
Generate backup_archive.sh in UNIX, including
/Oracle/ramn/RMAN partition file = backup. RCV
?? 3. Add Scheduling
In Windows, use the task scheduling wizard or the AT command.
In UNIX, write a file on the target machine to start the automatic backup process. Assuming the file name is Oracle, the file will be placed in the/var/spool/cron/crontabs directory
$> CAT Oracle
0 23 ** 0 backup_archive.sh
# Indicates database backup at on Sunday
0 12, 18 *** backup_archive.sh
? ??? # Indicates backup at and every day
Each row of the crontab file is composed of six fields (minutes, hours, day of month, month, day of week, command), which are separated by spaces or tabs.
V. Common Mistakes
1. Use exp/imp for backup
EXP/imp is not a good backup tool. In the future development, Oracle will have lower and lower support for exp/IMP backup. Oracle only regards exp/IMP as a good tool rather than a backup tool. For large databases, such as TB-level databases or data warehouses, exp/IMP will certainly be insufficient.
2. Back up the database in the Application
On the Forum, there are many such requirements: "How do I back up and restore databases in programs? ". First of all, this is not impossible, but the implementation process will be complicated and unexpected. As far as my feelings are concerned, the first point of the question is that I don't know about oracle or DBA. If Oracle can easily implement backup and recovery, I can say, no DBA is required.
3. Cold backup is easier than hot backup, and the effect will be better
Some people think that cold backup is to close the database for consistent backup, it is certainly better than the specific heat backup, it is easy to use, in fact not all, in hot backup, the same can achieve full backup of the database, it does not affect the operation of the database. It is recommended that all production machines run in archive mode and adopt hot backup mode.
Vi. FAQs
1. Why can't I import the exported data and prompt unsupported Character Set conversion?
A: refer to the character set principles above. When exporting data, the client is consistent with the database character set. When importing data, change it to the same as the target database character set.
2. I have more and more archived logs. When can I delete archived logs?
A: each full backup (such as OS full cold backup or full hot backup) or Incremental Backup Based on full backup (such as RMAN Incremental Backup Based on level 0 backup) you can delete the archived logs before the backup point. We recommend that you keep the logs on the tape for one year.
3. Must all data files be backed up during full backup?
A: No. There are at least two types of data files that can not be backed up. One is temporary data files. If they are lost, they can be deleted and rebuilt. The other is read-only tablespace data files, if the read-only attribute of the tablespace has not been modified since the last backup, backup is not required.
4. Do I need to back up online logs?
A: For archive hot backup, there is no need to back up online logs. However, for cold backup, you can back up online logs, especially those that are not archived. The cold backup after the online log is backed up. Because the database is consistent, it can be restored to this backup point.
VII. Summary
1. What is database backup? database backup is the process of copying the database to the dump device.
? ? 2. The database running mode can be archive or non-archive. We recommend that you run hot backup in archive mode.
? ? 3. Understand database backup methods, logical backup, cold backup, and hot backup
? ? 4. Understand Database Backup tools. exp/IMP performs logical backup. OS scripts can perform cold backup or hot backup, while RMAN can also perform cold backup or hot backup.
? ? 5. Understand Oracle's backup policy and how to select the best backup policy
? ? 6. Learn how to start automatic backup and understand the AT command of windows and the cron process of UNIX.
References:
Expert one-on-one Oracle ?? [Us] Thomas Kyte published by Tsinghua University Press
Oracle 8i Web Development Guide [us] Dan hotka, et al, published by Tsinghua University Press
Oracle 8i DBA Architecture & Administration and backup & Recovery Study Guide
?? [Us] Dong stuns Biju Thomas Published by the Electronics Industry Press
Bytes -----------------------------------------------------------------------------------

Add a batch of files to the scheduled task. The content is as follows:
Set RQ = % Date :~ -10%
Exp user/password @ Sid file = D:/bak % RQ %. dmp full = Yes log = D:/LG % RQ %. Log
---------------------------------------------------------------------------------
& The file name for each backup is D:/BAK2004-04-01.DMP log file name is D:/LG2004-04-01.LOG
& Set date format to YYYY-MM-DD format and put the current date in variable RQ

You must ensure that your disk has enough space to store each backup file !!

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.