Instructor's Notes
(If applicable)
- Lesson 10 – Getting Started with Tapes (with Oracle RMAN. An introduction to Media Management software concepts and use of tapes for backup and restore operations).
- Author: Dave Anderson, SkillBuilders
- www.skillbuilders.com
- Last Update: October 17, 2007
Other Text:
(Examples or comments displayed on slide, if any).
Instructor's Notes
(If applicable)
- In this lesson you will learn about:
- Media Management concepts
- Installing the MML
- Backup using tapes
- Common Legato and Veritas environment variables
- Configuring default tape channels
- Backing up with default channels
- Restore / Recovery with tape channels
- Checking the progress of tape jobs
- Terminating tape jobs
- Media Manager debugging
Other Text:
(Examples or comments displayed on slide, if any).
Instructor's Notes
(If applicable)
- We learned in the RMAN architecture lesson that RMAN does not have the built-in ability to write directly to tape. We must install additional software called (by Oracle) “Media Management” software.
- In addition to Oracle’s product, Oracle Secure Backup, several vendors supply media management (i.e. tape) software (and are part of the Oracle “Backup Solutions Program”). The Media Management Vendor Partner list includes Legato, Veritas, Hewlett Packard and others. Visit the web site listed above for a complete list of vendors and their software products.
- Warning: The Oracle Backup Solutions web site lists both Veritas NetBackup and Veritas Backup Exec as compatible MML’s. While NetBackup is, the Backup Exec product (the less expensive product) is not.
Other Text:
(Examples or comments displayed on slide, if any).
Instructor's Notes
(If applicable)
- The Oracle server becomes (i.e. is viewed as) a client to the Media Management server. A typical tape environment will include the following components:
- Oracle Server(s) – One or more servers running databases that require tape backup.
- Tape Media Management Library – A software module linked into the Oracle kernel. This module accepts the generic calls from the Oracle server processes and translates them into calls that the tape client software understands. For example, Legato provides the “NetWorker Module for Oracle”.
- Media Management Client – This software is installed on and runs on each Oracle server. The client accepts requests from the MML and interacts with the Media Management Server.
- Media Management Server – The MM server handles requests from one or more clients to either backup or restore Oracle data. The MM Server often runs on a separate server (i.e. computer) than the Oracle databases; this server is connected to one or more tape devices.
Other Text:
(Examples or comments displayed on slide, if any).
Oracle Server<br>Oracle Database<br>Tape MML (link into Oracle)<br>MM Client<br>MM Server<br>TAPES<br>
Instructor's Notes
(If applicable)
- Oracle 10g Release 2 includes Oracle Secure Backup, an integrated tape management software solution. Oracle Secure Backup supports:
- RMAN. As an RMAN media manager, it enables RMAN to backup directly to tape devices.
- Oracle Secure Backup Express Edition is positioned as a replacement for Legato Single Server Version, which was shipped at no cost with Release 1. LSSV supports just one tape device (among several other limitations).
- Encryption of backups.
- Any number of output devices, tape or otherwise, at a cost of $3000 per device.
- Backup of non-database files. For example, you can backup the Oracle software in the Oracle Home.
- Networked environments. A single installation of Oracle Secure Backup can be used to
- For more information, refer to the Oracle® Database Readme 10g Release 2 (10.2), section 10 Media Management Software. The Readme document can be accessed from the welcome.html message shipped with Oracle 10g Release 2.
Other Text:
(Examples or comments displayed on slide, if any).
R2<br>
Instructor's Notes
(If applicable)
- Each vendor that supplies a media management module will document the installation procedures. For example, Legato provides an installation guide for its Legato Single Server Version (LSSV) at:
http://portal1.legato.com/lssv/lssvig_6.1.pdf.
- The command shown above is one step in a ten-step process for installing the LSSV. (LSSV is a free MML that is shipped with all versions of the Oracle database. It is a limited-feature product that only works in environments where the tape device is installed locally on the Oracle server. Visit http://www.legato.com/lssv for details.)
- Refer to the specific vendor installation manuals for details on installation. Complete installation and setup of the MML and tape device is outside the scope of this course.
Other Text:
(Examples or comments displayed on slide, if any).
<br>root@beatles> ./lsminst .<br>
Instructor's Notes
(If applicable)
- Once the tape software is installed, backing up to tape is a simple process. Use “type sbt” instead of “type disk” on the ALLOCATE CHANNEL command. Additionally, you may need or want to send the MM software additional instructions with the PARMS option. In the example shown above, I use the Legato NSR_COMPRESSION=TRUE environment variable to enable hardware compression. Refer to your media management software vendors administration guide for more information and a complete list of environment variables.
- In this example I also use the SET COMMAND ID command to put an easily identifiable string in the V$SESSION.CLIENT_INFO column. This will aid in debugging and tuning. Refer to the debugging and tuning lessons for more information.
Other Text:
(Examples or comments displayed on slide, if any).
run {
<br>allocate channel t1 type sbt MAXOPENFILES 8
<br> parms='ENV=(NSR_COMPRESSION=TRUE)';
<br>set command id to 'RMAN';
<br>backup full force tag='Full Backup' database; }<br>Use SET to put string in V$SESSION.CLIENT_INFO<br>Use ENV= to set MM environment variables<br>Use SBT to allocate tape channel<br>Enable tape drive compression<br>
Instructor's Notes
(If applicable)
- Both Veritas and Legato support environment variables as a way of configuring the media management environment. (I suspect the other vendors do as well.) Refer to the example on the previous page to see how to set the environment variables. Above I list common environment variables for these products.
- Refer to the specific product administration guides for details on the use of these environment variables. You will find the LSSV Administration Guide at http://portal2.legato.com/lssv/lssvag_6.1.pdf.
Other Text:
(Examples or comments displayed on slide, if any).
Instructor's Notes
(If applicable)
- With Oracle9i, we can configure default channels. The example shown above sets the default channel to tape, then issues a backup command. Note that the channel allocated by the BACKUP command is “ORA_SBT_TAPE_1”; this is the default channel name assigned by RMAN.
Other Text:
(Examples or comments displayed on slide, if any).
RMAN> configure default device type to sbt;
<br>
<br>old RMAN configuration parameters:
<br>CONFIGURE DEFAULT DEVICE TYPE TO DISK;
<br>new RMAN configuration parameters:
<br>CONFIGURE DEFAULT DEVICE TYPE TO 'SBT_TAPE';
<br>new RMAN configuration parameters are successfully stored
<br>starting full resync of recovery catalog
<br>full resync complete
<br>
<br>RMAN> backup tablespace users;
<br>
<br>Starting backup at 12-JAN-04
<br>allocated channel: ORA_SBT_TAPE_1
<br>channel ORA_SBT_TAPE_1: sid=17 devtype=SBT_TAPE
<br>. . .<br>
Instructor's Notes
(If applicable)
- The RMAN SHOW ALL command will display all configurable persistent settings and their values. Here, I have excerpted the configurable settings related to tapes and tape channels. The setting are shown in the form of the command that controls that setting. A brief description of each setting follows:
- CONFIGURE DEFAULT DEVICE TYPE TO 'SBT_TAPE'; - A tape device will be used for any operation that requires a device and does not explicitly allocate its own channel. Use the CONFIGURE DEFAULT DEVICE TYPE command to control this setting.
- CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE TO '%F'; - If controlfile autobackup is enabled, the autobackup should be written to tape with a unique piece-name (i.e. file-name) consisting of DBID, date and sequence number.
- CONFIGURE DEVICE TYPE SBT_TAPE PARALLELISM 1; - Controls the default degree of parallelization. For example, a backup using default tape channels in this environment would allocate one channel (or one tape device – a good choice in my environment since I have just one tape device). See the Tuning RMAN lesson for more information on parallelism.
- CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; - RMAN has the ability to create multiple copies of backups each time a backup is taken. Specify the number of copies that should be created by default with this setting. Note that not all Tape MML’s support this. For example the Legato Single Server Version does not.
- CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; - Similar to the DATAFILE BACKUP COPIES, this controls the number of copies of backed up archivelogs.
- CONFIGURE MAXSETSIZE TO 1 G; - let you to limit the size of a backup set to 1 tape.
Other Text:
(Examples or comments displayed on slide, if any).
RMAN> show all;
<br>
<br>RMAN configuration parameters are:
<br>CONFIGURE DEFAULT DEVICE TYPE TO 'SBT_TAPE';
<br>CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE TO '%F';
<br>CONFIGURE DEVICE TYPE SBT_TAPE PARALLELISM 1; # default
<br>CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
<br>CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # defau
<br>CONFIGURE MAXSETSIZE TO 1 G;
<br>Output shown is an excerpt of the SHOW ALL output<br>
Instructor's Notes
(If applicable)
- This example demonstrates how to use the CONFIGURE command to set default tape channels. First, I configure a tape channel (using hardware compression; refer to the Tuning RMAN lesson for more information on compression and MAXOPENFILES). Next, I set the degree of parallelism to two – thus two tape channels will be automatically allocated for any job that does not allocate its own channels.
- Note that since two channels are allocated I would also want to:
- Configure a second tape channel with all desired environment variables (e.g. compression)
- Insure that two tape devices are available for use.
Other Text:
(Examples or comments displayed on slide, if any).
RMAN> configure channel 1 device type sbt
<br>2> maxopenfiles=8
<br>3> parms='ENV=(NSR_COMPRESSION=TRUE)'
<br>4> ;
<br>
<br>new RMAN configuration parameters:
<br>CONFIGURE CHANNEL 2 DEVICE TYPE 'SBT_TAPE' MAXOPENFILES 8
<br>. . .
<br>
<br>RMAN> configure device type sbt parallelism 2;
<br>
<br>new RMAN configuration parameters:
<br>CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 2;
<br>new RMAN configuration parameters are successfully stored
<br>starting full resync of recovery catalog
<br>. . .<br>
Instructor's Notes
(If applicable)
- Additional examples of backing up with tapes is shown above. We can see that the default channel configured is a tape channel and the degree of parallelism for tapes is two.
Other Text:
(Examples or comments displayed on slide, if any).
RMAN> backup database plus archivelog;
<br>
<br>
<br>Starting backup at 30-NOV-03
<br>current log archived
<br>allocated channel: ORA_SBT_TAPE_1
<br>channel ORA_SBT_TAPE_1: sid=18 devtype=SBT_TAPE
<br>channel ORA_SBT_TAPE_1: NMO v3.5.0.1
<br>allocated channel: ORA_SBT_TAPE_2
<br>channel ORA_SBT_TAPE_2: sid=12 devtype=SBT_TAPE
<br>channel ORA_SBT_TAPE_2: NMO v3.5.0.1<br>RMAN> run {
<br>2> set command id to 'RMAN';
<br>3> backup database plus archivelog;
<br>4> }
<br>
<br>executing command: SET COMMAND ID
<br>
<br>
<br>Starting backup at 30-NOV-03
<br>current log archived
<br>using channel ORA_SBT_TAPE_1
<br>using channel ORA_SBT_TAPE_2<br>Backup from command line<br>Use RUN block to use SET command<br>
Instructor's Notes
(If applicable)
- Restore and recovery operations will also make use of the configured (default) settings. Here we see the default tape channel(s) being allocated as a result of the RESTORE and RECOVER commands.
Other Text:
(Examples or comments displayed on slide, if any).
RMAN> sql 'alter tablespace ts1 offline';
<br>
<br>sql statement: alter tablespace ts1 offline
<br>starting full resync of recovery catalog
<br>full resync complete
<br>
<br>RMAN> restore tablespace ts1 force;
<br>
<br>Starting restore at 30-NOV-03
<br>
<br>using channel ORA_SBT_TAPE_1<br>RMAN> recover tablespace ts1;
<br>
<br>Starting recover at 30-NOV-03
<br>using channel ORA_SBT_TAPE_1
<br>using channel ORA_SBT_TAPE_2
<br>using channel ORA_DISK_1
<br>
<br>starting media recovery
<br>media recovery complete
<br>
<br>Finished recover at 30-NOV-03
<br>
<br>RMAN> sql 'alter tablespace ts1 online';<br>No significant difference from disk restore<br>
Instructor's Notes
(If applicable)
- We see in this example the Oracle reports the wait event as “sbtbackup”. I have been waiting for 1000 seconds (16 minutes) for a tape to be mounted.
- Chapter 15 of the Oracle9i Recovery Manager User’s Guide lists all the possible tape-related events: sbtinit sbtopen sbtread sbtwrite sbtbackup.
- See the supplied script V$SESSION_LONGOPS.SQL for a working sample of this code.
Other Text:
(Examples or comments displayed on slide, if any).
system@TEST> SELECT sid, seconds_in_wait AS sec_wait, event
<br> 2 FROM v$session_wait
<br> 3 WHERE wait_time = 0
<br> 4 ORDER BY sid;
<br>
<br> SID SEC_WAIT EVENT
<br>---------- ---------- -------------------------------------
<br> 1 82491 pmon timer
<br>. . .
<br> 12 1006 SQL*Net message from client
<br> 16 0 SQL*Net message from client
<br> 17 1006 imm op
<br> 18 1006 sbtbackup<br>See the Debugging and Tuning lessons for more information like this…<br>
Instructor's Notes
(If applicable)
- Like jobs that read / write to disk, some tape media managers support cancellation with the attention key (CTRL+C on an RMAN Windows client). Legato, for example, supports this and documents this requirement (to keep catalogs in sync): Add user “oracle” to LSSV administrators list.
- Warning
- CTRL+C did not always work! For example, if the job was waiting for a tape mount, the cancel request was honored on the client, but left RMAN sessions hanging and the Legato console with a pending tape mount. To clear up the pending tape mount, I was forced to load and mount the tape on the Legato server. Then, eventually, the orphaned RMAN processes were cleaned up (i.e. killed).
Other Text:
(Examples or comments displayed on slide, if any).
RMAN> run {
<br>2> allocate channel t1 type sbt MAXOPENFILES 8 parms=
<br>3> backup tag='test' tablespace ts6; }
<br>
<br>allocated channel: t1
<br>channel t1: sid=17 devtype=SBT_TAPE
<br>channel t1: NMO v3.5.0.1
<br>
<br>Starting backup at 29-NOV-03
<br>. . .
<br>channel t1: starting piece 1 at 29-NOV-03
<br>^C
<br>C:\OracleScripts\RMAN><br>CTRL+C on Windows client terminates RMAN<br>Might have to clean up orphaned processes<br>
Instructor's Notes
(If applicable)
- Media management software is an additional piece of software – provided by 3rd party vendors such as Legato or Veritas – required to backup to or restore from tape. If you are having trouble backing up to or restoring from tape, it can be very helpful to capture messages issued by the media manager software. How this is accomplished is specific to the software you have purchased. (Remember that Legato Single Server Version writes its log, by default, to /nsr/logs/daemon.log on the Legato server. (See the section “RMAN Messages” in the lesson Debugging RMAN.) This is the standard log – not the “debugging” log.)
- In my environment I use the Legato Single Server Version (LSSV). Turning on the LSSV debugging log is accomplished by using the RMAN SEND command. Specifically, as the example illustrates, I send NSR_DEBUG environment variable with the path for the log file to LSSV. The name of the LSSV log file is “sbtio.log”. An excerpt from an LSSV log is shown here:
- [oracle@beatles udump]$ more sbtio.log
- SBT-2776 11/19/2003 01:29:01 PM nwora_remove: Error removing ssid 28984882 from the media database:
- nsrmm: RAP error: user oracle on machine beatles is not on administrator list
- I received this error (SBT-2776) when I attempted to remove a tape catalog entry with an RMAN command (DELETE EXPIRED or DELETE OBSOLETE). LSSV reports that I need to add user “oracle” to the LSSV administrator list. (Note that the slide example is not the example that generated the log message shown here.)
Author’s Note
These pages – “Media Manager Debugging” – are intentionally repeated in the lesson Debugging RMAN.
Other Text:
(Examples or comments displayed on slide, if any).
RMAN> run {
<br>2> allocate channel t1 type sbt MAXOPENFILES 8;
<br>3> send 'NSR_ENV=( NSR_CLIENT=beatles,
<br>4> NSR_COMPRESSION=TRUE,
<br>5> NSR_DEBUG=/opt/oracle/admin/test/udump)';
<br>6> set command id to 'dave test';
<br>7> backup tag='debug' tablespace ts1; }
<br>
<br>allocated channel: t1
<br>channel t1: sid=17 devtype=SBT_TAPE
<br>channel t1: NMO v3.5.0.1
<br>
<br>sent command to channel: t1
<br>executing command: SET COMMAND ID
<br>Starting backup at 29-NOV-03<br>
Instructor's Notes
(If applicable)
- In this lesson we learned that RMAN requires additional software, called media management software, to conduct operations to and from tape devices. Once the media management software is installed, allocating and utilizing a tape channel can be accomplished as such:
- run {
- allocate channel t1 type sbt MAXOPENFILES 8
- parms='ENV=(NSR_COMPRESSION=TRUE)';
- set command id to 'RMAN';
- backup full force tag='Full Backup' database; }
- Alternatively, use the CONFIGURE command as shown in detail in this lesson. There are not significant syntactical differences in the actual BACTUP, RECOVER or RESTORE commands.
Other Text:
(Examples or comments displayed on slide, if any).
Instructor's Notes
(If applicable)
- In this lesson you learned:
- Media Management concepts
- Installing the MML
- Backup using tapes
- Common Legato and Veritas environment variables
- Configuring default tape channels
- Backing up with default channels
- Restore / Recovery with tape channels
- Checking the progress of tape jobs
- Terminating tape jobs
- Media Manager debugging
Other Text:
(Examples or comments displayed on slide, if any).
Instructor's Notes
(If applicable)
- Workshop – Backup and Recover using a Tape
- This workshop requires a pre-installed working media manager and tape device. Though this lesson provides an introduction to installation (on a Linux platform), installation and setup of the MML and device is outside the scope of the course and this workshop.
- Use a manually allocate tape channel to backup the USERS tablespace.
- Use a default tape channel to backup the USERS tablespace.
- Delete the datafile associated with the USERS tablespace.
- Recover the USERS tablespace.
Other Text:
(Examples or comments displayed on slide, if any).