本文是我当年在客户部署TSM 备份软件的一个全面的实施文档,供兄弟们参考

1 环境准备

  1.1、介质描述

Storage Manager Linux Server
AIX
平台的TSM Server

Storage Manager AIX Client
AIX
平台的TSM 备份文件的客户端

Storage Manager Windows Client
Windows
平台的TSM 备份文件的客户端

Storage Manager for Storage Area Network
通过SAN环境,即LAN-Free来备份数据需要安装的组件

Storage Manager for Database Protection for Oracle AIX

AIX平台,备份oracle数据库需要安装的组件

  1.2、服务器及客户端信息 
 
    1.3.1、备份存储池

Platform StoragePool Description
AIX FILE_TAPE_POOL
备份重要文件系统
AIX TAPE_POOL
备份oracle数据库

  1.3.2、备份文件系统(待定)

  1.3.3、备份数据库(待定)

     2 配置TSM Server

2.1、安装TSM Server

2.1.1、下载TS3584 for AIX驱动

下载链接为ftp://ftp.software.ibm.com/storage/devdrvr/

2.1.2、安装TS3584驱动
1.
执行smitty install 进行安装

2.1.3、安装TSM Server  for AIX
1.
执行smitty install 进行安装

2.2、更新TSM Server配置

2.2.1、更新TSM Server参数
1
设置服务器名称及密码:
set servername tsmserver
set serverpassword password

2 注册许可证:
reg lic file=*.lic number=100
执行q lic来查看

3 设置日志模式:
set logmode rollforward

4 设置密码过期时间:
set PASSExp 9999

5 设置通信及空闲延时:
Setopt commtimeout 3600
Setopt idletimeout 60

6 设置其他参数:
vi /opt/tivoli/tsm/server/bin/dsmserv.opt
BUFPOOLSIZE 524288
LOGPOOLSIZE 2048
LANGUAGE zh_CN
DEVCONFIG /tsm/files/devconfig.out
VOLUMEHISTORY /tsm/files/volhistory.out

2.2.2、定义新数据库卷和日志卷及其镜像、触发
1
定义db卷及其镜像
define dbv /tsmfs/dbvol/db01.dsm formatsize=1000 wait=yes
define dbv /tsmfs/dbvol/db02.dsm formatsize=1000 wait=yes
define dbv /tsmfs/dbvol/db03.dsm formatsize=1000 wait=yes

extend db 3000
执行q dbv f=d来查询

2 定义log卷及其镜像
define logv /tsmfs/logvol/log01.dsm formatsize=1000 wait=yes
define logv /tsmfs/logvol/log02.dsm formatsize=1000 wait=yes
define logv /tsmfs/logvol/log03.dsm formatsize=1000 wait=yes
extend log 3000
执行q logv f=d来查询

3 定义扩展dblog的触发
define spacetrigger db fullpct=75 spaceexpansion=25 expansionprefix=/tsmfs/dbvol/ maximumsize=1000
define spacetrigger log fullpct=75 spaceexpansion=25 expansionprefix=/tsmfs/logvol/ maximumsize=1000
执行q spacetrigger db f=dq spacetrigger log f=d来查询

4 定义备份db的触发
define dbbackuptrigger devclass=LTOCLASS logfullpct=60
2.2.3
、定义磁带库、磁带机及其路径
def library 3584lib libtype=scsi shared=yes
def path tsmserver 3584lib srctype=server autodetect=yes desttype=library device=/dev/smc0 online=yes

def drive 3584lib 3580A element=autodetect online=yes
def drive 3584lib 3580B element=autodetect online=yes
def drive 3584lib 3580C element=autodetect online=yes
def drive 3584lib 3580D element=autodetect online=yes
def drive 3584lib 3580E element=autodetect online=yes
def drive 3584lib 3580F element=autodetect online=yes

def path tsmserver 3580A srctype=server autodetect=yes desttype=drive library=3584lib device=/dev/IBMtape0 online=yes

def path tsmserver 3580B srctype=server autodetect=yes desttype=drive library=3584lib device=/dev/IBMtape1 online=yes

def path tsmserver 3580C srctype=server autodetect=yes desttype=drive library=3584lib device=/dev/IBMtape2 online=yes

def path tsmserver 3580D srctype=server autodetect=yes desttype=drive library=3584lib device=/dev/IBMtape3 online=yes

def path tsmserver 3580E srctype=server autodetect=yes desttype=drive library=3584lib device=/dev/IBMtape4 online=yes

def path tsmserver 3580F srctype=server autodetect=yes desttype=drive library=3584lib device=/dev/IBMtape5 online=yes

2.2.4、定义设备类
define devclass TBKCLASS library=3584lib devtype=LTO
define devclass LTOCLASS library=3584lib devtype=LTO

2.2.5、给磁带标号
label libvolume 3584lib search=yes labelsource=barcode checkin=scratch overwrite=yes
可以通过q libv来查询

2.2.6、定义TSM服务器自动管理
tsm server
数据库备份:
define schedule backup_tsmdb_file type=administrative cmd="backup db devclass=TBKCLASS type=full " starttime=07:00 active=yes description="Database backup using files"

tsm server重要文件备份:
define schedule backup_devconfig type=administrative cmd="backup devconfig filenames=/tsm/dbbackup/devconfig.new" starttime=09:00 active=yes description="backup devconfig using files"

tsm server 卷历史信息删除:
define schedule delete_volhistory type=administrative cmd="delete volhistory TODate=today-2 type=dbbackup" starttime=07:30 active=yes description="Volhistory backup"

tsm server 卷空间回收操作:
define schedule expire_inventory type=administrative cmd="expire inventory" startt=08:00 description="Inventory expiration"

2.2.7、定义TSM服务器自动加载服务和rman catalog db备份调度(待定)
1
rman catalog db的备份:
crontab -e
##############TSM CLIENT SCHEDULE###########################################################
0 19 * * * /opt/oracle/scripts/exprman.sh>/dev/console 2>&1 #Export rman catalog at 19:00 everyday
0 21 * * * /tsm/script/fullfs.sh>/dev/console 2>&1 #FullBackup Files at 21:00 everyday

2.2.8、定义存储池
define stgpool FILE_TAPE_POOL LTOCLASS maxscratch=nolimit
define stgpool TAPE LTOCLASS maxscratch=nolimit

2.2.9、定义备份oraclefile的策略域
define domain FILE_DOMAIN descr="BACKUP WIN FILES"
define domain ORACLE_DOMAIN descr="BACKUP ORACLE FILES"

2.2.10、定义备份oraclefile的策略集
define policyset FILE_DOMAIN standard
define policyset ORACLE_DOMAIN standard

2.2.11、定义备份oraclefile的管理类
define MGMTCLASS FILE_DOMAIN standard standard SPACEMGTECHNIQUE=NONE AUTOMIGNONUSE=0 MIGREQUIRESBKUP=YES

define MGMTCLASS ORACLE_DOMAIN standard standard SPACEMGTECHNIQUE=NONE AUTOMIGNONUSE=0 MIGREQUIRESBKUP=YES

定义备份oraclefile的副本组
define COPYGROUP FILE_DOMAIN standard standard DESTINATION=FILE_TAPE_POOL FREQUENCY=0 VEREXISTS=2 VERDELETED=1 RETEXTRA=90 RETONLY=180 MODE=MODIFIED SERIALIZATION=SHRSTATIC

2.2.12、分配备份oraclefile的默认管理类
assign defmgmtclass FILE_DOMAIN standard standard
assign defmgmtclass ORACLE_DOMAIN standard standard

2.2.13、激活备份oraclefile的策略集
activate policyset FILE_DOMAIN standard
activate policyset ORACLE_DOMAIN standard
activate policyset ORA-DBPOLICY standard

2.2.14、定义客户端备份调度(oracle的完全备份)
2.2.15
、定义调度与节点的关联
2.2.16
、定义客户端调度服务
2.2.17
、注册节点
reg node P570NODE password domain=FILE_DOMAIN passexp=0 backdelete=yes maxnummp=10
reg node DELLNODE password domain=FILE_DOMAIN passexp=0 backdelete=yes maxnummp=10

3.1、安装
AIXoracle数据库服务器上安装以下3个文件集
tivoli.tsm.client.ba
tivoli.tsm.client.api.32bit
tivoli.tsm.client.api.64bit
安装完成后,在AIX系统中,会生成/usr/tivoli/tsm/client/ba/bin/usr/tivoli/tsm/client/api/bin64

3.2、配置
3.2.1
、配置/usr/tivoli/tsm/client/ba/bindsm.optdsm.sys
编辑文件/usr/tivoli/tsm/client/ba/bin/dsm.opt
servername tsmserver

编辑文件/usr/tivoli/tsm/client/ba/bin/dsm.sys
SErvername tsmserver
COMMmethod TCPip
enablelanfree yes
LANFREECommmethod TCPIP
LANFREETCPPort 1500
TCPPort 1500
TCPServeraddress 192.9.205.14
nodename P570NODE
passwordaccess generate
errorlogname /tmp/tsm/log/dsmerror.log
schedlogname /tmp/tsm/log/dsmsched.log

SErvername tdpo
COMMmethod TCPip
enablelanfree yes
LANFREECommmethod TCPIP
LANFREETCPPort 1500
TCPPort 1500
TCPServeraddress 192.9.205.14
nodename ORACLENODE
passwordaccess generate
errorlogname /tmp/tsm/log/dsmerror.log
schedlogname /tmp/tsm/log/dsmsched.log

3.2.2、配置/usr/tivoli/tsm/client/api/bin64dsm.optdsm.sys
编辑文件/usr/tivoli/tsm/client/api/bin64/dsm.opt
servername tdpo

编辑文件/usr/tivoli/tsm/client/api/bin64/dsm.sys
SErvername tdpo
COMMmethod TCPip
enablelanfree yes
LANFREECommmethod TCPIP
LANFREETCPPort 1500
TCPPort 1500
TCPServeraddress 192.9.205.14
nodename ORACLENODE
passwordaccess generate
errorlogname /tmp/tsm/log/dsmerror.log
schedlogname /tmp/tsm/log/dsmsched.log

   4 配置TDPO FOR ORACLE

4.1、安装
4AIXoracle数据库服务器上安装以下2个文件集
tivoli.tsm.client.oracle.aix53.64bit
tivoli.tsm.client.oracle.tools.aix53.64bit
安装完成后,在AIX系统中,会生成/usr/tivoli/tsm/client/oracle/bin64

4.2、配置
4.2.1
、配置/usr/tivoli/tsm/client/oracle/bin64dsm.opttdpo.opt
编辑文件/usr/tivoli/tsm/client/oracle/bin64/dsm.opt
Servername tdporacle

编辑文件/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt
DSMI_ORC_CONFIG /usr/tivoli/tsm/client/oracle/bin64/dsm.opt
DSMI_LOG /tmp/tsm/log
TDPO_NODE ORACLENODE

4.2.2、更改oracle用户的环境变量
root用户切换至oracle数据库的实例用户,更改该用户的.profile文件,将
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
此变量更改至.profile文件的最前面

4.2.3、链接库文件
root用户切换至oracle数据库的实例用户,执行以下操作:
$ln -s /usr/lib/libobk64.a $ORACLE_HOME/lib/libobk.a

4.2.4、设置目录权限
chmod -R 777 /tmp/tsm/log
chown -R oracleinstall /tmp/tsm/log

4.2.5sbttest测试
su – oracle
sbttest test
The sbt function pointers are loaded from libobk.a(shr.o) library.
-- sbtinit succeeded
Return code -1 from sbtinit, bsercoer = 0, bsercerrno = 0
Message 0 not found; product=RDBMS; facility=SBT

4.2.6、生成密码文件
root用户执行/usr/tivoli/tsm/client/oracle/bin64/tdpoconf password

连续输入三次密码password,当出现如上图的成功提示后,
/usr/tivoli/tsm/client/oracle/bin64下生成一个口令文件TDPO.rac01

4.2.7、更改rman设置
su – oracle
rman target /
CONFIGURE RETENTION POLICY TO REDUNDANCY 7;
(设置备份冗余度为两个版本)
CONFIGURE CONTROLFILE AUTOBACKUP ON;
(设置控制文件自动备份)

4.3oracle备份
4.3.1
、通过系统任务定义备份(oracle的增量备份)和file的调度
##############TSM CLIENT SCHEDULE###########################################################
0 7 * * 0 /tmp/tsm/script/fullfs.sh>/dev/console 2>&1 #FullBackup Files at 07:00 Sunday

4.3.2、文件备份脚本
脚本/tmp/tsm/script/fullfs.sh
export LOGFILE=/tmp/tsm/log/`date +%m%d.%H%M`file_full.log
dsmc selective file_a -subdir=yes>$LOGFILE
dsmc selective /cm_etl/CM_ETL_LOG/ -subdir=yes>>$LOGFILE

脚本/tmp/tsm/script/increfs.sh
export LOGFILE=/tmp/tsm/log/`date +%m%d.%H%M`file_incre.log
dsmc incremental file_a -subdir=yes>$LOGFILE
dsmc incremental /cm_etl/CM_ETL_LOG/ -subdir=yes>>$LOGFILE

4.3.3oracle备份脚本
oracle
完全备份(包括datafilecontrofilearchivelog
脚本/tmp/tsm/rman/full.sh
rq=`date +"%Y.%m.%d_%H.%M.%S"`
su - oracle -c /tmp/tsm/rman/rman.full.sh >/tmp/tsm/log/rman.full.$rq 2>&1

脚本/tmp/tsm/rman/rman.full.sh
export ORACLE_SID=aml
rman target / rcvcat rman/rman@catalog << EOF_RMAN
run{
allocate channel t1 type 'sbt_tape' parms 'ENV=(tdpo_optfile=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
allocate channel t2 type 'sbt_tape' parms 'ENV=(tdpo_optfile=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
allocate channel t3 type 'sbt_tape' parms 'ENV=(tdpo_optfile=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
allocate channel t4 type 'sbt_tape' parms 'ENV=(tdpo_optfile=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
allocate channel t5 type 'sbt_tape' parms 'ENV=(tdpo_optfile=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
backup full tag 'dbfull' format 'dbfull_%t_%s_%p' diskratio=0 database include current controlfile;
sql 'alter system archive log current';
backup format 'arch%t_%s_%p' diskratio=0 archivelog all delete input;
release channel t1;
release channel t2;
release channel t3;
release channel t4;
release channel t5;
}
EOF_RMAN
## delete OLD backups
export ORACLE_SID=aml
rman target / << EOF_RMAN
allocate channel for maintenance type 'sbt_tape' parms 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
crosscheck backup;
crosscheck archivelog all;
report obsolete;
delete noprompt obsolete recovery window of 90 days;
delete noprompt expired backup;
release channel;
EOF_RMAN

5 Oracle增量备份(包括datafilecontrofilearchivelog

脚本/tmp/tsm/rman/incre.sh
rq=`date +"%Y.%m.%d_%H.%M.%S"`
su - oracle -c /tmp/tsm/rman/rman.incre.sh >/tmp/tsm/log/rman.incre.$rq 2>&1

脚本/tmp/tsm/rman/rman.incre.sh
export ORACLE_SID=aml
rman target / rcvcat rman/rman@catalog / << EOF_RMAN
run{
allocate channel t1 type 'sbt_tape' parms 'ENV=(tdpo_optfile=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
allocate channel t2 type 'sbt_tape' parms 'ENV=(tdpo_optfile=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
allocate channel t3 type 'sbt_tape' parms 'ENV=(tdpo_optfile=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
allocate channel t4 type 'sbt_tape' parms 'ENV=(tdpo_optfile=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
allocate channel t5 type 'sbt_tape' parms 'ENV=(tdpo_optfile=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
allocate channel t6 type 'sbt_tape' parms '
backup incremental level 1 tag '%d_full_%s_%p' filesperset 5 database diskratio=0 include current controlfile;
sql 'alter system archive log current';
backup format 'arch%t_%s_%p' diskratio=0 archivelog all delete input;
release channel t1;
release channel t2;
release channel t3;
release channel t4;
release channel t5;
}
EOF_RMAN

## delete OLD backups
export ORACLE_SID=aml
rman target / rcvcat rman/rman@catalog << EOF_RMAN
allocate channel for maintenance type 'sbt_tape' parms 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
crosscheck backup;
crosscheck archivelog all;
report obsolete;
delete noprompt obsolete recovery window of 90 days;
delete noprompt expired backup;
release channel;
EOF_RMAN