13 Dec Do you know how your Oracle RMAN backup works?
Recovery Manager or better known as RMAN, is an Oracle client utility that is installed with the Enterprise or Standard edition, you can also find it with the Admin option when installing the Oracle Client.
In it’s most basic form, the RMAN client connects, an it needs to be with a “sysdba” privileged user, to the database that is being backed up, called a TARGET database, this client, is an executable that is normally found in $ORACLE_HOME/bin.
By being a client side utility, it allows you to use one RMAN executable version to backup current and previous versions of the Oracle Database, there are some restrictions to this though, which can be verified in MOS document RMAN Compatibility Matrix [ID 73431.1].
This RMAN executable uses a file called recover.bsq , this file is located in $ORACLE_HOME/rdbms/admin , basically what the executable does, is to interpret the commands you give it , direct server sessions to execute those commands, and record its activity in the TARGET database control file that is being backed up.
There are two main SYS packages that do the work of backup and recovery, which are DBMS_RCVMAN, this has the procedures which list your database incarnations, the set until time recovery window, list your backups, to name a few, and DBMS_BACKUP_RESTORE , which as you might have guessed is the one who does the backup and recovery operations, like create the control file snapshot , backup the datafiles , backup the spfile to name some.
As mentioned above, the way that the RMAN client directs the server sessions to execute the commands are through channels , a channel represents one stream of data to a device, and corresponds to one database server session. The channel reads data into PGA memory, processes it, and writes it to the output device.
- Read Phase
A channel reads blocks from disk into input I/O buffers. The allocation of these buffers depend on the number of datafiles being read simultaneously from disk and written to the same backup piece. One way to control the numbers of files is the backup parameter FILESPERSET
- Copy Phase
A channel copies blocks from input buffers to output buffers and performs additional processing on the blocks, like the validation of the data blocks, as it verifies that it’s not backing up corrupt data blocks, it’s also the phase where it does the binary compression and the backup encryption
- Write Phase
A channel writes the blocks from output buffers to storage media. The write phase can be either to SBT or to disk, and these are mutually exclusive, meaning you write to one or the other, not both.
Once the backup finishes, you can search the trace file and see what it is actually doing, here is an example of the RCVMAN fetching the incarnation information:
Below you can see the RPC calls being done by DBMS_BACKUP_RESTORE and the IO information by the INPUT buffers and the OUTPUT buffers.
I hope this helps you understand more how your backup works, and this is just the super condensed version, there is a lot of information missing, like how RMAN allocates the IN and OUT buffers, or how the disk writes are differentiated from the SBT writes, so go out there and see it yourself.
Also some of the information for this entry came from these two great books: