'work in progress'
==== Setting up RMAN to backup directly to tape ====
RMAN cannot backup directly to tape due to there being many different tape backup suppliers.\\
The solution is the TDPO interface to which tape suppliers supply parameters. RMAN then knows what to do.
=== Files involved ===
* dsm.sys
* dsm.opt
* tdpo.opt
==== Setting up DataPump to backup directly to tape ====
=== Files involved ===
* dsm.sys
By default dsm.sys is located in /usr/tivoli/tsm/client/ba/bin64\\
An example using PROMPT
SErvername TSM_SINTP1_TDPO
COMMmethod TCPIP
TCPPort 1516
TCPServeraddress 10.80.0.15
TCPBuffsize 31
TCPWindowsize 32
LARGECOMMBUFFERS YES
TXNBytelimit 10000
PASSWORDACCESS PROMPT
MAXCMDRETRIES 4
INCLEXCL /home/ibmtools/scripts/rman/inclexcl.lst
QUERYSCHEDPERIOD 3
RETRYPERIOD 30
SCHEDLOGNAME /home/ibmtools/logs/rman/dsmsched.log
ERRORLOGNAME /home/ibmtools/logs/rman/dsmerror.log
SCHEDLOGRETENTION 15 D
SCHEDMODE POLLING
MAILPROG /usr/bin/mail root
NODENAME SO_U_SINTP1_ORA_X_SAF
DIRMC D01NOS_T1
An example using GENERATE
SErvername TSM_AGJIRAP1_TDPO
TCPPort 1518
TCPServeraddress baxnos-bx2
TCPBuffsize 31
TCPWindowsize 1024
LARGECOMMBUFFERS YES
TXNBytelimit 10000
PASSWORDACCESS GENERATE
PASSWORDDIR /oracle/AGJIRAP1/admin
MAXCMDRETRIES 4
INCLEXCL /oracle/AGJIRAP1/admin/inclexcl.lst
QUERYSCHEDPERIOD 3
RETRYPERIOD 30
SCHEDLOGNAME /oracle/AGJIRAP1/admin/dsmsched.log
ERRORLOGNAME /oracle/AGJIRAP1/admin/dsmerror.log
SCHEDLOGRETENTION 15 D
SCHEDMODE POLLING
NODENAME SO_U_AGJIRAP1_ORA_X_BAX
DIRMC D01NOS_14
cat tdpo_SINTP1.opt # PROMPT
DSMI_ORC_CONFIG /oracle/SINTP1/admin/dsm.opt
DSMI_LOG /home/ibmtools/logs/rman/tdpoerror_SINTP1
TDPO_FS tdpo_SINTP1
TDPO_NODE SO_U_SINTP1_ORA_X_SAF
TDPO_PSWDPATH /oracle/SINTP1/admin
* tdpo_trace_flags orclevel0 orclevel1 orclevel2
* tdpo_trace_file /home/ibmtools/logs/rman/tdpo_SINTP1.out
or
cat tdpo.opt # GENERATE
DSMI_ORC_CONFIG /oracle/AGJIRAP1/admin/dsm.opt
DSMI_LOG /oracle/AGJIRAP1/admin/tdpoerror_AGJIRAP1
TDPO_FS tdpo_AGJIRAP1
* tdpo_trace_flags orclevel0 orclevel1 orclevel2
* tdpo_trace_file /home/ibmtools/logs/rman/tdpo_AGJIRAP1.out
From [[http://blog.yannickjaquier.com/oracle/rman-configuration-with-tivoli-data-protection-for-oracle-tdpo.html|yannickjaquier.com]]
===== RMAN configuration with Tivoli Data Protection for Oracle (TDPO) =====
tdpo is generally installed in either /opt/tivoli/tsm or /usr/tivoli/tsm\\
The configuration and testing described in this document have been done on Red Hat Enterprise Linux Server release 5.5 (Tikanga) 64 bits with Oracle 11gR2 (11.2.0.2.0) and 10gR2 (10.2.0.5.0).\\
First let you preferred system administrator install the product for you, you should find it in:\\
[[root@oracleserver.domainname /]]# ll /opt/tivoli/tsm/client
total 20
drwxr-xr-x 4 root bin 4096 Jun 7 15:28 api
drwxr-xr-x 3 root bin 4096 Jun 7 15:27 icc32
drwxr-xr-x 3 root bin 4096 Jun 7 15:28 icc64
drwxr-xr-x 3 root bin 4096 Jun 7 15:27 lang
drwxr-xr-x 5 root root 4096 Jun 7 15:29 oracle
The Tivoli Storage Manager (TSM) server configuration part is in:
[[root@oracleserver.domainname /]]# ll /opt/tivoli/tsm/client/api/bin64
total 4044
-rwxr-xr-x 1 root root 810 Jul 13 06:33 dsm.opt
-r--r--r-- 1 root bin 782 Dec 5 2006 dsm.opt.smp
-rwxr-xr-x 1 root root 1194 Jul 13 12:17 dsm.sys
-r--r--r-- 1 root bin 971 Dec 5 2006 dsm.sys.smp
-rwsr-xr-x 1 root bin 1832042 Nov 28 2006 dsmtca
lrwxrwxrwx 1 root bin 16 Jun 7 15:28 en_US -> ../../lang/en_US
-r-xr-xr-x 1 root bin 2274183 Nov 28 2006 libApiTSM64.so
drwxr-xr-x 2 root bin 4096 Jun 7 15:28 sample
The TSM client configuration (TDPO) part is in:
[[root@oracleserver.domainname /]]# ll /opt/tivoli/tsm/client/oracle/bin64
total 1536
-rwxrw-rw- 1 root root 67 Mar 21 2007 agent.lic
-rwxrwxr-x 1 root root 29 Jul 13 06:31 dsm.opt
drwxr-xr-x 2 root root 4096 Jun 7 15:29 en_US
-rwxr-xr-x 1 root root 575528 Mar 21 2007 libobk.so
-rwxr-xr-x 1 root root 491744 Mar 21 2007 tdpoconf
-rw-rw---- 1 root dba 279 Jul 13 12:18 tdpoerror.log
-rw-r--r-- 1 root root 48 Jul 13 08:37 TDPO.oracleserver.domainname
-rwxrwxr-- 1 root root 412 Jul 13 06:34 tdpo.opt
-rwxr-xr-x 1 root root 693 Mar 21 2007 tdpo.opt.smp
-rwxr-xr-x 1 root root 693 Jun 7 15:54 tdpo.optyd11072011
-rwx--x--x 1 root root 442632 Mar 21 2007 tdposync
TSM Configuration
Configuration is made of four files:
[[root@oracleserver.domainname /]]# cat /opt/tivoli/tsm/client/api/bin64/dsm.opt
Servername tsmserver.sgp.st.com
[[root@oracleserver.domainname /]]# cat /opt/tivoli/tsm/client/api/bin64/dsm.sys
SErvername tsmserver.sgp.st.com
COMMMethod TCPip
TCPPort 1511
TCPServeraddress tsmserver.sgp.st.com
NODENAME oracleserver.domainname
PASSWORDACCESS PROMPT
PASSWORDDIR /opt/tivoli/tsm
SCHEDLOGNAME "/var/log/tsm/dsmsched.log"
SCHEDLOGRETENTION 3
ERRORLOGNAME "/var/log/tsm/dsmerror.log"
ERRORLOGRETENTION 5
[[root@oracleserver.domainname /]]# cat /opt/tivoli/tsm/client/oracle/bin64/tdpo.opt
DSMI_ORC_CONFIG /opt/tivoli/tsm/client/oracle/bin64/dsm.opt
DSMI_LOG /opt/tivoli/tsm/client/oracle/bin64
TDPO_FS /adsmorc
TDPO_NODE oracleserver.domainname
TDPO_OWNER root
TDPO_PSWDPATH /opt/tivoli/tsm/client/oracle/bin64
TDPO_DATE_FMT 1
TDPO_NUM_FMT 1
TDPO_TIME_FMT 1
TDPO_MGMT_CLASS_2 mgmtclass2
TDPO_MGMT_CLASS_3 mgmtclass3
TDPO_MGMT_CLASS_4 mgmtclass4
Create the password file to be able to access to TSM server:
[[root@oracleserver.domainname /]]# ./tdpoconf passw
IBM Tivoli Storage Manager for Databases:
Data Protection for Oracle
Version 5, Release 4, Level 1.0
(C) Copyright IBM Corporation 1997, 2007. All rights reserved.
* **********************************************************
* IBM Tivoli Storage Manager for Databases Utility
* Password file initialization/update program
* **********************************************************
Please enter current password:
Please enter new password:
Please reenter new password for verification:
ANU0260I Password successfully changed.
This command create the following password file:
[[root@eul3001 bin64]]# ll /opt/tivoli/tsm/client/oracle/bin64/TDPO.oracleserver.domainname
-rw-r--r-- 1 root root 48 Jul 13 08:37 /opt/tivoli/tsm/client/oracle/bin64/TDPO.oracleserver.domainname
Verify all is fine with:
[[root@oracleserver.domainname bin64]]# ./tdpoconf SHOWENVironment
IBM Tivoli Storage Manager for Databases:
Data Protection for Oracle
Version 5, Release 4, Level 1.0
(C) Copyright IBM Corporation 1997, 2007. All rights reserved.
Data Protection for Oracle Information
Version: 5
Release: 4
Level: 1
Sublevel: 0
Platform: 64bit TDPO LinuxAMD64
Tivoli Storage Manager Server Information
Server Name: tsmserver.sgp.st.com
Server Address: tsmserver.sgp.st.com
Server Type: Linux/x86_64
Server Port: 1511
Communication Method: TCP/IP
Session Information
Owner Name: root
Node Name: oracleserver.domainname
Node Type: TDPO LinuxAMD64
DSMI_DIR: /opt/tivoli/tsm/client/api/bin64
DSMI_ORC_CONFIG: /opt/tivoli/tsm/client/oracle/bin64/dsm.opt
TDPO_OPTFILE: /opt/tivoli/tsm/client/oracle/bin64/tdpo.opt
Password Directory: /opt/tivoli/tsm/client/oracle/bin64
Compression: FALSE
License Information: License file exists and contains valid license data.
Oracle Configuration
The Oracle configuration is quite simple, you just need to create a symbolic link on TDPO library in all your $ORACLE_HOME/lib directory:
[[oracleg@oracleserver.domainname ~]]$ ln -s /opt/tivoli/tsm/client/oracle/bin64/libobk.so $ORACLE_HOME/lib
[[oracle@oracleserver.domainname ~]]$ ll $ORACLE_HOME/lib/libobk.so
lrwxrwxrwx 1 oraracle dba 45 Jul 13 12:00 /oracle/software/lib/libobk.so -> /opt/tivoli/tsm/client/oracle/bin64/libobk.so
Then ensure dba Unix group (better to provide access to DBA group in case you have multiple Oracle accounts on your server) is able to write in all log files you defined in all TSM configuration files and be able to read tdpo.opt configuration file.
With Unix commands it gives something like:
[[root@oracleserver.domainname /]]# chmod a+r /opt/tivoli/tsm/client/oracle/bin64/tdpo.opt
[[root@oracleserver.domainname /]]# chown root:dba /opt/tivoli/tsm/client/oracle/bin64/tdpoerror.log
[[root@oracleserver.domainname /]]# chmod g+rw /opt/tivoli/tsm/client/oracle/bin64/tdpoerror.log
[[root@oracleserver.domainname /]]# chown -R root:dba /var/log/tsm
[[root@oracleserver.domainname /]]# chmod g+rw /var/log/tsm
All errors I personally encountered were linked to missing rights on either log files (write permission) and read rights on configuration files. Don’t be too generous while giving those rights…
And that’s it ! You are done, you can test all is working with (even before starting RMAN):
[[oracle@oracleserver.domainname admin]]$ sbttest test
The sbt function pointers are loaded from libobk.so library.
-- sbtinit succeeded
Return code -1 from sbtinit, bsercoer = 0, bsercerrno = 0
Message 0 not found; product=RDBMS; facility=SBT
RMAN backup
I’m not entering in all options of powerful RMAN command but below simple script will perform your first tape backup:
- !/bin/ksh
- Trapping errors -------------------------------------------------------------
trap 'STATUS=$?;set +x;echo;echo error $STATUS at line nb $LINENO executing :`sed -n "${LINENO}p" $0`;echo;exit $STATUS' ERR
- OS management ---------------------------------------------------------------
OSTYPE=$(uname -s)
case $OSTYPE in
"AIX" ) alias bdf="/usr/bin/df -Ik"
alias ll="/usr/bin/ls -l" ;;
"SunOS") alias bdf="/usr/bin/df -k"
alias ll="/usr/bin/ls -l"
alias awk="/usr/xpg4/bin/awk"
alias grep="/usr/xpg4/bin/grep" ;;
"Linux") alias bdf="/bin/df -k"
alias grep=egrep
alias echo="echo -e"
alias ll="ls -l" ;;
esac
- Variables -------------------------------------------------------------------
JOB_NAME=$(basename $0)
TODAY=`date +'%Y%m%d_%H%M%S'`
LOG_FILE=/tmp/${JOB_NAME}_${TODAY}_$$.log
- Main Here -------------------------------------------------------------------
JOB_START=`date +%s`
echo "\
Starting at `date +'%Y%m%d_%H%M%S'`\
"
rman << EOF
connect target /
connect catalog rman/rman@rmanrepository
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 9 DAYS;
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE CONTROLFILE AUTOBACKUP OFF;
CONFIGURE DEFAULT DEVICE TYPE TO sbt;
CONFIGURE CHANNEL DEVICE TYPE sbt PARMS 'ENV=(TDPO_OPTFILE=/opt/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
CONFIGURE DEVICE TYPE sbt PARALLELISM 1 BACKUP TYPE TO COMPRESSED BACKUPSET;
run
{
allocate channel sbt1 type sbt parms 'ENV=(TDPO_OPTFILE=/opt/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
allocate channel sbt2 type sbt parms 'ENV=(TDPO_OPTFILE=/opt/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
allocate channel sbt3 type sbt parms 'ENV=(TDPO_OPTFILE=/opt/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
allocate channel sbt4 type sbt parms 'ENV=(TDPO_OPTFILE=/opt/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
backup as compressed backupset database include current controlfile tag '${TODAY}';
backup as compressed backupset archivelog all delete all input tag '${TODAY}';
release channel sbt1;
release channel sbt2;
release channel sbt3;
release channel sbt4;
}
EOF
JOB_END=`date +%s`
echo "\
Ending at `date +'%Y%m%d_%H%M%S'`"
echo "\
Completed in $((($JOB_END - $JOB_START)/60)) minutes"
echo "\
Normal Exit"
==== Troubleshooting ====
This has to work first.\\
If this doesn't work, nothing will.
run {\t
allocate channel t1 type 'SBT_TAPE' PARMS 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';\t(or wherever your optfile is)
}
=== **Problem:** ===
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of allocate command on c1 channel at 06/08/2014 11:14:54
ORA-19554: error allocating device, device type: SBT_TAPE, device name:
ORA-27000: skgfqsbi: failed to initialize storage subsystem (SBT) layer
SVR4 Error: 2534: Unknown system error
Additional information: 7011
ORA-19511: Error received from media manager layer, error text:
SBT error = 7011, errno = 2534, sbtopen: system error
**Solution:**
Node was created on the wrong TSM server
Probably only see this message if database is in one datacentre but backed up to another one.
=== **Problem:** ===
Starting backup at 06-JUN-2014 15:43:34
current log archived
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 06/06/2014 15:43:36
ORA-19554: error allocating device, device type: SBT_TAPE, device name:
ORA-27000: skgfqsbi: failed to initialize storage subsystem (SBT) layer
SVR4 Error: 2534: Unknown system error
Additional information: 7011
ORA-19511: Error received from media manager layer, error text:
SBT error = 7011, errno = 2534, sbtopen: system error
RMAN>
**Solution:**
* If it's a load balancing cluster, tdpo needs to be installed and configured on both sides.
dsm.opt, tdpo.opt, dsm.sys and TSM.PWD all have to be in the same directories on both sides.
* check that $ORACLE_HOME/lib/libobk.so is linked back to the correct tdpo file (32 or 64 bit version)
* check the backup_rman_functions.ini has the correct information regarding location of opt files. (specific to us)
=== **Problem:** ===
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of allocate command on c1 channel at 12/18/2012 18:12:29
ORA-19554: error allocating device, device type: SBT_TAPE, device name:
ORA-27000: skgfqsbi: failed to initialize storage subsystem (SBT) layer
IBM AIX RISC System/6000 Error: 406: Unknown system error
Additional information: 7011
ORA-19511: Error received from media manager layer, error text:
SBT error = 7011, errno = 406, sbtopen: system error
**Solution:**
cd /etc/tsm
chmod 644 dsm.sys
=== **Problem:** ===
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of allocate command on t1 channel at 06/07/2014 17:09:58
ORA-19554: error allocating device, device type: SBT_TAPE, device name:
ORA-27000: skgfqsbi: failed to initialize storage subsystem (SBT) layer
SVR4 Error: 400: Unknown system error
Additional information: 7011
ORA-19511: Error received from media manager layer, error text:
SBT error = 7011, errno = 400, sbtopen: system error
**Solution:**\\
Configuration error!\\
Check the dsm.opt, tdpo.opt, inclexcl.lst and dsm.sys files. Compare them with a system that works.\\
Found my error in dsm.sys:\\
Name of the tsm server was wrong and I removed the line " COMMmethod TCPIP" as it was not in the stanza that worked for another database.\\
Check the parameter DSMI_LOG in tdpo.opt file\\
Make sure that the directory it points to (and its files) is writeable by the user doing the work\\
Remember TSM comments are * not # !
chown oraibm:dba /home/ibmtools/logs/rman/tdpoerror_APITSMP3
chmod 777 /home/ibmtools/logs/rman/tdpoerror_APITSMP3/tdpoerror.log
=== **Problem:** ===
- RMAN-00571: ===========================================================
- RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
- RMAN-00571: ===========================================================
- RMAN-03009: failure of allocate command on c1 channel at 12/17/2012 14:58:05
- ORA-19554: error allocating device, device type: SBT_TAPE, device name:
- ORA-27211: Failed to load Media Management Library
- Additional information: 13
**Solution:**
cd /usr/tivoli/tsm/client/oracle/bin64
ls -ltr
chmod 755 libobk.a
=== **Problem:** ===
- RMAN-00571: ===========================================================
- RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
- RMAN-00571: ===========================================================
- RMAN-03009: failure of allocate command on c1 channel at 12/17/2012 15:34:08
- ORA-19554: error allocating device, device type: SBT_TAPE, device name:
- ORA-27000: skgfqsbi: failed to initialize storage subsystem (SBT) layer
- IBM AIX RISC System/6000 Error: 106: Reserved errno was encountered
- Additional information: 7011
- ORA-19511: Error received from media manager layer, error text:
- SBT error = 7011, errno = 106, sbtopen: system error
**Solution:**
cd /home/ibmtools/logs/rman
chown oraibm:ibmtls dsmerror.log
chmod ug+rwx dsmerror.log
==== Other ====
* Check results from:
tdpoconf showenv -tdpo_optfile=/oracle//admin/tdpo.opt
* Check the logs you'll find in directory pointed by the parameter DSMI_LOG in your tdpo confirguration file. The file is tdpoerror.log. There is also a trace file generated in user_dump_dest.
* Check you have a file agent.lic in opt/tivoli/tsm/client/oracle/bin64 directory.
==== References ====
* Installation de Tivoli Data Protection pour Oracle by albanlepunk
* Tivoli Storage Manager client node lacks authority to delete backup copies
* Oracle RMAN 11g Backup and Recovery
* [[http://publib.boulder.ibm.com/infocenter/tsminfo/v6/index.jsp?topic=%2Fcom.ibm.itsm.hsmul.doc%2Ft_dmssys_opt.html|Editing dsm.sys options]]