oracle中的sbt库是什么,使用Oracle默认SBT接口测试磁带通道

使用Oracle默认SBT接口测试磁带通道

1、创建备份目录

[oracle@utf10g ~]$ mkdir -p /backup/sbt

2、使用RMAN连接目标数据库(即需要备份的数据库),此示例中在本地连接目标数据库utf10g

[oracle@utf10g ~]$ rman target=/ catalog=ctlg/ctlg@bcatalog

Recovery Manager: Release 10.2.0.4.0 - Production on Wed Aug 22 17:50:01 2012

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: UTF10G (DBID=1585746538)

connected to recovery catalog database

3、运行备份操作,在通道分配期间使用PARMS参数指定Oracle测试库文件。同时还要指定RMAN写入备份的位置BACKUP_DIR,如:

RMAN> run {

2> allocate channel sbt_ch1 type 'sbt_tape'

3> PARMS="SBT_LIBRARY=oracle.disksbt,

4> ENV=(BACKUP_DIR=/backup/sbt)";

5> backup datafile 1 format='%U';}

allocated channel: sbt_ch1

channel sbt_ch1: sid=1095 devtype=SBT_TAPE

channel sbt_ch1: WARNING: Oracle Test Disk API

Starting backup at 2012-08-22 17:54:53

channel sbt_ch1: starting full datafile backupset

channel sbt_ch1: specifying datafile(s) in backupset

input datafile fno=00001 name=/soft/oracle/oradata/utf10g/system01.dbf

channel sbt_ch1: starting piece 1 at 2012-08-22 17:54:53

channel sbt_ch1: finished piece 1 at 2012-08-22 17:56:09

piece handle=06nja47d_1_1 tag=TAG20120822T175453 comment=API Version 2.0,MMS Version 8.1.3.0

channel sbt_ch1: backup set complete, elapsed time: 00:01:16

Finished backup at 2012-08-22 17:56:09

Starting Control File and SPFILE Autobackup at 2012-08-22 17:56:09

piece handle=c-1585746538-20120822-00 comment=API Version 2.0,MMS Version 8.1.3.0

Finished Control File and SPFILE Autobackup at 2012-08-22 17:56:14

released channel: sbt_ch1

注:可以使用永久性配置命令设置Oracle库,但是需要记住,已经完成了Oracle库的设置,不要让其限制太长时间:

RMAN> configure channel device type 'sbt_tape' parms 'SBT_LIBRARY=oracle.disksbt,ENV=(BACKUP_DIR=/backup/sbt)';

new RMAN configuration parameters:

CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS 'SBT_LIBRARY=oracle.disksbt,ENV=(BACKUP_DIR=/backup/sbt)';

new RMAN configuration parameters are successfully stored

starting full resync of recovery catalog

full resync complete

注:需要指定MM服务器时,必须在RMAN会话中传递指定服务器名的环境参数。在分配磁带通道时,将服务器名指定为环境变量。上面的示例中,使用allocate channel命令的PARMS选项来传递环境变量。不同的MM产品具有不同的环境变量,如Veritas NetBackup要求使用NB_ORA_SERV参数:

configure channel device type 'sbt_tape' parms "ENV=(NB_ORA_SERV=storage1)";

其中,storage1为MM服务器的名称,同时数据库服务器在MM服务器中已经注册并具有写磁带设备的权限。

注:分配通道时还可以传递其他参数来利用MM服务器上的管理功能,这要具体到产品,此不赘述。

4、使用 sbttest 和 loadsbt.exe测试

通常总有一些提示说明是否成功链接了MML 与Oracle,如,来自通道分配的信息说明了MML版本。不过这些指示不能保证最后的成功,在更下层的网络拓扑中(MM客户端或MM服务器)仍然可能出现故障。

Oracle 提供了一个名为sbttest的实用程序,可用它来测试以确保RMAN能够使用MM配置来执行磁带备份操作。 从命令可以调用这个实用程序,该程序执行一个完整的测试:sbttest 会向磁带写一个数据块,然后请求读取这个数据库。 通过这种方式,sbttest 运行备份操作期间执行的所有SBT API 函数,并确认这些函数能否成功。

sbtest命令帮助:

[oracle@utf10g ~]$ sbttest

Error: backup file name must be specified

Usage: sbttest backup_file_name

[os_res_size pl_res_size block_size block_count]>

Required parameters:

backup_file_name: The name of the backup file which will be created by

this program. If a BFS or Backup Piece already exists

with this name, then this program will not create a new

backup file - the existing file will be read in its

entirety and its contents will not be verified

Optional parameters:

-dbname specifies the database name which will be used by SBT

to identify the backup file. The default is "sbtdb"

-trace specifies the name of a file where the Media Management

software will write diagnostic messages.

-remove_before if specified, then the specified backup file will be

deleted before it is opened. This option is intended

for when sbttest has already been run but did not complete

successfully, leaving behind the backup file it created.

-no_remove_after The default behavior of this program is to delete the

backup file, if it was created by this program. If this

option is specified, then the file will not be

removed when this program is complete.

-read_only if -read_only is specified, then backup_file_name must already

exist. Its contents will be read. If it is determined that the

file was created by this program, then its contents is validated.

-no_regular_backup_restore skips non-proxy backup and restore.

-no_proxy_backup skips proxy copy backup session.

-no_proxy_restore skips proxy copy restore session.

-file_type specifies file type - 1, 2 or 3.

-copy_number this is the copy_number parameter to sbtpcbackup.

-media_pool this is the media_pool parameter to sbtpcbackup.

-os_res_size specifies the size in bytes of the os reserved block.

-pl_res_size specifies the size in bytes of the platform reserved block.

-block_size specifies the size in bytes of each block written to the

backup file. The default is 16384.

-block_count specifies how many blocks will be written to the

backup file. The default is 100.

-proxy_file specifies the os file name, backup file name, os reserved size,

platform reserved size, block size, and block count for each

proxy file. For each proxy_file, the os_file_name and

bk_file_name parameters are mandatory, the other four

parameters are optional. If none of the four is specified,

either the default or the value specified with -os_res_size,

pl_res_size, block_size, block_count will be used. It some of

the four are the same as the values set with -os_res_size,

pl_res_size, block_size, and block_count, a letter 'g' or 'G'

can be used.

For example,

stksbt2 -os_res_size 10 -pl_res_size 20 -block_count 30

-proxy_file file1.osf file1.bkf g g g 100

then, for file1.osf, the backup file name is file1.bkf, the

os reserved size is 10 bytes, and the platform reserved size

is 20, block size is 16384 byte, and the block count is 100.

But in this case,

stksbt2 -proxy_file file1.osf file1.bkf g g g 100

-os_res_size 10 -pl_res_size 20 -block_count 30

for file1.osf, the os_res_size and pl_res_size will be the

default value, 0 (instead of 10 and 20), and the block_count

will be 100 (instead of 30) and the block_size will also be

the default, 16384.

-libname specifies the SBT library to test. sbttest loads library

using dlopen() call. If this option is not used, sbttest

tries to test against libobk.so. Otherwise uses statically

linked library.

Specify oracle.disksbt for oracle's disk SBT library.

Sbttest 的用法非常简单: 只要从命令提示符运行。 确认完成了所有的MM配置,然后进入RMAN运行环境中的命令提示符,并输入sbttest 和测试文件名。

Sbttest 实用程序已经相当完善。 现在,我们可以传递许多参数来测试MM系统的所有过程,包括命名要测试的数据库,修改sbttest 写入的数据块数目,以及处理sbttest 写入磁带的文件。 从命令提示符简单的输入sbttest 会给出所有可以使用的参数开关和简单的文本说明。

Sbttest 使用程序只适用于Unix 平台;在windows 平台上,我们可以想Oracle Support 请求loadsbt.exe 实用程序。 遗憾的是,Loadsbt.exe 实用程序不具有与sbttest相同的性能,它只是简单的在搜索路劲中查找orasbt.dll 文件。 如果找到该文件,loadsbt.exe 实用程序会试图加载该文件,其加载方法与Oracle 在磁带备份操作期间加载的方法相同。 如果可以加载orasbt.dll 文件,loadsbt.exe 实用程序会通知用户,但它不会在磁带上写入数据块。 所以我们无法查看整个MM 配置工作。 因此,loadsbt.exe 的作用不如sbttest.

注: 来自《Oracle 10g RMAN 备份与恢复》 笔记

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值