In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Chapter 6: Overview of RMAN
6.1 definition and functions of rman:
Recovery Manager
2) establish server process for backup and recovery, and do backup and recovery on oracle server
3) rman backup datafile (divided into three levels: database, tablespace, datafile), controlfile, spfile, archivelog
4) support consistent backup (cold backup) and inconsistent backup (hot backup) in archive mode
5) only consistent backups are supported for non-archiving (mount cold backup)
* examination sites:
1) non-archived RMAN can only be backed up cold and done under mount, but manual backup the backup from cp under mount is not available for RMAN.
2) A non-archived RMAN restore can only restore the last backup.
6.2 advantages of rman:
1) do not back up unused blocks in data files (backup block below the high water mark), saving time and space (test sites)
When backing up, automatically check data files for bad blocks, and can mark bad blocks and skip bad blocks, because RMAN is an ORACLE BLOCK-level backup technology.
For undo tablespaces, only a small part of the space is backed up (no commit data is backed up), and incremental backups can be achieved without backing up temporary tablespaces.
Support for multi-channel parallel work
6) ASM files can be backed up
6.3Architecture of rman:
You can connect to three types of databases:
Target database (target library for backup)
Auxiliary database (auxiliary library)
Catalog database (catalog database).
Storage devices: disk, tape (sbt tape drive) devices that store backup files
Channel: the backup and recovery channel (service process) between the target library and the storage device starts at least one channel by default, and multiple channel concurrent operations can be started at the same time.
Server process: the process for backup and recovery
Rman metadata: record backup information (placed in the controlfile of the target library)
Catalog database: centrally manage and store backup metadata, as well as backup scripts
MML:media manage layer media management layer: library files or drivers used to manage tape drives
6.4 rman connection target library method
1) Local connection
The RMAN tool and target database are on the same server
Rman target /
2) remote connection
The RMAN client starts snooping in target database through an ORACLE_NET connection to target database, and configures tnsnames.ora in client.
6.5. view the default configuration of rman and modify the configuration information of rman
1) View the default configuration of rman
RMAN > show all
2) understand the RMAN environment variables of the above lines
First line: CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
There are two retention strategies: you can only choose one, and they are mutually exclusive. (see PPT-II-47)
One is the time strategy, which specifies a time window that must be able to recover data at any time in this period of time. Now time-full backup point > = time window.
A redundancy policy that specifies at least several redundant backups.
Restore window backup save policy:
For example, if we specify that the recovery window is 7 days, suppose today is Monday, and there were three full and archived logs before. The first one was generated 5 days ago, the second one was generated 10 days ago, and the earliest one was backed up 15 days ago.
Then the backup made ten days ago and the archive log that followed must be kept, while the backup made 15 days ago will become an obsolete backup (obsolete) (see PPT-48).
The following command configures the recovery window to 7 days:
RMAN > configure retention policy to recovery window of 7 days
Redundant backup save strategy:
Using this save strategy, RMAN retains N backups of data starting with the latest backup and obsolete the rest.
For example, if you have three backups and the redundancy number is 2, then the earliest backup will be discarded. The following command sets the backup policy to 2:
RMAN > configure retention policy to redundancy 2
Setting NONE will invalidate the backup retention policy, and Clear will restore the default retention policy
RMAN > configure retention policy to none; / / RMAN will not mark any backup sets or image files as obsolete status thereafter.
RMAN > configure retention policy clear
Example: ensure that at least one backup can be restored to the point in time of Sysdate-5, and the previous backup will be marked as Obsolete (obsolete)
RMAN > configure retention policy to recovery window of 5 days
At least three redundant backups are required, and more than three backups will be marked as redundant
RMAN > configure retention policy to redundancy 3
Second line: CONFIGURE BACKUP OPTIMIZATION OFF; # default
Set the backup optimization option (optimization) to set the backup optimization in the configuration, such as:
RMAN > configure backup optimization on
If the optimization setting is on, it is only used for archiving log, read-only or offline tablespace data files, because these files will not change, and the backup set runs an optimization algorithm. Skip duplicate backup files, for example, if you want to back up the archive log, this parameter is set.
Duplicate backups can be avoided for on, which can greatly save space and time. (PPT103)
Point of reference: the backup optimization option depends on the RETENTION POLICY policy, and if optimization is enabled, RMAN will not create additional file copies if there are enough copies of the same files.
Line 3: CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
There are two types of devices, either disk (DISK) or magnetic tape (STB), which defaults to disk.
Line 4: CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
Set up automatic backup of control files (autobackup on)
RMAN > CONFIGURE CONTROLFILE AUTOBACKUP ON
Off: by default, control files and spfile are backed up when system tablespaces are backed up
On: control files and spfile are automatically backed up when any file is backed up, and controlfile is automatically backed up when the physical structure of the database changes.
Line 5: CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO'% fit; # default
You can specify the backup path and format of the control file with the following configuration, and format specifies the path and file name of the backup file.
RMAN backup file format backup files can be customized in a variety of formats, as follows:
C number of copies of backup slices
% D is located on the day of the month (DD)
% M is located in the month of the year (MM)
% F A unique name based on DBID, in the form of c-IIIIIIIIII-YYYYMMDD-QQ, where IIIIIIIIII is the DBID,YYYYMMDD of the database is the date, and QQ is a sequence of 1-256
D database name
% n database name, fill to the right up to eight characters
% u an eight-character name represents the backup set and creation time
% p the backup slice number in this backup set, starting from 1 to the number of files created
% U A unique file name representing% u_%p_%c
Number of% s backup set
T backup set timestamp
% T year month day format (YYYYMMDD)
Line 6: CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET
Specify a degree of parallelism of 2 in future backup and restore operations, that is, two channels are opened at the same time for backup and restore
The number of parallelism determines the number of channels open. Of course, you can also specify channels in RUN {} to determine the degree of parallelism between backup and restore. If the channel configuration is specified in RUN {}, the default parallelism specified in the configuration parameters will be overridden
(test site) usually a channel corresponds to a backup set.
To improve RMAN performance and throughput, in addition to the number of channels, you can also control the number of input data files, backup sets and backup slices through some parameters.
The influence of parameters can be divided into two levels: global and local, which can be divided into:
PARALLELISM: saved in the RMAN repository.
CONFIGURE CHANNEL: update the configuration and save it in the RMAN repository.
ALLOCATE CHANNEL: limited to run {}, do not save.
BACKUP: limited to this backup statement, it will not be saved.
Related parameters
FILESPERSET: maximum number of input files per backup set
Described in the BACKUP statement
MAXOPENFILES: the maximum number of input files that can be opened at a given time
Described in ALLOCATE CHANNEL or CONFIGURE CHANNEL
MAXPIECESIZE: the backup slice size of each channel is described in ALLOCATE CHANNEL or CONFIGURE CHANNEL
MAXSETSIZE: limit the maximum backup set size
Describe in a BACKUP statement or in a matching parameter
BACKUP DURATION: increase or decrease the time it takes to complete a backup
Described in the BACKUP statement
1) assign a channel in RUN {} to specify the corresponding relationship between the backup data file and the channel.
Example 1:
RMAN > RUN {
ALLOCATE CHANNEL c1 DEVICE TYPE sbt
ALLOCATE CHANNEL c2 DEVICE TYPE sbt
ALLOCATE CHANNEL c3 DEVICE TYPE sbt
BACKUP
INCREMENTAL LEVEL = 0
FORMAT'/ data/df_%d_%s_%p.bak'
(DATAFILE 1, 4, 5, CHANNEL C1)
(DATAFILE 2 CHANNEL 3 c2)
(DATAFILE 6 CHANNEL 7 c3)
}
2) use the FILESPERSET parameter to limit the number of input files in the backup set, and specify that each backup set can contain the maximum number of input files at a time. The default value of this parameter is 64. Example 2 stipulates that 8 files are backed up in each backup set.
If the database has 20 files, only 3 backup sets will be generated and 3 backup slices will be generated. Although 4 channels are open, the parallelism is 3, and 1 channel is idle.
Example 2:
RMAN > RUN {
2 > ALLOCATE CHANNEL T1 DEVICE TYPE sbt
3 > ALLOCATE CHANNEL T2 DEVICE TYPE sbt
4 > ALLOCATE CHANNEL T3 DEVICE TYPE sbt
5 > ALLOCATE CHANNEL T4 DEVICE TYPE sbt
6 > BACKUP DATABASE FILESPERSET 8
}
In example 2, if you cancel the ALLOCATE CHANNEL statement, the number of channels is specified according to the global variable PARALLELISM, assuming 1, there are 20 files, what the result of FILESPERSET=8 should be: one channel works, and eight files form a backup set.
Each backup set is matched to a backup slice, and one backup set is completed and then the next backup set is followed. Run three times in series.
3) use the MAXPIECESIZE parameter to limit the backup slice size
Example 3:
RMAN > report schema
RMAN > RUN {
CONFIGURE CHANNEL DEVICE TYPE DISK MAXPIECESIZE 300M
BACKUP datafile 2 format'/ u01qqappActionoradataAccording to oradataAccord% U.bak'
}
RMAN > show all
RMAN > list backup
The maximum backup slice is limited to 300m, and if the output file is 500m (note that the input file is not limited), two backup slices will be generated in one backup set.
If you change 300 to 600
RMAN > RUN {
CONFIGURE CHANNEL DEVICE TYPE DISK MAXPIECESIZE 600M
BACKUP datafile 2 format'/ u01qqappActionoradataAccording to oradataAccord% U.bak'
}
Only one backup film can be produced.
If you set
CONFIGURE CHANNEL DEVICE TYPE DISK MAXPIECESIZE 300M
Replace it with
ALLOCATE CHANNEL c1 DEVICE TYPE DISK MAXPIECESIZE 300M
Is the difference between the whole and the part.
RMAN > CONFIGURE CHANNEL DEVICE TYPE DISK clear; / / remove this variable
4) use the maxsetsize parameter to limit the backup set size:
Example 4:
RMAN > backup database maxsetsize 500m format'/ u01Accord oradataUniplex HYKG% U.bak'
As a result, one channel produces multiple backup sets, each for one backup slice.
Note: as a basic principle, a backup set can only occupy one channel, and an input data file cannot be divided into multiple backup sets, so it must be satisfied here: the maximum input file size RUN {
ALLOCATE CHANNEL d1 DEVICE TYPE disk
ALLOCATE CHANNEL d2 DEVICE TYPE disk
ALLOCATE CHANNEL d3 DEVICE TYPE disk
BACKUP AS COMPRESSED BACKUPSET DATAFILE 2 SECTION SIZE 300m format'/ u01Accord oracle.oradataUniplex Hyykamp% U.bak'
}
Note: SECTION SIZE implicitly qualifies maxpiecesize, so SECTION SIZE cannot be used when maxpiecesize is in effect globally. (examination site)
Therefore, the use of SECTION SIZE,maxpiecesize can only be explained in allocate channel. (local parameters can override global parameters)
RMAN > CONFIGURE CHANNEL DEVICE TYPE DISK clear
Line 7: CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
Backup sets can also be multiplexed (but not for image files), with a maximum of 4. If it is 2, back up 2 copies of the same (PPT-II-101). Note: TO STB and TO DISK are independent (PPT-II-102), that is, they cannot be multiplexed with DISK and TAPE at the same time (test site). So again, if you have to duplex disks and tapes, please use backup backupset. You can override this parameter by using the RMAN command alone
RMAN > backup copies 2 datafile 4 format'/ u01ActionActionoradataActionHyykspur HYYKARAGHYYKARAGHYYKARAGH
RMAN > list backup
Line 8: CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
Multiplexing of archive logs, similar to multiplexing of data files
Line 9: CONFIGURE MAXSETSIZE TO UNLIMITED; # default
This configuration limits the maximum size of backup sets on the channel. Units support Bytes, KB, MB, and GB. The default value is unlimited. (mentioned earlier)
Line 10: CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
Line 11: CONFIGURE ENCRYPTION ALGORITHM','; # default
Encryption, Transparent encryption transparent encryption, with wallet
Password encryption: no wallet, (PPT-II-107)
Line 12: CONFIGURE COMPRESSION ALGORITHM 'BZIP2'; # default
Compression in RMAN is also called binary compression, which is a new parameter added to 11g (PPT-II-104-106g). Compression can only be used for backup set. There are two algorithms: 'BZIP2' and
'ZLIB'. Do not mix RMAN compression with the external compression utility.
Line 13: CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
Generally speaking, if you only have a single instance (not a Data Guard environment), the previous archivelog is useless and can be deleted, but many people are not used to setting parameters here and prefer to use scripts to delete archive files. (see Oracle one-week backup plan in the last chapter)
Line 14 CONFIGURE SNAPSHOT CONTROLFILE NAME TO'/ u01qqoracleUniqqdb _ default _
When the rman control file RMAN repository is fully synchronized with catalog, you need to establish a snapshot of controlfile, which specifies the location of the snapshot. (PPT-II-74)
6.6 Classification of rman backups:
1) backupset: do not back up blocks that have never been used in datafile (above HWM), and can achieve incremental backup (you can back up to disk and tape). If only one channel is enabled, all backed-up datafile will be put into one backupset by default, and a backup slice backup piece will be generated.
2) image copy (image file): in fact, similar to manual cp, backing up all data blocks of datafile cannot be used as the basis for incremental backup (that is, level 0 incremental backup). It can only be backed up to disk, but not to tape, because the restore steps can be omitted and the database can be restored quickly.
6.7 the command format for rman:
1) Interactive (also known as stand alone mode)
RMAN > shutdown immediate
RMAN > startup force mount
RMAN > alter database open
RMAN > sql 'alter system switch logfile'
RMAN > sql 'select * from scott.emp'; / / A pair of select does not show the result
2) batch processing (also known as job)
RMAN > run {
Shutdown immediate
Startup mount
Allocate channel c1 type disk
Allocate channel c2 type disk
Backup database format'/ u01qqappActionoradataAccording to oradataAccording to% dudes% s.bak'
Alter database open
}
3) based on EM (WEB)
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.