tivoli+rman實現(xiàn)自動將rman備份寫入磁帶的方案
2024-07-21 02:40:23
供稿:網(wǎng)友
這個是別人給我的,具體實施步驟差不多,可能有些細小問題。其中l(wèi)ib庫問題,我也正在研究,metalink上都沒有人能說清楚64bit,9i,tdp的libobk.*的問題,所以歡迎有這方面經(jīng)驗的解釋一下!
Tivoli Storage Manager&磁帶庫
備份系統(tǒng)實施報告
一、 TSM軟件安裝
1. TSM Server軟件的安裝
A、 以root用戶登陸
B、 通過#smitty installp進行軟件的安裝
選擇相應的軟件包進行安裝:Tivoli.tsm.server.rte 、Tivoli.tsm.server.com 、Tivoli.tsm.server.webadmin 、Tivoli.tsm.license.rte 、Tivoli.tsm.license.cert 、Tivoli.tsm.devices.aix43.rte 。
2. TSM 客戶端軟件安裝
A、 以root用戶登陸
B、 通過#smitty installp進行軟件的安裝
選擇相應的軟件包進行安裝:Tivoli.tsm.client.ba.aix43.32bit下的Backup/Archive Base files、Backup/Archive Common Files 、Tivoli.tsm.client.books 、Tivoli.tsm.client.web.aix43.32bit、 tivoli.tsm.client.image.aix43.32bit 。
3. TSM for Oracle的軟件的安裝
A、 以root用戶登陸
B、 通過#smitty installp進行軟件的安裝
選擇相應的軟件包進行安裝:tivoli.tsm.client.api.aix43.64bit、tivoli.tsm.client.oracle.64bit、tivoli.tsm.client.oracle.tools.64bit 。
二、 修改環(huán)境變量和配置文件
1. TSM Server和TSM Client安裝完成后對進行環(huán)境變量的修改。
在TSM Server的.PRofile文件增加如下內(nèi)容:
eXPort DSMSERV_DIR=/usr/tivoli/tsm/server/bin
export DSMSERV_CONFIG=/usr/tivoli/tsm/server/bin/dmserv.opt
在TSM Client的.profile文件增加如下內(nèi)容:
export DSM_DIR=/usr/tivoli/tsm/client/ba/bin
export DSM_CONFIG=/usr/tivoli/tsm/client/ba/bin/dsm.opt
export DSM_LOG=/usr/tivoli/tsm/client/ba/bin
2. 修改TSM Server的dsmserv.opt文件
解除屏蔽選項:
COMMmethod TCPip
COMMmethod HTTP
添加下面兩行:
TCPPort 1500
HTTPPort 1580
3. 修改TSM Client的dsm.opt和dsm.sys文件
在dsm.opt文件中指定TSM Server:
Servername tsm(說明此處為TSM Server的名字)
在dsm.sys文件中添加如下內(nèi)容:
SErvername tsm
COMMmethod TCPip
TCPPort 1500
TCPServeraddress xxx.xxx.xxx.xxx
nodename xxxxxxx
passWordaccess generate
managedservices webclient schedule
4. 修改/usr/tivoli/tsm/client/oracle/bin/tdpo.opt
DSMI_ORC_CONFIG /usr/tivoli/tsm/client/api/bin64/dsm.opt
DSMI_LOG /usr/tivoli/
TDPO_FS adsmorc
TDPO_NODE tdpora1
TDPO_OWNER root
TDPO_PSWDPATH /usr/tivoli/tsm/client/oracle/bin64
TDPO_DATE_FMT 1
TDPO_NUM_FMT 1
TDPO_TIME_FMT 1
三、 TSM 進程治理
1. 啟動TSM Server
#/usr/tivoli/tsm/server/bin/dsmserv quiet &
2. 啟動TSM Client
#/usr/tivoli/tsm/client/ba/bin/dsmcad
3. 停止TSM Server
#/usr/tivoli/tsm/server/bin/dsmadmc(輸入提示的用戶、口令)
dsmadmc>halt
4. 停止TSM Client
通過ps –efgrep dsmcad 查找出對應的PID,然后通過kill命令停止進程。
四、 TSM軟件配置
1. 在操作系統(tǒng)檢查磁帶庫設(shè)備硬件
#lsdev –Cc tape(會看到rmtx和smc0 的狀態(tài)為Avaliable),如不能看到則需要安裝3583磁帶庫的驅(qū)動程序,具體安裝方法請參見3583相關(guān)資料。
2. 磁帶庫配置
A、使用tapeutil找到Driver的element值#tapeutil
B、選擇“open a device”:/dev/smc0
C、選擇“elements Information”,就可以得到Driver和Slots的elements值。
E、定義磁帶庫
define library autolib liBType=scsi(定義一個名字為autolib的SCSI磁帶庫)。
F、定義磁帶庫的PATH(定義TSM SERVER名為TSM所連的接磁帶庫autolib在TSM SERVER中的設(shè)備PTAH:/dev/smc0)。
define path tsm autolib srctype=server desttype=library device=/dev/smc0 online=yes
G、定義磁帶機(Driver)(定義磁帶庫autolib中的磁帶機,磁帶機的名字叫做 driver01)。
define drive autolib drive01 element=256
H、定義磁帶機(Driver)的PATH(定義TSMSERVER名為TSM所連接的磁帶庫autolib中的磁帶機在TSM SERVER中的設(shè)備PATH)。
define path tsm drive01 srctype=server desttype=drive library=autolib device=/dev/rmt0 online=yes
I、定義設(shè)備CLASSES
define devclass ltotape devtype=lto library=autolib format=ultriumc mountlimit=drives mountretention=5 estcapacity=200G
J、檢查磁帶庫的相關(guān)配置
query library、query driver、query path、query devclasses
K、定義磁帶存儲池
define stgpool 3583_pool ltotape maxscratch=20(定義ltotape設(shè)備類使用的磁帶存儲池3583_pool)。
3. 調(diào)整TSM DB 和LOG空間的大小
define dbvolume /tsmdata/dblog/db01.dsm formatsize=160 wait=yes
extend db 160
dfine logvloume /tsmdata/dblog/log01.dsm formatsize=100 wait=yes
extend log 100
define spacetrigger db fullpct=85 spaceexpansion=25 expansionprefix=/tsmdata/dblog/
define spacetrigger log fullpct=85 spaceexpansion=25 expansionprefix=/tsmdata/dblog/
redUCe db 16
reduce log 8
delete dbvolume /usr/tivoli/tsm/server/bin/db.dsm
delete logvolume /usr/tivoli/tsm/server/bin/log.dsm
安裝TSM SERVER時默認的db和log的大小分別是16,8MB。
4. 備份策略的設(shè)置
Storage management policies are rules your administrator defines in order to manage your backups and archives on the server(Storage managermanet policies是治理員為了在服務(wù)端治理備份和歸檔定義的一種規(guī)則)。You can associate (or bind) your data to these policies(你能夠綁定你的數(shù)據(jù)到這些Policies);when the data is backed up or archived, it is managed according to policy criteria(當數(shù)據(jù)被備份或歸檔被相應Policy標準治理)。Policy criteria include a policy domain, and a management class ,a policy set, a copy group。
policy決定了是否一個文件或目錄適合備份或歸檔、保留多少個備份版本、非激活狀態(tài)的備份和歸檔拷貝保留多長時間、拷貝存放在何處。
Policy daemon是一組有相類似備份或歸檔需求數(shù)據(jù)的客戶機的集合(A policy domain is a group of clients with similar requirements for backing up and archiving data.)。Policy domains contain one or more policy sets。
A policy set is a group of one or more management classes。
A management class is a collection of backup and archive copy groups that establishes and contains specific storage management requirements for backing up and archiving data.
Within a management class, the specific backup and archive requirements are in copy groups. Copy groups define the specific storage management attributes that describe how the server manages backed up or archived data. Copy groups include both backup copy groups and archive copy groups. A management class can have one backup copy group, one archive copy group, both, or neither。
A、 創(chuàng)建備份 client node
B、 通過WEB方式建立Policy daemon,選擇object class/Policy daemon/define a Policy daemon
C、 選擇Policy daemon下面的.Policy sets/define a policy sets,并將policy set給Active
D、 選擇Policy sets下面的ManageClass/define a manageclass
E、 選擇ManagClass下面的Copy Group
F、 將Client node分配到相應的Policy daemon
5.
6.
五、 文件系統(tǒng)備份
六、 RMAN的配置
安裝一套獨立與生產(chǎn)數(shù)據(jù)庫之外的ORACLE數(shù)據(jù)庫作為catalog database,最好安裝在不同的主機上。
1. 在catalog數(shù)據(jù)庫服務(wù)器上創(chuàng)建RMAN所需要的表空間
$svrmgrl
svrmgrl>connect system/manager
svrmgrl>create tablespace rman_ts datafile ‘<dir>/<name>’
>size 100M autoextend on next 100M maxsize 300M;
2. 創(chuàng)建RMAN用戶并賦予角色及權(quán)限
svrmgrl>create user rman identified by rman
>default tablespace rman_ts
>temporary tablespace temporary
>quota unlimited on rman_ts;
svrmgrl>grant recovery_catalog_owner to rman;
svrmgrl>connect / as sysdba;
svrmgrl>grant dba,connect,resource to rman;
3. 創(chuàng)建recovery catalog的表結(jié)構(gòu)
$rman target internal/oracle@targetSID rcvcat rman/rman@recoverycatalogSID
rman>create catalog;
4. 在catalog數(shù)據(jù)庫中對目標數(shù)據(jù)庫進行注冊
rman>register database;
七、 ORACLE數(shù)據(jù)庫的備份
Database備份script:
run {
allocate channel d1 type 'sbt_tape' connect 'internal/manager@scdb2' parms
'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
allocate channel d2 type 'sbt_tape' connect 'internal/manager@scdb1' parms
'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
backup
format 'ctl_t%t_s%s_p%p'
tag cf
(current controlfile);
backup
full
filesperset 8
format 'db_t%t_s%s_p%p'
tag fulldb
(database);
release channel d1;
release channel d2;
}
Archivelog的備份script:
run {
allocate channel d1 type 'sbt_tape' parms
ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)'
connect 'internal/manager@scdb1';
sql 'alter system archive log current';
backup
format 'arch_t%t_s%s_p%p'
(archivelog
like '/jfbackup/arch_log/arch_1_%.arc'
delete input);
release channel d1;
}
run {
allocate channel d2 type 'sbt_tape' parms
ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)'
connect 'internal/manager@scdb2';
sql 'alter system archive log current';
backup
format 'arch_t%t_s%s_p%p'
(archivelog
like '/jfbackup/arch_log/arch_2_%.arc'
delete input);
release channel d2;
}
同時還可以對指定的tablespace datafile進行備份,具體請參見RMAN相關(guān)手冊。
手工執(zhí)行ORACLE的備份:
rman target internal/oracle@targetSID rcvcat rman/rman@recoverycatalogSID cmdfile=/xxx/xxx msglog=xxx.log
八、 ORACLE數(shù)據(jù)庫的恢復
run
{
allocate channel d3 type 'sbt_tape' connect 'internal/manager@scdb1' parms
'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
allocate channel d4 type 'sbt_tape' connect 'internal/manager@scdb2' parms
'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
restore controlfile;
alter database mount;
restore database;
recover database;
release channel d1;
release channel d2;
sql "alter database open resetlogs";
}