oracle磁带机(Tape Driver)

1)mhvtl
1@@@@install dependency packages.(redhat5)
#yum -y install zlib-devel*
#yum -y install mtx*
#yum -y install mt-st*
#yum -y install lsscsi.i386*
#yum -y install make*

2@@@@prepare user and directory.
[root@station90 mhvtl]# useradd vtl
[root@station90 mhvtl]# passwd vtl
[root@station90 mhvtl]# mkdir /opt/mhvtl
[root@station90 mhvtl]# mkdir /etc/mhvtl
[root@station90 mhvtl]# chown -R vtl:vtl /opt/mhvtl
[root@station90 mhvtl]# chown -R vtl:vtl /etc/mhvtl

3@@@@make
[root@station90 mhvtl]# tar -zxvf mhvtl.tgz
[root@station90 mhvtl]# cd mhvtl-0.18/
[root@station90 mhvtl-0.18]# ls
doc include kernel man README usr
etc INSTALL Makefile mhvtl.spec scripts
[root@station90 mhvtl-0.18]# make distclean
[root@station90 mhvtl-0.18]# cd kernel/
[root@station90 kernel]# make ;make install
[root@station90 kernel]# cd ..
[root@station90 mhvtl-0.18]# ls
doc include kernel man README usr
etc INSTALL Makefile mhvtl.spec scripts
[root@station90 mhvtl-0.18]# make ;make install

4@@@@config of mhvtl
@@@start mhvtl service (optional)
#service mhvtl start
#/etc/init.d/mhvtl start
@@@configure files
[root@station90 mhvtl]# ls /etc/mhvtl/
device.conf library_contents.10 library_contents.30 mhvtl.conf
####begin#################################################
[root@station90 mhvtl]# cat /etc/mhvtl/mhvtl.conf
# Home directory for config file(s)
MHVTL_CONFIG_PATH=/etc/mhvtl

# Default media capacity (500 M)
CAPACITY=500 @@@always modify it to 8000 for lab.

# Set default verbosity [0|1|2|3]
VERBOSE=1

# Set kernel module debuging [0|1]
VTL_DEBUG=0
######end#################################################

@@@there are virtual tapes,data store in it.
[root@station90 mhvtl]# ls /opt/mhvtl/
CLN101L4 E01005L4 E01013L4 E03001L4 E03009L4 E03017L4 F01034L5
CLN102L5 E01006L4 E01014L4 E03002L4 E03010L4 E03018L4 F01035L5
................................

@@@lsscsi info
[root@station90 mhvtl]# lsscsi -l
...........................
[root@station90 mhvtl]# lsscsi -g
[0:0:0:0] disk VMware, VMware Virtual S 1.0 /dev/sda /dev/sg0
[1:0:0:0] mediumx STK L700 550V - /dev/sg9 @@@driver1
[1:0:1:0] tape IBM ULT3580-TD5 550V /dev/st0 /dev/sg1 @@@type1
[1:0:2:0] tape IBM ULT3580-TD5 550V /dev/st1 /dev/sg2 @@@type2
[1:0:3:0] tape IBM ULT3580-TD4 550V /dev/st2 /dev/sg3 @@@type3
[1:0:4:0] tape IBM ULT3580-TD4 550V /dev/st3 /dev/sg4 @@@type4
[1:0:8:0] mediumx SPECTRA PYTHON 550V - /dev/sg10 @@@driver2
[1:0:9:0] tape IBM ULT3580-TD4 550V /dev/st4 /dev/sg5 @@@type5
[1:0:10:0] tape IBM ULT3580-TD4 550V /dev/st5 /dev/sg6 @@@type6
[1:0:11:0] tape IBM ULT3580-TD4 550V /dev/st6 /dev/sg7 @@@type7
[1:0:12:0] tape IBM ULT3580-TD4 550V /dev/st7 /dev/sg8 @@@type8

5@@@@command of tape driver
@@@load tape manually.
# mtx -f /dev/sg10 load 1 0 @@@1=> tape and 0 => slot position
# mtx -f /dev/sg10 unload 1 0 @@@remove tape from slot.
# mtx -f /dev/sg10 status @@@check the tape status
# mt -f /dev/st0 status


@@@backup something
@@@Note:distinguish /dev/nst0 with /dev/st0, nst0 do not change next write point.
# tar -cvf /dev/nst5 /boot @@@copy the /boot to tape05
# mt -f /dev/st5 rewind @@@rewind tape,and change starting point to origin.
# tar -tvf /dev/nst5 @@@check backup files in the tapes you backup just now.
# tar rvf /dev/st0 test3.tar.gz @@@continue store file,
# tar -A pamd.tar -vf /dev/st0 @@@append a file to tail of tape.


6@@@@example for HP380 real tape driver.
####begin############################################
@@@ HP380 G3 DAT72 DB 2.2
#echo "engage scsi" >> /proc/driver/cciss/cciss0
#cat /proc/scsi/scsi
/dev/st0
/dev/nst0
mt -f /dev/st0 tel
mt -f /dev/nst0 tel
mt -f /dev/nst0 status
mt -f /dev/nst0 asf 1
tar tvf /dev/nst0
tar tvf /dev/st0
mt -f /dev/nst0 rewind @@@rewind tape to initial
mt -f /dev/nst0 eod
mt -f /dev/nst0 fsf
mt -f /dev/nst0 bsf
mt -f /dev/nst0 offline @@@return to initial position,then eject.
mt -f /dev/st0 erase
mt -f /dev/st0 retension
@@@1.1 ERP
#echo "engage scsi" >> /proc/driver/cciss/cciss0
#cat /proc/scsi/scsi
#mt -f /dev/nst0 rewind
#nohup tar cf /dev/nst0 /ora1159/prod &
#mt -f /dev/nst0 offline

@@@1.2 ERP
#echo "engage scsi" >> /proc/driver/cciss/cciss0
#cat /proc/scsi/scsi
#df -h
#cd /XXXXX/YYYYY
#mt -f /dev/nst0 rewind
#nohup tar -xpf /dev/nst0 &
#mt -f /dev/nst0 offline

@@@1.3 ERP proddata
#echo "engage scsi" >> /proc/driver/cciss/cciss0
#cat /proc/scsi/scsi
#nohup tar cf /dev/nst0 /ora1159/prod/proddata &

@@@1.4 ERP proddata
#echo "engage scsi" >> /proc/driver/cciss/cciss0
#cat /proc/scsi/scsi
#df -h
#cd /XXXXX/YYYYY
#mt -f /dev/nst0 rewind
#nohup tar -xpf /dev/nst0 &

@@@1.5 ERP proddata
#echo "engage scsi" >> /proc/driver/cciss/cciss0
#cat /proc/scsi/scsi
#df -h
#cd /XXXXX/YYYYY
#mt -f /dev/nst0 rewind
#mt -f /dev/nst0 fsf
#nohup tar -xpf /dev/nst0 &

@@@
[root@erpapp diskA]# cat /proc/scsi/scsi
Attached devices: none
[root@erpapp diskA]# echo "engage scsi" >> /proc/driver/cciss/cciss0
[root@erpapp diskA]# cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
Vendor: HP Model: C7438A Rev: V312
Type: Sequential-Access ANSI SCSI revision: 03
[root@erpapp diskA]#

@@@
tar cvf - dirname|rsh remote dd of=/dev/rmt/0
rsh remote dd if=/dev/rmt/0 tar xvf -
######end############################################


2)obtools
Note: if you install this on redhat6,maybe you need "ld5.so"(copy it from redhat5).scurity backup 10.3.0.0
1@@@@uninstall for scurity backup
@@@remove these files inculding hide files
@@@stop service,httpd and observiced using the same port 80.
@@@avoid conflict,stop httpd.
[root@station23 etc]# service httpd stop
[root@station23 backup]# service observiced stop
Stopping Oracle Secure Backup services: [ OK ]
@@@
#find /etc *observiced* -exec rm -rf {} \;
#rm -rf /etc/ob*
local db dir: /usr/etc/ob
temp dir: /usr/tmp
ob dir: /usr/local/oracle/backup
admin dir: /usr/local/oracle/backup/admin
[root@station23 oracle]# ldconfig -v

2@@@@install
@@@prepare installation files
[root@station23 observice]# pwd
/root/observice
[root@station23 observice]# ls
cdtools doc.tar linux32 osb.10.1.0.3_linux32.rel welcome.html
doc install.tar obrme.pdf setup

@@@install
[root@station23 ~]# mkdir -p /usr/local/share/backup
[root@station23 backup]# pwd
/usr/local/oracle/backup
[root@station23 backup]# /root/observice/setup

@@@
####begin######################################
# .bash_profile

# Get the aliases and functionsosb.10.1.0.3_linux32.rel
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=/usr/local/oracle/backup/./.bin.linux32/:$PATH:$HOME/bin

export PATH
unset USERNAME
######end######################################

@@@
[root@station23 oracle]# lsscsi -g
[0:0:0:0] mediumx STK L700 550V - /dev/sg8
[0:0:1:0] tape IBM ULT3580-TD5 550V /dev/st0 /dev/sg0
[0:0:2:0] tape IBM ULT3580-TD5 550V /dev/st1 /dev/sg1
[0:0:3:0] tape IBM ULT3580-TD4 550V /dev/st2 /dev/sg2
[0:0:4:0] tape IBM ULT3580-TD4 550V /dev/st3 /dev/sg3
[0:0:8:0] mediumx SPECTRA PYTHON 550V - /dev/sg9
[0:0:9:0] tape IBM ULT3580-TD4 550V /dev/st4 /dev/sg4
[0:0:10:0] t in 2: barcode E01002L4, oid 101
in 3: barcode E01003L4, oid 102
ape IBM ULT3580-TD4 550V /dev/st5 /dev/sg5
[0:0:11:0] tape IBM ULT3580-TD4 550V /dev/st6 /dev/sg6
[0:0:12:0] tape IBM ULT3580-TD4 550V /dev/st7 /dev/sg7

@@@[root@station23 oracle]# service mhvtl start
mhvtl already running...
[root@station23 oracle]# chkconfig mhvtl on

[root@station23 ~]# service observiced start
[root@station23 ~]# chkconfig observiced on

@@@
[root@station23 backup]# rlwrap obtool
Oracle Secure Backup 10.1.0.3
login: admin
Password: ******
ob> lshost
station23 admin,client (via OB) in service
ob> chhost --addrole mediaserver station23
ob> lshost
station23 admin,mediaserver,client (via OB) in service
ob> mkdev -t library -o -a station23:/dev/sg8 lib01
ob> mkdev -t library -o -a station23:/dev/sg9 lib02
ob> mkdev -t tape -o -a station23:/dev/sg0 -l lib01 -d 1 tape01
ob> mkdev -t tape -o -a station23:/dev/sg1 -l lib01 -d 2 tape02
ob> mkdev -t tape -o -a station23:/dev/sg2 -l lib01 -d 3 tape03
ob> mkdev -t tape -o -a station23:/dev/sg3 -l lib01 -d 4 tape04
ob> mkdev -t tape -o -a station23:/dev/sg4 -l lib02 -d 5 tape05
ob> mkdev -t tape -o -a station23:/dev/sg5 -l lib02 -d 6 tape06
ob> mkdev -t tape -o -a station23:/dev/sg6 -l lib02 -d 7 tape07
ob> mkdev -t tape -o -a station23:/dev/sg7 -l lib02 -d 8 tape08
ob> [root@station23 ~]# service observiced starthelp................
ob> lsdev -g t in 2: barcode E01002L4, oid 101
in 3: barcode E01003L4, oid 102
ape01 @@@check the tape driver status.
ob> inventory -L lib01
ob> inventorRMAN> show all y -L lib02 @@@only use one type driver in IDE disk.
Error: unable to open qlm connection - conflicting dte assignments
ob> lsvol -L lib01 -l
Inventory of library lib01:
in 1: barcode E01001L4, oid 100
in 2: barcode E01002L4, oid 101
.......................
ob> loadvol -D tape01 -m write 1 @@@load the tape
ob> lsvol -L lib01 -l
........................
in dte1: unlabeled, barcode E01001L4, oid 132, lastse 1, mediainfo hwRMAN> show all encryptable
.......................
ob> unloadvol -D tape01 @@@unload tape

3@@@@add OS user for scurity backup
https://station23.example.com
add a exception => get cerfter
user: admin password:******




4@@@@backup something to tape using rman
@@@
[oracle@station23 ~]$ rman target /
RMAN> show all ;
RMAN> CONFIGURE DEFAULT DEVICE TYPE TO SBT;
RMAN> backup tablespace example;

@@@
RMAN> allocate channel for maintenance device type sbt;

@@@the virtual tape change status.
ob> lsvol -L lib01 -l
Inventory of library lib01:
in 1: volume RMAN-DEFAULT-000001, barcode E01001L4, oid 133, 0 kb remaining, content manages reuse, mediainfo hw encryptable
in 2: barcode E01002L4, oid 101
in 3: barcode E01003L4, oid 102


3)scurity backup application for catalog.
1@@@@create a new database for backup only.
#xhost +
#su - oracle
$dbca




[oracle@station23 ~]$ export ORACLE_SID=logorcl
SQL> conn /as sysdba;
SQL> create tablespace tbscatlog datafile '/u01/app/oracle/oradata/logorcl/tbscatlog.dbf' size 100M ;
SQL> create user ucate identified by hr default tablespace tbscatlog;
SQL> grant connect,recovery_catalog_owner to ucate;
SQL> alter user ucate quota unlimited on tbscatlog;
@@@or grant unlimited tablespace privileges to ucate.
SQL> conn ucate/hr
Connected.
SQL> select count(*) from tab;

COUNT(*)
----------
0

@@@add a tns to service logorcl.oracle.com
[oracle@station23 admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora
LOGORCL23 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.23)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = logorcl.oracle.com)
)
)
........................

[oracle@station23 ~]$ tnsping logorcl23
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.23)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = logorcl.oracle.com)))
OK (30 msec)

@@@
[oracle@station23 ~]$ rman target / catalog ucate/hr@logorcl23
Recovery Manager: Release 10.2.0.2.0 - Production on Wed Dec 14 10:42:42 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: LOGORCL (DBID=2449016660)
connected to recovery catalog database
RMAN> create catalog tablespace tbscatlog;
recovery catalog created
RMAN> register database;
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete

@@@
SQL> conn ucate/hr
Connected.
SQL> select count(*) from tab;

COUNT(*)
----------
90

@@@generally,if your controlfile change,you must rebuild controlfile.
RMAN> drop catalog; @@@ do twice
RMAN> unregister database;
RMAN> create catalog;
RMAN> register database;
RMAN> resync catalog;


4)backup flashback area to obt_tape
1@@@@
RMAN> backup recovery files;
@@@if device type is disk, you could not run the command,
RMAN> show all;
CONFIGURE DEFAULT DEVICE TYPE TO DISK;

@@@modify it to sbt_tape, you could do.
@@@because flashback_recovery_area must keep unique.
RMAN> show all;
CONFIGURE DEFAULT DEVICE TYPE TO 'SBT_TAPE';
RMAN> backup recovery files;
Starting backup at 2011-12-18 11:49:12
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: sid=145 devtype=SBT_TAPE
channel ORA_SBT_TAPE_1: Oracle Secure Backup


5)crosscheck to delete backup on sbt
1@@@@basic
@@@crosscheck mean check whether data on your filesystem match
@@@data on rman list or not.
@@@if not , it would be modified the status to expired.
RMAN> crosscheck backupset 20;
> allocate channel for maintenance device type sbt;
> delete backupset 20;

@@@or you modified its status to unavaliable.
@@@generally,you find the backupset exist a broke block.
RMAN> change backupset 29 unavaliable.

2@@@channel
@@@A channel represents one stream of data to a device type.
@@@A channel must be allocated before you execute backup and recovery @@@commands. Each allocated channel establishes a connection from the
@@@RMAN executable to a target database instance. An Oracle database
@@@process for the target database is created for every channel allocated.
SQL> select device_type from V$BACKUP_DEVICE;
DEVICE_TYPE
-----------------
SBT_TAPE

RMAN> CONFIGURE DEFAULT DEVICE TYPE TO sbt;
RMAN> show all;
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
RMAN> list backup;
using target database control file instead of recovery catalog
List of Backup Sets
BP Key: 5 Status: AVAILABLE Compressed: NO Tag: TAG20111213T190332
....................................
Handle: 0gmu4jv4_1_1 Media:
....................................
RMAN> allocate channel for maintenance device type sbt;
RMAN> crosscheck backup; @@@or: crosscheck copy;
RMAN> delete expired backup noprompt;
RMAN> RUN {
2> ALLOCATE CHANNEL c1 DEVICE TYPE disk;
3> BACKUP DATAFILE '/u01/oradata/user01.dbf';
4> }


6)extra backup a copy in tape
1@@@@
@@@
@@@first:you must appointed tape
@@@
@@@because flashback_recovery_area keep unique always.
RMAN> backup copies 2 tablespace users;
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =========
RMAN-00571: =====================================================
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 12/20/2011 12:10:23
ORA-19806: cannot make duplex backups in recovery area

@@@
@@@second:you must assign backup_tape_io_slaves=true
@@@
RMAN> CONFIGURE DEFAULT DEVICE TYPE TO sbt;
RMAN> backup copies 2 tablespace users;
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =========
RMAN-00571: =====================================================
RMAN-03009: failure of backup command on ORA_SBT_TAPE_1 .......
ORA-19565: BACKUP_TAPE_IO_SLAVES not enabled when duplexing to sequential devices

@@@
@@@third:do it.
@@@
SQL> show parameter tape
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
backup_tape_io_slaves boolean TRUE
tape_asynch_io boolean TRUE
RMAN> backup copies 2 tablespace users;

没有更多推荐了,返回首页