backup_database

Schedules a backup for database targets. This verb has multiple subcommands that perform different types of database backups. Some options are common across multiple subcommands, while other options are specific to a subcommand. The available subcommands are as follows:
  • customBackup: Schedules a custom backup, with user-specified scope, level, and frequency.

  • suggestedBackup: Schedules a backup using the Oracle-suggested strategy appropriate to the local backup configuration.

backup_database -customBackup

Schedules a custom Database Backup deployment procedure for one or more database targets. Each backup uses the database target specific RMAN configuration.

Format
emcli backup_database -customBackup
	((-target_name="<database target name>" -target_type="oracle_database|rac_database|oracle_cloud_dbcs")
	| -input_file="target_list:<full path name of input file>")
	[-db_cred="<database named credential>"]
	[-db_host_cred="<database host named credential>"]
	[-scope="wholeDB|tablespace|datafile|archivedLog|recoveryFilesOnDisk|cdbRoot|pluggableDbs"]
	[-scope_value="comma-separated list of values"]
	[-backup_type="full|incr0|incr1" [-incr_type="diff|cumulative"]]
	[-destination_media="disk|tape|ra|cloud"]
	[-skip_backup_archived_logs]
	[-delete_archived_logs_after_backup]
	[-delete_obsolete]
	[-max_files_per_set="n"]
	[-max_corruptions="n"]
	[-section_size="n"]
	[-procedure_name="<deployment procedure name>"]
	[-storage_container="<backup storage container name>"]
	[[-rman_encryption="wallet|password|both"]
	 [-rman_encryption_cred="<RMAN encryption named credential>"]
	 [-encryption_algorithm="AES128|AES192|AES256"]]
	[-schedule=
		{
		 start_time:yyyy/MM/dd HH:mm;
		 tz:{java timezone ID};
		 frequency:interval/weekly/monthly/yearly;
		 repeat:#m|#h|#d|#w;
		 months:#,#,...;
		 days:#,#,...;
		 end_time:yyyy/MM/dd HH:mm;
		 grace_period:;
		}] 
		 
Options
  • target_name

    A single-instance, cluster database, or database cloud service target name for the database that will be backed up. (A multi-database backup can be performed by using the -input_file option instead of -target_name/-target_type.)

  • target_type

    The type of the target specified by -target_name, either a single-instance database (oracle_database), a cluster database (rac_database), or a database cloud service (oracle_cloud_dbcs).

  • input_file

    The name of a file containing the information for each database that will be backed up. This option is an alternative to -target_name/-target_type. The format of this file is as follows:
    target.0.target_name=<database #1 target name>
    target.0.target_type=oracle_database|rac_database|oracle_cloud_dbcs
    target.0.db_cred=<database named credential for database #1>
    target.0.db_host_cred=<database host named credential for database #1>
    target.1.target_name=<database #1 target name>
    target.1.target_type=oracle_database|rac_database|oracle_cloud_dbcs
    target.1.db_cred=<database named credential for database #2>
    target.1.db_host_cred=<database host named credential for database #2>

    The target_name and target_type lines are required for each database. The db_cred and db_host_cred lines are optional; if present for a database, they override the command-line named credential settings (if any) for that database.

  • db_cred

    The name of an existing Enterprise Manager database named credential that can be used to connect to all the specified target databases. If the operating system user specified by the -db_host_cred argument is a member of the operating system DBA group, the database credentials can specify a Normal role user. Otherwise, the database credentials must specify a SYSDBA role user. If this argument is not specified, then preferred credentials will be used. If multiple databases are specified, this should be a global named credential. If the -input_file option is used, this setting can be optionally overridden for an individual database as noted above.

  • db_host_cred

    The name of an existing Enterprise Manager database host named credential that can be used to run  the RMAN command on the specified target database hosts.  If this argument is not specified, then preferred credentials are used. If multiple databases are specified, this should be a global named credential. If the -input_file option is used, this setting can be optionally overridden for an individual database as noted above.

  • scope

    The scope of the backup. If this argument is not specified, the default value is wholeDB. The possible values are:
    • wholeDB: All data files in the database.

    • tablespace: One or more data files associated with the tablespace name.

    • datafile: One or more data files.

    • archivedLog: Exact copy of each distinct log sequence number.

    • recoveryFilesOnDisk: All recovery files on disk, whether they stored in the fast recovery area or other locations on disk.

    • cdbRoot: The data files in the whole container root.

    • pluggableDbs: The data files in one or more pluggable databases.

  • scope_value

    A comma-separated list of values to back up. It is required when the -scope value is tablespace|datafile|pluggableDbs.

  • backup_type

    The type of backup. If this argument is not specified, the default value is full. The possible values are:
    • full:  Back up all data blocks in the data files being backed up.

    • incr0: Incremental level 0. This is similar to a full backup, but can be used as the base of an incremental backup strategy.

    • incr1: Incremental level 1. This back up is only for the changed blocks.

  • incr_type

    The type of incremental backup. This is used in combination with -backup_type="incr". If this argument is not specified, the default is diff. The possible values are:
    • diff: Back up blocks updated since the most recent level 0 or level 1 incremental backup.

    • cumulative: Back up all blocks changed since the most recent level 0 backup.

  • destination_media

    The destination media for this backup. If this argument is not specified, the default value is disk. The possible values are:
    • disk: Backup to disk (not allowed when -scope="recoveryFilesOnDisk").

    • tape: Backup to a SBT (system backup to tape) device.

    • ra: Backup to a Recovery Appliance.

    • cloud: Backup to Database Backup Cloud Service.

  • rman_encryption

    Specify to encrypt the backup using the Oracle Encryption Wallet, a user-supplied password, or both. The possible values are:
    • wallet: Oracle Encryption Wallet

    • password: user-supplied password

    • both: Oracle Encryption Wallet and user-supplied password

    This option can be specified when -scope="wholeDB|tablespace|datafile|archivedLog|recoveryFilesOnDisk|cdbRoot|pluggableDbs".

  • rman_encryption_cred

    The name of an existing Enterprise Manager generic named credential that contains the encryption password. This is required when:
    • -rman_encryption="password" is specified

    • -rman_encryption_algorithm

    The name of the encryption algorithm to use while encrypting backups. This is used in combination with -rman_encryption. The possible values are AES128, AES192, and AES256. If this argument is not specified, the default value is AES256.

  • storage_container

    The name of the Oracle Storage Service container where this backup will be stored. If the container does not already exist it will be created. This argument overrides the container obtained from the Hybrid Cloud Setup account information or the Database Backup Cloud Service Settings (whichever is applicable) when the initial backup configuration was performed.

    This option is applicable only when -destination_media="cloud".

  • skip_backup_archived_logs

    Do not back up all archived logs on disk that have not been backed up.If this argument is not specified, the default behavior is to back up all archived logs that have not been backed up.

    This option can be specified when -scope="wholeDb|tablespace|datafile|cdbRoot|pluggableDbs".

  • delete_obsolete

    Delete backups that are no longer required to satisfy the retention policy. This option can be specified when -scope="wholeDB|tablespace|datafile|cdbRoot|pluggableDbs".

  • max_files_per_set

    The maximum number of files to include in each backup set. This option can be specified when -scope="wholeDB|tablespace|datafile|archivedLog|cdbRoot|pluggableDbs".

  • max_corruptions

    The maximum number of physical corruptions allowed in data files. This option can be specified when -scope="datafile".

  • section_size

    The size in MB of each backup section produced during a data file backup, resulting in a multi-section backup where each backup piece contains one file section. This option cannot be used if the Maximum Backup Piece Size is set in the RMAN configuration. This option can be specified when -scope="wholeDB|tablespace|datafile|archivedLog|cdbRoot|pluggableDbs".

  • procedure_name

    The name of the Database Backup deployment procedure. At procedure execution time, the name will be modified to include a timestamp.

  • delete_archived_logs_after_backup

    Delete all archived logs from disk after they are successfully backed up. Ignored if -skip_backup_archived_logs is specified. This option can be specified when -scope="wholeDB|tablespace|datafile|cdbRoot|pluggableDbs".

  • schedule

    Schedules the customized backup deployment procedure. If schedule option is not provided, the procedure runs immediately.
    • start_time: Time when the procedure has to start execution. The format should be "yyyy/MM/dd HH:mm".

    • tz: The timezone ID (optional).

    • frequency: Valid values are once/interval/weekly/monthly/yearly (optional).

      If frequency is set to interval then repeat has to be specified.

      If frequency is set to weekly or monthly, days has to be specified.

      If frequency is set to yearly, both days and months have to be specified.

    • repeat: Frequency with which the procedure has to be repeated. This is required only if the frequency is set to interval.

    • days: Comma separated list of days. This is required only if frequency is weekly, monthly, or yearly.

    • months: Comma separated list of months. This is required only if the frequency is yearly. The valid range is 1 through 12.

    • end_time: End time for procedure executions. If it is not specified, procedure will run indefinitely (optional). The format should be "yyyy/MM/dd HH:mm".

    • grace_period: Grace period in minutes (optional).

Example 1

The following example performs an incremental whole-database backup to Oracle Cloud with password encryption. It also schedules the backup for a later time.
emcli backup_database -customBackup -scope="wholeDB"
-target_name="db1" -target_type="oracle_database" 
-backup_type="incr0" -destination_media="cloud"
-storage_container="dbContainer1" -rman_encryption="password" encryption_algorithm="AES128"
-rman_encryption_cred="NC1" -schedule="start_time:2016/11/08 10:08;tz:PST;

Example 2

The following example backups a Database Cloud Service target to cloud. It does not include archived logs in the backup.
	emcli backup_database -customBackup -target_name="SALES-DBCS"
	-target_type="oracle_cloud_dbcs" -scope="wholeDB"
	-backup_type="full" -destination_media="cloud"
	-skip_backup_archived_logs -db_cred="SYS_DB_CRED" -db_host_cred="NZHAO_HOST_CRED"

Example 3

The following example performs a differential incremental backup for pluggable databases CDB1_PDB1 and PDB1 to disk. It also deletes the archived logs and obsolete backups after the backup.
emcli backup_database -customBackup -target_name="db1"
-target_type="oracle_database" -scope="pluggableDbs"
-scope_value="CDB1_PDB1,PDB1" -backup_type="incr1"
-incr_type="diff" -delete_archived_logs_after_backup -delete_obsolete
-destination_media="disk" -db_cred="DB_SYS_CRED"
-db_host_cred="OMS_HOST_CRED"

Example 4

The following example performs a full backup of the databases specified in the target list of the input_file to disk.

 emcli backup_database -customBackup -input_file="target_list:rcap.prop" -backup_type="full" -destination_media="disk"
where the content in rcap.prop is
rcap.prop
target.0.target_name=rcap
target.0.target_type=oracle_database
target.0.db_cred=DB_CREDS
target.0.db_host_cred=HOST_CREDS
target.1.target_name=rcap2
target.1.target_type=oracle_database
target.1.db_cred=DB_CREDS
target.1.db_host_cred=HOST_CREDS

backup_database -suggestedBackup

Schedules a backup using the Oracle suggested strategy appropriate to the specified backup destination. For disk, the standard incremental-update and roll forward strategy is used. For Recovery Appliance, an incremental-forever strategy is used.

Format
emcli backup_database -suggestedBackup
	((-target_name="<database target name>"
	-target_type="oracle_database|rac_database|oracle_cloud_dbcs")
	| -input_file="target_list:<full path name of input file>")
	[-db_cred="<database named credential>"]
	[-db_host_cred="<database host named credential>"]
	[-destination_media="disk|ra"]
	[-skip_backup_archived_logs]
	[-delete_archived_logs_after_backup]
	[[-rman_encryption="wallet|password|both"]
	 [-rman_encryption_cred="<RMAN encryption named credential>"]
	 [-encryption_algorithm="AES128|AES192|AES256"]]
	[-schedule=
		{
		 start_time:yyyy/MM/dd HH:mm;
		 tz:{java timezone ID};
		 frequency:interval/weekly/monthly/yearly;
		 repeat:#m|#h|#d|#w;
		 months:#,#,...;
		 days:#,#,...;
		 end_time:yyyy/MM/dd HH:mm;
		}]
Options
  • target_name

    A single-instance, cluster database, or database cloud service target name for the database that will be backed up. (A multi-database backup can be performed by using the -input_file option instead of -target_name/-target_type.)

  • target_type

    The type of the target specified by -target_name, either a single-instance database (oracle_database), a cluster database (rac_database), or a database cloud service (oracle_cloud_dbcs).

  • input_file

    The name of a file containing the information for each database that will be backed up. This option is an alternative to -target_name/-target_type. The format of this file is as follows:
    target.0.target_name=<database #1 target name>
    target.0.target_type=oracle_database|rac_database|oracle_cloud_dbcs
    target.0.db_cred=<database named credential for database #1>
    target.0.db_host_cred=<database host named credential for database #1>
    target.1.target_name=<database #1 target name>
    target.1.target_type=oracle_database|rac_database|oracle_cloud_dbcs
    target.1.db_cred=<database named credential for database #2>
    target.1.db_host_cred=<database host named credential for database #2>
  • db_cred

    The name of an existing Enterprise Manager database named credential that can be used to connect to all the specified target databases. If the operating system user specified by the -db_host_cred argument is a member of the operating system DBA group, the database credentials can specify a Normal role user. Otherwise, the database credentials must specify a SYSDBA role user. If this argument is not specified, then preferred credentials will be used. If multiple databases are specified, this should be a global named credential. If the -input_file option is used, this setting can be optionally overridden for an individual database as noted above.

  • db_host_cred

    The name of an existing Enterprise Manager database host named credential that can be used to run  the RMAN command on the specified target database hosts.  If this argument is not specified, then preferred credentials will be used. If multiple databases are specified, this should be a global named credential. If the -input_file option is used, this setting can be optionally overridden for an individual database as noted above.

  • destination_media

    The destination media for this backup. If this argument is not specified, the default value is disk. The possible values are:
    • disk: Backup to disk.

    • ra: Backup to a Recovery Appliance.

  • rman_encryption

    Specifies to encrypt the backup using the Oracle Encryption Wallet, a user-supplied password, or both. The possible values are:
    • wallet: Oracle Encryption Wallet

    • password: user-supplied password

    • both: Oracle Encryption Wallet and user-supplied password

  • rman_encryption_cred

    The name of an existing Enterprise Manager generic named credential that contains the encryption password. This is required when -rman_encryption=\"password\" is specified.

  • rman_encryption_algorithm

    The name of the encryption algorithm to use when encrypting backups. Used in combination with -rman_encryption. The possible values are AES128, AES192, and AES256. If this argument is not specified, the default value is AES256.

  • skip_backup_archived_logs

    This option does not back up all the archived logs on disk that have not been backed up. If this argument is not specified, the default behavior is to back up all the archived logs that have not been backed up. This option should be provided if the database is configured to ship redo to the Recovery Appliance. This option can only be specified when -destination_media=\"ra\".

  • delete_archived_logs_after_backup

    Deletes all the archived logs from disk after they are successfully backed up. This task is ignored if -skip_backup_archived_logs is specified. This option can only be specified when -destination_media=\"ra\".

Example 1

 The following example schedules a daily backup to a Recovery Appliance using the Oracle suggested strategy. This does not include archived logs in the backup.
	emcli backup_database -suggestedBackup -target_name="prod-db" "-target_type=" "oracle_database"
	-destination_media="ra"
	-skip_backup_archived_logs
	-db_cred="DB_SYS_CRED"
	-db_host_cred="OMS_HOST_CRED"
	-schedule="start_time:2016/12/19 16:00;tz:PST;frequency:interval;repeat:1d"

Example 2

The following example schedules a daily backup to disk using the Oracle suggested strategy.
	emcli backup_database -suggestedBackup -target_name="prod-db"
	-target_type="oracle_database" -destination_media="disk"
	-db_cred="DB_SYS_CRED" -db_host_cred="OMS_HOST_CRED"
	schedule="start_time:2016/12/19 23:55;tz:PST;frequency:interval;repeat:1d"