SEP sesam Extension for Oracle

From SEPsesam

Jump to: navigation, search

SEP sesam Extension for Oracle 8i/9i/10g/11g on Linux, Unix and Windows

(C)SEP AG

Copyright 1999-2011 by SEP AG. 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.


Contents

Introduction

The SEP sesam online module for Oracle/RMAN provides a Media Management Library (MML) for saving data from Oracle databases to a SEP sesam Server. The API of MML is specified by Oracle to give the Recovery Manager (RMAN) access to a backup application. SEP sesam will manage the whole backup media handling like loading the correct tapes, whereas RMAN decides which data has to be saved or recovered. This document provides information about the Sesam specific parts of Oracle backups. It’s not an Oracle/RMAN administration guide. Please read the documentation of RMAN to get familiar with Oracle’s backup and recovery concepts and tools.


System Requirements

  • Oracle 8i/9i/10g/11g on Linux, AIX, Solaris and Windows
  • SEP sesam Version >= 3.4 (incl. DB-Online-Module for Oracle 8/9/10/11)
  • Standard SEP sesam Backup Client installed
  • File system backups should work with this SEP sesam Client
  • An already installed oracle server with a running Oracle application and running database
  • For Oracle online backups, the database has to run in Archive Log mode

Please consult the Oracle administration guide. For installation we assume the following environment. Please adjust the paths and variables according to your needs.

ORACLE SID=mydb
ORACLE BASE=/opt/oracle
ORACLE HOME=/opt/oracle/product/oracle
$ORACLE HOME/bin is in the search path


  • SEP sesam Client for Linux/Windows:

http://download.sep.de/extensions/databases/oracle/

Check and set up Oracle database archivelog mode

  • Start sqlplus from the console with Oracle database admin credentials:
#> sqlplus "/as sysdba"
  • Check the archivelog mode for online backup:
#> select name, log_mode from v$database;
NAME      LOG_MODE
--------- ------------
MYDB      ARCHIVELOG

If the database log mode show ARCHIVELOG then a Oracle RMAN online backup is possible. If not the archivelog mode has to be switched on. For that the database has to be shutdown, first:

  • Shutdown the database MYDB:
#> shutdown immediate;
  • Start the database and set it to Mount status:
#> startup mount;
  • Switch on archivelog mode:
#> alter database archivelog;
  • Bring the database online:
#> alter database open;

Again, you can check the archivelog mode using the appropriate SQL command above.


Installation on Linux or Unix

  • First verify that the standard SEP sesam Backup Client is already installed
  • File system backup should work with this SEP sesam Client
  • Login as oracle user
  • Create a new directory sob in $ORACLE HOME
  • Unpack the file <OS> sob x.x.x.x.tgz there (or sesam-oracle-client<version>.tar.gz for Linux based systems)
  • Create a symbolic link in $ORACLE HOME/lib to the unpacked library file libobk.so. If file already exists, rename it first.
oracle@oraclesrv:~> cd $ORACLE_HOME
oracle@oraclesrv:/product/oracle> mkdir sob
oracle@oraclesrv:/product/oracle> cd sob
oracle@oraclesrv:/product/oracle/sob> tar xvzf /tmp/linux_sob.2.3.1.1.tgz
oracle@oraclesrv:/product/oracle/sob> cd ../lib
oracle@oraclesrv:/product/oracle/lib> ln -s ../sob/libobk.so

Starting with Oracle 9i the Oracle kernel commonly must not be re-linked any more.


Installation on Windows

  • verify that the standard Sesam Backup Client is already installed
  • rename an already existing file ”orasbt.dll” in <ORACLE HOME>\bin directory.
  • copy the Sesam file ”orasbt.dll” there.

The database has to be restarted to activate the new DLL.


Complete function test by sbttest program

By using the Oracle program sbttest you can test complete functionality of libobk.so, without interfering with running databases. libobk.so is only available since Oracle version 10g under Windows. For this following environment variables have to be set:

  • SESAM SERVER=<Name of SEP sesam Server>
  • SESAM JOB=<Jobname of Oracle backup> Name of an already configured task on SEP sesam Server with task type Oracle
  • SESAM POOL=<Media pool name> Name of a already configured media pool on SEP sesam Server
oracle@oraclesrv:~/product/10g/lib> export SESAM_SERVER=backsrv
oracle@oraclesrv:~/product/10g/lib> export SESAM_JOB=oracle_test
oracle@oraclesrv:~/product/10g/lib> export SESAM_POOL=DISK
oracle@oraclesrv:~/product/10g/lib> sbttest test1 -trace sbttest.log
The sbt function pointers are loaded from libobk.so library.
-- sbtinit succeeded
-- sbtinit (2nd time) succeeded
Note: This SBT library does not handle version 2.0 of SBT.
sbtinit: Media manager is version 2.3.1.1
sbtopen for output successful
sbtwrite successful, wrote 100 buffers
sbtclose successful after sbtwrite
sbtinfo successful
file t1 is on volume 5:3
sbtopen for input successful
file was created by this program; seed=27600, bufsize=16384, bufcount=100
sbtread successful, read 100 buffers
sbtclose successful after sbtread
sbtremove successful
*** The SBT API test was successful ***

If the test fails, you will find the SEP sesam specific trace messages in sbttest.log.


Configuration

RMAN backup

This chapter only explains the SEP sesam specific parts of Oracle RMAN. It’s not a RMAN administration guide. It’s absolutely necessary to consult the Oracle RMAN documentation for setting up a correct backup strategy. The following example script 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_JOB=oracle_full,SESAM_POOL=DISK)’
backup database
format ’O%d_%u.dat’
filesperset 100;
release channel t1;
}

The script is doing the following:

1. Login to target database (database to be saved)

2. Open a backup channel (For parallel backups more channels can be allocated)

  • SEP sesam specific parameters
SESAM SERVER Name of the SEP sesam Server (*)
SESAM JOB Task name for the Oracle backup (*). The task has to be created on SEP sesam Server before, with task type Oracle.
SESAM POOL Poolname (*)
SESAM DRIVE Drive number
SESAM TAPE SERVER Name of SEP sesam Tape Server
SOB TRACE Tracelevel (max. 3)
SOB LOGFILE name of logfile. If no logfile is specified trace messages

are written to sbtio.log

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.
  • (*) = mandatory parameters
  • format identifier. The format specifier must result in a unique id. Oracle and SEP sesam using this id to identify the correct saveset during restore. Oracle guarantees that the combination of %d%u is unique.

3. include 100 files in one saveset

4. Release the backup channel

When this script is executed with rman cmdfile ora full.rman, the following appears:

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-02
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-02
channel t1: finished piece 1 at 30-JUL-02
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-02
RMAN>
Recovery Manager complete.

SEP sbc Oracle client Extension

The archive <OS> sob 3.0.x.x.tgz file contains the SEP module sbc Oracle client. This module is a shell script, which may be called from SEP sesam as a SEP sesam Command Event. Please take a look into SEP sesam Administration documentation for further information about SEP sesam command events. This wrapper script creates a RMAN script with the given arguments and executes RMAN with the generated script.

 oracle@orax10:~/product/10.2/db_1/sob> ./sbc_oracle_rman.sh
 Usage: ./sbc_oracle_rman.sh -b|r <-l level> -T <TargetDBS> -R <Catalog> -S <SesamServer> \
                             -j <SesamJob> -m <Mediapool> -o <option> -p <Number of streams> <TableSpace>
 
 Arguments:
  -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.
      HINTS:
      Before the restore the database must be set to the required state,
      e.g. "SHUTDOWN; STARTUP MOUNT;"
      After restore an "ALTER DATABASE OPEN RESETLOGS;" may 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 archivelogs after backup
     delete_later              Delete archivelogs when successfully backed up 3 times
     offline                   WARNING: This option will automatically SHUTDOWN
                                        the database before and STARTUP after the backup!
 
     controlfile               Restore controlfile with rman catalog
     controlfile_DBID={DBID}   Restore controlfile without rman catalog. Needs DBID
     recover                   Recover after restore
     until={YYYYMMDD-HH:MM:SS} Point-in-time recover with until time
 
  -T <Target database connect string>:  Default: ORACLE_SID
  -R <Recovery catalog connect string>: Default: NoCatalog
  -C <SesamServer>: SEP sesam Server host name
  -S <TapeServer>: Tape Server host name
  -j <SesamJob>: SEP sesam Job name, under which the backup is running
  -v [0|1]: debug on (set -x)
  -m <pool name>: SEP sesam media pool to use for the backup
  -p <number> defines the number of backup channels
     <TableSpace> defines a single tablespace to backup or restore.
                  If this is not given, a backup/restore of the whole database is done

Examples:

  • Level 0 Backup of the SID orcl to the SEP sesam Server smsrv to the already configured task orax10_DB-orcl to mediapool 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
  • Archive log backup of SID prod to Sesam Server backupsrv to the already configured task dbsrv_ora-prod to mediapool DAY with using Sesam drive 5 and without using a 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
  • Full restore of the database prod with automatic recovery from Sesam Server smsrv and Sesam task orax10_DB-prod from mediapool DISK

1. At first shutdown the database with the oracle management tools

 SQL> shutdown immediate

2. Mount the database

 SQL> startup mount

3. Restore the database

 # /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

4. Open the new incarnation of the database

 SQL> alter database open;


  • Point-In-Time-Recovery to time February, the 2nd 2011 of database fanta with automatic recovery. Connect to the preconfigured SEP sesam task dbserver_ora-fanta in the SEP sesam GUI and using the Recovery Catalog RCAT

1. At first shutdown the database by oracle management tools

 SQL> shutdown immediate

2. Mount the database

 SQL> startup mount

3. Restore the database

 # /opt/oracle/product/10.2/db_1/sob/sbc_oracle_rman.sh -r -T fanta -R sys/password@RCAT -o recover,until=20110202-16:31:00 -C sesamsrv -j dbserver_ora-fanta -m Month

4. Open the new incarnation of the database

 SQL> alter database open resetlogs;


Create an Oracle task

In case of an Oracle backup the SEP sesam Server works as media manager. Oracle RMAN starts the backup and sends the data to the destination referenced to the given parameter of the SEP sesam environment.

Example with following values:

- Oracle server name:    orax10
- Oracle database (SID): prod
- SEP sesam Server:      smsrvt
- Sesam Oracle taskname: orax10_DB-orcl
- Sesam media pool:      DISK
  • Create task of the Oracle backup client orax10, define the taskename and set the appropriate Oracle database name (SID) as source:



Create a Sesam command event

It's useful to start the command sbc_oracle_rman.sh on the Oracle server remote by a Sesam schedule. To configure this, you have to create a schedule first:



After <OK>, right mouse click and select New command event.



In the dialog click the button <List> and the next window will be opened. To create e new command choose the button <New> and fill all fields with the appropriate values.



Name
Name of the command event
Client
Select the hostname of the Oracle server from list.
User
Enter the username, who should perform the command with his rights on the Oracle Server
Command
Enter the full qualified command, which should be executed on the Oracle Server

Then commit the command definition with the button <Save>. Then assign this command to the command event by button <UseIt>. The dialog below shows the complete definition. Commit the configuration with <OK>.



Set remote command permissions

As default the SEP sesam server has no rights to execute commands remote on a backup client (here the Oracle server). To give the appopriate permissions for needed command it is neccessary to copy the file sesam_cmdusers_allow from the template directory of the Sesam Client to the /etc driectory of the client (Oracle server). After that adapt the file with appropriate values. You have to set the user who has to execute the command and behind it separated by a blank the full qualified command.

Example:

cp /opt/sesam/skel/templates/sesam_cmdusers.allow /etc

Edit the file and enter the following line (referencing to the example above):

oracle /opt/oracle/product/10.2/db_1/sob/sbc_oracle_rman.sh


Further Links/Literature

For further reading on the topic we recommend the following books:

Personal tools