`

【【Oracle posted -- Backup 大全】】

 
阅读更多

Chapter 1. Summary
1, understand what is Backup
2, understanding the importance of backup
3, understood the database operation types
4, understanding of different ways and different backup
5, a correct understanding of the backup strategy and its benefits
II. Understand the importance of backup
It can be said that the computer system born from the very first day, there will be a backup this concept, powerful computer with the speed of processing capability, a lot of people in the work place, but

It is often very often, it is so fragile, and the chip on the main board, the main board circuitry, memory, power can not be any other normal work, it would be calculated

System fails to function properly. Of course, these defects can study complex will not cause damage to data and applications. However, if the computer's hard disk damage, it would lead to a few

It was lost when the backup to be used to restore data.
In fact, in our real world, there has been a lot of backup strategies, such as RAID technology, the two hot-backup, clustering technology is the development of the computer system backup

And high availability? Many a time, the backup system will really solve the problem of database backup, disk media as the damage is often done from a mirror above a simple recovery phase

Complicated, or simply switch on the machine.
However, the above-mentioned hardware backup strategy is to be considered in the light of the backup and restore, which is the necessary price. We can choose the basis Backup Strategy

The price data is lost : to ensure that data is not lost and the cost ratio. Another time, the backup hardware sometimes failed to meet the practical needs, if you mistakenly delete a

Tables, but you want to restore the database and the backup will become important. Oracle itself provides a powerful backup and restore strategy, we discussed here

ORACLE Backup, the backup refer to the following Oracle database backup, restore and will be posted next lectures.
The so-called backup, the database is in the process of duplicating equipment to the dump. Among them, dump equipment refers to a copy of the database available for the tape or disk.
To carry out what kind of recovery depend on what kind of backup. As a DBA, has the responsibility to maintain the database from the following three aspects of the recovery :
Failure to keep to a minimum the number of the database, thereby maintaining the largest database availability;
When the database is inevitable failure, to minimize the time to restore order, thereby restoring to achieve maximum efficiency;
When the database after the failure to ensure that the maximum loss or no loss of data, so that data can be the biggest recovery.
Disaster restoration work is the most important design adequate frequency of hard disk backup process. Backup process should satisfy the requirements of the recovery. For example, if a database

Extend the shutdown time, it may be a cold week for backup and archiving Redo Log, 24*7 system, we might consider is the only backup. If

Backup day course will be very ideal, but its reality. Enterprises have to find ways to reduce the costs of maintaining, the reality of the program can be used. If carefully planned

And the availability of the database to find ways to reach the bottom line, a small amount of money spent for a successful backup and restore is possible.
Chapter III. ORACLE understanding of the mode of operation
There are two ways : First, Oracle Database archiving operation mode (ARCHIVELOG), filed its objective is to maximize database failure to restore database

, We can be assured of not losing any of the data submitted. The second is archiving method (NOARCHIVELOG), only to restore the database to the most recent recovery point (or cold backup logic

Backup). According to the database high availability and the number of users to bear the loss of the workload for production databases, as strong demand for archiving; Those

Is developing and debugging database archiving method can be adopted.
How to change the mode of operation of the database, creating a database, creating a database as part of the initial decision of the archived database. Under normal circumstances to

NOARCHIVELOG way. When build up a good database, we need to put the needs of the operation in the database archiving way into ARCHIVELOG mode.
310 ways to change archiving method for archiving
1. Closed database backup of the data, and change the mode of operation of the database is an important change in the database, the database should be backed up, the question may arise

That the protection.
2. Fun revised parameters, automatically filing amended (added) init[SID].ora document initialization parameters :
Log_archive_start=true # activated automatically archiving
Log_archive_format=ARC%T%S.arc # archiving document format
File path # log_archive_dest=/arch12/arch
In 8i, we can have up to five file paths and can be archived to other servers, such as database backup (standby database) server
3. Mount started Instance to state that the inclusion into the database but does not open the database :
$>;SVRMGRL
SVRMGRL "internal ;connect
SVRMGRL ";startup mount
4. Laws issued orders
SVRMGRL ";alter database archivelog;
SVRMGRL>;alter database open;
Filing for the state not to change the state filed 320
The same with the above steps, but not the same operation, mainly in the b operation, or now the Notes to delete the parameter d operation in order to
SVRMGRL ";alter database noarchivelog;
Attention from the archive file-way mode switch to a database of all must be done after the cold backup to prevent accidents from happening.

Chapter IV. ORACLE Backup classification
According to the simple backup, can be divided into logical backup, backup cooling (off-line backup), backup (online backup), cold and hot backup can backup

Collectively known as physical backup
According to a backup tools can be divided into EXP/IMP backup, OS copy, RMAN, third-party tools such as VERITAS
We will be following a number of perspectives to illustrate the various backup methods
4.1 EXP/IMP logical backup
Import / Export is the oldest surviving ORACLE two command line tool, in fact, I never think Exp/Imp is a good backup, is correct

Exp/Imp only dump is a good tool, especially in small database dumps, table space for the relocation of Table extraction, detection logic and physics there is no conflict

Small credit. Of course, we can define it as a physical backup of the database after a small auxiliary backup logic, it is not a bad suggestion.
For the growing database, especially TB-level database and the emergence of more and more data storage, EXP/IMP more inadequacies, and this time, the database

RMAN backup and third-party tools have shifted. Now we briefly describe EXP/IMP use.
4.1.1 use
Exp parameter_name=value
Or Exp parameter_name= (value1, value2 : :)
As long as you can see all the input parameters to help help=y
Such as :
C:/>;set nls_lang=simplified chinese_china.zhs16gbk
C:/>;exp -help
Export : Release 8.1.6.0.0-Production on Thursday April 10 2003 19:09:21
(C) Copyright 1999 Oracle Corporation. All rights reserved.

EXP through import order and user name / password, you can
In the user / password in the following order :

Example : EXP SCOTT/TIGER
Or, you also can be imported with the EXP order to control the various parameters of "derived"
Mode of operation. To the designated parameters, you can use keywords :

Format : EXP KEYWORD=value or KEYWORD= (value1, value2,. . . , ValueN)
Example : EXP SCOTT/TIGER GRANTS=Y TABLES= (EMP and DEPT, MGR)
Or TABLES= (T1 : P1, P2 : T1), T1 branch Table
USERID order must be the first line parameters.
Keyword (acquiescence) keyword (acquiescence)
--------------------------------------------------------------------------
USERID user ID / password FULL derived entire document (N)
BUFFER data buffer size OWNER owners who list of users
FILE output (EXPDAT.DMP) Payroll table name list
COMPRESS into one area (Y) RECORDLENGTH IO record length
GRANTS derived authority (Y) increment derived types INCTYPE
INDEXES derived Index (Y) 4:137-139 tracking increment derived (Y)
ROWS derived data (the Y) Document parameters PARFILE
CONSTRAINTS derived limits (Y) CONSISTENT Crosstab consistency
LOG screen output target analysis of the log files STATISTICS (ESTIMATE)
DIRECT Direct Path (N) TRIGGERS derived Trigger (Y)
FEEDBACK indication x Bank (0) progress
FILESIZE the maximum size of the document dump
QUERY selected subset of the clauses derived table

The only transmission available for the following keyword table space
TRANSPORT_TABLESPACE transmission table space can be derived metadata (N)
TABLESPACES transmission to the list of table space
Successfully terminated without warning in the case are derived.
C:/>;
Help very detailed description of the meaning and use of parameters, and listed a few simple examples, note that from 8i, has begun to support the subset data

The way forward is to designate their Where conditions, or his trip data derived from the table.
Nls_lang=simplified chinese_china.zhs16gbk attention to the above set by setting environment variables can help to the Chinese exp, if

Nls_lang=American_america set. Character Set, then your English is a help.
Incremental and accumulated in the reservoir must be derived only effective way, but most cases, and total incremental derived and can not imagine how the so effective. Come from the Oracle 9i

To begin with, no longer support the incremental and cumulative derived derived.
Table 4.1.2 transmission
Table space transmission is a rapid increase in new 8i database as a way of mobile data, a database is the data format data files attached to another

Database, rather than the data derive Dmp document, which in some cases is very useful, because table space mobile data transmission system as complex documents fast.
Table space on the transmission rules, namely :
Source database and the database necessary to run the same hardware platform.
Source database and the database must use the same characters.
Source database and the database must have the same size data blocks
Database table space can be moved with the same name, table space
SYS targets can not be relocated
Since the transmission must set the targets contained
Some objects, such as materialized views, based on the indexing function can be transmitted
The following methods can be used to detect a table space or table space with a standard transmission :
Sys.dbms_tts.transport_set_check exec ( 'tablespace_name' true);
Select * from sys.transport_set_violation;
If not choose that it only includes sheet data table space, and is included. Some self-contained space for the table, such as data table space and table space

Can be transmitted together.
Following is a brief use steps, if we want to use detailed information, online help can also make reference to Oracle.
1. Table space for the CD installed (assuming APP_Data table space for the name and APP_Index)
Alter tablespace app_data read only;
Alter tablespace app_index read only;
2. EXP issued orders
SQL>;host exp userid= "" "sys/password as sysdba" ""
Transport_tablespace=y tablespace= (app_data, app_index)
More attention is needed
To implement SQL EXP, three USERID must use quotation marks, must also be careful to avoid the UNIX "/" use
816 and in the future, can be used to operate sysdba
The order must be placed in a row in SQL (because it shows that the problem here is on the two lines)
3. Copy data files to another location, database
Can be cp (Unix) or copy (Windows) or through ftp transmission of documents (in the bin must form)
4. Table space locally for literacy
5. Additional data files to the target database
Imperialiste file=expdat.dmp userid= "" "sys/password as sysdba" ""
Transport_tablespace=y
"Datafile= (c:/temp/app_data, c:/temp/app_index)"
6. Set up database table space for literacy
Alter tablespace app_data read write;
Alter tablespace app_index read write;
4.1.3 derived / Introduction and Character Set
Oracle set up to understand the multi-lingual, multi-lingual ORACLE set up to support the world-wide language and characters, most of the language suggested that the monetary form of classification

Ways and CHAR, VARCHAR2, CLOB, LONG effective field data show. Oracle set up the multi-lingual characteristics is the most important of the two countries have set up language

Character Set installed, the state decided to set up a language interface or suggest the use of the language, characters and the characters of the decision to keep the database data (such as text) when

The coding rules. As one small example of the above, the environment variable NLS_LANG different lead changes help EXP, which is multi-lingual set up role

(NLS_LANG includes national language setting and characters set up here is the role of national languages installed, rather than characters).
Oracle set characters, and characters into the database client Character Set Environment installed. In the database end, the characters in the creation of the database creation and the preservation of

Props$ database table, 8i above products can be used "Alter database character set Character Set" to modify the database character set

It is only from the subset of the super-set, not to pass amendments to update props$ characters, if not support the change may result in the loss of all the characters

Data is supported by the conversion of normal work may also lead to the database. Character Set into single byte character sets and multi-byte character set is a typical US7ASCII

Single byte characters, the characters in this concentrated length=lengthb and Architecture Optimization of Word-length ZHS16GBK is commonly used characters, lengthb=2*length here.
Client characters in the environment is relatively simple, is the main item NLS_LANG environment variables or registry, the level of priority for attention NLS_LANG parameters : Register documents a a

Environmental variables a alter session. NLS_LANG composed of "national language provision. Character Set, "who nls_lang=simplified

Chinese_china.zhs16gbk. Client end of the same database with the best characters (not the same as the national language can be installed, such as zhs16gbk written scripts, Client

Ameircan_America.zhs16gbk nls_lang =simplified chinese_china.zhs16gbk or can be, will not affect the normal database characters show)

If not the same characters, but the characters do not change compatibility, and the data derived Client / characters with the introduction of the data are meaningless drivel


Use a little bit of skill, it can deduced / into different characters in the database, data conversion. It should be a two-band document editing tools, such as

Uedit32. Dmp derived using open editing documents, obtaining 2, 3 bytes of content, 00 01, 229 10 put it into number one, the use of function

NLS_CHARSET_NAME characters can be obtained :
SQL>; select nls_charset_name (1) from dual;
NLS_CHARSET_NAME (1)
-------------------
US7ASCII
Dmp know that the document character set for US7ASCII, if necessary make the characters into ZHS16GBK dmp documents will be required to obtain use of the word NLS_CHARSET_ID

Tallies numbers :
SQL>; select nls_charset_id ( 'zhs16gbk') from dual;
NLS_CHARSET_ID ( 'ZHS16GBK')
--------------------------
852
16 nary put into 852 to 354, 2, 3 bytes of replacing 03 54 00 01, completed his goal of the characters from us7ascii to zhs16gbk dmp document conversion

This, then dmp documents into the database to zhs16gbk characters on it. (Note that the number of metric conversion between the hexadecimal system, which would like to know

Word)
4.1.4 cross-licensing Exp/Imp
Exp/Imp many times, cross-licensing, as in version 7 and 8 between versions of the imported data is derived, but to do so we must choose the correct version of the rules :
Always use the version matching IMP version of the database, if the introduction of the 816, 816 were used into the tool.
EXP always use the version matching low that the two versions of the database, such as between 815 and 816 mutual guide, the EXP 815 tools were used.
Backup 4.2 OS
There are two types of backup systems, backup cold (Cold backup) and backup (Hot backup), with the backup system is a fundamental difference between the logical backup.

Logical backup data from the database, rather than physical backup of data blocks. Is the backup copy of the entire operating system and data files.
Backup 4.2.1 cold
Backup database level before the start of the document to be closed. Operation must be closed with a normal, immediate and transaction option to enforce the shutdown.
Each paper backup of the database was down, these documents include :
All data files ☆
Control all documents ☆
All along the line REDO LOG File
☆ INIT.ORA (optional)
Cold backup for the general steps :
A. Examples close to the normal backup (instance);
B. The entire database to a backup catalog
C. Database launched
If
SVRMGRL>;connect internal
SVRMGRL "immediate ;shutdown
SVRMGRL "Gabriel cp" file>; "back-directory>;
Or
SVRMGRL ";!tar cvf /dev/rmt/0 /u01/oradata/prod
SVRMGRL ";startup
Scripting : If using cold backup of the database, the database must be closed for inspection order logic, if not ordered the closure of the normal enforcement database

Which would lead to the database is not normal, then all will be back to the cold backup is invalid.
4.2.2 Hot Backup
When the backup is effective database is open to users of OS-level data backup. ARCHIVELOG mode only for the backup database. Before the data file backup

Correspond to the table through the use of space : BEGIN BACKUP : ALTER TABLESPACE way to backup place. Table space component can then use the data files

Cold backup copies of the operating system similar orders. In order to copy data files operating system, residents should use BACKUP : ALTER TABLESPACE order :

From the table to make room for hot-backup mode.
Backup online backup log is not necessary, but the state must be filed in the case revived, the log file may need to be used. At present, we must protect online log

Or in a good state of microscopy, the current online log damage, the damage is a huge database, the database only to the lost data restoration work.
Table space for the interim, the temporary storage of information, we can also consider the backup is not backup, fault if the provisional document, the data files can be deleted with the Table

Space and rebuild a temporary table space.
Hot Standby is obvious
- A. Table space in the data file level or backup, backup time is short.
- B. Backup can still be used when the database.
- C. Level restoration can be achieved seconds (restored to a certain point of time).
- D. Almost all entities to be made to restore the database.
- E. Rapid restoration is, in most cases, still working to restore the database.
Hot backup systems for the general steps :
1. Database Link
SVRMGRL>;connect internal;
2. Table space will need a backup (User) installed as a backup method
SVRMGRL>;Alter tablespace User begin backup;
3. Copy data files
SVRMGRL>;!cp /u01/oradata/prod/user01.ora /backup/prod/user01.ora
Or
$cp Cp /u01/oradata/prod/user01.ora /backup/prod/user01.ora
4. Copy the data files after the completion of table space backup means dragging body
SVRMGRL>;Alter tablespace User end backup;
5. Table space for all the necessary backup plots 2,3,4
6. Backup order to control the use of the following documents : BACKUP : ALTER DATABSE CONTROLFILE
If it into a binary file backup
Alter database backup controlfile to 'new fielname';
Backup into text documents
Alter database backup controlfile to trace;
As hot backup, database users still operating, so every table is the best space in the shortest possible time to backup status, and as such it requires a space for a table

Backup table space, not space at the table together to make backup copies of data files while state.
Caution : If the backup database if the interruption (eg electricity), then restart the database, the database will suggest a need to restore data files

You need is the time to power outages at the state backup data files through the end of ALTER TABLESPACE BACKUP : Backup : sound manner. Which specific data

Table space at the state or backup documentation can be obtained v$backup with v$datafile

4.3 RMAN (backup and restore management)
Backup 4.3.1 for the use of RMAN
4.3.1.1 understanding RMAN
Recovery manager (RMAN) provided by Oracle DBA tools, backup and restore operations management terminology. RMAN only for ORACLE8 or higher version. It

Backup components to the entire database or databases, including table space, data files, document control and archiving of documents. RMAN Backup and may request to visit and implementation

Restoration.
RMAN Backup has the following advantages
Online backup support ☆
Multi-level incremental backup support ☆
☆ support concurrent backup and restore
Backup needed to reduce the volume ☆
☆ backup, restore simple
Importantly, the restoration manager allows you to use the data block level incremental backup (with the derived / Incremental into different). Incremental backup RMAN time and

Space effective because they only backup since changed since the last backup of the data block. Another characteristic of RMAN space is the only effective use of data file backup

The data blocks, neglected space, the unused blocks of data, the pre-allocation of space for the table space is a great advantage.
From 9i, RMAN also increased the level of data block to the resumption, we can further reduce the time to restore databases.
RMAN support for different types of backup
FULL backup of the entire database, including all of the data blocks
INCREMENTAL incremental backup, incremental backup only been modified since the last backup of the data block. As the incremental increase in the need for a zero-based support incremental 7

Volume.
OPEN opened in the use of database
Closed installed in the database (MOUNT), but do not open the backup, backup can be closed or CONSISTENT IN CONSISTENT types.
CONSISTENT installed in the database alone was not opened, and the installation of the database before being closed (and not damaged or abnormal withdrawal) use.

CONSISTENT simple backup for the original complex (RESTORE) rather than restore (RECOVER)
INCONSISTENT opened or installed in the database (but not opened) use. The database in the normal closure or collapse, INCONSISTENT backup needs restoration.
Understand BACKUP, RESTORE, RECOVER order, which is an order of the three basic RMAN, database backup, and restore the original complex operation.
4.3.1.2 understand restore Contents
Understand restore list can not restore RMAN catalog (NOCATALOG) operation, this time keeping backup information in the control of documentation. Backup documents kept in control

Information is very dangerous, and if the damage control document will lead to the loss of information backup and restore failures, but not restore catalog, the order will not be many RMAN

Support. So important database, it is proposed to create a list of restoration, restoring catalog is a database, but the information in this database used to keep backup, a

Contents can be used to restore a number of database backup.
RMAN catalog creation, the following steps explain the best RMAN catalog in a database in the process.
1. Table of Contents creation of a single space
SQL>;Create tablespace tools datafile 'fielname' size 50m;
2. RMAN to create users
SQL>;Create user identified by RMAN RMAN default tablespace tools temporary tablespace temp;
3. Delegated authority to RMAN
SQL>;Grant connect, resource, recovery_catalog_owner to rman;
4. Open RMAN
$>;RMAN
5. Database Link
RMAN>;connect catalog rman/rman
6. Contents building restoration
RMAN>;Create tablespace tools catalog
Registration database, established after the successful restoration of Contents on the registration database, the database is the need for backup database, a catalog can resume

Registration number database, the order of registration database :
$>;RMAN Target internal/password catalog rman/rman@rcdb;
RMAN>;Register database;
Complete the registration database, it can be used to RMAN Backup, Oracle Online Reference Manual or more orders "ORACLE8i manual backup and restore".
RMAN suggested that the database is not a simple cancellation of the anti-registered on the operational needs of a package, the process is as follows :
1. Link database, access to ID database
$>; Target RMAN catalog rman/rman@rcdb; internal/password
: : Connected to target database RMAN-06005 RMAN (DBID=1231209694)
2. Inquiries resume lists more detailed information
SQL>; SELECT db_key, db_id FROM WHERE db_id db = 1231209694;

DB_KEY DB_ID
---------- ---------------
1 1237603294
1 row selected.
3. Dbms_rcvcat.unregisterdatabase cancellation process database operations, such as
SQL>; EXECUTE dbms_rcvcat.unregisterdatabase (1, 1237603294)
4.3.1.3 used for backup RMAN
RMAN script to use backup database, the following are a few examples perform backup RMAN.
1. Backup entire database
Back-full tag 'basicdb' format '/bak/oradata/full_%u_%s_%p' database;
2. Backup space for a table
Back-tag 'tsuser' format '/bak/oradata/tsuser_%u_%s_%p' tablespace users;
3. Log file backup
Back-tag 'alog' format '/bak/archivebak/arcbak_%u_%s_%p' archivelog all delete input;
4.3.2 maintenance RMAN
4.3.2.1 access information RMAN
Check back
RMAN>;list backup
Backup overdue list
RMAN>;report obsolete
Delete expired backup
RMAN>;allocate channel for maintenance type disk;
RMAN>;change backupset id delete;
RMAN>;release channel;
4.3.2.2 synchronous or replacement of RMAN
If the target database is a change in physical objects, such as adding an information document, we need to simultaneously use the following order :
RMAN>;resync catalog;
If the target database reset the database, the need to use the following order synchronization
RMAN>;reset database;
When the manual deletion of the database archiving documents, the following script to implement synchronization
RMAN>;allocate channel for maintenance type disk;
RMAN>; change archivelog all crosscheck;
RMAN>;release channel;
When the manual backup RMAN to delete the database, the following script to be implemented simultaneously
RMAN>;allocate channel for maintenance type disk;
RMAN>;crosscheck backup;
RMAN>;delete expire backup;
RMAN>;release channel;

Chapter 5. Customization appropriate Backup Strategy
5.1 Customization right strategy
Backup strategy is not only able to guarantee the right of 24*7 database servers, high-performance operation, but also to ensure the backup and restore speed and reliability. We will be the RMAN

Multi-level incremental backup of a backup strategy as an example for discussion. Backup is a multi-level in order to reduce the time needed for backup daily, which guarantee a good system

Recovery. Backup and restore time to time to have a balance. For example, if a database for the entire backup, and then only on the database backup file can be guaranteed

The latest state to resume, but this will not be tolerated recovery time. It is multi-level backup to solve this problem, the following is a multi-level backup

Examples :
Every six months to make a backup of the entire database (including all the table space and CD data)
Backup is done once a month for each class (includes CD-table space)
Each week a backup level
Do a daily backup 2
Any need to change the database catalog and re-synchronization CATALOG backup (such as adding data files) or backup (such as revising Table space for the CD)
Backup can log file after each backup or archive log backup regularly.
If possible, direct backup to tape.
The entire database backup script
Run{
Allocate channel c1 type disk;
Allocate channel c2 type disk;
Allocate channel c3 type disk;
Back-full tag 'dbfull' format '/u01/oradata/backup/full%u_%s_%p' database
Include current controlfile;
Sgl 'alter system archive log current';
Back-three format fileaperset '/u01/oradata/backup/arch%u_%s_%p'
Archivelog all delete input; # backup archiving options that can regularly Backup
Release channel c1;
Release channel c2;
Release channel c3;
}
Zero-backup script
Run{
Allocate channel c1 type disk;
Allocate channel c2 type disk;
Allocate channel c3 type disk;
Backup incremental level 0 tag 'db0' format '/u01/oradata/backup/db0%u_%s_%p'
Database skip readonly;
Sgl 'alter system archive log current';
Back-three format fileaperset '/u01/oradata/backup/arch%u_%s_%p'
Archivelog all delete input; # backup archiving options that can regularly Backup
Release channel c1;
Release channel c2;
Release channel c3;
}
Similarly, we can get a level backup, secondary backup script, and if the script level Backup
Run{
Allocate channel c1 type disk;
Allocate channel c2 type disk;
Allocate channel c3 type disk;
Backup incremental level 1 tag 'Short' format '/u01/oradata/backup/db1%u_%s_%p'
Database skip readonly;
Sgl 'alter system archive log current';
Back-three format fileaperset '/u01/oradata/backup/arch%u_%s_%p'
Archivelog all delete input; # backup archiving options that can regularly Backup
Release channel c1;
Release channel c2;
Release channel c3;
}
If more backup strategy, the daily backup of data needed only one day to change the volume. Done the most to restore month when resuming a zero Backup +

Backup Backup + II + 6 1 1 documents in the archives of the day. If not this recovery time, we can reduce the time lag between zero backup.
After each backup, backup point principle in the log file can be deleted before, but in order to further the safety and future needs (such as the use of LOGMNR investigation

Find the required information), the proposed conditional, archiving log preserved for a year, we can preserve the tapes and other equipment on the cheap visit.
And the optimization of RMAN Backup 5.2
Following a three-step backup operation is completed
1, the data read from disk
2, block processing of data in memory
3, write data to disk or tape
Literacy can be synchronous or asynchronous operation of the completed simultaneously I/O operation, a one-time only allowed IO operation, but I/O asynchronous operation, a time

Allow inter-operation of a number of IO. Therefore, the fine-tune backup and restore mainly concentrated in the following areas :
1, increase the operating capacity of synchronous or asynchronous I/O
Asynchronous operation in support of the operating system can be installed TAPE_AYSNCH_IO, DISK_ASYNCH_IO and BACKUP_TYPE_IO_SLAVES to support asynchronous operation

Improve writing ability.
2, the ability to improve disk Reading
In back-orders can be assured through the establishment of DISKRATIO to read data from a number of disk to ensure continuous data flow.
3, the buffer zone and set up the correct parameters
LARGE_POOL_SIZE set up so that the backup can be used for buffer pool, through the use of the buffer zone set up DB_FIL_DIRECT_IO_COUNT can improve. If so

Using backup tapes, the tapes can be erected BACKUP_TYPE_IO_SLAVES to improve writing ability.
4, parallel backup
Open multi-channel, parallel backup and restore
5.3 database backup RMAN
RMAN backup their database needs, but in itself is very small, but not always change in each of RMAN backup is completed, you can use the following script

RMAN database backup.
EXP pafile =exprman.sql
To exprman.sql
USERID=RMAN/RMAN
BUFFER=32768
OWNER=RMAN
FILE=RMAN.DMP
ROWS=Y
GRANTS=Y
COMPRESS=Y
CONSISTENT=Y
Automatic database backup 5.4
Automatic database backup confined to the following three methods :
The tasks under Windows (At Orders)
Under the UNIX Cron
Third-party tools such as Viritas
In these three methods Viritas tools belonging to a third party, many people might not have any contacts about the windows of the main tasks of the project and Unix cron
1. Script generated documents, such as backup.rcv
Assume that the content of the document 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. 生成执行文件
在windows上生成backup_archive.bat,内容包括
rman cmdfile = backup.rcv
在unix下生成 backup_archive.sh,内容包括
/oracle/ramn/rman cmdfile = backup.rcv
3. 加入调度
在windows中用任务计划向导即可,或使用at命令。
在unix中,在目标机器上编写一个文件,用以启动自动备份进程。假定文件名为ORACLE,文件将放

在/var/spool/cron/crontabs目录下
$>;cat oracle
0 23 * * 0 backup_archive.sh
#表示星期天23点对数据库备份
0 12,18 * * * backup_archive.sh
#表示每天12点,18点备份
Crontab文件的每一行由六个域(minutes,hours,day of month,month,day of week,command)组成,域之间用空格或Tab分隔

开来

第六章. 常见误区
1、使用EXP/IMP备份
EXP/IMP不是一个良好的备份工具,在以后的发展之中,ORACLE对EXP/IMP用于备份的支持会越来越低。ORACLE只是把

EXP/IMP当作一个好的工具而不是备份工具,在对于大型数据库,如TB级数据库或数据仓库,EXP/IMP肯定会力不从心。
2、在应用程序中备份数据库
在论坛上,有很多这样的要求,“我怎么在程序中备份与恢复数据库?”。首先说,这个并不是不可以实现,但是实现的过

程会很复杂而且意外会很多。就我的感觉,提出这样问题的人,首先一点就是对ORACLE或DBA的不了解,如果ORACLE可以这

么轻松的实现备份与恢复,那么我可以说,就不需要DBA了。
3、冷备份比热备份更容易,效果会更好
有人认为,冷备份是关闭数据库进行的一致性备份,肯定比热备份要好,使用也容易,其实不尽然,在热备份中,一样可以

实现数据库的全备份,而且不会影响到数据库的运行。建议所有的生产机,都运行在归档方式下,采用热备份方式。
第七章. 常见问题
1、我导出的数据为什么不能导入,提示不支持的字符集转换
答:参考上面的字符集原则,导出数据时客户端与数据库字符集一致,导入时修改为与目标数据库字符集一致。
2、我的归档日志越来越多,我什么时候可以删除归档日志?
答:在每一次全备份(如OS全冷备份或全热备份)或基于全备份的增量备份(如RMAN基于0级备份上的增量备份)后都可以

删除该备份点之前的归档日志,建议在磁带上保留一年。
3、全备份时一定需要备份所有数据文件吗?
答:不需要,起码有两类数据文件可以不备份,一类就是临时数据文件,如果丢失,可以删除后重建;一类是只读表空间数

据文件,如果上次备份以来,没有修改过表空间的只读属性,就可以不需要备份。
4、联机日志需要备份吗?
答:如果是归档方式热备份,就没有必要备份联机日志。但是对于冷备份,可以备份联机日志,特别是不归档状态。备份过

联机日志后的冷备份,因为数据库是一致的,可以恢复到该备份点。
第八章. 小结
1、什么是数据库备份,数据库备份就是把数据库复制到转储设备的过程。
2、数据库的运行方式,可以分为归档方式和非归档方式,建议运行在归档方式下运行热备份。
3、了解了数据库的备份方式,逻辑备份、冷备份、热备份
4、了解数据库的备份工具,EXP/IMP执行逻辑备份,OS脚本可以执行冷备份或热备份,RMAN也可以执行冷备份或热备份
5、了解ORACLE的备份策略,并怎样选择最佳的备份策略
6、知道怎么样启动自动备份,了解Windows的at命令与unix的cron进程。
参考文献:
Expert One-on-one Oracle [美] Thomas Kyte 着 清华大学出版社
Oracle 8i Web开发指南 [美] Dan Hotka,et al. 着 清华大学出版社
Oracle 8i DBA Architecture & Administration and backup & Recovery Study Guide
[美] Dong Stuns Biju Thomas着 电子工业出版社
Oracle 数据库管理员技术指南 [美] Sumit Sarin着 机械工业出版社

注:---转自itpub

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics