In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article is about how to use RMAN to back up a database. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
The database backup and recovery tool recommended by Oracle is RMAN (recovery Manager, Recovery Manager). It is not necessary to use RMAN,Oracle to support creating backups and performing restores by using operating system utilities, but RMAN has features that no other product can match. Here are a few advantages of using RMAN backup:
1. The recovery process is intelligent, there is no need to consider which backup files to restore, the system automatically selects and manages
2. Incremental backup is supported. Only the changed data blocks are backed up, instead of making a full backup every time, which can significantly reduce the time and space spent on backup.
3. Support encrypted backup to ensure the security of backup data, which is necessary for data backup stored on removable devices.
4. Support flexible choice of table space backup, data file backup, control file backup and archive log file backup, etc.
5. Powerful management commands and report functions can easily query and manage backups.
6. The backup and restore operation of RMAN has nothing to do with OS and is cross-platform.
I. the concept and terminology of RMAN backup
Backups performed with operating system commands are called user-managed backups, while backups performed using RMAN are called server-managed backups. "in general, you need to consider the following three backup strategies before performing server-managed backups:"
Closed or open?
Full backup or partial backup?
Full backup or incremental backup?
Backup in closed state is performed during database shutdown, also known as cold backup, consistent backup, offline backup, while backup in open state is performed during database use, also known as hot backup, non-consistent backup, and online backup. Open backups can only be performed when the database is in archive log mode. If the database is in non-archived log mode, only backups can be made in a closed state. In most cases, local backups must also take place when the database is in archived log mode. An incremental backup can be a cumulative incremental backup (including all blocks changed since the last full backup) or a differential incremental backup (including all blocks changed since the last incremental backup).
The file types that can be backed up by RMAN are:
Data file
Control file
Server initialization parameter file spfile
Archive redo log files
Backup set
Files that RMAN cannot back up include:
Temporary file
Online redo log file
Password file
Static parameter file pfile
Oracle Net profile
RMAN can generate three types of backups:
Backup set (backup set): a dedicated format for backup files. A backup set file can contain multiple database files.
Compressed backup set (compressed backup set): the same as the backup set, but RMAN applies the compression algorithm when writing to the backup set
Image copy (image copy): it is the same backup file as the input file, and the image copy can be exchanged immediately with the source content. Compared with the backup set file, there is no need to extract the file from the backup set during restore.
RMAN backup and restore operations are performed by a server process called a channel. Channels can be divided into disk types (backups on accessible disks) or SBT_TAPE types (backups on tapes can be accessed).
RMAN repositories (repository) are metadata about backups. Repositories are generally stored in control files in the target database or in a set of tables called catalog databases. When backing up multiple different databases, you can build a separate catalog database to store the metadata for RMAN backups.
RMAN operations are initiated, monitored, and controlled by the RMAN executable, and there are three ways to connect to the database:
Target database (target): databases that need to be backed up, restored, and restored
Catalog database (catalog): used to back up multiple target databases
Secondary database (auxiliary): a database created from a backup of the target database.
Offline backup of server management
Server-managed offline backups are backups that are performed after the database is shut down, also known as cold backup, consistent backup. For databases that are not in archive log mode, this mode can only be used when backing up.
RMAN consistent backups can be performed only if the database is in load mode. The reason is that RMAN needs to read the control file in order to find the data file. If you try to perform a user-managed operating system backup in load mode, it will be invalid, because in load mode, when you copy the control file, you may have written to the control file, so the copy becomes inconsistent. and lost its function. RMAN avoids this problem by taking a read-consistent snapshot of the control file and backing it up.
There are three technologies that use RMAN:
Interactive interface: used to perform ad hoc tasks
Script interface: running jobs through the operating system's scheduler
Enterprise Manager interface: used to generate scripts that define jobs scheduled by Enterprise Manager.
A typical offline-all-full backup script is as follows
Run {
Shutdown immediate
Startup mount
Allocate channel d1 type disk
Backup as compressed backupset database format'd:\ rman_bak\ mes\% dudes% upright% cations% T'
Alter database open
}
% d: database ID
% u: produces a unique file name
% c: how many backups
% T: backup time.
The script first closes the database instance and restarts to load mode, then allocates a channel for disk backup (disk means disk channel, and another backup channel is tape sbt_tape), then starts the compressed backup command to complete the full library backup (including backup of data files, control files and spfile files), and specifies the target location and file name format of the backup files, and opens the database after the backup is finished.
If you save it as a script file offline_full_whole.rman, you can schedule the following operating system commands to run the script
Rman target sys/hznj2010@mes @ offline_full_whole.rman
Note that in the command format, the script file name is preceded by the @ symbol, and target indicates that it is connected to the target database.
You can also use RMAN to connect to the target database in two steps, and then execute the script file
C:\ Users\ Administrator > rman target /
RMAN > @ d:\ offline_full_whole.rman
Two backup set files are generated at the target location, and the backup set contains the contents of all data files, control files, and spfile files.
Online backup managed by the server
When making an open backup, RMAN may attempt to copy the file block when the DBWn process writes to the block, which will cause the block to be broken. A fracture block may be useless in a backup because copying it when it is updated can lead to internal inconsistencies in the copy. RMAN detects broken blocks and retries block replication until a consistent version is obtained. To obtain a read-consistent version of the control file, RMAN creates a read-consistent snapshot copy of the control file, which is the content of the actual backup.
When creating a backup set, RMAN does not back up unused blocks, which saves a lot of space.
A typical online-all-full backup script is as follows
Run {
Allocate channel d1 type disk
Backup as compressed backupset database format'd:\ rman_bak\ mes\% dudes% upright% cations% T'
Backup as compressed backupset archivelog all delete all input format'd:\ rman_bak\ mes\% dudes% upright% cations% T'
}
The script command first allocates a channel process for disk writing, then the first backup command backs up the entire database (data files, control files, and spfile files), and the second backup command backs up all archive log files and deletes them from disk after backup, which frees up disk space. The result is three backup set files that contain the contents of all data files, control files, spfile files, and archive log files, and automatically delete archive log files that no longer need to be retained after the backup is complete.
Some RMAN commands can be impromptu, that is, they can be executed directly from the RMAN command prompt, while some commands can only be executed in the RUN script block, such as the allocate channel command needs to be executed in the script block.
Backups can also be done only for parts of the content, such as a tablespace, a separate file, and so on.
Back up a tablespace
RMAN > backup as backupset format'd:\ rman_bak\ mes\% dumped% upright% cased% T'tablespace cmes
Back up a data file, you can specify a file number or file name
RMAN > backup as backupset format'd:\ rman_bak\ mes\% dumped% upright% cased% T'datafile 4
Back up a batch of archived log files, using the wildcard%
RMAN > backup as backupset format'd:\ rman_bak\ mes\% dudes% upright% cased% T'archivelog like'D:\ oradata\ mes\ archivelog\ ARC_752D1AF3_1_882311480_1%'
Backup control file
RMAN > backup current controlfile format'e:\ rman_bak\ mes\ control_bak\ cations% dudes% ubiquitous% cations% T'
IV. Incremental backup
Incremental backup is divided into differential incremental backup and cumulative incremental backup. Incremental backups are called incremental level (incremental level) 0 backups when they depend on the starting point of all blocks, and then differential incremental level 1 backups extract all blocks that have changed since the last level 1 backup, or, if there is no level 1 backup in between, all blocks that have changed since the last level 0 backup. Cumulative incremental backups always extract all blocks that have changed since the previous level 0 backup, regardless of whether any level 1 backup exists.
The RMAN command to perform an incremental level 0 backup is as follows, and the backup set will contain all used blocks
RMAN > backup as backupset incremental level 0 database
The following command performs a differential incremental level 1 backup, which extracts all blocks that have changed since the last level 1 backup, and if no level 0 backup has been run, the first level 1 incremental backup is actually a level 0 backup
RMAN > backup as backupset incremental level 1 database
The following command performs a cumulative incremental level 1 backup, which extracts all blocks that have changed since the level 0 backup
RMAN > backup as backupset incremental level 1 cumulative database
You can specify incremental levels greater than 1, but they have no effect, and they are supported only for compatibility with older versions of RMAN, so you don't have to use them now.
In many cases, you may want incremental backups to be faster, which can be achieved by enabling block change tracking (block change tracking).
Block change tracking relies on starting an additional background process: CTWR (Change Tracking Writer, change tracking writer). This process records the address of each changed block in the change tracking file. If block change tracking is enabled, RMAN reads the change tracking file when performing an incremental backup to determine which blocks need to be backed up. This is much faster than scanning the entire data file.
Changing the default location of the trace file can be specified in the initialization parameter db_create_file_dest. Its initial size is 10MB and grows in increments of 10MB. Change the trace file to a bitmap format, each containing 32 blocks of data. Enabling block change tracking has the lowest performance overhead, which experience has shown to be unimportant. To enable block change tracking and specify the name and location of the trace file, use the following command
Alter database enable block change tracking using file'd:\ oradata\ mes\ change_tracking.dbf'
To monitor the effectiveness of block change tracking, query the view v$backup_datafile
Col name for a50
Col read_radio for a10
Select t1.Fileframes, t2.name, t1.datafile_blocks, t1.blocks_read, to_char (round (t1.blocks_read / t1.datafile_blocks, 2) * 100) | |'% 'read_radio, t1.completion_time
From v$backup_datafile T1 join v$datafile T2 on (t1.file# = t2.file#) and t1.used_change_tracking = 'YES' and t1.incremental_level > 0 order by file#, completion_time
FILE# NAME DATAFILE_BLOCKS BLOCKS_READ READ_RADIO COMPLETION_TIME
-
1 D:\ ORADATA\ MES\ SYSTEM01.DBF 65280 1895 3% 2016-12-04 14:58:49
1 D:\ ORADATA\ MES\ SYSTEM01.DBF 65280 1135 2% 2016-12-04 20:58:03
2 D:\ ORADATA\ MES\ UNDOTBS01.DBF 10880 1983 18% 2016-12-04 14:58:49
2 D:\ ORADATA\ MES\ UNDOTBS01.DBF 10880 679 6% 2016-12-04 20:58:03
3 D:\ ORADATA\ MES\ SYSAUX01.DBF 38400 5815 2016-12-04 14:58:49
3 D:\ ORADATA\ MES\ SYSAUX01.DBF 38400 3467 9% 2016-12-04 20:58:03
4 D:\ ORADATA\ MES\ USERS01.DBF 640 10% 2016-12-04 14:58:48
4 D:\ ORADATA\ MES\ USERS01.DBF 640 255 40% 2016-12-04 20:58:03
5 D:\ ORADATA\ MES\ CMES01.DBF 12800 10% 2016-12-04 14:58:48
5 D:\ ORADATA\ MES\ CMES01.DBF 12800 10% 2016-12-04 20:58:03
6 D:\ ORADATA\ MES\ RMES01.DBF 131072 9% 2016-12-04 14:58:48
6 D:\ ORADATA\ MES\ RMES01.DBF 131072 13 2016-12-04 20:58:03
7 D:\ ORADATA\ MES\ INDX01.DBF 131072 10% 2016-12-04 14:58:48
7 D:\ ORADATA\ MES\ INDX01.DBF 131072 10% 2016-12-04 20:58:03
8 D:\ ORADATA\ MES\ HMES01.DBF 64000 10% 2016-12-04 14:58:48
8 D:\ ORADATA\ MES\ HMES01.DBF 64000 10% 2016-12-04 20:58:03
9 D:\ ORADATA\ MES\ RMES02.DBF 131072 10% 2016-12-04 14:58:48
9 D:\ ORADATA\ MES\ RMES02.DBF 131072 10% 2016-12-04 20:58:03
10 D:\ ORADATA\ MES\ INDX02.DBF 131072 10% 2016-12-04 14:58:48
10 D:\ ORADATA\ MES\ INDX02.DBF 131072 10% 2016-12-04 20:58:03
Where DATAFILE_BLOCKS reflects the size of the data file, BLOCKS_READ and READ_RADIO show the number of blocks read and the read block ratio per incremental backup, and if this ratio continues to increase per backup, consider performing incremental backups more frequently.
To see if block change tracking is enabled, and to check the location and size of the trace file, query the view v$block_change_tracking
Col filename for a50
Select * from v$block_change_tracking
STATUS FILENAME BYTES
-
ENABLED D:\ ORADATA\ MES\ BLOCK_CHANGE_TRACKING.DBF 11599872
Confirm that the CTWR server process (change trace writer) is enabled, which can query the view v$process
Select program from v$process where program like'% CTWR%'
PROGRAM
ORACLE.EXE (CTWR)
If you want to cancel block change tracking, the command is
Alter database disable block change tracking
5. Other backup methods
1. Copy of the image
An image copy of a file is exactly the same as a data file, control file, or archive log file. The result is as if the file was copied with an operating system program, but the mechanism is different. RMAN reads and writes Oracle blocks, not operating system blocks. The advantage of the image copy backup method is that the restore is very fast because there is no need to extract files from the backup set.
A copy of the image can consist of data files, control files, or archive log files, but not spfile files.
The backup command for the image copy uses the keyword copy, such as backing up the entire database with the following command, and without changing the default configuration, a disk channel will be started to copy all data files and control files to the flashback recovery area (while automatically generating a backup set of spfile files)
RMAN > backup as copy database
If you want to move all archive logs into the flashback recovery area, the command is
RMAN > backup as copy archivelog all delete all input
You can query the backup status using the view v$backup_files
SQL > select backup_type, file_type, status, fname, tag, df_tablespace, df_file# from v$backup_files
BACKUP_TYPE FILE_TYPE STATUS FNAME TAG DF_TABLESPACE DF_FILE#
-- -
COPY DATAFILE AVAILABLE D:\ RMAN_BAK\ MES\ MES_2OQJEQ48_1_20151011 TAG20151011T143448 RMES 6
COPY DATAFILE AVAILABLE D:\ RMAN_BAK\ MES\ MES_2PQJEQ7I_1_20151011 TAG20151011T143448 RMES 7
COPY DATAFILE AVAILABLE D:\ RMAN_BAK\ MES\ MES_2QQJEQBP_1_20151011 TAG20151011T143448 SYSTEM 1
COPY DATAFILE AVAILABLE D:\ RMAN_BAK\ MES\ MES_2RQJEQD7_1_20151011 TAG20151011T143448 SYSAUX 2
COPY DATAFILE AVAILABLE D:\ RMAN_BAK\ MES\ MES_2SQJEQEA_1_20151011 TAG20151011T143448 CMES 5
COPY DATAFILE AVAILABLE D:\ RMAN_BAK\ MES\ MES_2TQJEQEI_1_20151011 TAG20151011T143448 UNDOTBS1 3
COPY CONTROLFILE AVAILABLE D:\ RMAN_BAK\ MES\ MES_2UQJEQEP_1_20151011 TAG20151011T143448 0
COPY DATAFILE AVAILABLE D:\ RMAN_BAK\ MES\ MES_2VQJEQES_1_20151011 TAG20151011T143448 USERS 4
BACKUP SET SPFILE
BACKUP SET PIECE AVAILABLE D:\ RMAN_BAK\ MES\ MES_30QJEQEU_1_20151011 TAG20151011T143448
2. Compress backup
RMAN supports compressed backup. Using the compressed keyword, the following command will complete the compressed backup of the database and archive logs.
RMAN > backup as compressed backupset database plus archivelog
3. Protect backup
RMAN supports multiple backups, using the keyword copies. The following command generates two sets of backup sets of database and archive logs at the default disk destination.
RMAN > backup as backupset device type disk copies 2 database plus archivelog
You can also back up the backup set. For example, you can transfer the backup set to another target device and delete the backup in the same location with the following command
RMAN > backup device type disk format'd:\ shift_bak\% dumped% upright% cased% T'backupset all delete all input
4. Encrypted backup
In some environments you may want encrypted backups because they may be stored on removable devices that are almost beyond the control of DBA.
There are two ways of encryption: transparent encryption and password encryption.
1) transparent encryption
This is the default method adopted by RMAN, based on the use of wallet. This is a key file that contains the encryption and decryption of data, which is itself protected by a password. This encryption method is suitable for encrypted backup and recovery only on the local computer, as long as the wallet certificate is configured. Certificate documents need to be kept properly and should not be lost, otherwise they cannot be recovered in the future.
The procedure for transparent encrypted backups is as follows:
A) first create a wallet directory in the default location of Oracle
% ORACLE_BASE%\ admin\\ wallet
B) check the status of the wallet. It is off by default.
SQL > select * from v$encryption_wallet
WRL_TYPE WRL_PARAMETER STATUS
File C:\ ORACLE\ ADMIN\ MES\ WALLET CLOSED
C) Open the wallet and set a password for the certificate. The system may report an ORA-28374 error. This is the Bug of Oracle. Ignore it.
SQL > alter system set encryption key authenticated by "pm1234"
Alter system set encryption key authenticated by "pm1234"
*
An error occurred on line 1:
ORA-28374: the primary key typed was not found in Wallet
D) configure RMAN encrypted backup to be enabled
RMAN > configure encryption for database on
Old RMAN configuration parameters:
CONFIGURE ENCRYPTION FOR DATABASE OFF
New RMAN configuration parameters:
CONFIGURE ENCRYPTION FOR DATABASE ON
New RMAN configuration parameters have been successfully stored
E) normal backup operation can be carried out after that.
F) the wallet needs to be opened with the correct password before RMAN recovery operation
SQL > alter system set wallet open identified by "pm1234"
The system has changed.
G) normal recovery operation can be carried out after that. If the wallet is not opened, the recovery process fails.
H) if you want to unencrypt the backup function, you can reset the encryption configuration of RMAN to the default value
RMAN > CONFIGURE ENCRYPTION FOR DATABASE clear
Old RMAN configuration parameters:
CONFIGURE ENCRYPTION FOR DATABASE ON
RMAN configuration parameters have been successfully reset to their default values
2) password encryption
This is to set the algorithm and key before the backup, and then make a normal backup. Encrypted backup files need to provide the correct key before the restore operation, otherwise they cannot be recovered.
From the view v$rman_encryption_algorithms, you can view the encryption algorithms supported by RMAN. The default encryption algorithm is AES128.
SQL > select * from v$rman_encryption_algorithms
ALGORITHM_ID ALGORITHM_NAME ALGORITHM_DESCRIPTIO IS_DEFAULT RESTORE_ONLY
--
1 AES128 AES128-bit key YES NO
2 AES192 AES192-bit key NO NO
3 AES256 AES256-bit key NO NO
The operation procedure of password encrypted backup is as follows:
A) check the current encryption algorithm of RMAN. # default indicates that this is the default setting of RMAN.
RMAN > show encryption algorithm
The RMAN configuration parameters of the database for which db_unique_name is MES are:
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
B) if you need to change the encryption algorithm, you can use the following command, such as change to AES256
RMAN > configure encryption algorithm 'aes256'
New RMAN configuration parameters:
CONFIGURE ENCRYPTION ALGORITHM 'aes256'
New RMAN configuration parameters have been successfully stored
C) check to confirm whether the encryption algorithm has changed
RMAN > show encryption algorithm
The RMAN configuration parameters of the database for which db_unique_name is MES are:
CONFIGURE ENCRYPTION ALGORITHM 'aes256'
D) if you want to revert to the default encryption algorithm, use the keyword clear
RMAN > configure encryption algorithm clear
Old RMAN configuration parameters:
CONFIGURE ENCRYPTION ALGORITHM 'aes256'
RMAN configuration parameters have been successfully reset to their default values
E) set the key and enable encryption
RMAN > set encryption on identified by 'pm1234' only
Executing command: SET encryption
F) you can then start the normal backup operation.
G) before the recovery operation, the key needs to be provided, otherwise it cannot be recovered.
RMAN > set decryption identified by 'pm1234'
Executing command: SET decryption
H) the normal recovery operation can be carried out after that.
5. Archive backup
In Oracle terms, archived backups refer to backups that you want to keep for a long time or permanently. Typically, archived backups are created only to meet the requirements for record retention. Archive backups ignore the retention policy configured by RMAN and are not automatically deleted by the delete obsolete command.
The syntax for creating an archive backup is as follows:
Backup... Keep {forever | until time 'date_expr'} [restore point rpname]
Where forever means that the permanent save does not expire, and until time specifies the expiration date, either of them. The date expression can be an actual date or a formula. The following command will generate a full archive backup of the database, because it is an archive backup, which will also include archive logs
RMAN > backup as compressed backupset database keep until time 'sysdate + 90' restore point quarterly_bak
VI. Parallel backup operation
Each time you use RMAN, at least two sessions are initiated to the target database, known as default sessions and polling sessions. The default session is a session that invokes the kernel PL/SQL that implements RMAN and polls the session to monitor the progress of the RMAN operation. When RMAN reads and writes to a disk or tape, it will require a third session: the channel. By starting multiple channels to achieve the parallelization of backup work, the time spent on backup can be reduced.
The degree of parallelism that can be achieved when RMAN backups is limited by the number of channels and the number of input files. Consider the following script
Run {
Allocate channel t1 type disk
Allocate channel t2 type disk
Allocate channel t3 type disk
Allocate channel t4 type disk
Backup database files per set 8
}
Four named channels are started in the script, and RMAN calculates the number of files in the database and distributes them to the backup set, each with no more than 8 files. If the database consists of 100 data files plus control files, 13 backup sets are generated, the first 12 backup sets contain 8 files each, and the 13th backup set contains the remaining 5 files with a parallelism of 4, which is limited by the number of channels. However, if the database has only 20 data files, only 3 backup sets will be generated, with a parallelism of 3 and a channel idle, which is limited by the number of input files.
By default, the maximum parallelism does not exceed the number of input files, because by default, one channel can only read one file at the same time, but after using the multi-segment backup feature, a file can be accessed in parallel by multiple channels at the same time. This application is mainly for backups of single larger files.
The use of multiple keywords is as follows
Run {
Allocate channel t1 type disk
Allocate channel t2 type disk
Allocate channel t3 type disk
Allocate channel t4 type disk
Backup as backupset datafile 16 section size 10g
}
The script starts four channels, each of which reads a 10g segment of data file 16, and each channel generates a slice containing a backup of the segment (a separate physical file). Assuming that the file size is 200G, 20 backup slice files will be generated, 4 in parallel at a time. Without the section size keyword, parallelism will be 1, and only one channel can be used to perform the entire operation, while the other three channels will be idle.
7. Configure default parameters for RMAN backup
The default parameters of RMAN backup are often not suitable for our requirements. We may need to configure the default backup parameters before the backup work starts. Once these parameters are configured, the backup command will proceed according to the default values if the target parameters are not specified.
The show command can view the default parameters currently configured by RMAN. The following are the default values of the system when these parameters are not set. All configuration parameters are displayed using the show all command. The # default marked at the end of each line of configuration statement indicates that the parameter value is the default value of the system.
RMAN > show all
Replace the recovery directory with the target database control file
The RMAN configuration parameters of the database for which db_unique_name is MES are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO'% favored; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE' DEFAULT' OPTIMIZE FOR LOAD TRUE; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO'C:\ ORACLE\ PRODUCT\ 11.2.0\ DBHOME_1\ DATABASE\ SNCFMES.ORA'; # default
To adjust the default values for these parameters, use the configure command, such as the following settings:
Change the backup configuration of the control file, set it to automatic backup, and specify the destination path for the backup. In this way, the control files and spfile files will be automatically backed up when the database structure is changed or RMAN backups are done. Here, the% F format is only valid for automatic backups, and it is not valid to specify this parameter when backing up manually.
RMAN > configure controlfile autobackup on
RMAN > configure controlfile autobackup format for device type disk to'd:\ rman_bak\ mes\ control_bak\% F'
Change the target location and naming convention of the data file backup set
RMAN > configure channel device type disk format'd:\ rman_bak\ mes\% dudes% upright% cations% T'
Change the backup type from the default backupset to copy, so that any backup of RMAN does not produce a backup set, but a copy of the image
RMAN > configure device type disk backup type to copy
Change the default backup device type from disk disk to tape sbt
RMAN > configure default device type to sbt
Change the number of parallel disk backups, starting 2 channels below
RMAN > configure device type disk parallelism 2
Enables backup optimization, which allows RMAN not to back up specific files if it thinks there are enough copies of them. Optimization is related to the retention policy. The default retention policy is 1, which means that RMAN will try to save at least one copy. Backup optimization applies only to archived logs and data files that are read-only or offline tablespaces. Since the online readable and writable data file is always changing, RMAN will not consider it to have the same copy
RMAN > configure backup optimization on
Change the retention policy of the backup, and below set the redundancy of the retention policy to 3, which means that RMAN will try to save 3 copies
RMAN > configure retention policy to redundancy 3
You can set two retention policies, and the redundancy level specifies the number of file copies that should be saved. Another strategy is to set the recovery window. The following backup settings ensure that you can go back to any time in the past 90 days by performing a point-in-time recovery.
RMAN > configure retention policy to recovery window of 90 days
To restore the configured settings to the system default values, use the clear command. As shown below, first use the show command to view the relevant configuration information, and then use the clear command to restore to the system default
RMAN > show device type
The RMAN configuration parameters of the database for which db_unique_name is MES are:
CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET
RMAN > configure device type disk clear
Old RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET
RMAN configuration parameters have been successfully reset to their default values
RMAN > show device type
The RMAN configuration parameters of the database for which db_unique_name is MES are:
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
In fact, among these configuration parameters, most of the default settings do not need to be adjusted, and RMAN can achieve the desired backup effect. However, it is important to note that the target location of the default backup is not reflected in this configuration list. By default, the target location of RMAN disk backup is the flashback recovery area. When flash_recovery_area,Oracle is installed, its default selected location is in the Oracle base directory% ORACLE_BASE%. During Oracle installation, it is recommended that you adjust to a different disk location to improve system performance.
You can check the initialization parameters db_recovery_file_dest and db_recovery_file_dest_size to view the flashback recovery area information. The default size of this area in Oracle 10g is 2G, which is raised to 4G in 11g.
SQL > show parameter db_recovery_file_dest
NAME TYPE VALUE
-
Db_recovery_file_dest string c:\ oracle\ flash_recovery_area
Db_recovery_file_dest_size big integer 2G
If the flashback recovery area does not have enough capacity, you can resize it
SQL > alter system set db_recovery_file_dest_size=4G
The advantage of storing backups in a flashback recovery area location is that RMAN can automatically manage the area, and if the flashback recovery area is full, RMAN will automatically delete outdated backups from it.
After completing the above configuration, you can use one of the following commands to complete the online backup of the database
Backup as compressed backupset incremental level 1 database plus archivelog delete all input
Manage and monitor RMAN backups
Once you have made some backups, you need to manage them, such as reporting which backups have been created, what are the contents and status of these backups, which still need to be backed up, which backups are invalid or redundant to delete, and how to delete previous backups.
1. List, validate, restore...validate, restore...preview, report, delete and crosscheck commands
The list command lists backups that have been created.
List backup summary information
RMAN > list backup summary
List all backup sets
RMAN > list backupset
You can also use the command above.
RMAN > list backup
View a single backup set
RMAN > list backupset 5
List all copies of the image
RMAN > list copy
List all database file backup sets (excluding control files, server initialization parameter files, and archive log files)
RMAN > list backup of database
List backup sets that contain control files
RMAN > list backup of controlfile
Lists backup sets that contain server initialization parameter files
RMAN > list backup of spfile
List all archive log file backup sets
RMAN > list backup of archivelog all
List the backup sets that contain archived logs with log switching series number 1000 "1050"
RMAN > list backup of archivelog from sequence 1000 until sequence 1050
List the backup sets that contain data file 1
RMAN > list backup of datafile 1
List backup sets that contain USERS tablespaces
RMAN > list backup of tablespace users
List all archive log files
RMAN > list archivelog all
To change the date and time format in the list output, set the operating system environment variable nls_date_format before starting RMAN, such as executing the command under Windows
C:\ > set nls_date_format=yyyy-mm-dd hh34:mi:ss
Validate, restore...validate, and restore...preview are used to verify the availability of the backup set and to verify and see if the required recovery content is in the backup set.
Verify the availability of backup sets
RMAN > validate backupset 20
Verify that the tablespace is in the backup set
RMAN > restore tablespace users validate
Verify that the data file is in the backup set
RMAN > restore datafile'd:\ oradata\ mes\ system01.dbf' validate
The above command can also be represented by a file number
RMAN > restore datafile 1 validate
Check whether a backup that restores the entire database exists
RMAN > restore database preview
Check to see if the backup required to restore a tablespace exists
RMAN > restore tablespace users preview
Check to see if the backup required to restore a data file exists
RMAN > restore datafile 5 preview
The report command determines which backups are needed by asking the target database according to the set retention policy.
List the data files that make up the database
RMAN > report schema
Apply a retention policy and list all data files that need at least one backup to meet the policy
RMAN > report need backup
Lists all objects that have not been backed up for a week. Using this command will ignore the configured retention policy
RMAN > report need backup days 7
List data files with less than 2 backups
RMAN > report need backup redundancy 2
List all redundant backups that are no longer needed and can be deleted according to the redundancy of the retention policy
RMAN > report obsolete
After this command, you can use the delete command to delete the redundant backups.
RMAN > delete obsolete
List expired backups with 7 days as the recovery window policy
RMAN > report obsolete recovery window of 7 days
After this command, you can use the delete command to delete the redundant backups.
RMAN > delete obsolete recovery window of 7 days
List expired backups with redundancy 2 as redundancy policy
RMAN > report obsolete redundancy 2
After this command, you can use the delete command to delete the redundant backups.
RMAN > delete obsolete redundancy 2
The delete command can also delete all backups at once or selectively delete backups.
Delete all backups
RMAN > delete backup
Delete all copies of the image
RMAN > delete copy
Delete all database file backups (excluding control files, server initialization parameter files and archive log files)
RMAN > delete backup of database
Delete control file backup
RMAN > delete backup of controlfile
Delete initialization parameter file backup
RMAN > delete backup of spfile
Delete all archive log file backups
RMAN > delete backup of archivelog all
Delete the backup set with the specified number
RMAN > delete backupset 36
Delete the specified marked backup set
RMAN > delete backupset tag TAG20151006T145256
Delete all archive log files
RMAN > delete archivelog all
The list and report commands read the information in the RMAN repository, that is, the data stored in the target database control file. It does not indicate whether the backup file actually exists physically. To confirm that the backup does exist, you need to use the cross-check crosscheck command.
Cross-check the existence of all backups
RMAN > crosscheck backup
Cross-check whether the backup of the database file exists
RMAN > crosscheck backup of database
Cross-check whether the backup of the control file exists
RMAN > crosscheck backup of controlfile
Cross-check whether the backup of the initialization parameter file exists
RMAN > crosscheck backup of spfile
Cross-check the existence of all archive log files
RMAN > crosscheck archivelog all
Cross-check the existence of backups of all archived log files
RMAN > crosscheck backup of archivelog all
Backups that do not exist are marked as expired expired in the repository, while real backups are marked as available available. Backup information marked expired can be removed from the RMAN repository by the delete expired command and will no longer be displayed in the results of the list command. Unlike the delete obsolete command, where the delete obsolete command actually deletes the file and updates the repository information, the delete expired command only updates the repository information and does not actually delete the file from disk.
Delete all expired backup information in the repository
RMAN > delete expired backup
Sometimes because we manually deleted the archive log, RMAN found that the archive was missing and could not perform the backup. At this point, you can apply the cross-check command to first check the missing archive log file.
RMAN > crosscheck archivelog all
Then delete expired archive log records from the RMAN repository
RMAN > delete expired archivelog all
After that, you can perform a normal backup.
2. Dynamic performance view of RMAN backup
To be more flexible in querying RMAN backup information and developing your own reports instead of relying on RMAN's list command, you can use the following views
V$backup_files:
Backup file information (including data files, control files, SPFILE, archive log files) is also recorded in unbacked up archive logs, which do not have a backup set number.
Col backup_type for a20
Col file_type for a20
Col fname for a100
Col tag for a30
Col df_tablespace for a20
Select bs_key, backup_type, file_type, status, fname, tag, obsolete, bytes, bs_completion_time, df_tablespace, df_file#, rl_sequence# from v$backup_files
BS_KEY BACKUP_TYPE FILE_TYPE STATUS FNAME TAG OBSOLETE BYTES BS_COMPLETION_TIME DF_TABLESPACE DF_FILE# RL_SEQUENCE#
- -
1 BACKUP SET ARCHIVED LOG YES 11453440 2016-12-3 23:01:40 157
1 BACKUP SET ARCHIVED LOG YES 2435072 2016-12-3 23:01:40 158
1 BACKUPSET PIECE AVAILABLE D:\ FLASH_RECOVERY_AREA\ MES\ BACKUPSET\ 2016 / 12 / 03\ O1_MF_ANNNN_TAG20161203T230138_D45QLN48_.BKP TAG20161203T230138 YES 5046272 23:01:40 on 2016-12-3
2 BACKUP SET DATAFILE D:\ ORADATA\ MES\ INDX01.DBF NO 657506304 2016-12-3 23:03:03 INDX 7
2 BACKUP SET DATAFILE D:\ ORADATA\ MES\ RMES01.DBF NO 772112384 2016-12-3 23:03:03 RMES 6
2 BACKUP SET DATAFILE D:\ ORADATA\ MES\ RMES02.DBF NO 741302272 2016-12-3 23:03:03 RMES 9
2 BACKUP SET DATAFILE D:\ ORADATA\ MES\ SYSTEM01.DBF NO 410411008 2016-12-3 23:03:03 SYSTEM 1
2 BACKUP SET DATAFILE D:\ ORADATA\ MES\ HMES01.DBF NO 188416 2016-12-3 23:03:03 HMES 8
2 BACKUP SET DATAFILE D:\ ORADATA\ MES\ SYSAUX01.DBF NO 216842240 2016-12-3 23:03:03 SYSAUX 3
2 BACKUP SET DATAFILE D:\ ORADATA\ MES\ CMES01.DBF NO 15392768 2016-12-3 23:03:03 CMES 5
2 BACKUP SET DATAFILE D:\ ORADATA\ MES\ UNDOTBS01.DBF NO 88473600 2016-12-3 23:03:03 UNDOTBS1 2
2 BACKUP SET DATAFILE D:\ ORADATA\ MES\ USERS01.DBF NO 614400 2016-12-3 23:03:03 USERS 4
2 BACKUP SET DATAFILE D:\ ORADATA\ MES\ INDX02.DBF NO 581894144 2016-12-3 23:03:03 INDX 10
2 BACKUPSET PIECE AVAILABLE D:\ FLASH_RECOVERY_AREA\ MES\ BACKUPSET\ 2016 / 12 / 03\ O1_MF_NNND1_TAG20161203T230141_D45QLOYK_.BKP TAG20161203T230141 NO 596959232 23:03:03 on 2016-12-3
3 BACKUP SET ARCHIVED LOG NO 609280 2016-12-3 23:03:09 159
3 BACKUPSET PIECE AVAILABLE D:\ FLASH_RECOVERY_AREA\ MES\ BACKUPSET\ 2016 / 12 / 03\ O1_MF_ANNNN_TAG20161203T230308_D45QOFDJ_.BKP TAG20161203T230308 NO 610816 23:03:09 on 2016-12-3
COPY ARCHIVED LOG AVAILABLE D:\ FLASH_RECOVERY_AREA\ MES\ ARCHIVELOG\ 2016 December 04\ O1_MF_1_160_D46WLOPT_.ARC NO 1951232 160
4 BACKUP SET SPFILE NO 2 2016-12-3 23:03:10
4 BACKUP SET CONTROLFILE NO 7045120 2016-12-3 23:03:10 0
4 BACKUP SET PIECE AVAILABLE D:\ FLASH_RECOVERY_AREA\ MES\ AUTOBACKUP\ 2016 / 12 / 03\ O1_MF_S_929660590_D45QOGRN_.BKP TAG20161203T230310 NO 7127040 23:03:10 on 2016-12-3
View image copy backup
Select backup_type, file_type, status, fname, tag, obsolete, bytes, df_tablespace, df_file# from v$backup_files where backup_type = 'COPY'
BACKUP_TYPE FILE_TYPE STATUS FNAME TAG OBS BYTES DF_TABLESPACE DF_FILE#
COPY DATAFILE AVAILABLE E:\ FLASH_RECOVERY_AREA\ MES\ BACKUPSET\ MES_06RMUTNJ_1_20161208 INC_COPY NO 503316480 SYSTEM 1
COPY DATAFILE AVAILABLE E:\ FLASH_RECOVERY_AREA\ MES\ BACKUPSET\ MES_07RMUTOD_1_20161208 INC_COPY NO 283115520 SYSAUX 3
COPY DATAFILE AVAILABLE E:\ FLASH_RECOVERY_AREA\ MES\ BACKUPSET\ MES_08RMUTOS_1_20161208 INC_COPY NO 26214400 UNDOTBS1 2
COPY DATAFILE AVAILABLE E:\ FLASH_RECOVERY_AREA\ MES\ BACKUPSET\ MES_09RMUTOV_1_20161208 INC_COPY NO 5242880 USERS 4
Query archive logs that have not yet been backed up
Col fname for a100
Select rl_sequence#, fname, status, completion_time, obsolete from v$backup_files where backup_type = 'COPY' and file_type =' ARCHIVED LOG'
RL_SEQUENCE# FNAME STATUS COMPLETION_TIME OBSOLETE
160D:\ FLASH_RECOVERY_AREA\ MES\ ARCHIVELOG\ 2016 December 04\ O1_MF_1_160_D46WLOPT_.ARC AVAILABLE 9:33 on 2016-12-4: NO
Query the backup information contained by the backup file name
Col backup_type for a15
Col file_type for a15
Col fname for a100
Col bs_incr_type for a15
Col df_tablespace for a15
Select backup_type, file_type, fname, tag, completion_time, compressed, obsolete, bs_incr_type, df_file#, df_tablespace from v$backup_files where stamp = (select stamp from v$backup_files where fname like'% O1 / MFNND1 / TAG20161204T145847 / D47HO8HL%')
BACKUP_TYPE FILE_TYPE FNAME TAG COMPLETION_TIME COMPRESSED OBSOLETE BS_INCR_TYPE DF_FILE# DF_TABLESPACE
-
BACKUP SET DATAFILE D:\ ORADATA\ MES\ INDX01.DBF NO INCR1 7 INDX
BACKUP SET DATAFILE D:\ ORADATA\ MES\ USERS01.DBF NO INCR1 4 USERS
BACKUP SET DATAFILE D:\ ORADATA\ MES\ RMES01.DBF NO INCR1 6 RMES
BACKUP SET DATAFILE D:\ ORADATA\ MES\ RMES02.DBF NO INCR1 9 RMES
BACKUP SET DATAFILE D:\ ORADATA\ MES\ INDX02.DBF NO INCR1 10 INDX
BACKUP SET DATAFILE D:\ ORADATA\ MES\ HMES01.DBF NO INCR1 8 HMES
BACKUP SET DATAFILE D:\ ORADATA\ MES\ CMES01.DBF NO INCR1 5 CMES
BACKUPSET PIECE D:\ FLASH_RECOVERY_AREA\ MES\ BACKUPSET\ 2016 December 04\ O1_MF_NNND1_TAG20161204T145847_D47HO8HL_.BKP TAG20161204T145847 14:58 on 2016-12-4 YES NO INCR1
The query belongs to an abandoned backup according to the retention policy.
Col fname for a100
Select fname, tag from v$backup_files where file_type='PIECE' and obsolete='YES'
FNAME TAG
D:\ FLASH_RECOVERY_AREA\ MES\ BACKUPSET\ 2016 / 12 / 03\ O1_MF_ANNNN_TAG20161203T230138_D45QLN48_.BKP TAG20161203T230138
D:\ FLASH_RECOVERY_AREA\ MES\ AUTOBACKUP\ 2016 / 12 / 03\ O1_MF_S_929660590_D45QOGRN_.BKP TAG20161203T230310
D:\ FLASH_RECOVERY_AREA\ MES\ AUTOBACKUP\ 2016 / 12 / 04\ O1_MF_S_929717936_D47HOJO1_.BKP TAG20161204T145856
D:\ FLASH_RECOVERY_AREA\ MES\ AUTOBACKUP\ 2016 / 12 / 04\ O1_MF_S_929739489_D484Q18P_.BKP TAG20161204T205809
D:\ FLASH_RECOVERY_AREA\ MES\ AUTOBACKUP\ 2016 / 12 / 04\ O1_MF_S_929743942_D48926C1_.BKP TAG20161204T221222
D:\ FLASH_RECOVERY_AREA\ MES\ AUTOBACKUP\ 2016 / 12 / 04\ O1_MF_S_929743973_D489355M_.BKP TAG20161204T221253
D:\ FLASH_RECOVERY_AREA\ MES\ AUTOBACKUP\ 2016 / 12 / 04\ O1_MF_S_929743988_D4893NW7_.BKP TAG20161204T221308
V$backup_set:
One row of information for each backup set, which can be queried in federation with the view v$backup_files.
Col backup type for A10
Col file name for A100
Col tag for A20
Col file type for A20
Col backup content for A20
Col Increment Type for A10
Select bf.bs_key keyword
Bf.backup_type backup Typ
Bf.fname file name
Bf.tag marker
Bf.bytes file size
Bf.status statu
Bf.bs_type backup content
Bf.bs_incr_type increment type
Bs.controlfile_included control file
Bf.compressed compressed backup
Bf.obsolete redundant backup
-- bs.multi_section multi-segment backup
Bf.keep archive backup
Bf.keep_options Archive option
Bf.keep_until expiration time
Bs.start_time start time
Bs.completion_time completion time
Bs.elapsed_seconds takes time
From v$backup_files bf, v$backup_set bs
Where bf.bs_key = bs.recid
And bf.file_type = 'PIECE'
Keyword backup type file name mark file size status backup content increment type control file compression backup redundant backup archive backup archive option expiration time start time finish time
-- --
1 BACKUPSET D:\ FLASH_RECOVERY_AREA\ MES\ BACKUPSET\ 2016 December 03\ O1_MF_ANNNN_TAG20161203T230138_D45QLN48_.BKP TAG20161203T230138 5046272 AVAILABLE ARCHIVED LOG FULL NO YES YES NO 2016-12-3 2 2016-12-3 2 1
2 BACKUPSET D:\ FLASH_RECOVERY_AREA\ MES\ BACKUPSET\ 2016 December 03\ O1_MF_NNND1_TAG20161203T230141_D45QLOYK_.BKP TAG20161203T230141 596959232 AVAILABLE DATAFILE INCR1 NO YES NO NO 2016-12-3 2 2016-12-3 2 82
3 BACKUPSET D:\ FLASH_RECOVERY_AREA\ MES\ BACKUPSET\ 2016 December 03\ O1_MF_ANNNN_TAG20161203T230308_D45QOFDJ_.BKP TAG20161203T230308 610816 AVAILABLE ARCHIVED LOG FULL NO YES NO NO 2016-12-3 2 2016-12-3 2 1
4 BACKUP SET D:\ FLASH_RECOVERY_AREA\ MES\ AUTOBACKUP\ 2016 December 03\ O1_MF_S_929660590_D45QOGRN_.BKP TAG20161203T230310 7127040 AVAILABLE DATAFILE FULL YES NO NO NO 2016-12-3 2 2016-12-3 20
V$backup_piece:
One line of information for each backup, which also contains deleted backups.
Col handle for a100
Select recid, handle, tag, status, start_time, completion_time, elapsed_seconds, deleted, bytes, is_recovery_dest_file, compressed from v$backup_piece
RECID HANDLE TAG STATUS START_TIME COMPLETION_TIME ELAPSED_SECONDS DELETED BYTES IS_RECOVERY_DEST_FILE COMPRESSED
-
1 D:\ FLASH_RECOVERY_AREA\ MES\ BACKUPSET\ 2016 / 12 / 03\ O1_MF_ANNNN_TAG20161203T230138_D45QLN48_.BKP TAG20161203T230138 A 2016-12-3 2 2016-12-3 23:01 0 NO 5046272 YES YES
2 D:\ FLASH_RECOVERY_AREA\ MES\ BACKUPSET\ 2016 December 03\ O1_MF_NNND1_TAG20161203T230141_D45QLOYK_.BKP TAG20161203T230141 A 2016-12-3 2 2016-12-3 23:03 82 NO 596959232 YES YES
3 D:\ FLASH_RECOVERY_AREA\ MES\ BACKUPSET\ 2016 / 12 / 03\ O1_MF_ANNNN_TAG20161203T230308_D45QOFDJ_.BKP TAG20161203T230308 A 2016-12-3 2 2016-12-3 23:03 0 NO 610816 YES YES
4 D:\ FLASH_RECOVERY_AREA\ MES\ AUTOBACKUP\ 2016 / 12 / 03\ O1_MF_S_929660590_D45QOGRN_.BKP TAG20161203T230310 A 2016-12-3 2 2016-12-3 23:03 0 NO 7127040 YES NO
V$backup_piece_details:
Backup slice details can be combined with v$backup_piece query.
Col handle for a100
Col size_bytes_display for a10
Select t1.recid
T1.handle
T1.tag
T1.status
T1.start_time
T1.completion_time
T1.elapsed_seconds
T1.deleted
T1.bytes
T1.is_recovery_dest_file
T1.compressed
T2.size_bytes_display
From v$backup_piece T1 join v$backup_piece_details T2 on (t1.recid = t2.recid)
RECID HANDLE TAG STATUS START_TIME COMPLETION_TIME ELAPSED_SECONDS DELETED BYTES IS_RECOVERY_DEST_FILE COMPRESSED SIZE_BYTES
--
4 D:\ FLASH_RECOVERY_AREA\ MES\ AUTOBACKUP\ 2016 / 12 / 03\ O1_MF_S_929660590_D45QOGRN_.BKP TAG20161203T230310 A 2016-12-3 2 2016-12-3 23:03 0 NO 7127040 YES NO 6.80m
1 D:\ FLASH_RECOVERY_AREA\ MES\ BACKUPSET\ 2016 / 12 / 03\ O1_MF_ANNNN_TAG20161203T230138_D45QLN48_.BKP TAG20161203T230138 A 2016-12-3 2 2016-12-3 23:01 0 NO 5046272 YES YES 4.81m
2 D:\ FLASH_RECOVERY_AREA\ MES\ BACKUPSET\ 2016 December 03\ O1_MF_NNND1_TAG20161203T230141_D45QLOYK_.BKP TAG20161203T230141 A 2016-12-3 2 2016-12-3 23:03 82 NO 596959232 YES YES 569.30M
3 D:\ FLASH_RECOVERY_AREA\ MES\ BACKUPSET\ 2016 / 12 / 03\ O1_MF_ANNNN_TAG20161203T230308_D45QOFDJ_.BKP TAG20161203T230308 A 2016-12-3 2 2016-12-3 23:03 0 NO 610816 YES YES 596.50K
V$backup_redolog:
Archive log backup information, which can be queried jointly with the view v$backup_files.
Col bs_tag for a20
Select t1.sequence#
T2.bs_tag
T1.resetlogs_change#
T1.resetlogs_time
T1.first_change#
T1.first_time
T1.next_change#
T1.next_time
T2.keep
T2.obsolete
T2.bs_status
T2.bs_bytes
T2.bs_compressed
From v$backup_redolog t1
Join v$backup_files T2 on (t1.sequence# = t2.rl_sequence#)
SEQUENCE# BS_TAG RESETLOGS_CHANGE# RESETLOGS_TIME FIRST_CHANGE# FIRST_TIME NEXT_CHANGE# NEXT_TIME KEEP OBSOLETE BS_STATUS BS_BYTES BS_COMPRESSED
- -
157 TAG20161203T230138 602121 2016-10-31 22: 3949968 2016-12-3 1 3980863 2016-12-3 2 NO YES AVAILABLE 5046272 YES
158 TAG20161203T230138 602121 2016-10-31 22: 3980863 2016-12-3 2 3982037 2016-12-3 2 NO YES AVAILABLE 5046272 YES
159 TAG20161203T230308 602121 2016-10-31 22: 3982037 2016-12-3 2 3982215 2016-12-3 2 NO NO AVAILABLE 610816 YES
V$backup_spfile:
Backed up spfile and controlfile information.
Col fname for a100
Select t.backup_type, t.file_type, t.status, t.fname, t.tag, t.completion_time, t.obsolete, t.bs_bytes from v$backup_files t where t.stamp in (select stamp from v$backup_spfile)
BACKUP_TYPE FILE_TYPE STATUS FNAME TAG COMPLETION_TIME OBSOLETE BS_BYTES
-
BACKUP SET SPFILE NO 7127040
BACKUP SET CONTROLFILE NO 7127040
BACKUP SET PIECE AVAILABLE D:\ FLASH_RECOVERY_AREA\ MES\ AUTOBACKUP\ 2016 December 03\ O1_MF_S_929660590_D45QOGRN_.BKP TAG20161203T230310 2016-12-3 23:03 NO 7127040
V$backup_datafile:
Each line of information made up of data file backups.
Col name for a50
Col read_radio for a10
Select t1.Fileframes, t2.name, t1.datafile_blocks, t1.blocks_read, to_char (round (t1.blocks_read / t1.datafile_blocks, 2) * 100) | |'% 'read_radio, t1.completion_time
From v$backup_datafile T1 join v$datafile T2 on (t1.file# = t2.file#) order by file#, completion_time
FILE# NAME DATAFILE_BLOCKS BLOCKS_READ READ_RADIO COMPLETION_TIME
-
1 D:\ ORADATA\ MES\ SYSTEM01.DBF 65280 65280 2016-12-03 23:02:39
1 D:\ ORADATA\ MES\ SYSTEM01.DBF 65280 1895 3% 2016-12-04 14:58:49
1 D:\ ORADATA\ MES\ SYSTEM01.DBF 65280 1135 2% 2016-12-04 20:58:03
2 D:\ ORADATA\ MES\ UNDOTBS01.DBF 10880 10880 2016-12-03 23:02:03
2 D:\ ORADATA\ MES\ UNDOTBS01.DBF 10880 1983 18% 2016-12-04 14:58:49
2 D:\ ORADATA\ MES\ UNDOTBS01.DBF 10880 679 6% 2016-12-04 20:58:03
3 D:\ ORADATA\ MES\ SYSAUX01.DBF 38400 38400 2016-12-03 23:02:16
3 D:\ ORADATA\ MES\ SYSAUX01.DBF 38400 5815 2016-12-04 14:58:49
3 D:\ ORADATA\ MES\ SYSAUX01.DBF 38400 3467 9% 2016-12-04 20:58:03
4 D:\ ORADATA\ MES\ USERS01.DBF 640 640 100% 2016-12-03 23:02:03
4 D:\ ORADATA\ MES\ USERS01.DBF 640 10% 2016-12-04 14:58:48
4 D:\ ORADATA\ MES\ USERS01.DBF 640 255 40% 2016-12-04 20:58:03
5 D:\ ORADATA\ MES\ CMES01.DBF 12800 12800 2016-12-03 23:01:52
5 D:\ ORADATA\ MES\ CMES01.DBF 12800 10% 2016-12-04 14:58:48
5 D:\ ORADATA\ MES\ CMES01.DBF 12800 10% 2016-12-04 20:58:03
6 D:\ ORADATA\ MES\ RMES01.DBF 131072 131072 2016-12-03 23:03:03
6 D:\ ORADATA\ MES\ RMES01.DBF 131072 9% 2016-12-04 14:58:48
6 D:\ ORADATA\ MES\ RMES01.DBF 131072 13 2016-12-04 20:58:03
7 D:\ ORADATA\ MES\ INDX01.DBF 131072 131072 2016-12-03 23:03:03
7 D:\ ORADATA\ MES\ INDX01.DBF 131072 10% 2016-12-04 14:58:48
7 D:\ ORADATA\ MES\ INDX01.DBF 131072 10% 2016-12-04 20:58:03
8 D:\ ORADATA\ MES\ HMES01.DBF 64000 64000 2016-12-03 23:02:38
8 D:\ ORADATA\ MES\ HMES01.DBF 64000 10% 2016-12-04 14:58:48
8 D:\ ORADATA\ MES\ HMES01.DBF 64000 10% 2016-12-04 20:58:03
9 D:\ ORADATA\ MES\ RMES02.DBF 131072 131072 2016-12-03 23:03:03
9 D:\ ORADATA\ MES\ RMES02.DBF 131072 10% 2016-12-04 14:58:48
9 D:\ ORADATA\ MES\ RMES02.DBF 131072 10% 2016-12-04 20:58:03
10 D:\ ORADATA\ MES\ INDX02.DBF 131072 131072 2016-12-03 23:03:03
10 D:\ ORADATA\ MES\ INDX02.DBF 131072 10% 2016-12-04 14:58:48
10 D:\ ORADATA\ MES\ INDX02.DBF 131072 10% 2016-12-04 20:58:03
V$backup_device:
For tape backup, displays the name of the SBT device that is connected to the RMAN.
Select * from v$backup_device
DEVICE_TYPE DEVICE_NAME
SBT_TAPE
V$rman_configuration:
RMAN non-default backup configuration information.
Col name for a50
Col value for a80
Select * from v$rman_configuration
CONF# NAME VALUE
--
1 CONTROLFILE AUTOBACKUP ON
2 CHANNEL DEVICE TYPE DISK FORMAT'd:\ flash_recovery_area\ mes\ backupset\% dudes% upland% cations% T'
3 CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO'd:\ flash_recovery_area\ mes\ autobackup\% F'
Thank you for reading! This is the end of this article on "how to use RMAN backup database". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!
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.