How to create a Data Protector RMAN template to backup Oracle 10g.................................................... 19
Oracle 9i configuration without a recovery catalog............................................................................ 21
For more information.......................................................................................................................... 24
Page 2
Abstract
The purpose of this document is to describe the necessary steps to modify Oracle Backup
Specifications within Data Protector to support deduplication in the VLS.
Introduction
In order to perform deduplication of Oracle RMAN Database backups on the HP StorageWorks
Virtual Library System (VLS), specific configuration steps are required. The VLS depends on a specific
naming for Oracle objects being backed up. This is important to the VLS to be able to identify
identical objects of different backup sessions to do deduplication on them. The document describes
how to accomplish this by modifying HP Data Protector backup specifications to support Oracle.
Background section describes this specific naming convention for the Oracle objects.
The
Oracle 10g configuration section describes the required modifications that are necessary for
The
Oracle 10g RMAN backups.
Oracle 9i configuration section describes special modifications that are necessary for Oracle 9i.
The
Background
To identify related Oracle objects the VLS uses a specific Oracle RMAN string format. This format can
be seen in the middle column below. The left column shows the default HP Data Protector settings. The
backup must include the controlfile backup, and therefore, two more configurations have to be used
as else errors will occur during the backup session.
HP Data Protector default Necessary VLS configuration Comments
NA. CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP
FORMAT FOR DEVICE TYPE 'SBT_TAPE' TO '%F';
This section describes how to set up a new backup specification or modifying already existing backup
specifications in order to support deduplication of Oracle 10g on a HP VLS system.
Creating a backup specification
This section explains the basic steps to create an Oracle backup specification from scratch.
Select the Backup context in the Data Protector GUI and create a new Oracle backup specification by
right clicking “Oracle Server” and selecting “Add Backup….”
Figure 1:
It is recommended to use a special Oracle deduplication template when creating the backup
specification. A lot of configuration steps are not needed then. This will minimize the effort if you have
to create many backup specifications. See the
backup Oracle 10g
Select the Deduplication template and click OK.
sub-section on how to create this template.
How to create a Data Protector RMAN template to
3
Page 4
Figure 2:
Select the Oracle instance you want to backup in the next screen and enter its credentials. Then select
the databases you want to backup.
Figure 3:
4
Page 5
Select the VLS device you want to write the backup to and click next until you can save the
backup specification.
Figure 4:
It is not required to perform all of the configuration steps if you have used a preconfigured
template. By using a template as explained in the
backup Oracle 10g
sub-section, you only need to adjust the control file format string as explained in
How to create a Data Protector RMAN template to
the next section. If you use a default Data Protector template, you have to adjust all settings as
explained in the next section.
5
Page 6
Modifying existing backup specifications
Select the Backup context in the Data Protector GUI and select the Oracle backup specification you
want to configure for deduplication. Switch to Options tab:
Figure 5:
6
Page 7
Click the Application Specific Options:
Figure 6:
Click Edit to open the RMAN Script for modification:
Figure 7:
7
Page 8
A typical default RMAN Script is shown below:
run {
allocate channel 'dev_0' type 'sbt_tape'
parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=oracle backup
specification)';
allocate channel 'dev_1' type 'sbt_tape'
parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=oracle backup
specification)';
allocate channel 'dev_2' type 'sbt_tape'
parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=oracle backup
specification)';
allocate channel 'dev_3' type 'sbt_tape'
parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=oracle backup
specification)';
backup incremental level <incr_level>
format 'oracle backup specification<ORACL_%s:%t:%p>.dbf'
database;
sql 'alter system archive log current';
backup
format 'oracle backup specification<ORACL_%s:%t:%p>.dbf'
archivelog all;
backup
format 'oracle backup specification<ORACL_%s:%t:%p>.dbf'
current controlfile;
}
Four channels are allocated and three backup statements are configured (database, archivelog, and
controlfile). In order to enable deduplication the format specifications for database, archivelog, and
controlfile have to be modified. The modification is shown below (red):
…
backup incremental level <incr_level>
format 'oracle backup specification<ORACL_%s:%t:%p:%f>.df'
database;
sql 'alter system archive log current';
backup
format 'oracle backup specification<ORACL_%s:%t:%p>.al'
archivelog all;
backup
format 'oracle backup specification<ORACL_%s:%t:%p:%f>.cntrl'
current controlfile;
}
Changes:
Format for database - add “:%f” to the % parameter list
- Change ending .dbf Æ .df
Format for archivelog - Change ending .dbf Æ .al
Format for controlfile - add ”:%f” to the % parameter list
- Change ending .dbf Æ .cntrl
8
Page 9
It is important that the % parameters are configured in exactly this sequence using exactly these
separators:
<DB_NAME_%s:%t:%p:%f>.EXTENSION
• DB_NAME: ORACL in the example above.
• %f is not available for archivelog.
• EXTENSION: .df (for data files), .al (for archive logs) or .cntrl (for
the controlfile)
The backup must include the controlfile backup. This can be configured within Oracle RMAN configuration
as a default option or by adding the following two RMAN statements right at the beginning:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE 'SBT_TAPE'
TO '%F';
Note:
It is mandatory to enable the auto backup of the controlfile. If not enabled,
Oracle will automatically include the SPFILE in the backup which leads to a
format error as the “%f” parameter is not supported for the SPFILE.
See below the complete script:
run {
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE 'SBT_TAPE' TO
'%F';
allocate channel 'dev_0' type 'sbt_tape'
parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=oracle backup
specification)';
allocate channel 'dev_1' type 'sbt_tape'
parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=oracle backup
specification)';
allocate channel 'dev_2' type 'sbt_tape'
parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=oracle backup
specification)';
allocate channel 'dev_3' type 'sbt_tape'
parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=oracle backup
specification)';
backup incremental level <incr_level>
format 'oracle backup specification<ORACL_%s:%t:%p:%f>.df'
database;
sql 'alter system archive log current';
backup
format 'oracle backup specification<ORACL_%s:%t:%p>.al'
archivelog all;
backup
format 'oracle backup specification<ORACL_%s:%t:%p:%f>.cntrl'
current controlfile;
}
9
Page 10
Oracle 9i configuration
The %f format parameter was introduced in Oracle 10g. It is not available in Oracle 9i. This parameter
is required though to support deduplication as explained in the previous section. Therefore, it has to be
hard coded. The following sub-sections explain how to find out the right values to replace the %f.
Configuration in HP Data Protector
The following examples show how to do the required modifications using an existing backup
specification created by a blank backup template. The deduplication template for Oracle 10g should
not be used.
Open the RMAN script in the Data Protector GUI
The following examples assume that a recovery catalog for the target database is available and
already configured for the backup specification (see Configure Oracle dialog). The configuration of a
recovery catalog for the target database is required to store local or global RMAN scripts in the
recovery catalog.
Select the Oracle backup specification you want to configure for deduplication. Select the Source tab,
right click on the database server and select “Configure”
Figure 8:
10
Page 11
Switch to the “Catalog” tab and check that “Use recovery catalog” is correctly configured similar to
the example below.
Figure 9:
It is recommended to use a recovery catalog for this configuration. In case no recovery catalog is
available at all, please refer to the
Oracle 9i configuration without a recovery catalog sub-section.
Close the Configure Oracle dialog and switch to the Options tab:
Figure 10:
11
Page 12
Click the Application Specific Options:
Figure 11:
Click Edit to open the RMAN Script for modification:
Figure 12:
12
Page 13
A typical default RMAN Script is shown below:
run {
allocate channel 'dev_0' type 'sbt_tape'
parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=oracle backup
specification)';
allocate channel 'dev_1' type 'sbt_tape'
parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=oracle backup
specification)';
allocate channel 'dev_2' type 'sbt_tape'
parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=oracle backup
specification)';
allocate channel 'dev_3' type 'sbt_tape'
parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=oracle backup
specification)';
backup incremental level <incr_level>
format 'oracle backup specification<ORACL_%s:%t:%p>.dbf'
database;
sql 'alter system archive log current';
backup
format 'oracle backup specification<ORACL_%s:%t:%p>.dbf'
archivelog all;
backup
format 'oracle backup specification<ORACL_%s:%t:%p>.dbf'
current controlfile;
}
Four channels are allocated and three backup statements are configured (database, archivelog, and
controlfile).
Modify the archive log and control file backup statements
In order to enable deduplication, the format specifications for archivelog and controlfile have to be
modified. The modification is shown below (red):
…
backup incremental level <incr_level>
format 'oracle backup specification<ORACL_%s:%t:%p>.dbf'
database;
sql 'alter system archive log current';
backup
format 'oracle backup specification<ORACL_%s:%t:%p>.al'
archivelog all;
backup
format 'oracle backup specification<ORACL_%s:%t:%p:1>.cntrl'
current controlfile;
}
Changes:
Format for archivelog
Format for controlfile
• Change ending .dbf Æ .al
• Add ”:1” to the % parameter list
• - Change ending .dbf Æ .cntrl
13
Page 14
It is important that the % parameters are configured in exactly this sequence:
For Archivelog <DBNAME_%s:%t:%p>.al
For Controlfile <DBNAME_%s:%t:%p:1>.cntrl
DBNAME is ORACL in the example above and should match your database name.
Configure the controlfile autobackup
The backup must include the controlfile backup. This can be configured within Oracle RMAN
configuration as a default option or by adding the following two RMAN statements right at the beginning:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE 'SBT_TAPE'
TO '%F';
Note:
It is mandatory to enable the auto backup of the controlfile. If not enabled,
Oracle will automatically include the SPFILE in the backup which leads to a
format error as the “%f” parameter is not supported for the SPFILE.
run {
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE 'SBT_TAPE' TO '%F';
allocate channel 'dev_0' type 'sbt_tape'
parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=oracle backup
specification)';
…
Replace the database backup statement
As the %f parameter is not available in Oracle 9i, the distribution of the data files to the allocated
channels needs to be done manually. To do this, it is necessary to store the backup statement for the
data files in an external script because the Data Protector parser is not able to parse the required
changes. Extract the database backup statement marked in red and save it to a temporary location
like a text file.
…
backup incremental level <incr_level>
format 'oracle backup specification<ORACL_%s:%t:%p>.dbf'
database;
...
Replace this backup statement by a call to an external script which will be created later. The following
examples assume that a recovery catalog for the target database is available and already configured.
If no recovery catalog is available, please refer to the
catalog
sub-section in the Appendix.
Oracle 9i configuration without a recovery
…
EXECUTE SCRIPT 'backup_datafiles';
...
14
Page 15
In the example above, the script is named backup_datafiles, however, you may specify any other
script name.
The complete rman script in the Data Protector GUI now should look like:
run {
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE 'SBT_TAPE' TO '%F';
allocate channel 'dev_0' type 'sbt_tape'
parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=oracle backup
specification)';
allocate channel 'dev_1' type 'sbt_tape'
parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=oracle backup
specification)';
allocate channel 'dev_2' type 'sbt_tape'
parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=oracle backup
specification)';
allocate channel 'dev_3' type 'sbt_tape'
parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=oracle backup
specification)';
EXECUTE SCRIPT 'backup_datafiles';
sql 'alter system archive log current';
backup
format 'oracle backup specification<ORACL_%s:%t:%p>.al'
archivelog all;
backup
format 'oracle backup specification<ORACL_%s:%t:%p:1>.cntrl'
current controlfile;
}
Now save the script and apply the changes to the backup specification.
Get required information about data files
It is necessary to find out the overall number of data files and also their unique file ID. To do this, you have
to connect to the database you want to backup by sqlplus while the database is open and execute:
SQL> select file_id, tablespace_name, file_name from dba_data_files order by file_id;
FILE_ID TABLESPACE_NAME FILE_NAME
---------- ------------------------------ ------------------------------------------------- 1 SYSTEM /opt/oracle/oradata/ORACL/system01.dbf
2 UNDOTBS1 /opt/oracle/oradata/ORACL/undotbs01.dbf
3 SYSAUX /opt/oracle/oradata/ORACL/sysaux01.dbf
4 USERS /opt/oracle/oradata/ORACL/users01.dbf
5 EXAMPLE /opt/oracle/oradata/ORACL/example01.dbf
6 UNDOTBS2 /opt/oracle/oradata/ORACL/undotbs02.dbf
7 UNDOTBS3 /opt/oracle/oradata/ORACL/undotbs03.dbf
8 UNDOTBS4 /opt/oracle/oradata/ORACL/undotbs04.dbf
9 POOL /opt/oracle/oradata/ORACL/tbs_pool01.dbf
10 POOL /opt/oracle/oradata/ORACL/tbs_pool02.dbf
The example above shows the result of the statement if your database has 10 data files.
Save the output to a temporary text file and exit sqlplus.
15
Page 16
Create the Contents of the external script file
All data files should be distributed evenly (load-balanced) across the available channels. In the
preceding example, the 10 data files need to be distributed across a maximum of four channels. All
later examples assume that the 10 data files are distributed across channel 0, 1, 2, and 3 which are
named by default “dev_0”, “dev_1”, “dev_2” and “dev_3” (see the allocate channel entries in the
rman script in the Data Protector GUI for reference).
Create a new text file on the target database server in a location which is readable by the oracle user
(The example assumes that the text file is created as ‘/home/oracle/rman_script’). In the text file enter
now a backup statement with a separate paragraph per channel enclosed by opening and closing
brackets ‘{‘ and ‘}’.
In the given example, the data files 1, 3, and 9 are assigned to channel dev_0, the data files 2, 4
and 10 are assigned to channel dev_1, the data files 5 and 6 are assigned to channel dev_2 and the
data files 7 and 8 are assigned to channel dev_3. The sequence of the data file IDs does not need to
be ordered, e.g. for channel dev_0 the data file sequence 9,3,1 is used.
You also have to specify the number of data files per channel by specifying the parameter filesperset
followed by the number, e.g. for channel dev_1 where 3 data files are backed up the parameter
filesperset needs to be set to 3, whereas for channel dev_2 the parameter needs to be set to 2 as in
the given example only 2 data files are configured for this channel.
For the format string, you may use the original format string you have copied from the Data Protector
GUI with some modifications.
Changes:
• For each format string change the ending from .dbf to .df
• For each format string add “:X” to the % parameters where X is the last data file ID in the datafile
statement. For dev_0 channel, this would be 1; for dev_1 channel, this would be 10; for dev_2
channel, this would be 6; and for dev_3 channel, this would be 7.
It is important that the % parameters are configured in exactly this sequence:
<DBNAME_%s:%t:%p:X>.df
DBNAME is ORACL in the example above and X is the last data file id—so 1, 10, 6 or 7 in the
given example.
For incremental level you may choose any valid rman incremental level, whereas incremental level 0
is a full backup.
Now save the file and close the text editor.
Create the script in rman and store the content in the catalog
The contents of the script file now need to be loaded into the recovery catalog and stored as an
rman script.
Start rman and connect to both the catalog and also the target database:
RMAN> CONNECT CATALOG rman/xxx@RCVCAT
connected to recovery catalog database
RMAN> CONNECT TARGET /
connected to target database: ORACL (DBID=3273914744)
Be sure to adapt the username, password, and database ID for the recovery catalog to your settings.
Create the script and load the contents of the text file in the catalog by using the CREATE SCRIPT
statement and paste the content of the text file line by line into the command prompt (unfortunately the
‘FROM FILE’ syntax is not available in Oracle 9i):
Be sure that the script name (here: ‘backup_datafiles’) matches the one specified in the Data Protector
GUI. After the creation of the script in the recovery catalog exit rman.
If necessary the script can later be replaced / deleted in rman using the commands ‘REPLACE SCRIPT’
and ‘DELETE SCRIPT’ (please check the rman documentation for reference)
17
Page 18
Script Summary
Now you should have one rman script in the Data Protector GUI and one external script saved in the
recovery catalog similar to the example below:
Rman Script (Changes from default are marked red)
run {
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE 'SBT_TAPE' TO
'%F';
allocate channel 'dev_0' type 'sbt_tape'
parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=oracle backup
specification)';
allocate channel 'dev_1' type 'sbt_tape'
parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=oracle backup
specification)';
allocate channel 'dev_2' type 'sbt_tape'
parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=oracle backup
specification)';
allocate channel 'dev_3' type 'sbt_tape'
parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=oracle backup
specification)';
EXECUTE SCRIPT 'backup_datafiles';
sql 'alter system archive log current';
backup
format 'oracle backup specification<ORACL_%s:%t:%p>.al'
archivelog all;
backup
format 'oracle backup specification<ORACL_%s:%t:%p>.dbf'
recovery area;
backup
format 'oracle backup specification<ORACL_%s:%t:%p:1>.cntrl'
current controlfile;
}
External script (in the recovery catalog—named backup_datafiles):
This configuration for Oracle 9i has some limitations that include the following:
• If a data file is added or removed, the external script needs to be edited
• The incremental level of the backup can no longer be chosen in the Data Protector GUI, but only
configured in the external script
18
Page 19
• The external script needs to be setup and maintained in the recovery catalog. If no recovery catalog
is available, then a script file on the database server needs to be used (refer to the
configuration without a recovery catalog
• In the Source tab of the backup specification in the Data Protector GUI, the data file backup is not
shown although the data files will be included in the backup.
Figure 13:
sub-section in the Appendix)
Oracle 9i
Appendix
How to create a Data Protector RMAN template to backup Oracle 10g
You can move some necessary configuration steps explained in this document into a backup
specification template. This section explains what you need to do.
Select the Backup context in the Data Protector GUI and copy an already existing template by right
clicking on it (for example, copy “Database_Archive” to “Deduplication”):
Figure 14:
19
Page 20
Select your newly copied template and select the Options tab. Adjust the description and click the
Application Specific Options:
Figure 15:
Select “Archive logs” and “Database” in the “What to backup” section. Click the Edit button and
modify the script to contain the following:
run {
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE 'SBT_TAPE' TO
'%F';
allocate channel 'dev_0' type 'sbt_tape'
parms
'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=application,OB2BARLIST=Deduplication)
';
backup incremental level <incr_level>
format 'Deduplication<application_%s:%t:%p:%f>.df'
database;
sql 'alter system archive log current';
backup
format 'Deduplication<application_%s:%t:%p>.al'
archivelog all;
}
20
Page 21
Figure 16:
When you use this template during Oracle backup specification, you only need to adjust the
controlfile backup in the RMAN script.
Oracle 9i configuration without a recovery catalog
If no recovery catalog is available for the target database, it is not possible to store the script in the
database. The only possibility is to use an external script file and execute this external script file by rman.
The following configuration assumes that all configuration steps for Oracle 9i, until the
Replace the database backup statement sub-section have already been performed.
As %f parameter is not available in Oracle 9i, the distribution of the data files to the allocated
channels needs to be done manually. To do this, it is necessary to store the backup statement for the
data files in an external script because the Data Protector parser is not able to parse the required
changes. Extract the database backup statement marked in red and save it to a temporary location
like a text file.
…
backup incremental level <incr_level>
format 'oracle backup specification<ORACL_%s:%t:%p>.dbf'
database;
...
Replace this backup statement by a call to an external script file which will be created later. The script
file needs to be located on the target database server and the absolute path to the file needs to be
specified after a heading @ character:
…
@/home/oracle/rman_script;
...
21
Page 22
In the previous example, the script is located in the /home/oracle directory and is named ‘rman_script’,
however, you may specify any path and any file name as long as the file is readable by the oracle user.
To get the required data for the data file distribution, please see the
data files
To create the external script file, please see the Create the Contents of the external script file
sub-section with one small modification:
Do not include the opening and closing brackets ‘{‘ and ‘}’ in the script file, but only insert the
backup statement:
After saving the text file the configuration is finished. Now you should have one rman script in the
Data Protector GUI and one external script file similar to the example below:
RMAN Script (Changes from default are marked red)
run {
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE 'SBT_TAPE' TO '%F';
allocate channel 'dev_0' type 'sbt_tape'
parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=oracle backup
specification)';
allocate channel 'dev_1' type 'sbt_tape'
parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=oracle backup
specification)';
allocate channel 'dev_2' type 'sbt_tape'
parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=oracle backup
specification)';
allocate channel 'dev_3' type 'sbt_tape'
parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=oracle backup
specification)';
@/home/oracle/rman_script;
sql 'alter system archive log current';
backup
format 'oracle backup specification<ORACL_%s:%t:%p>.al'
archivelog all;
backup
format 'oracle backup specification<ORACL_%s:%t:%p>.dbf'
recovery area;
backup
format 'oracle backup specification<ORACL_%s:%t:%p:1>.cntrl'
current controlfile;
}