Performing common RMAN tasks for Oracle DB instances
In the following section, you can find how you can perform Oracle Recovery Manager (RMAN) DBA tasks on your Amazon RDS DB instances running Oracle. To deliver a managed service experience, Amazon RDS doesn't provide shell access to DB instances. It also restricts access to certain system procedures and tables that require advanced privileges.
You can use the Amazon RDS package rdsadmin.rdsadmin_rman_util
to perform RMAN backups of your
Amazon RDS for Oracle database to disk. The rdsadmin.rdsadmin_rman_util
package supports full and incremental
database file backups, tablespace backups, and archive log backups.
RMAN backups consume storage space on the Amazon RDS DB instance host. When you perform a
backup, you specify an Oracle directory object as a parameter in the procedure call. The
backup files are placed in the specified directory. You can use default directories,
such as DATA_PUMP_DIR
, or create a new directory. For more information, see
Creating and
dropping directories in the main data storage space.
After an RMAN backup has finished, you can copy the backup files off the Amazon RDS for Oracle DB instance host. You might do this for the purpose of restoring to a non-RDS host or for long-term storage of backups. For example, you can copy the backup files to an Amazon S3 bucket. For more information, see using Amazon S3 integration.
The backup files for RMAN backups remain on the Amazon RDS DB instance host until you remove them manually. You can
use the UTL_FILE.FREMOVE
Oracle procedure to remove files from a directory. For more information,
see FREMOVE procedure
When backing up archived redo logs or performing a full or incremental backup that includes archived redo logs, redo log retention must be set to a nonzero value. For more information, see Retaining archived redo logs.
Note
For backing up and restoring to another Amazon RDS for Oracle DB instance, you can continue to use the Amazon RDS backup and restore features. For more information, see Backing up and restoring
Currently, RMAN restore isn't supported for Amazon RDS for Oracle DB instances.
Topics
Common parameters for RMAN procedures
You can use procedures in the Amazon RDS package rdsadmin.rdsadmin_rman_util
to perform tasks with
RMAN. Several parameters are common to the procedures in the package. The package has the following common
parameters.
Parameter name | Data type | Valid values | Default | Required | Description |
---|---|---|---|---|---|
|
varchar2 |
A valid database directory name. |
— |
Yes |
The name of the directory to contain the backup files. |
|
varchar2 |
|
— |
No |
A unique string that is included in the backup file names. NoteThe limit is 30 characters. |
|
varchar2 |
A valid owner of the directory specified in
|
— |
Yes |
The owner of the directory to contain the backup files. |
|
varchar2 |
|
NULL |
No |
A string that can be used to distinguish between backups to indicate the purpose or usage of backups, such as daily, weekly, or incremental-level backups. The limit is 30 characters. The tag is not case-sensitive. Tags are always stored in uppercase, regardless of the case used when entering them. Tags don't need to be unique, so multiple backups can have the same tag. If you don't specify a tag, then RMAN assigns a default tag automatically using the
format For example, a backup might receive a tag The
|
|
boolean |
|
|
No |
Specify Specify |
|
boolean |
|
|
No |
Specify Specify If you include archived redo logs in the backup, set retention
to one hour or greater using the
|
|
boolean |
|
|
No |
Specify Specify |
|
boolean |
|
|
No |
Specify Specify |
|
number |
A valid integer between
|
|
No |
Number of channels. |
|
boolean |
|
|
No |
When When |
|
number |
A valid integer |
|
No |
The section size in megabytes (MB). Validates in parallel by dividing each file into the specified section size. When |
|
varchar2 |
|
|
No |
The level of corruption detection. Specify Specify |
Validating DB instance files
You can use the Amazon RDS package rdsadmin.rdsadmin_rman_util
to validate Amazon RDS for Oracle DB instance
files, such as data files, tablespaces, control files, or server parameter files (SPFILEs).
For more information about RMAN validation, see
Validating database files and backups
Topics
Validating a DB instance
To validate all of the relevant files used by an Amazon RDS Oracle DB instance, use
the Amazon RDS procedure rdsadmin.rdsadmin_rman_util.validate_database
.
This procedure uses the following common parameters for RMAN tasks:
-
p_validation_type
-
p_parallel
-
p_section_size_mb
-
p_rman_to_dbms_output
For more information, see Common parameters for RMAN procedures.
The following example validates the DB instance using the default values for the parameters.
EXEC rdsadmin.rdsadmin_rman_util.validate_database;
The following example validates the DB instance using the specified values for the parameters.
BEGIN rdsadmin.rdsadmin_rman_util.validate_database( p_validation_type => '
PHYSICAL+LOGICAL
', p_parallel =>4
, p_section_size_mb =>10
, p_rman_to_dbms_output =>FALSE
); END; /
When the p_rman_to_dbms_output
parameter is set to
FALSE
, the RMAN output is written to a file in the
BDUMP
directory.
To view the files in the BDUMP
directory, run the following
SELECT
statement.
SELECT * FROM table(rdsadmin.rds_file_util.listdir('BDUMP')) order by mtime;
To view the contents of a file in the BDUMP
directory, run the
following SELECT
statement.
SELECT text FROM table(rdsadmin.rds_file_util.read_text_file('BDUMP','rds-rman-validate-
nnn
.txt'));
Replace the file name with the name of the file you want to view.
Validating a tablespace
To validate the files associated with a tablespace, use the Amazon RDS procedure
rdsadmin.rdsadmin_rman_util.validate_tablespace
.
This procedure uses the following common parameters for RMAN tasks:
-
p_validation_type
-
p_parallel
-
p_section_size_mb
-
p_rman_to_dbms_output
For more information, see Common parameters for RMAN procedures.
This procedure also uses the following additional parameter.
Parameter name | Data type | Valid values | Default | Required | Description |
---|---|---|---|---|---|
|
varchar2 |
A valid tablespace name |
— |
Yes |
The name of the tablespace. |
Validating a control file
To validate only the control file used by an Amazon RDS Oracle DB instance, use the
Amazon RDS procedure
rdsadmin.rdsadmin_rman_util.validate_current_controlfile
.
This procedure uses the following common parameter for RMAN tasks:
-
p_validation_type
-
p_rman_to_dbms_output
For more information, see Common parameters for RMAN procedures.
Validating an SPFILE
To validate only the server parameter file (SPFILE) used by an Amazon RDS Oracle DB
instance, use the Amazon RDS procedure
rdsadmin.rdsadmin_rman_util.validate_spfile
.
This procedure uses the following common parameter for RMAN tasks:
-
p_validation_type
-
p_rman_to_dbms_output
For more information, see Common parameters for RMAN procedures.
Validating a data file
To validate a data file, use the Amazon RDS procedure
rdsadmin.rdsadmin_rman_util.validate_datafile
.
This procedure uses the following common parameters for RMAN tasks:
-
p_validation_type
-
p_parallel
-
p_section_size_mb
-
p_rman_to_dbms_output
For more information, see Common parameters for RMAN procedures.
This procedure also uses the following additional parameters.
Parameter name | Data type | Valid values | Default | Required | Description |
---|---|---|---|---|---|
|
varchar2 |
A valid datafile ID number or a valid datafile name including complete path |
— |
Yes |
The datafile ID number (from
|
|
number |
A valid integer |
|
No |
The number of the block where the validation starts within
the data file. When this is |
|
number |
A valid integer |
|
No |
The number of the block where the validation ends within
the data file. When this is |
Enabling and disabling block change tracking
Block changing tracking records changed blocks in a tracking file. This technique
can improve the performance of RMAN incremental backups. For more information, see Using Block Change Tracking to Improve Incremental Backup Performance
To enable block change tracking for a DB instance, use the Amazon RDS procedure
rdsadmin.rdsadmin_rman_util.enable_block_change_tracking
. To disable block change tracking,
use disable_block_change_tracking
. These procedures take no parameters.
Read-only replicas support block change tracking. If you create a read-only replica from a source DB that
uses block change tracking, the replica uses block change tracking. You can't enable block change tracking on
a mounted replica. If you place a mounted replica in read-only mode, block change tracking isn't enabled, but
you can enable it using enable_block_change_tracking
. If you promote an Oracle replica to a
source DB, you can use block change tracking just as for any other Oracle DB instance.
Block change tracking procedures are supported for the following DB engine versions:
-
Oracle Database 21c (21.0.0)
-
Oracle Database 19c (19.0.0)
-
Oracle Database 12c Release 2 (12.2), using 12.2.0.1.ru-2019-01.rur-2019-01.r1 or higher
-
Oracle Database 12c Release 1 (12.1), using 12.1.0.2.v15 or higher
Note
In a single-tenant CDB, the following operations work, but no customer-visible mechanism can detect the current status of the operations. See also Limitations of a single-tenant CDB.
To determine whether block change tracking is enabled for your DB instance, run the following query.
SELECT STATUS, FILENAME FROM V$BLOCK_CHANGE_TRACKING;
The following example enables block change tracking for a DB instance.
EXEC rdsadmin.rdsadmin_rman_util.enable_block_change_tracking;
The following example disables block change tracking for a DB instance.
EXEC rdsadmin.rdsadmin_rman_util.disable_block_change_tracking;
Crosschecking archived redo logs
You can crosscheck archived redo logs using the Amazon RDS procedure
rdsadmin.rdsadmin_rman_util.crosscheck_archivelog
.
You can use this procedure to crosscheck the archived redo logs registered in the control file and optionally delete the expired logs records. When RMAN makes a backup, it creates a record in the control file. Over time, these records increase the size of the control file. We recommend that you remove expired records periodically.
Note
Standard Amazon RDS backups don't use RMAN and therefore don't create records in the control file.
This procedure uses the common parameter p_rman_to_dbms_output
for
RMAN tasks.
For more information, see Common parameters for RMAN procedures.
This procedure also uses the following additional parameter.
Parameter name | Data type | Valid values | Default | Required | Description |
---|---|---|---|---|---|
|
boolean |
|
|
No |
When When |
This procedure is supported for the following Amazon RDS for Oracle DB engine versions:
-
Oracle Database 21c (21.0.0)
-
Oracle Database 19c (19.0.0)
-
Oracle Database 12c Release 2 (12.2), using 12.2.0.1.ru-2019-01.rur-2019-01.r1 or higher
-
Oracle Database 12c Release 1 (12.1), using 12.1.0.2.v15 or higher
The following example marks archived redo log records in the control file as expired, but does not delete the records.
BEGIN rdsadmin.rdsadmin_rman_util.crosscheck_archivelog( p_delete_expired =>
FALSE
, p_rman_to_dbms_output =>FALSE
); END; /
The following example deletes expired archived redo log records from the control file.
BEGIN rdsadmin.rdsadmin_rman_util.crosscheck_archivelog( p_delete_expired =>
TRUE
, p_rman_to_dbms_output =>FALSE
); END; /
Backing up archived redo logs
You can use the Amazon RDS package rdsadmin.rdsadmin_rman_util
to back up archived redo logs for an
Amazon RDS Oracle DB instance.
The procedures for backing up archived redo logs are supported for the following Amazon RDS for Oracle DB engine versions:
-
Oracle Database 21c (21.0.0)
-
Oracle Database 19c (19.0.0)
-
Oracle Database 12c Release 2 (12.2), using 12.2.0.1.ru-2019-01.rur-2019-01.r1 or higher
-
Oracle Database 12c Release 1 (12.1), using 12.1.0.2.v15 or higher
Topics
Backing up all archived redo logs
To back up all of the archived redo logs for an Amazon RDS Oracle DB instance, use
the Amazon RDS procedure
rdsadmin.rdsadmin_rman_util.backup_archivelog_all
.
This procedure uses the following common parameters for RMAN tasks:
-
p_owner
-
p_directory_name
-
p_label
-
p_parallel
-
p_compress
-
p_rman_to_dbms_output
-
p_tag
For more information, see Common parameters for RMAN procedures.
The following example backs up all archived redo logs for the DB instance.
BEGIN rdsadmin.rdsadmin_rman_util.backup_archivelog_all( p_owner => '
SYS
', p_directory_name => 'MYDIRECTORY
', p_parallel =>4
, p_tag => 'MY_LOG_BACKUP
', p_rman_to_dbms_output =>FALSE
); END; /
Backing up an archived redo log from a date range
To back up specific archived redo logs for an Amazon RDS Oracle DB instance by
specifying a date range, use the Amazon RDS procedure
rdsadmin.rdsadmin_rman_util.backup_archivelog_date
. The date
range specifies which archived redo logs to back up.
This procedure uses the following common parameters for RMAN tasks:
-
p_owner
-
p_directory_name
-
p_label
-
p_parallel
-
p_compress
-
p_rman_to_dbms_output
-
p_tag
For more information, see Common parameters for RMAN procedures.
This procedure also uses the following additional parameters.
Parameter name | Data type | Valid values | Default | Required | Description |
---|---|---|---|---|---|
|
date |
A date that is between the |
— |
Yes |
The starting date for the archived log backups. |
|
date |
A date that is between the |
— |
Yes |
The ending date for the archived log backups. |
The following example backs up archived redo logs in the date range for the DB instance.
BEGIN rdsadmin.rdsadmin_rman_util.backup_archivelog_date( p_owner => '
SYS
', p_directory_name => 'MYDIRECTORY
', p_from_date => '03/01/2019 00:00:00
', p_to_date => '03/02/2019 00:00:00
', p_parallel =>4
, p_tag => 'MY_LOG_BACKUP
', p_rman_to_dbms_output =>FALSE
); END; /
Backing up an archived redo log from an SCN range
To back up specific archived redo logs for an Amazon RDS Oracle DB instance by
specifying a system change number (SCN) range, use the Amazon RDS procedure
rdsadmin.rdsadmin_rman_util.backup_archivelog_scn
. The SCN
range specifies which archived redo logs to back up.
This procedure uses the following common parameters for RMAN tasks:
-
p_owner
-
p_directory_name
-
p_label
-
p_parallel
-
p_compress
-
p_rman_to_dbms_output
-
p_tag
For more information, see Common parameters for RMAN procedures.
This procedure also uses the following additional parameters.
Parameter name | Data type | Valid values | Default | Required | Description |
---|---|---|---|---|---|
|
number |
An SCN of an archived redo log that exists on disk. The
value must be less than or equal to the value specified for
|
— |
Yes |
The starting SCN for the archived log backups. |
|
number |
An SCN of an archived redo log that exists on disk. The
value must be greater than or equal to the value specified
for |
— |
Yes |
The ending SCN for the archived log backups. |
The following example backs up archived redo logs in the SCN range for the DB instance.
BEGIN rdsadmin.rdsadmin_rman_util.backup_archivelog_scn( p_owner => '
SYS
', p_directory_name => 'MYDIRECTORY
', p_from_scn =>1533835
, p_to_scn =>1892447
, p_parallel =>4
, p_tag => 'MY_LOG_BACKUP
', p_rman_to_dbms_output =>FALSE
); END; /
Backing up an archived redo log from a sequence number range
To back up specific archived redo logs for an Amazon RDS Oracle DB instance by
specifying a sequence number range, use the Amazon RDS procedure
rdsadmin.rdsadmin_rman_util.backup_archivelog_sequence
. The
sequence number range specifies which archived redo logs to back up.
This procedure uses the following common parameters for RMAN tasks:
-
p_owner
-
p_directory_name
-
p_label
-
p_parallel
-
p_compress
-
p_rman_to_dbms_output
-
p_tag
For more information, see Common parameters for RMAN procedures.
This procedure also uses the following additional parameters.
Parameter name | Data type | Valid values | Default | Required | Description |
---|---|---|---|---|---|
|
number |
A sequence number an archived redo log that exists on
disk. The value must be less than or equal to the value
specified for |
— |
Yes |
The starting sequence number for the archived log backups. |
|
number |
A sequence number of an archived redo log that exists on
disk. The value must be greater than or equal to the value
specified for |
— |
Yes |
The ending sequence number for the archived log backups. |
The following example backs up archived redo logs in the sequence number range for the DB instance.
BEGIN rdsadmin.rdsadmin_rman_util.backup_archivelog_sequence( p_owner => '
SYS
', p_directory_name => 'MYDIRECTORY
', p_from_sequence =>11160
, p_to_sequence =>11160
, p_parallel =>4
, p_tag => 'MY_LOG_BACKUP
', p_rman_to_dbms_output =>FALSE
); END; /
Performing a full database backup
You can perform a backup of all blocks of data files included in the backup using
Amazon RDS procedure
rdsadmin.rdsadmin_rman_util.backup_database_full
.
This procedure uses the following common parameters for RMAN tasks:
-
p_owner
-
p_directory_name
-
p_label
-
p_parallel
-
p_section_size_mb
-
p_include_archive_logs
-
p_optimize
-
p_compress
-
p_rman_to_dbms_output
-
p_tag
For more information, see Common parameters for RMAN procedures.
This procedure is supported for the following Amazon RDS for Oracle DB engine versions:
-
Oracle Database 21c (21.0.0)
-
Oracle Database 19c (19.0.0)
-
Oracle Database 12c Release 2 (12.2), using 12.2.0.1.ru-2019-01.rur-2019-01.r1 or higher
-
Oracle Database 12c Release 1 (12.1), using 12.1.0.2.v15 or higher
The following example performs a full backup of the DB instance using the specified values for the parameters.
BEGIN rdsadmin.rdsadmin_rman_util.backup_database_full( p_owner => '
SYS
', p_directory_name => 'MYDIRECTORY
', p_parallel =>4
, p_section_size_mb =>10
, p_tag => 'FULL_DB_BACKUP
', p_rman_to_dbms_output =>FALSE
); END; /
Performing an incremental database backup
You can perform an incremental backup of your DB instance using the Amazon RDS
procedure
rdsadmin.rdsadmin_rman_util.backup_database_incremental
.
For more information about incremental backups, see Incremental backups
This procedure uses the following common parameters for RMAN tasks:
-
p_owner
-
p_directory_name
-
p_label
-
p_parallel
-
p_section_size_mb
-
p_include_archive_logs
-
p_include_controlfile
-
p_optimize
-
p_compress
-
p_rman_to_dbms_output
-
p_tag
For more information, see Common parameters for RMAN procedures.
This procedure is supported for the following Amazon RDS for Oracle DB engine versions:
-
Oracle Database 21c (21.0.0)
-
Oracle Database 19c (19.0.0)
-
Oracle Database 12c Release 2 (12.2), using 12.2.0.1.ru-2019-01.rur-2019-01.r1 or higher
-
Oracle Database 12c Release 1 (12.1), using 12.1.0.2.v15 or higher
This procedure also uses the following additional parameter.
Parameter name | Data type | Valid values | Default | Required | Description |
---|---|---|---|---|---|
|
number |
|
|
No |
Specify Specify |
The following example performs an incremental backup of the DB instance using the specified values for the parameters.
BEGIN rdsadmin.rdsadmin_rman_util.backup_database_incremental( p_owner => '
SYS
', p_directory_name => 'MYDIRECTORY
', p_level =>1
, p_parallel =>4
, p_section_size_mb =>10
, p_tag => 'MY_INCREMENTAL_BACKUP
', p_rman_to_dbms_output =>FALSE
); END; /
Backing up a tablespace
You can back up a tablespace using the Amazon RDS procedure
rdsadmin.rdsadmin_rman_util.backup_tablespace
.
This procedure uses the following common parameters for RMAN tasks:
-
p_owner
-
p_directory_name
-
p_label
-
p_parallel
-
p_section_size_mb
-
p_include_archive_logs
-
p_include_controlfile
-
p_optimize
-
p_compress
-
p_rman_to_dbms_output
-
p_tag
For more information, see Common parameters for RMAN procedures.
This procedure also uses the following additional parameter.
Parameter name | Data type | Valid values | Default | Required | Description |
---|---|---|---|---|---|
|
varchar2 |
A valid tablespace name. |
— |
Yes |
The name of the tablespace to back up. |
This procedure is supported for the following Amazon RDS for Oracle DB engine versions:
-
Oracle Database 21c (21.0.0)
-
Oracle Database 19c (19.0.0)
-
Oracle Database 12c Release 2 (12.2), using 12.2.0.1.ru-2019-01.rur-2019-01.r1 or higher
-
Oracle Database 12c Release 1 (12.1), using 12.1.0.2.v15 or higher
The following example performs a tablespace backup using the specified values for the parameters.
BEGIN rdsadmin.rdsadmin_rman_util.backup_tablespace( p_owner => '
SYS
', p_directory_name => 'MYDIRECTORY
', p_tablespace_name =>MYTABLESPACE
, p_parallel =>4
, p_section_size_mb =>10
, p_tag => 'MYTABLESPACE_BACKUP
', p_rman_to_dbms_output =>FALSE
); END; /
Backing up a control file
You can back up a control file using the Amazon RDS procedure
rdsadmin.rdsadmin_rman_util.backup_current_controlfile
.
This procedure uses the following common parameters for RMAN tasks:
-
p_owner
-
p_directory_name
-
p_label
-
p_compress
-
p_rman_to_dbms_output
-
p_tag
For more information, see Common parameters for RMAN procedures.
This procedure is supported for the following Amazon RDS for Oracle DB engine versions:
-
Oracle Database 21c (21.0.0)
-
Oracle Database 19c (19.0.0)
-
Oracle Database 12c Release 2 (12.2), using 12.2.0.1.ru-2019-01.rur-2019-01.r1 or higher
-
Oracle Database 12c Release 1 (12.1), using 12.1.0.2.v15 or higher
The following example backs up a control file using the specified values for the parameters.
BEGIN rdsadmin.rdsadmin_rman_util.backup_current_controlfile( p_owner => '
SYS
', p_directory_name => 'MYDIRECTORY
', p_tag => 'CONTROL_FILE_BACKUP
', p_rman_to_dbms_output =>FALSE
); END; /