1、China TCO internal useChina TCO internal use 最大程度减小数据恢复给业务带来的影响;使您的备份与恢复策略更为有效;减少您听到“我们恢复不了您的数据”的机会;提供改进您的备份与恢复流程的建议;图形表达备份与恢复流程;China TCO internal use备份数据策略恢复数据策略灾难恢复流程故障报警备份系统高可用性数据库联机备份备份管理China TCO internal use1.选用适当的备份设备和备份软件2.尽可能使用多于一个的物理设备3.经常有规律的作备份4.至少保存两份最新的备份5.定义备份进度:方式、频率、时序和保管6.备份权限的设定7
2、.备份步骤信息的记录8.定时清洁和维护设备9.数据恢复和故障预演China TCO internal use 备份整个磁盘作为一个映像 限制:恢复时要求作为一个映像,不可依据文件类型 限制卷的大小 适合灾难恢复 逐个文件的备份 支持各种备份方式1.全备分2.增量备份3.差分备份 备份和恢复的灵活性 更慢,独立于文件存取的速度China TCO internal uselevel0全备份Full backuplevel2差分备份Differential backuplevel1增量备份Incremental backupChina TCO internal use仅需一盘磁盘tape 1+x t
3、apetape 1+(x-1)tapeslevel0全备份Full backuplevel2差分备份Differential backuplevel1增量备份Incremental backupChina TCO internal useBackup and Recovery Procedures 1.拜访用户2.现状分析3.制定策略4.用户确认开始结束China TCO internal use Step 1 拜访用户拜访用户对备份技术进行讲解,主要介绍备份与恢复的重要性和必要性,以及备份与恢复的内容,方法和策略。Backup and Recovery Procedures 1China T
4、CO internal usev Objectives of Backup/Recoveryv Scope of Backup/Recoveryv Type of Backup Solutionv System Backup/Recovery Utilitiesv System Recovery Toolsv Typical System Backup Solutionv Backup WindowBackup and Recovery on HP-UX SystemWhy Backup?v Hardware(Disk)Failurev Database/Application Corrupt
5、ionv Administrator Errorv User Errorv Site Disaster“There are twotype of computer users,those that have lost data and those that will”What should be backed up?v Operating System files and configuration v Disk layout informationv User profiles and home directoriesv Application and database binaries a
6、nd filesv The data from the applicationThe data includes:Type of Backup Solutionv OS/Database Backupv Incremental/Full Backupv Online/Offline Backupv Local/Network BackupChina TCO internal useSystem Backup/Recovery Utilities Standard UNIX Utilitiestar,cpio,dump/restore,vxdump/vxrestore,dd,mt HP-UX U
7、tilites(HP_UX only)fbackup/frecoverSAM UtilitiesCOPYUTILmake_recoveryChina TCO internal usebackup utilities introduceRecommended system backup utility.For each file transferred,the files contents and all relevant information necessary to restore it to an equivalent state are copied to output device,
8、which can be raw magnetic tape drive,the standard output,DDS-format tape,rewritable magneto-optical disk or a file.Reads media written by fbackup,and copies specified files from this media to specified location.vfbackup and frecover are proprietary utilities usable only on HP-UX systems.vSAM uses fb
9、ackup and frecover as its backup programs.Saves and restores files on magnetic tape,flexible disk,or regular file.Saves and restores archives of files on magnetic tape,other devices,or a regular file,and copies files from one directory to another while replicating the directory tree structure.All-pu
10、rpose utility that copies to/from raw devices.Data conversion is possible.It is often used to save or restore information disk-to-disk.Copies specified input file to specified output;usually,both input and output files are device files.China TCO internal usetar-tape archivev Backup a directory:#cd /
11、data#tar cvf /dev/rmt/0m .v Restore all files from a tape:#cd /datatar xvf /dev/rmt/0mv Restore one file from a tape:#cd /data#tar xvf /dev/rmt/0m./file1.txtv Create a index of the file list on the tape:#tar tvf /dev/rmt/0m /tmp/index.txt/data/dataChina TCO internal usetar syntax$tar key arg.file|-C
12、 directoryKeys:cxvfmutrwhCommon keys:c Create archive.x Extract archive.t List names of all files in archive.r Append file(s)to end of existing archive.If-C directory is specified,tar will change to directory and continue save or restore.China TCO internal use对系统全对系统全备份备份#tar cvf/dev/rmt/0m/备份备份某某目录
13、目录#tar cvf/dev/rmt/0m/tmp改变文件改变文件的的备份路径备份路径#tar cvf/dev/rmt/0m-C/tmp.Note:路径/tmp 在磁带上的备份路径变为./#cd/tmp#tar cvf/dev/rmt/0m./*恢复恢复数据数据#tar xvf/dev/rmt/0m(磁带上所有数据)#tar xvf/dev/rmt/0m/tmp(恢复目录/tmp)查看查看磁带磁带上的数据上的数据#tar tvf/dev/rmt/0m tar命令应用China TCO internal usedd exampleTo copy an entire disk drive to a
14、nother identically-sized device:#dd if=/dev/rdsk/c0t1d0 of=/dev/rdsk/c3t3d0 bs=4096China TCO internal usedd syntax#dd if=input_file of=output_file bs=block_sizeWarning:Data will be destroyed on the output file location.Ensure that the correct output file is designated to prevent unintentional data d
15、estruction.China TCO internal usecpio exampleTo use with the find command to backup all files and sub-directories of the/home directory:$find/home-print|cpio-ocB /dev/rmt/0mTo print a listing of files stored on a backup created by cpio:$cpio-itBv /dev/rmt/0mTo restore a file from a cpio backup:$cpio
16、-icBv/etc/lvmtab /dev/rmt/0mChina TCO internal usecpio syntax$cpio-o-e extarg achvxABC$cpio-i bodfmrstuvxBPRSU6 pattern$cpio-p-e extarg adlmruvxU directoryCommon options:o Copy out(export)specified files to archivei Copy in(import)specified files from archivep Duplicate directory tree(passthrough)c
17、Write or read header information in ASCII character format for portabilityd Create directories as neededt Print table of contents only.B Block input/output at 5120 bytes to record.Use only with data directed to or from devices that support variable-length records.v Print file characteristics(numeric
18、-mode,owner,blocks,date,filename)pattern Only files that match pattern are saved/restoreddirectory Destination directory treeChina TCO internal usefbackup/frecoverv Backup a directory:#fbackup-f /dev/rmt/0m-i/datav Restore all files from a tape:#frecover-orf/dev/rmt/0mv Restore one file from a tape:
19、#frecover-oxf /dev/rmt/0m -i /data/file1.txtv Create a index of the file list on the tape:#frecover-f/dev/rmt/0m-I/tmp/index.txt/data/dataChina TCO internal usefbackup syntax#fbackup-f devicefile-0-9 optionsWhere:-f devicefile Identifies backup device-0-9 Backup level(0=full backup;1-9 indicates inc
20、remental)Common options:-i filename Informs fbackup to include file filename.-e filename Informs fbackup to exclude file filename.-I filename Creates an index in filename.-g filename The filename specifies an ASCII file which contains file trees to include or exclude.China TCO internal usefbackup命令应
21、用一1 进入进入单用户单用户#shutdown-y 0#/etc/mount-a 2 系统全系统全备份备份#fbackup f/dev/rmt/0m-0iv/-I/tmp/sysbk.index -f:设备文件名(such as DDS tape driver)-i:要包含的目录 -e:不包含的目录 -I:备份内容检索目录 -v:备份内容详细列表 -0:零级备份#fbackup f/dev/rmt/0m-i/-e/home 备份除了目录/home的所有目录3 说明说明1)该命令方式对系统当前”mounted“的文件系统进行备份 2)备份级别说明 备份级别有09 个级别,如果当前系统采用零级备份
22、,当下一次采用5 级 备份时,系统仅将会对有变化的文件进行备份 China TCO internal use1#mkdir-p/tmp/fbackupfiles/index#mkdir-p/tmp/fbackupfiles/log 2#touch/tmp/fbackupfiles/index/full.date+%y%m%d.%H:%M 3进入单用户#shutdown y 0#/etc/mount-a 4对系统进行全备份#fbackup 0vi/-f/dev/rmt/0m -I/tmp/fbackupfiles/index/full.date+%y%m%d.%H:%M 2 /tmp/fback
23、upfiles/log/full.date+%y%m%d.%H:%M 5说明 通过该方式可以知到系统备份需要的时间 fbackup命令应用二China TCO internal usefbackup命令应用三1进入单用户#shutdown y 0#/etc/mount-a 2对系统进行全备份#fbackup 0uv/-f/dev/rmt/0m -g/tmp/fbackupfiles/mygraph -I/tmp/fbackupfiles/index/full.date+%y%m%d.%H:%M 2 /tmp/fbackupfiles/log/full.date+%y%m%d.%H:%M 3说明
24、 a.文件 mygraph:包含需要备份的目录,格式如下:i/users/data i/home/app e/oracle/sql b.参数 u:当备份系统成功时,系统将更新/var/adm/fbackupfiles/dates.China TCO internal usefbackup命令应用四备份远程系统 1 登录在本地系统时#remsh backup_sysname”fbackup f DDS_sysname:/dev/rmt/0m-0vi/”2 登录在远程系统时#fbackup f backup_sysname:/dev/rmt/0m 0vi/China TCO internal us
25、efbackup命令应用五压缩方式备份(不建议使用、影响系统性能)1 压缩方式备份#fbackup 0vi/dir-f-|compress|dd of=/dev/rmt/0m obs=10k “”:指向标准输出 2 查看备份内容#dd if=/dev/rmt/0m ibs=10k|uncompress|frecover I-f-China TCO internal usefrecover syntax#frecover-r-hmosvyAFNOX-f device-c config -S skip-E extarg#frecover-x-hmosvyAFNOX-f device-c confi
26、g-S skip-E extarg-e path-i path -g graph#frecover-I path vy-f device-c config#frecover-V path vy-f device-c configCommon options:-r Recover all files on backup tape.-x Files identified by-i(include),-e(exclude)or g(graph file)are extracted/not extracted.-V path Write volume header to path.-o Recover
27、 files regardless of age.-X Recover files relative to current working directory.China TCO internal use恢复磁带机上所有内容:1 进入单用户:#shutdown-y 0#/etc/mount-a 2 恢复数据#frecover rf/dev/rmt/0m 恢复磁带上的所有数据 -f:设备文件名 -r:恢复磁带上的所有数据 -I:将磁带上文件索引存到指定的文件中#frecover I/tmp/index.txt-f/dev/rmt/0mfrecover命令应用一China TCO internal
28、 usefrecover命令应用二恢复某一目录:#frecover-xi/directory#frecover x-i/dir1-i/dir2#frecover-xoi/dir -o:覆盖/dir下已有的、相同名称的文件#frecover-xvXi/dir -X:按磁带上目录恢复数据#cd/tmp/local;frecover xvYi/dir -Y:按磁带上文件名恢复数据 例如:#cd/tmp/local#frecover xvF-i/home/filename 恢复结果/tmp/local/filename 不是/home/filename China TCO internal usefr
29、ecover命令应用三从远程磁带机上恢复数据到本地:#frecover xi/dir f remote_name:/dev/rmt/0m China TCO internal usefrecover命令应用四从本地磁带机上恢复数据到远地系统:#remsh remote_name”frecover xi/dir-f local_name:/dev/rmt/0m”China TCO internal useInternal of fbackup/data record record record record record record.fbackuprdrfbackuprdrfbackuprdr
30、fbackupwtrfbackupIn-MemoryAreaChina TCO internal useSAM-Backup and Recovery Automated Backups produces log and index files E-Mail results to specified user Interactive Backup and Restore incremental file system backup and restoreChina TCO internal use1.Run SAM.2.Select SAM area Backup and Recovery.3
31、.Select area Automated Backups.4.Select menu option Actions.Add an Automated Backup.5.Choose whether it is a local or remote backup.The“Add an Automated Backup”window or screen displays.6.Choose Select Backup Scope.The“Select Backup Scope”window or screen displays.7.Specify which are included files(
32、files to backup)and which are excluded files(optionalwhich files not to backup).Select Backup Scope of:o Specified Files,which must be typed in by file or directory name explicitly.o Local File Systems Only(No NFS)o All File Systems(Includes NFS),which includes all file systems recognized by the sys
33、tem,no matter what type.8.Choose Specify Backup Device from options.9.Select the backup device from list.It may be necessary to indicate tape device options,also.setup automated backup using SAMChina TCO internal use10.Choose Select Backup Time from options.The“Select Backup Time”window or screen di
34、splays,as in this example:o Enter the time and day(s)for the full and incremental(if enabled)backups to be performed.o The time must be entered in HH:MM format.Therefore,2:00 is unacceptable,but 02:00 is acceptable.o Note that day is entered by either day of week or day of month(which lists the numb
35、ers 1-31 for selection).You can select more than one day for the backup to be performed.11.Optionally,select Set Additional Parameters.Specify email address of user to notify of backups,for example.12.When the“Add an Automated Backup”window or screen next displays,select OK,and the“Backup and Recove
36、ry”window or screen displays.It lists all configured automatic backups for the system,for viewing and verification,as necessary.setup automated backup using SAMChina TCO internal useSAM备份方法1)备份数据#sam -Select“Backup and Recovery“-Select“Interactive Backup and Recovery“-Select“Backup Device“-Select“Ba
37、ckup Files Interactively“(From Action menus)-Select Backup Scope -Select Local File Systems Only(no NFS)-Select“OK“2)检查备份的数据 1 检查文件/var/sam/log/br_log -Full backup started on host1:Wed oct 16 15:10:09 EAT 1998(Scheduled Backup)fbackup 0 u v g/etc/sam/br/graphDCAa04366 I/var/sam/log/br_indext.full-c/
38、etc/sam/br/fbackup_config d/var/adm/fbackupfiles/dates f/dev/rmt/c1td0d0 BEST 2&1 Full backup completed on host1:Wed Oct 16 16:44:01 EAT 1998 Exit code=0 -Notes:if Exit code=2,there is problem on backup procedure.2 查看磁带上有那些文件#frecover rNsv f/dev/rmt/0m China TCO internal usebackup disk using COPYUTI
39、L1.Boot to ISL.2.Run the Copy Utility.ISL ode copyutilODE copyright message and COPYUTIL copyright message display.It then scans the device busses and displays information about thestorage devices it has detected on the system.Example:Ty Indx Path Product ID Bus Size Rev-D 0 2/0/1.0.0 QUANTUMLPS270S
40、 disc drive SCSI 258 MB 5909D 1 2/0/1.1.0 SEAGATEST3600N disc drive SCSI 499 MB 9686D 2 2/0/1.3.0 HPC2244 disc drive SCSI 1.0 GB 0B04T 3 2/0/1.5.0 HPC1504X/HPC1521B DDS tape SCSI N/A 1009D 4 2/0/1.6.0 QUANTUMLPS270S disc drive SCSI 258 MB 59093.Run backup.COPYUTIL backup4.Specify the disk index numb
41、er from which the backup will come,and then the tape index number to which the backup will go.Example:To copy data off the last Quantum disk drive(disk index 4)onto the DDS tape drive(tape index 3).Enter the Disk Index(q/?):4Enter the Tape Index(q/?):35.Follow instructions to load the tape into the
42、tape drive,if not already done,and enter“y”to continue.The backup begins to the tape,with screen output indicating what percentage has been backed up to the tape.This may take an hour or more.6.Exit COPYUTIL.China TCO internal useCOPYUTIL备份方法1)如何启动“Copyutil“1 从CD boot,进入ISL BOOT_ADMINboot scsi.n.m(p
43、ath of CDROM drive-such as scsi.4.0)2 ISLode copyutil Type help for command information 3 ISL_CMDcopyutil please wait while scan device bussess TY Indx Path Product ID Bus Size Rev D 0 16/5.6.0 SEAGATEST31230N disk drive SCSI 1.0 GB HPM4 D 1 16/5.5.0 SEAGATEST31230N disk drive SCSI 1.0 GB HPM4 T 2 1
44、6/5.0.0 HPC1504X/HPC1521B DDS tape SCSI n/a 10092)备份系统硬盘上的所有数据COPYUTILbackup Enter the disk index(q/?):0 Enter the Tape index(q/?):2 Use data compression?(y/n)?Y When backup finished,system will show:DONE!COPYUTIL exit3)恢复数据到指定的系统硬盘上COPYUTIL restore Enter the Tape index(q/?):2 Enter the disk index(q
45、/?):0 Use data compression?(y/n)?Y After system display:Restored Successful,that means restore is finished!COPYUTIL exit4)注意:当用copyutil备份Root Disk到相应的磁带时,该磁带可以作为bootable 磁带使用 China TCO internal useNeeds for System Recovery Failed boot/root disk Corrupt OS(ie:non bootable)Backout path from upgrade Di
46、saster RecoveryHP-UX 11.00HP-UX 10.20China TCO internal useSystem Setup for Easier RecoveryHow a system is setup can greatly effect ease and ability to recover:vSINGLE disk in root Volume Group,mirrored if possible.vDedicated to Operating System.VG00Only need to recover one disk!China TCO internal u
47、sePossible Root Disk Layouts/stand48MBprimary swap=memory100MBsecondary swap+dump?/usr400MB/opt200MB/var300MB/tmp100MB/home?Spare spacerest of diskChina TCO internal useMethods to Recover SystemReinstallation COPYUTILmake_recoveryH9000China TCO internal useWhat is“make_recovery”?v Restore a non-boot
48、able system with little or no manual interventionv Restore a system after replace the corrupted root diskv Clone the software from one system to another-migration,disaster recoveryv Convert from hfs to vxfs file systemsv Modify root file system or primary swap space size An easy to use system admini
49、stration tool to create a System Recovery Tape.Part of Ignite-UX.Can be used to:China TCO internal useHow to use make_recovery?-backup/opt/ignite/bin/make_recovery -AprvC -d destination -b boot_destination-AInclude the entire root disk volume group-pPreview mode/creates files but doesnt write tape-r
50、 Resume creation after editing files to include/exclude list-vVerbose mode-dTape drive device file(default is /dev/rmt/0m)-bLocation to assemble files 32MB needed(default is /var/tmp)-CCreate status file for later comparison with check_recovery toolTypical Usage:#make_recovery -A -C#make_recovery -A