Documente Academic
Documente Profesional
Documente Cultură
This paper discusses how RMAN can be used to update a transported tablespace with an
incremental backup. Saravanan Shanmugam is an
Oracle Certified Master and was
the lead DBA and primary
Before detailing the incrementally updated transportable tablespace procedure, standard database architect for the work on
transportable tablespaces will first be discussed. Complete details of the transportable which this paper is based.
tablespace procedure are documented in the Oracle Database Administrator’s Guide.
Source
Target Database
Database
Plugged-in
Tablespace tablespace
Changed Changed
Blocks Blocks
Subsequent
Copies
Before starting the incrementally updated transportable tablespace process, it is recommended to perform a one-time setup of
block change tracking on the source database.
Block change tracking speeds up incremental backups by only reading and backing up changed blocks versus reading the
entire datafile for changed blocks. This is accomplished by indicating which blocks have changed in a small bitmap file
(change tracking file), as data changes occur. Upon an incremental backup, the file is read to locate just the changed blocks,
and only those blocks are backed up.
For example, the following SQL command will enable block change tracking:
> alter database enable block change tracking using file
'/prepsp_0006/appl/oracle/prepsp/block_change_file';
Recovery Catalog
RMAN backup metadata is always written to the controlfile on backup operations; however, these records can age out based
on the control_file_record_keep_time init.ora parameter (defaults to 7 days). Therefore, a recovery catalog is
recommended for keeping an extended history of all RMAN backups, past the control_file_record_keep_time. For
example, this is needed if the transportable tablespace procedure is run on a quarterly or monthly basis, since incremental
backups will be taken relative to the full image copy that was created last quarter or month. Refer to the Oracle Backup and
Recovery Advanced User’s Guide for the steps on creating a recovery catalog.
Make an image copy backup of the datafiles to the NFS mounted filesystem /prepsp_0006, with the following RMAN
script:
run {
allocate channel d1 device type disk format
'/prepsp_0006/appl/oracle/prepsp/db1.dbf';# See Note 2
allocate channel d2 device type disk format
'/prepsp_0006/appl/oracle/prepsp/db2.dbf';
BACKUP INCREMENTAL LEVEL 1 TAG "TEST9_BACKUP" for
recover of copy with tag "TEST9_BACKUP"
tablespace test1; # See Note 3
}
In this example, the import script should be run with datafiles pointing to datafiles in
/prepsp_0006/appl/oracle/prepsp on the destination database.
3. When the transported tablespace needs to be incrementally updated (e.g. on quarterly or monthly basis), first drop the
tablespace in the destination database with ‘drop tablespace <tbs name> including contents’. As
mentioned previously, only tablespace metadata will be dropped, and physical datafiles will remain intact for use in next
step.
4. If a new datafile was added to the source database since the last incremental update, run the following script to make an
initial image copy in the destination database filesystem (for example, if the new datafile number is ‘3’).
First, place the tablespace TEST1 in read-only mode:
alter tablespace test1 read only;
run {
allocate channel d1 device type disk format
'/prepsp_0006/appl/oracle/prepsp/db3.dbf';
BACKUP INCREMENTAL LEVEL 1 TAG "TEST9_BACKUP" for
recover of copy with tag "TEST9_BACKUP"
datafile 3; # See Note 5
}
Note 5: Even though this is an ‘incremental level 1’ command, since there is no existing incremental level 0 of the
datafile, an incremental level 0 of the datafile will instead be created.
5. Perform an incremental backup and merge it with the datafiles in the destination database filesystem, thereby creating a
new set of datafiles, with the following script.
Place the tablespace TEST1 in read-only mode (if step 4 was not performed):
alter tablespace test1 read only;
run {
allocate channel d1 device type disk format
'/prepsp_0005/appl/oracle/prepsp/db1%t.dbf';# See
Note 6
allocate channel d2 device type disk format
'/prepsp_0005/appl/oracle/prepsp/db2%t.dbf';
BACKUP INCREMENTAL LEVEL 1 TAG "TEST9_BACKUP" for
recover of copy with tag "TEST9_BACKUP" tablespace
test1; # create new incremental backup
recover copy of tablespace test1 with TAG
"TEST9_BACKUP"; # merge latest incremental with
existing image copy
After script finishes, tablespace TEST1 can be put back into read-write mode.
Note 6: A different mount point (/prepsp_0005) is used in this example so that the incremental backups can be created
in a different mount point, separate from the target datafiles location.
6. Plug the new datafiles into the destination database.
> impdp readonly/readonly DIRECTORY=exp_dir
NETWORK_LINK=dtest2.world
TRANSPORT_TABLESPACES=test1 TRANSPORT_FULL_CHECK=n
TRANSPORT_DATAFILES='/prepsp_0006/appl/oracle/prepsp/db1.dbf','/prepsp_0006/appl/o
racle/prepsp/db2.dbf'
Benefits
Some of the benefits with this approach are as follows:
1. Creating the incremental backup used to roll forward the datafiles takes much less time than copying the whole datafiles.
For example, this is very useful in data warehouse environments where last month’s data is added to the existing year’s
worth of read-only data. Copying datafiles for the year’s worth of data, each time a monthly tablespace transport is
needed, would consume an excessive amount of time.
2. Since NFS-mounted filesystems are used in this method, tablespaces can also be transferred between database servers in
physically different locations or cities.
3. This procedure, which operates at the datafile level, has certain advantages over hardware-based copy methods.
Hardware-based methods typically work at the storage unit of a volume group, which means that datafiles belonging to
other tablespaces should not be placed in the same volume group as the tablespaces to be transported. This can result in
inefficient space usage in the volume group. For example, in our environment, volume groups have a size of 400 GB and
if the tablespace size is only 100 GB, then 300 GB is essentially wasted space.
Restrictions
The following restrictions apply:
1. The tablespace transported to the destination database should always be in read-only mode.
2. OMF-style format string cannot be used to make initial image copies (see Note 2 above). The only exception is in the
case of a newly added datafile to the existing tablespace.