5 1 0:Oracle Backup

From SEPsesam
Revision as of 12:28, 14 April 2023 by Jus (talk | contribs) (Created page with "<languages /> <br/> {{Release-Apollon}} ==<translate><!--T:1--> Overview</translate>== {{Additional_Resources_Box|seeAlsoLinks=<nowiki /> *<translate><!--T:2--> Oracle Requirements and Configuration *Oracle Restore *Oracle Duplicate Database</translate>}} <onlyinclude>{{Source:Oracle Backup}}</onlyinclude...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Welcome to the latest SEP sesam documentation version 5.1.0 Apollon. For previous documentation version(s), check documentation archive.


Overview


Quick setup

Once you have installed SEP sesam client and configured Oracle (by creating a symbolic link to libobk.so (Linux) or copying the orasbt.dll to <ORACLE HOME>\bin directory (Windows) as described in Oracle Requirements and Configuration, you can configure Oracle Backup.

Prerequisites

Set remote command permissions by specifying a user in the sesam_cmdusers_allow file.
Set Oracle database to ARCHIVELOG mode.
Create an Oracle backup task.

Run backup with SEP sesam

Create an Oracle command.
Create and schedule an Oracle command event.

Run backup externally (alternative procedure)

Set up RMAN backup script.

Additional options

Enable disaster recovery with CONTROLFILE AUTOBACKUP option.
Validate backups with crosscheck command.

The procedures and features explained herein provide only information about the SEP sesam-specific parts of Oracle backup. For detailed information on Oracle-specific backup and recovery, see Oracle database documentation.

SEP sesam provides the SEP SBC Oracle client module that integrates the Oracle Recovery Manager (RMAN) with the SEP sesam Server to manage Oracle database backup. Oracle RMAN controls the Oracle server processes and maintains the information in the recovery catalog and control file for performing Oracle backups and restores. SEP sesam Server acts as a media manager and provides scheduling, media management, and monitoring for Oracle backups and restores.

The foundation of the Oracle database backup is the SEP sesam backup task, which defines the backup scope and options. Unlike the standard backup procedure, no backup event scheduling is required for this task. The Oracle backup task acts as the bridge between SEP sesam and the Recovery Manager (RMAN) and is used by the RMAN process to execute the backup.

To drive the backup process with SEP sesam, a command in combination with the command event is created to call the SEP SBC Oracle client module. It generates and executes an RMAN script with the given arguments. A command event can be created either as a standalone, non-recurring instance, or it can be scheduled to occur at regular intervals to automate the Oracle backup process.

Alternatively, the Oracle backup can be initiated externally. In this case an RMAN script is configured on the Oracle server, referencing the SEP sesam server, the backup task, the media pool and optional additional backup parameters.

To ensure the smooth operation of the backup process, permissions that allow remote command execution should be configured on the Oracle server (the SEP sesam Client). Additionally, for online backups to function, the Oracle database must be in ARCHIVELOG mode.

Enabling ARCHIVELOG mode of the Oracle database

To perform an online backup, the Oracle database must be operating in ARCHIVELOG mode. Oracle recommends shutting down the database and conducting an offline backup to protect against potential issues before transitioning from NOARCHIVELOG mode. This offline backup will serve as the final backup of the database in NOARCHIVELOG mode and can be used in the event of any complications during the change to ARCHIVELOG mode.

To change the database archiving mode, you must be connected to the database with administrator privileges (as SYSDBA).

Checking the database archiving mode:
  1. Launch sqlplus from the console using Oracle database administrator credentials.
  2.      #> sqlplus "/as sysdba" 
  3. Check the archiving online backup mode.
  4.      #> select name, log_mode from v$database;
         NAME      LOG_MODE
         --------- ------------
         MYDB      NOARCHIVELOG

If the database log mode indicates ARCHIVELOG, you can perform an Oracle RMAN online backup. If it displays NOARCHIVELOG mode, perform the procedure described below.

Transitioning to ARCHIVELOG mode:
  1. Shut down the database (MYDB).
  2.      #> shutdown immediate;
  3. Start the database and set it to Mount status. To change the archive mode, the database must be mounted but not open.
  4.      #> startup mount;
  5. Switch to ARCHIVELOG mode.
  6.      #> alter database archivelog;
  7. Bring the database back online.
  8.      #> alter database open;
  9. Check the archiving mode again.
  10.      #> select name, log_mode from v$database;
         NAME      LOG_MODE
         --------- ------------
         MYDB      ARCHIVELOG 

Enabling ARCHIVELOG mode ensures that online redo log files are archived before reuse. It is strongly recommended to designate a specific location for these archive logs to prevent them from being stored in random locations. Note that if the designated archive log destination runs out of space, the database will automatically shut down. For details, see Oracle documentation Specifying Archive Destinations.

Creating an Oracle backup task

An Oracle backup task defines the scope of the backup and establishes the link between the Recovery Manager (RMAN) process and the SEP sesam savesets. The backup process in SEP sesam is handled by the command and command event, so there is no need to create or schedule a backup event for this task.

For general information on SEP sesam backup configuration and prerequisites, see Standard Backup Procedure. This section deals only with Oracle-specific information.

Note
It is recommended to create separate backup tasks for each Oracle database. This helps to identify valid backups for a specific Oracle database in case restore is required.

To configure a backup of Oracle database, first create a backup task for the Oracle client:

  1. From Main Selection -> Tasks -> By Clients, select the Oracle client and then click New Backup Task. The New Backup Task window opens.
  2. From the Task type drop-down list, select Oracle.
  3. Under Source, enter the name of the Oracle database or use the browse button to select the database in the Client File View.
  4. Configure the options as required and click OK to create the task. For detailed instructions see Creating a Backup Task.

Creating a command

SEP sesam offers the SEP SBC Oracle client module that uses RMAN for Oracle database backups. The module is called with a command event using the SEP sesam command sbc_oracle_rman. Based on the arguments provided with the sbc_oracle_rman command, the module generates and subsequently executes the RMAN script. The usage of this command varies depending on the platform. In a Windows shell scripting environment, it is required to specify the parameters in the precise order.

To create a command in SEP sesam from Main Selection -> Tasks -> Commands click New Command to open the New Command window. Fill in the fields as required. The command definition can also contain a cancellation command that stops the execution of the RMAN script in case the SEP sesam command is aborted (currently available on Windows only). For detailed instructions see Creating a Command.

Using sbc_oracle_rman command

The sbc_oracle_rman command is a wrapper script that generates an RMAN script with the given arguments and then executes RMAN with the generated script. The following parameters are available:

  -b: Backup operation. By default, this is a full, online, single channel backup.
  -r: Restore operation. By default, this is a full online, single channel restore.
      NOTE:
      Before restoring an Oracle database, it must be set to the required state,
      e.g., "SHUTDOWN; STARTUP MOUNT;"
      After restore an "ALTER DATABASE OPEN RESETLOGS;" might be necessary.

  -l <copy|full|diff|incr|arch>: Backup level COPY, FULL, DIFF, INCR and ARCHIVELOG.
     Backup level may be combined with ARCHIVELOG backup,
     e.g., -l copy_arch

  -o {option}: The following options are supported:

     delete                    Delete archive logs after backup.
     delete_later              Delete archive logs when successfully backed up 3 times.
     offline                   WARNING: This option will automatically SHUT DOWN
                                        the database before the backup and START it UP after the backup!

     controlfile               Restore control file with RMAN catalog.
     controlfile_DBID={DBID}   Restore control file without RMAN catalog. DBID is required.
     recover                   Recover after restore.
     until={YYYYMMDD-HH:MM:SS} Point-in-time recovery with specified time.

  -T <target_database_connect_string>:  default is ORACLE_SID
  -R <recovery_catalog_connect_string>: default is NoCatalog
  -C <SEP_sesam_Server>: SEP sesam Server hostname
  -S <tape_server>: tape server hostname
  -j <SEP_sesam_job>: the name of the SEP sesam job, under which the backup is running
  -v [0|1]: debug on (set -x)
  -m <media_pool_name>: the name of the SEP sesam media pool, used for backup
  -p <number> the number of backup channels
     <table_space> a single table space to be backed up or restored
     If it is not specified, a backup/restore of the whole database is performed.

Usage on Linux/Unix

 oracle@orax10:~/product/10.2/db_1/sob> ./sbc_oracle_rman.sh

Usage:

./sbc_oracle_rman.sh -b|r <-l level> -T <target_DBS> -R <Catalog> -S <SEP_sesam_Server> \
                             -j <SEP_sesam_job> -m <media_pool_name> -o <option> -p <number of streams> <table_space>
Usage examples for backup and restore on Linux/Unix
Example 1
Level 0 backup of the SID orcl to the SEP sesam Server smsrv to the already configured task orax10_DB-orcl to media pool VTD1 with recovery catalog RCVCAT.
 /opt/oracle/product/10.2/db_1/sob/sbc_oracle_rman.sh -b -l copy -T orcl -R sys/password@RCVCAT -C smsrv -j orax10_DB-orcl -m VTD1
Example 2
Archive log backup of SID prod to SEP sesam Server backupsrv to the already configured task dbsrv_ora-prod to mediapool DAY, using SEP sesam drive 5 and not using an Oracle recovery catalog.
 /opt/oracle/product/10.2/db_1/sob/sbc_oracle_rman.sh -b -l arch -T prod -C backupsrv -j dbsrv_ora-prod -m DAY -d 5
Example 3
Full restore of the database prod with automatic recovery from SEP sesam Server smsrv and sesam task orax10_DB-prod from media pool DISK.
  1. Shut down the database with Oracle management tools.
  2.   SQL> shutdown immediate
  3. Mount the database.
  4.   SQL> startup mount
  5. Restore the database.
  6.   # /opt/oracle/product/10.2/db_1/sob/sbc_oracle_rman.sh -r -T prod -o recover -C smsrv -j orax10_DB-prod -m DISK
  7. Open the newly restored database.
  8.   SQL> alter database open;
Example 4
Point-in-time-recovery to the 2nd of February 2017 of database fanta with automatic recovery. Connecting to the already configured SEP sesam task dbserver_ora-fanta in the SEP sesam GUI and using the recovery catalog RCAT.
  1. Shut down the database with Oracle management tools.
  2.   SQL> shutdown immediate
  3. Mount the database.
  4.   SQL> startup mount
  5. Restore the database.
  6.   # /opt/oracle/product/10.2/db_1/sob/sbc_oracle_rman.sh -r -T fanta -R sys/password@RCAT -o recover,until=20170202-16:31:00 -C sesamsrv -j dbserver_ora-fanta -m Month
  7. Open the newly restored database.
  8.   SQL> alter database open resetlogs;


Usage on Windows

The difference between the Windows and SEP sesam Linux/Unix Oracle extensions is that regular Windows shell scripting doesn't offer ARGV tags for all parameters. Consequently, the given parameters must be specified in this exact order when calling the script:

.\sbc_oracle_rman.cmd b full <user>/<password>@<sid> <user>/<password>@<RCAT> <SEP_sesam_Server> <SEP_sesam_job> <SEP_sesam_drive_number> <media_pool_name> [<trace_level>] [<table_space>]

If a user is authorized via OS login, you can use <sid>. If the Recovery Catalog (RCAT) option was not used, you must specify the nocatalog parameter to use the control file of the target database instead.

.\sbc_oracle_rman.cmd b full <sid> nocatalog <SEP_sesam_Server> <SEP_sesam_job> <SEP_sesam_drive_number> <media_pool_name> [<trace_level>] [<table_space>]
Usage examples for backup and restore on Windows
Example 1
Full backup with recovery catalog to SEP sesam Server backupsrv with SEP sesam backup task type Oracle oracle_db_orcl to media pool ltopool to SEP sesam drive 2.
.\sbc_oracle_rman.cmd b full oracle/password@orcl oracle/password@rcvcat backupsrv oracle_db_orcl 2 ltopool 2
Example 2
Full backup as above without recovery catalog.
.\sbc_oracle_rman.cmd b full oracle/password@orcl nocatalog backupsrv oracle_db_orcl 2 ltopool 2
Example 3
Full restore to DB 'reco' without recovery catalog.
 .\sbc_oracle_rman.cmd r full 'reco' nocatalog backupsrv oracle_db_orcl 2 ltopool


Embedding a plain-text password (optional)

To avoid entering a plain text password in the remote command, do one of the following:

  • Embed the password into the sbc_oracle_rman.sh script.
  • Use the Oracle Enterprise Manager scheduler to execute an RMAN backup script instead of using the SEP sesam command event. In this case make sure that you have the necessary access rights for the database and modify the environment variables in the script (SESAM_SERVER, SESAM_TASKEVENT...). For details see Creating external RMAN backup script.

When using the Oracle Recovery Catalog database, use the password of the RMAN user for the Recovery Catalog database to call the sbc_oracle_rman script, not the password for the Oracle database.

Creating a command event

A command event is used to execute the defined sbc_oracle_rman command for Oracle backup, either as a one-time event, or a scheduled event. Optionally, for the command event you can specify additional options to specialize the original sbc_oracle_rman command. The additional parameters are appended to the end of the command. In this case make sure the full command follows the correct syntax and parameter order (especially on Windows).

To create a command event, in SEP sesam from Main Selection -> Tasks -> Commands select and right-click the sbc_oracle_rman command, and then click New Command Event to open the New Command Event window. Fill in the fields as required. You can specify the follow-up command to validate the backup using the RMAN crosscheck command. For detailed instructions see Creating a Command Event.

Creating external RMAN backup script

This section explains only the SEP sesam-specific part of Oracle RMAN. For details about RMAN and setting up a correct backup strategy, see Oracle Database Documentation.

To manage backup of an Oracle database with SEP sesam externally, you need to create an RMAN script on the Oracle server. This script contains a set of instructions for RMAN to follow during the backup process. It begins by logging in to the target database, which is the database you intend to back up. Next, it opens a backup channel, through which the backup operation is performed. For parallel backups, you can allocate additional channels. Then the script initiates the backup process, generating a unique ID to identify the saveset, and keeping to the specified limit on the number of files per saveset. When backup is completed, the script releases the backup channel.

The RMAN script must reference the SEP sesam server, the specific Oracle backup task, and the media pool. Optionally, you can include additional parameters that are available.

Note
To enable source-side deduplication for external backups, use the following parameter:
SESAM_DRIVE=DS@+_SSDD_

Using the GUI option in backup event specification, referenced with SESAM_TASKEVENT parameter, will not enable the source-side deduplication.

SEP sesam specific parameters
SESAM_SERVER (*) Name of the SEP sesam Server (e.g., http://bcksrv:11000).
SESAM_TASKEVENT This parameter references the name of the (unscheduled) backup event intended for Oracle to use when performing backup, allowing users to set a migration task and follow-up event for the backup. Note that he configured backup event for an Oracle backup task must me unscheduled (option Without Schedule), which might require additional configuration, see Events without schedule.

When configuring the backup event for an Oracle backup task, you can set the migration task, follow-up event, and failover backup event, in addition to the general settings and parameters for the backup. This enables you to manage and maintain the backup settings and related subsequent actions in one location, without making any changes on the Oracle host. When backup is started, the SEP sesam Client on the Oracle host connects to the SEP sesam Server and retrieves all specified settings from the backup event configuration. When backup is finished, the configured migration task and events will be started. For more information on configuring backup events, see Creating a Backup Event.

Note that this parameter replaces parameters SESAM_JOB, SESAM_POOL, SESAM_TAPE_SERVER, SESAM_DRIVE, SESAM_MIGRATION_TASK, and SESAM_FOLLOW_EVENT.

SOB_TRACE Trace level (max. 3).
SOB_LOGFILE Name of the log file. If no log file is specified, trace messages are written to sbtio.log.

Deprecated parameters, replaced by SESAM_TASKEVENT:

SESAM_JOB (*) Task name for Oracle backup. You should create a task before setting up RMAN backup. See Creating a backup task type Oracle.
SESAM_POOL (*) Media pool name.
SESAM_DRIVE Drive number.
SESAM_TAPE_SERVER Name of the SEP sesam tape server. Optionally, specify a port range (e.g., bcksrv:11001@11003-11007).
SESAM_MIGRATION_TASK This optional parameter references the name of the migration task that will be started when Oracle backup completes successfully. If SESAM_TASKEVENT is used, the migration task can be specified in the backup event configuration.
SESAM_FOLLOW_EVENT This optional parameter references the name of the follow-up that will be started when Oracle backup completes successfully. For more information refer to Follow-up Events. If SESAM_TASKEVENT is used, the follow-up event can be specified in the backup event configuration.
RMAN specific parameters
SBT_LIBRARY=<path> Path to the SBT library file (libobk.so) on the system. Use on AIX systems, if the library cannot be found automatically. The library file libobk.so resides in <sesam_install>/bin/sesam.
Parameter must NOT be part of the ENV= variable. Example: allocate channel t1 type ’SBT’ parms='SBT_LIBRARY=/opt/sesam/bin/sesam/libobk.so ENV=(...)'. See: Oracle Documentation
Example RMAN backup script

The following script example performs a full database backup:

	oracle@oraclesrv:/product/oracle/bin> cat ora_full.rman
	connect target
	run{
	allocate channel t1 type ’SBT’ parms ’ENV=(SESAM_SERVER=backup,SESAM_TASKEVENT=oracle_full)’;
	backup database
	format ’O%d_%u.dat’;
	filesperset 100;
	release channel t1;
	}

Where:

  • format ’O%d_%u.dat’ generates a unique ID. Both Oracle and SEP sesam use this ID to identify the correct saveset during restore. Oracle guarantees that the combination of %d%u will result in a unique ID.
  • filesperset 100 sets the limit on the number of files per saveset to 100

When this script is executed with rman cmdfile ora full.rman, the result should be as follows:

 oracle@oraclesrv:\~/product/oracle/bin> ./rman cmdfile ora_full.rman
 Recovery Manager: Release 9.2.0.1.0 - ProductionCopyright (c) 1995
 RMAN> connected to target database: MYDB (DBID=2383580887)
 RMAN> connected to recovery catalog database
 RMAN> 2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13> 14>
 allocated channel: t1
 channel t1: sid=16 devtype=SBT_TAPE
 channel t1: MMS Version 1.7.0.1
 Starting backup at 30-JUL-23
 channel t1: starting full datafile backupset
 channel t1: specifying datafile(s) in backupset
 including current SPFILE in backupset
 including current controlfile in backupset
 input datafile fno=00001 name=/opt/oracle/oradata/mydb/system01.dbf
 input datafile fno=00002 name=/opt/oracle/oradata/mydb/undotbs01.dbf
 input datafile fno=00005 name=/opt/oracle/oradata/mydb/example01.dbf
 input datafile fno=00010 name=/opt/oracle/oradata/mydb/xdb01.dbf
 input datafile fno=00006 name=/opt/oracle/oradata/mydb/indx01.dbf
 input datafile fno=00009 name=/opt/oracle/oradata/mydb/users01.dbf
 input datafile fno=00003 name=/opt/oracle/oradata/mydb/cwmlite01.dbf
 input datafile fno=00004 name=/opt/oracle/oradata/mydb/drsys01.dbf
 input datafile fno=00007 name=/opt/oracle/oradata/mydb/odm01.dbf
 input datafile fno=00008 name=/opt/oracle/oradata/mydb/tools01.dbf
 channel t1: starting piece 1 at 30-JUL-23
 channel t1: finished piece 1 at 30-JUL-23
 piece handle=b_7_1_MYDB.dat comment=API Version 1.1,MMS Version 1.7.0.1
 channel t1: backup set complete, elapsed time: 00:07:47
 Finished backup at 30-JUL-23
 RMAN> Recovery Manager complete.


Backing up CDBs and PDBs

SEP sesam supports Oracle multitenant architecture that enables you to manage multiple databases within a single instance. With multitenant architecture the Oracle databases (v. ≥ 12c) function as multitenant container databases (CDBs) which include zero, one or more customer-created pluggable databases (PDBs). The PDB is a portable collection of schemas, schema objects, and non-schema objects that appears to an Oracle Net client as a traditional Oracle database (non-CDB). For more information on multitenant architecture and setup of CDBs and PDBs, see About the Multitenant Architecture.

By using the multitenant architecture, you can back up and restore a complete multitenant container database (CDB), the root, or one or more pluggable databases. The RMAN commands used for backing up and recovering CDBs and PDBs are very similar to those used for traditional Oracle databases (non-CDBs), with minor differences in the syntax. Note that you can perform the same backup and restore operations on non-CDBs as on CDBs and PDBs. For details on how to back up and restore CDBs and PDBs, see Oracle documentation.

To perform backups of pluggable databases (PDBs), adjust the RMAN backup script accordingly to include the necessary PDB-specific parameters. For more details refer to the examples provided below.

Usage examples for PDB backup and restore
backing up a single PDB
    run{
    allocate channel t1 type ’SBT’ parms ’ENV=(SESAM_SERVER=backup,SESAM_JOB=oracle_full,SESAM_POOL=DISK)’;
    BACKUP PLUGGABLE DATABASE pdbname;
    release channel t1;
    }
backing up multiple PDBs
    run{
    allocate channel t1 type ’SBT’ parms ’ENV=(SESAM_SERVER=backup,SESAM_JOB=oracle_full,SESAM_POOL=DISK)’;
    BACKUP PLUGGABLE DATABASE pdbname1, pdbname2;
    release channel t1;
    }
validating PDB for the restore
    run{
    allocate channel t1 type ’SBT’ parms ’ENV=(SESAM_SERVER=backup,SESAM_JOB=oracle_full,SESAM_POOL=DISK)’;
    RESTORE PLUGGABLE DATABASE pdbname VALIDATE;
    release channel t1;
    }
restoring PDB
     run{
     allocate channel t1 type ’SBT’ parms ’ENV=(SESAM_SERVER=backup,SESAM_JOB=oracle_full,SESAM_POOL=DISK)’;
     ALTER PLUGGABLE DATABASE pdbname CLOSE;
     RESTORE PLUGGABLE DATABASE pdbname;
     RECOVER PLUGGABLE DATABASE pdbname;
     ALTER PLUGGABLE DATABASE pdbname OPEN;
     release channel t1;
     } 


Enabling disaster recovery with CONTROLFILE AUTOBACKUP

When operating in NOCATALOG mode, RMAN stores its metadata in the control file of the target database instead of using a separate recovery database catalog. To enable smoother disaster recovery of a complete Oracle database, RMAN can be configured to automatically back up the control file and server parameter file.

Note
It is recommended that the CONTROLFILE AUTOBACKUP option is always enabled.

Enabling the CONTROLFILE AUTOBACKUP option ensures that during every Oracle backup, a dedicated saveset for the control file is generated and stored on the SEP sesam Server. This enables RMAN to recover the database even if the current control file, catalog, and server parameter file are lost. The control file provides database consistency information used for recovery and can be used to restore database information on a re-installed or replacement system.

  1. Using RMAN, check the CONTROLFILE AUTOBACKUP option setting.
  2.  RMAN> show controlfile autobackup;
     RMAN configuration parameters for database with db_unique_name XE are:
     CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
  3. Enable the CONTROLFILE AUTOBACKUP option.
  4.  RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;

Validating backups with crosscheck

WThe RMAN crosscheck command performs a synchronization and validation process of the Oracle database backups and copies between SEP sesam and recovery catalog. It ensures that the backup files are still present and accessible in their specified locations, verifying their integrity and readiness for potential restore operations.

If a backup or copy is found to be missing or inaccessible, RMAN updates its status in the recovery catalog, marking it as expired. This affects the whole saveset; if an object within a backup is not located, the entire backup is marked as expired.

When using crosscheck, you must allocate a backup channel of type 'SBT' if automatic channels for the media manager are not configured. This ensures that RMAN will use SEP sesam to perform the maintenance tasks. Additionally, the command delete expired can be used to efficiently remove all expired backups from RMAN.

Example
allocate channel for maintenance type 'SBT' parms
'ENV=(SESAM_SERVER=sesam,SESAM_JOB=job,SESAM_POOL=pool)';
crosscheck backup;
delete expired;


See also

Oracle Requirements and ConfigurationOracle RestoreOracle Duplicate Database

Copyright © SEP AG 1999-2024. All rights reserved.
Any form of reproduction of the contents or parts of this manual is allowed only with the express written permission from SEP AG. When compiling and designing user documentation SEP AG uses great diligence and attempts to deliver accurate and correct information. However, SEP AG cannot issue a guarantee for the contents of this manual.