一、业务需求 该用户为大型生产制造企业,应用为SAP,数据库为Oracle 10g。生产业务系统7*24小时高可用,以提供生产所需要的库存、生产、销售等实时数据。 目前的生产环境备份方式采用TSM+RMAN的方式,在夜间12点执行online备份。 为了适应新的企业信息化建设要求,计划部署一套ERP测试开发多用途业务平台,针对生产系统,实现SAP测试、报表输出、数据挖掘功能。 二、现状问题 由于SAP的模块较多,依赖信息系统的业务也较密集,为了进一步提高信息系统应用水平,计划利用生产数据库,通过flashcopy复制技术,搭建一套SAP测试平台、报表输出、数据挖掘系统,通过部署测试、报表、数据挖掘等系统,进一步拓展信息系统的功能,提高领导层对业务及行业市场战略决策的时效性。 而现有的信息系统平台,只能是通过在生产数据库上采用RMAN备份到磁带,或者通过export出来,然后,在测试系统主机上进行RMAN恢复或import;整个操作和过程相对而言较为繁琐,针对系统管理员而言,仍需要有一定的操作经验。 三、测试的目的 由于SAP业务主机繁忙,为了尽可能减少ORACLE数据库的维护和测试工作所带来的ORACLE备份、EXPORT、IMPORT等问题,旨在利用IBM DS4800基于微码的快闪复制技术FLASHCOPY,来加快数据库的快照备份,进一步为测试平台提供SAP生产数据,实现数据分析、数据挖掘、业务测试等功能。 四、测试环境说明 生产主机:IBM POWER 570(8路处理器,48G内存),运行SAP生产环境 测试主机:IBM POWER 550(2路处理器,16G内存),运行SAP测试环境 存储:IBM DS4800(16G机头,生产环境使用光纤盘,测试环境使用SATA) 应用情况:SAP ERP 数据库版本:ORACLE 10g 操作系统版本:AIX6.1 五、Flashcopy技术应用简述 FlashCopy快闪复制技术是基于IBM DS4000系列存储硬件微码级别的复制技术,需要购买许可并激活后才能使用。 FlashCopy对于加快数据库热备份非常有用。一般情况下,当数据被设置成为热备份方式时,优先的数据文件将被备份或复制到其他的介质上。随着数据库的增长,数据热备份的时间可能由几个小时增长到几天。对于数据热备份来说,最大的风险在于当所有数据库更新操作还没有完成磁盘复制,还都被保存在内存中时,将非常易受攻击。随着数据库的增长和备份时间的变长,风险也在加大。 FlashCopy能够帮助将热备份窗口减小到以分钟计算,一旦保留了一个拷贝,数据库将退出热备份模式,并重新开始正常的操作。然后,FlashCopy逻辑驱动器将被使用备份到离线的介质或复制到其他的介质。这项操作能够帮助缩短备份的操作时间。 FlashCopy逻辑驱动器还有进一步的用途。当需要进行数据库恢复时,FlashCopy逻辑驱动器能够被用于启动恢复。这项功能能够帮助避免从离线借助恢复的需求。 六、测试环境中存储与磁盘扩展柜连接示意图 1台DS4800主机,3台EXP810扩展柜,为提高性能,分为3个存储环路。 说明,测试环境为1台光纤交换机,划分多个ZONE,模拟成2个交换机。 七、存储LUN划分表 八、存储管理地址表 九、创建falshcopy盘步骤 通过IBM DS Storage Manager进行创建,下图所示,假如在现有的设备上创建FlashCopy卷,步骤如下图所示:
十、在测试主机端识别DS4800 LUN资源 备注:
十一、Flashcopy快闪复制脚本 1) FC-ALL主脚本: echo “display this time” >>/etc/flashcopyfiles/flcp.log date >>/etc/flashcopyfiles/flcp.log echo “remote sh /etc/flashcopyfiles/hotbkstart-before” >>/etc/flashcopyfiles/flcp.log rsh czqas /etc/flashcopyfiles/hotbkstart-before >>/etc/flashcopyfiles/flcp.log echo “start db hotbkstart” >>/etc/flashcopyfiles/flcp.log sh /etc/flashcopyfiles/HotbkStart.sh if [ $? != 0 ] then echo “Set database to readonly failed” >>/etc/flashcopyfiles/flcp.log else echo “Set database to readonly …..” >>/etc/flashcopyfiles/flcp.log fi cat /oracle/CZP/scripts/work/bbkup.log >>/etc/flashcopyfiles/flcp.log echo “ “ >>/etc/flashcopyfiles/flcp.log echo “disable flashcopy disk” >>/etc/flashcopyfiles/flcp.log /opt/IBM_DS4000/client/Smcli –n IBM ds4800 –f /etc/flashcopyfiles/fc-disable >>/etc/flashcopyfiles/flcp.log sleep 10 echo “recreate a flashcopy disk” >>/etc/flashcopyfiles/flcp.log /opt/IBM_DS4000/client/Smcli –n IBM ds4800 –f /etc/flashcopyfiles/fc-recreate >>/etc/flashcopyfiles/flcp.log sleep 20 echo “start db hotbkstop” sh /etc/flashcopyfiles/HotbkEnd.sh if [ $? != 0 ] then echo “Resume database failed” >>/etc/flashcopyfiles/flcp.log else echo “Resume database …..” >>/etc/flashcopyfiles/flcp.log fi cat /oracle/CZP/scripts/work/ebkup.log >>/etc/flashcopyfiles/flcp.log echo “ “ >>/etc/flashcopyfiles/flcp.log echo “remote sh /etc/flashcopyfs/hotbkstart-after” >>/etc/flashcopyfiles/flcp.log rsh czqas /etc/flashcopyfiles/hotbkstart-after >>/etc/flashcopyfiles/flcp.log echo “this job is complete” >>/etc/flashcopyfiles/flcp.log 2) hotbkstart-before脚本: echo “umount all filesystems and be ready to do recreate flashcopy” umount /fs/oracle/CZP/oraarch umount /fs/oracle/CZP umount /fs/oracle/CZPdata umount /fs/oracle echo “varyoffvg all vg “ varyoffvg sapdbvg exportvg sapdbvg varyoffvg sapdblogvg exportvg sapdblogvg echo “rmdev all flashcopy disk” rmdev –dl hdisk4 rmdev –dl hdisk5 rmdev –dl hdisk6 rmdev –dl hdisk7 rmdev –dl hdisk8 rmdev –dl hdisk9 3) HotbkStart.sh脚本: #!/bin/ksh Initialize() { ORACLE_SID=CZP ; export ORACLE_SID ORACLE_HOME=/oracle/${ORACLE_SID}/102_64; export ORACLE_HOME #In case of 9.2.0 oracle version, please use the following line UID=”connect system/hjsuzuki” #Please create the user bkpmgr with the mentioned password and grant DBA rivilege SQL=”${ORACLE_HOME}/bin/sqlplus system/hjsuzuki” Script_dir=”/oracle/${ORACLE_SID}/scripts/work” Log_dir=”/oracle/${ORACLE_SID}/scripts/log”; export Log_dir Today=`date ‘+%y%m%d’` controlfile_bkup_dir=”/oracle/${ORACLE_SID}/saptrace/usertrace” } Get_Ts() { echo “set echo off” > $Script_dir/bbkup.sql echo “set pages 1000” >> $Script_dir/bbkup.sql echo “set head off “ >> $Script_dir/bbkup.sql echo “set feed off “ >> $Script_dir/bbkup.sql echo “select ‘alter tablespace ‘||tablespace_name||’ begin backup;’ from dba_tablespaces order by tablespace_name; “ >> $Script_dir/bbkup.sql ${SQL} < $Script_dir/bbkup.sql > $Script_dir/bbkup.tmp grep “^alter” $Script_dir/bbkup.tmp > $Script_dir/bbkup.out } Check_Bkup () { #echo “$UID” > $Script_dir/chkbkup.sql echo “set head off” > $Script_dir/chkbkup.sql echo “set feed off” >> $Script_dir/chkbkup.sql echo “select ‘number+’||count(1) from v\$backup where status=’ACTIVE’;” >> $Script_dir/chkbkup.sql $SQL < $Script_dir/chkbkup.sql > $Script_dir/chkbkup.out grep “number” $Script_dir/chkbkup.out|cut –d”+” –f2|read bkupcnt #echo “Number : $bkupcnt “ if [ $bkupcnt –gt 0 ]; then echo “Few tablespaces are in backup mode …...” $SQL < $Script_dir/ebkup.out > $Script_dir/ebkup_check.log fi } Start_Bkup () { #echo “In start backup” ${SQL} < $Script_dir/bbkup.out > $Script_dir/bbkup.log } Check_Start_Bkup () { if [ `grep ORA $Script_dir/bbkup.log|wc –l` -gt 0 ] then echo “Error while putting TS in Backup mode!! Exiting !! on `date`” >> $Log_dir/HotBack.log exit fi } Switch_Logs_ctl () { echo “alter system switch logfile;” > $Script_dir/switch_logs_ctl.sql echo “alter system switch logfile;” >> $Script_dir/switch_logs_ctl.sql echo “alter system switch logfile;” >> $Script_dir/switch_logs_ctl.sql echo “alter system switch logfile;” >> $Script_dir/switch_logs_ctl.sql echo “alter rivil switch logfile;” >> $Script_dir/switch_logs_ctl.sql echo “alter system switch logfile;” >> $Script_dir/switch_logs_ctl.sql echo “alter system switch logfile;” >> $Script_dir/switch_logs_ctl.sql echo “alter system switch logfile;” >> $Script_dir/switch_logs_ctl.sql echo “alter database backup controlfile to trace;” >> $Script_dir/switch_logs_ctl.sql echo “alter database backup controlfile to ‘$controlfile_bkup_dir/control_bkup_$Today’;” >> $Script_dir/switch_logs_ctl.sql $SQL < $Script_dir/switch_logs_ctl.sql > $Script_dir/switch_logs_ctl.log } Main() { Initialize echo “Starting HotBkStart script on `date`” >> ${Log_dir}/HotBack.log Get_Ts Check_Bkup Switch_Logs_ctl echo “Putting all tablespaces in Backup mode on `date`” >> $Log_dir/HotBack.log Start_Bkup Check_Start_Bkup echo “Control Passed to BCV Split on `date`” >> $Log_dir/HotBack.log } Main 4) fc-disable脚本: disableFlashCopy logicalDrive [“ERP_PRO_1-1”]; disableFlashCopy logicalDrive [“ERP_PRO_2-1”]; disableFlashCopy logicalDrive [“ERP_PRO_3-1”]; disableFlashCopy logicalDrive [“ERP_PRO_4-1”]; disableFlashCopy logicalDrive [“ERP_LOG_1-1”]; disableFlashCopy logicalDrive [“ERP_LOG_2-1”]; 5) fc-recreate脚本: recreateFlashcopy logicalDrive [“ERP_PRO_1-1”]; recreateFlashcopy logicalDrive [“ERP_PRO_2-1”]; recreateFlashcopy logicalDrive [“ERP_PRO_3-1”]; recreateFlashcopy logicalDrive [“ERP_PRO_4-1”]; recreateFlashcopy logicalDrive [“ERP_LOG_1-1”]; recreateFlashcopy logicalDrive [“ERP_LOG_2-1”]; 6) HotbkEnd.sh脚本: #!/bin/ksh Initialize() { ORACLE_SID=CZP ; export ORACLE_SID ORACLE_HOME=/oracle/${ORACLE_SID}/102_64; export ORACLE_HOME #In case of 9.2.0 oracle version, please use the following line UID=”connect system/hjsuzuki” #Please create the user bkpmgr with the mentioned password and grant DBA rivilege SQL=”${ORACLE_HOME}/bin/sqlplus system/hjsuzuki” Script_dir=”/oracle/${ORACLE_SID}/scripts/work” Log_dir=”/oracle/${ORACLE_SID}/scripts/log”; export Log_dir Today=`date ‘+%y%m%d’` controlfile_bkup_dir=”/oracle/${ORACLE_SID}/saptrace/usertrace” } Check_End_Bkup () { #echo “$UID” > $Script_dir/chkbkup.sql echo “set head off” > $Script_dir/chkbkup.sql echo “set feed off” >> $Script_dir/chkbkup.sql echo “select ‘number+’||count(1) from v\$backup where status=’ACTIVE’;” >> $Script_dir/chkbkup.sql $SQL < $Script_dir/chkbkup.sql > $Script_dir/chkbkup.out grep “number” $Script_dir/chkbkup.out|cut –d”+” –f2|read bkupcnt #echo “Number : $bkupcnt “ if [ $bkupcnt –gt 0 ]; then #echo “Few tablespaces are in backup mode …...” $SQL < $Script_dir/ebkup.out > $Script_dir/ebkup_check.log fi } End_Bkup () { #echo “In end backup” sed “s/begin backup;/end backup;/g” $Script_dir/bbkup.out > $Script_dir/ebkup.out ${SQL} < $Script_dir/ebkup.out > $Script_dir/ebkup.log } Switch_Logs () { &nb |