482 lines
24 KiB
Plaintext
482 lines
24 KiB
Plaintext
|
*** Settings ***
|
|||
|
Resource ElementPath.robot
|
|||
|
Library Selenium2Library
|
|||
|
Library DatabaseLibrary
|
|||
|
Resource ../RE0_Common/KeyWord.robot # 公共关键字
|
|||
|
Resource ../RE0_Common/ElementPath.robot # 公共xpath
|
|||
|
|
|||
|
*** Keywords ***
|
|||
|
Oracle备份
|
|||
|
[Arguments] ${Oracle_BackType} ${agent_name} ${DBInstance} ${mds_name} ${encryption_attr} ${compress_attr} ${dedup_attr} ${cache}
|
|||
|
[Documentation] 功能:连接Oracle数据库,删除原有表、新建表后插入数据
|
|||
|
...
|
|||
|
... 使用方法:Oracle备份
|
|||
|
...
|
|||
|
... 变量: ${Oracle_BackType}备份类型 | ${agent_name}代理名 | ${DBInstance}实例名 | ${mds_name}介质名 | ${encryption_attr}是否加密 | ${compress_attr}是否压缩 | ${dedup_attr}是否重删 | ${cache}是否缓存
|
|||
|
log 选择定时数据保护
|
|||
|
元素点击 ${Timed_DataProtect} 点击进入定时数据保护页面 定位定时数据保护失败
|
|||
|
${date} Evaluate time.strftime('%Y%m%d%H%M%S',time.localtime()) time
|
|||
|
${random_strategyName}= Catenate SEPARATOR=_ ${Oracle_BackType} ${date}
|
|||
|
${createpolicy} Catenate SEPARATOR= 新建了策略[ ${random_strategyName} ]
|
|||
|
Set Suite Variable ${random_strategyName}
|
|||
|
Set Suite Variable ${createpolicy}
|
|||
|
Sleep 15s
|
|||
|
元素点击 xpath=//span[text()="${agent_name}"] 点击选择代理 定位代理所在位置失败
|
|||
|
元素点击 ${BackupSet} 点击进入备份集页面 定位备份集按钮失败
|
|||
|
元素点击 ${dpm_Protection strategy} 点击进入保护策略页面 定位保护策略按钮失败
|
|||
|
元素点击 ${Add_Policy} 点击添加策略按钮 定位添加策略按钮失败
|
|||
|
元素点击 ${Select_Backup source} 点击Oracle组件按钮 定位Oracle组件按钮失败
|
|||
|
元素输入 ${Input_PolicyName_Oracle} ${random_strategyName} 定位策略名输入框失败
|
|||
|
元素输入 ${Instance_name} ${DBInstance} 定位实例输入框失败
|
|||
|
元素点击 ${Connection credentials_Next} 点击实例页面下一步按钮 定位实例页面下一步按钮失败
|
|||
|
sleep 5s
|
|||
|
元素点击 ${Select_Target database} 点击勾选数据库 定位数据库勾选框失败
|
|||
|
元素点击 ${Target_database_Next_Oracle} 点击目标数据库页面下一步按钮 定位目标数据库页面下一步按钮失败
|
|||
|
元素点击 ${Oracle_Parameter_Next} 点击Oracle选项页面下一步按钮 定位Oracle选项页面下一步按钮失败
|
|||
|
元素点击 ${Add_taskcycle} 点击添加任务周期按钮 定位添加任务周期按钮失败
|
|||
|
Run Keyword If "${Oracle_BackType}"=="完全" KeyWord_Oracle.完全备份
|
|||
|
... ELSE IF "${Oracle_BackType}"=="差量" KeyWord_Oracle.差量备份
|
|||
|
... ELSE IF "${Oracle_BackType}"=="增量" KeyWord_Oracle.增量备份
|
|||
|
... ELSE IF "${Oracle_BackType}"=="归档日志" KeyWord_Oracle.归档日志备份
|
|||
|
... ELSE Fail 定位备份类型失败
|
|||
|
元素点击 ${Cycle_Once} 设置任务仅执行一次 定位仅执行一次失败
|
|||
|
元素点击 ${Cycle_Confirm} 确定任务周期设置完毕 定位任务周期设置失败
|
|||
|
元素点击 ${Cycle_NextStep} 点击下一步进入备份集存储设置界面 定位下一步失败
|
|||
|
元素点击 ${Manual_ChooseMDS} 点击勾选手动选择介质 定位选择介质失败
|
|||
|
元素点击 ${Select_MDS} 点击介质选择按钮 定位介质选择按钮失败
|
|||
|
元素点击 xpath=//option[@label="${mds_name}"] 点击选择指定介质 定位指定介质失败
|
|||
|
Run Keyword If ${dedup_attr}==1 重删
|
|||
|
元素点击 ${Storage_NextStep} 点击下一步进入到备份高级选项 定位下一步失败
|
|||
|
Run Keyword If ${encryption_attr}==1 加密
|
|||
|
Run Keyword If ${compress_attr}==0 取消压缩
|
|||
|
... ELSE 压缩
|
|||
|
Comment Run Keyword If ${check_attr}==1 校验
|
|||
|
Run Keyword If ${cache}==1 备份缓存 /opt
|
|||
|
循环点击 ${Backuphigh_OK} ${Cl_addOK}
|
|||
|
sleep 2s
|
|||
|
元素点击 ${Cl_addOK} 确定策略创建成功 策略创建失败
|
|||
|
元素点击 ${BackupSet} 点击进入备份集一栏 定位备份集栏失败
|
|||
|
元素输入 ${Input_Policy_Name} ${random_strategyName} 定位策略搜索框失败
|
|||
|
Log 输入策略名进行搜索
|
|||
|
Sleep 15s
|
|||
|
FOR ${n} IN RANGE 20
|
|||
|
Click Element ${Button_Searchbk}
|
|||
|
${bk_status} Run Keyword And Return Status Wait Until Element Is Visible xpath=//*[@id="backupSetTable"]//tr[2]/td[text()="已完成"]
|
|||
|
Run Keyword If "${bk_status}"=="True" Exit For Loop
|
|||
|
... ELSE Log 备份未完成
|
|||
|
Sleep 30s
|
|||
|
END
|
|||
|
Run Keyword If ${bk_status}==False Fail
|
|||
|
... ELSE Log 备份成功
|
|||
|
Sleep 15s
|
|||
|
|
|||
|
Oracle恢复
|
|||
|
[Arguments] ${DBInstance}
|
|||
|
[Documentation] 功能:通过备份集页面对备份成功的Oralce数据库进行恢复
|
|||
|
...
|
|||
|
... 使用方法:Oracle 实例名
|
|||
|
...
|
|||
|
... 变量:${DBInstance} 实例名
|
|||
|
元素点击 ${dpm_Protection strategy} 点击进入保护策略页面 定位保护策略按钮失败
|
|||
|
元素点击 ${BackupSet} 点击进入备份集页面 定位备份集按钮失败
|
|||
|
sleep 5s
|
|||
|
元素点击 ${Click_recover} 点击恢复按钮 定位恢复按钮失败
|
|||
|
sleep 5s
|
|||
|
元素点击 ${Oracle_Recover_Next1} 点击备份内容页面下一步按钮 定位备份内容页面下一步按钮失败
|
|||
|
元素输入 ${Recover_instancename} ${DBInstance} 定位实例名输入框失败
|
|||
|
元素点击 ${Oracle_Recover_Next2} 点击恢复目标页面下一步按钮 定位恢复目标页面下一步按钮失败
|
|||
|
元素点击 ${Oracle_Recover_Next3} 点击Oracle选项页面下一步按钮 定位Oracle选项页面下一步按钮失败
|
|||
|
元素点击 ${Oracle_Recover_Next4} 点击恢复选项页面下一步按钮 定位恢复选项页面下一步按钮失败
|
|||
|
元素点击 ${Recover_run} 点击完成恢复策略成功 点击完成按钮失败
|
|||
|
元素点击 ${confirm_restore} 点击确定恢复确认按钮成功 点击确定恢复确认按钮失败
|
|||
|
sleep 5s
|
|||
|
元素点击 ${recover_sucessOK} 点击恢复策略确定按钮 定位恢复确定按钮失败
|
|||
|
元素点击 ${Task} 点击作业栏按钮 定位作业栏失败
|
|||
|
sleep 15s
|
|||
|
FOR ${n} IN RANGE 20
|
|||
|
Comment Click Element ${Button_Searchwork}
|
|||
|
${work_status} Run Keyword And Return Status Wait Until Element Is Visible Xpath=//table[@lay-size="sm"]//tr[1]//div[text()="本次恢复成功 "]
|
|||
|
Run Keyword If ${work_status}==False Log 恢复未完成
|
|||
|
... ELSE Exit For Loop
|
|||
|
Sleep 60s
|
|||
|
END
|
|||
|
${work_status} Run Keyword And Return Status Wait Until Element Is Visible Xpath=//table[@lay-size="sm"]//tr[1]//div[text()="本次恢复成功 "]
|
|||
|
Run Keyword If ${work_status}==False Fail
|
|||
|
... ELSE Log 恢复成功
|
|||
|
Sleep 15s
|
|||
|
|
|||
|
删除Oracle数据表
|
|||
|
[Arguments] ${Oracle_TableName1} ${DBInstance_lin}
|
|||
|
[Documentation] 功能:连接Oracle数据库,删除原有表
|
|||
|
...
|
|||
|
... 使用方法:删除Oracle数据表 表名 实例名
|
|||
|
...
|
|||
|
... 变量: ${Oracle_TableName1}表名 | ${DBInstance_lin} 实例名
|
|||
|
log 连接数据库
|
|||
|
Connect To Database Using Custom Params cx_Oracle '${DBUser}','${DBPwd}','${DBInstance_lin}'
|
|||
|
${rowcount} Row Count select * from user_tables where table_name=upper('${Oracle_TableName1}')
|
|||
|
Run Keyword If ${rowcount} >= 1 Execute Sql String drop table ${Oracle_TableName1}
|
|||
|
Disconnect From Database
|
|||
|
|
|||
|
校验Oracle数据表
|
|||
|
[Arguments] ${Oracle_TableName1} ${DBInstance_lin}
|
|||
|
[Documentation] 功能:连接Oracle数据库,获取恢复后的表的行数和删除数据前表的行数做对比,一致则数据校验一致,否则恢复数据校验失败
|
|||
|
...
|
|||
|
... 使用方法:创建Oracle数据表 表名 实例名
|
|||
|
...
|
|||
|
... 变量: ${Oracle_TableName1}表名 \ \ ${DBInstance_lin} 实例名
|
|||
|
log 连接数据库
|
|||
|
Connect To Database Using Custom Params cx_Oracle '${DBUser}','${DBPwd}','${DBInstance_lin}'
|
|||
|
log 获取行数
|
|||
|
${result} Row Count select * from ${Oracle_TableName1}
|
|||
|
Execute Sql String select * from ${Oracle_TableName1}
|
|||
|
Disconnect From Database
|
|||
|
Run Keyword If "${result}"=="${rownum}" log 数据校验一致,恢复成功
|
|||
|
... ELSE Fail 数据校验不一致,恢复失败
|
|||
|
|
|||
|
创建Oracle数据表
|
|||
|
[Arguments] ${Oracle_TableName1} ${DBInstance_lin}
|
|||
|
[Documentation] 功能:连接Oracle数据库,删除原有表、新建表后插入数据
|
|||
|
...
|
|||
|
... 使用方法:创建Oracle数据表 表名 实例名
|
|||
|
...
|
|||
|
... 变量: ${Oracle_TableName1}表名 \ \ ${DBInstance_lin} 实例名
|
|||
|
log 删除表
|
|||
|
删除Oracle数据表 ${Oracle_TableName1} ${DBInstance_lin}
|
|||
|
log 连接数据库
|
|||
|
Connect To Database Using Custom Params cx_Oracle '${DBUser}','${DBPwd}','${DBInstance_lin}'
|
|||
|
log 获取行数
|
|||
|
${rowcount} Row Count select * from user_tables where table_name=upper('${Oracle_TableName1}')
|
|||
|
Run Keyword If ${rowcount} <=0 Execute Sql String create table ${Oracle_TableName1}(id char(50),name varchar(200))
|
|||
|
Execute Sql String insert into ${Oracle_TableName1}(id,name)values('1','yuyang')
|
|||
|
Execute Sql String insert into ${Oracle_TableName1}(id,name)values('2','yuyang2')
|
|||
|
Execute Sql String commit
|
|||
|
${rownum} Row Count select * from ${Oracle_TableName1}
|
|||
|
Set Suite Variable ${rownum}
|
|||
|
Log ${rownum}
|
|||
|
Disconnect From Database
|
|||
|
|
|||
|
策略删除
|
|||
|
Wait Until Element Is Visible ${Tab_Policy} 30s 定位策略失败
|
|||
|
Set Focus To Element ${Tab_Policy}
|
|||
|
Click Element ${Tab_Policy}
|
|||
|
Log 切换到策略一栏
|
|||
|
Wait Until Element Is Visible ${Policy_Delete} 10s 定位策略删除失败
|
|||
|
Set Focus To Element ${Policy_Delete}
|
|||
|
Click Element ${Policy_Delete}
|
|||
|
Log 点击删除
|
|||
|
Sleep 2s
|
|||
|
Wait Until Element Is Visible ${Confirm_Delete} 10s 确认删除定位失败
|
|||
|
Set Focus To Element ${Confirm_Delete}
|
|||
|
Click Element ${Confirm_Delete}
|
|||
|
Log 确认删除
|
|||
|
Sleep 2s
|
|||
|
Wait Until Element Is Visible ${Success_Confirm} 10s 定位删除成功按钮失败
|
|||
|
Set Focus To Element ${Success_Confirm}
|
|||
|
Click Element ${Success_Confirm}
|
|||
|
Log 完成策略删除
|
|||
|
Sleep 2s
|
|||
|
|
|||
|
环境清理
|
|||
|
Wait Until Element Is Visible ${dpm_Protection strategy} 30s 定位策略失败
|
|||
|
Set Focus To Element ${dpm_Protection strategy}
|
|||
|
Click Element ${dpm_Protection strategy}
|
|||
|
Log 切换到策略一栏
|
|||
|
Sleep 2s
|
|||
|
FOR ${n} IN RANGE 3
|
|||
|
${policy_status} Run Keyword And Return Status Wait Until Element Is Visible ${Policy_Delete}
|
|||
|
Run Keyword If ${policy_status}==True 策略删除
|
|||
|
... ELSE Exit For Loop
|
|||
|
Log 环境清理完毕
|
|||
|
|
|||
|
Oracle差量备份
|
|||
|
元素点击 ${dpm_Protection strategy} 选择定时保护策略 定位定时保护策略失败
|
|||
|
sleep 5s
|
|||
|
元素点击 ${Run_Now} 点击立即执行 定位立即执行失败
|
|||
|
元素点击 ${Select_BackType} 点击选择备份类型 定位选择备份类型失败
|
|||
|
元素点击 ${Now Difference_Backup} 选择差量备份 定位差量备份失败
|
|||
|
元素点击 ${Now Sure} 点击立即执行确定 定位立即执行确定失败
|
|||
|
元素点击 ${Cl_addOK} 点击确定 定位确定失败
|
|||
|
元素点击 ${BackupSet} 选择备份集页面 定位备份集页面失败
|
|||
|
元素输入 ${Input_Policy_Name} ${random_strategyName} 输入策略名
|
|||
|
FOR ${n} IN RANGE 10
|
|||
|
Click Element ${Button_Searchbk}
|
|||
|
${bk_status} Run Keyword And Return Status Wait Until Element Is Visible Xpath=//td[text()="${random_strategyName}"]/../td[contains(text(),"差量")]/../td[text()="已完成"]
|
|||
|
Run Keyword If "${bk_status}"=="True" Exit For Loop
|
|||
|
... ELSE Log 备份未完成
|
|||
|
Sleep 60s
|
|||
|
END
|
|||
|
Run Keyword If ${bk_status}==False Fail
|
|||
|
... ELSE Log 备份成功
|
|||
|
Sleep 15s
|
|||
|
|
|||
|
Oracle增量备份
|
|||
|
元素点击 ${dpm_Protection strategy} 选择定时保护策略 定位定时保护策略失败
|
|||
|
sleep 5s
|
|||
|
元素点击 ${Run_Now} 点击立即执行 定位立即执行失败
|
|||
|
元素点击 ${Select_BackType} 点击选择备份类型 定位选择备份类型失败
|
|||
|
元素点击 ${Now Add_Backup} 选择增量备份 定位增量备份失败
|
|||
|
元素点击 ${Now Sure} 点击立即执行确定 定位立即执行确定失败
|
|||
|
元素点击 ${Cl_addOK} 点击确定 定位确定失败
|
|||
|
log 开始备份
|
|||
|
元素点击 ${BackupSet} 选择备份集页面 定位备份集页面失败
|
|||
|
元素输入 ${Input_Policy_Name} ${random_strategyName} 输入策略名
|
|||
|
FOR ${n} IN RANGE 10
|
|||
|
Click Element ${Button_Searchbk}
|
|||
|
${bk_status} Run Keyword And Return Status Wait Until Element Is Visible Xpath=//td[text()="${random_strategyName}"]/../td[contains(text(),"增量")]/../td[text()="已完成"]
|
|||
|
Run Keyword If "${bk_status}"=="True" Exit For Loop
|
|||
|
... ELSE Log 备份未完成
|
|||
|
Sleep 60s
|
|||
|
END
|
|||
|
Run Keyword If ${bk_status}==False Fail
|
|||
|
... ELSE Log 备份成功
|
|||
|
Sleep 15s
|
|||
|
|
|||
|
Oracle归档日志备份
|
|||
|
元素点击 ${dpm_Protection strategy} 选择定时保护策略 定位定时保护策略失败
|
|||
|
sleep 5s
|
|||
|
元素点击 ${Run_Now} 点击立即执行 定位立即执行失败
|
|||
|
元素点击 ${Select_BackType} 点击选择备份类型 定位选择备份类型失败
|
|||
|
元素点击 ${Now GD_Backup} 选择归档日志备份 定位归档日志备份失败
|
|||
|
元素点击 ${Now Sure} 点击立即执行确定 定位立即执行确定失败
|
|||
|
元素点击 ${Cl_addOK} 点击确定 定位确定失败
|
|||
|
log 开始备份
|
|||
|
元素点击 ${BackupSet} 选择备份集页面 定位备份集页面失败
|
|||
|
元素输入 ${Input_Policy_Name} ${random_strategyName} 输入策略名
|
|||
|
FOR ${n} IN RANGE 10
|
|||
|
Click Element ${Button_Searchbk}
|
|||
|
${bk_status} Run Keyword And Return Status Wait Until Element Is Visible Xpath=//td[text()="${random_strategyName}"]/../td[contains(text(),"日志")]/../td[text()="已完成"]
|
|||
|
Run Keyword If "${bk_status}"=="True" Exit For Loop
|
|||
|
... ELSE Log 备份未完成
|
|||
|
Sleep 60s
|
|||
|
END
|
|||
|
Run Keyword If ${bk_status}==False Fail
|
|||
|
... ELSE Log 备份成功
|
|||
|
Sleep 15s
|
|||
|
|
|||
|
插入Oracle数据
|
|||
|
[Arguments] ${Oracle_TableName1} ${DBInstance_lin}
|
|||
|
log 连接数据库
|
|||
|
Connect To Database Using Custom Params cx_Oracle '${DBUser}','${DBPwd}','${DBInstance_lin}'
|
|||
|
log 获取行数
|
|||
|
${rowcount} Row Count select * from user_tables where table_name=upper('${Oracle_TableName1}')
|
|||
|
Run Keyword If ${rowcount} >=1 Execute Sql String insert into ${Oracle_TableName1} select * from ${Oracle_TableName1}
|
|||
|
${rownum} Row Count select * from ${Oracle_TableName1}
|
|||
|
Set Suite Variable ${rownum}
|
|||
|
Log ${rownum}
|
|||
|
Disconnect From Database
|
|||
|
|
|||
|
完全备份
|
|||
|
Sleep 2s
|
|||
|
Click Element ${Full_Backup}
|
|||
|
Log 勾选完全备份
|
|||
|
|
|||
|
增量备份
|
|||
|
Sleep 2s
|
|||
|
Click Element ${Incre_Backup}
|
|||
|
Log 勾选增量备份
|
|||
|
|
|||
|
差量备份
|
|||
|
Sleep 2s
|
|||
|
Click Element ${Difference_Backup}
|
|||
|
Log 勾选差量备份
|
|||
|
|
|||
|
归档日志备份
|
|||
|
Sleep 2s
|
|||
|
Click Element ${GD_Backup}
|
|||
|
Log 勾选归档日志备份
|
|||
|
|
|||
|
加密
|
|||
|
Sleep 2s
|
|||
|
Click Element ${Option_Encryption}
|
|||
|
Log 点击加密
|
|||
|
Sleep 2s
|
|||
|
|
|||
|
取消压缩
|
|||
|
Log 点击压缩
|
|||
|
|
|||
|
压缩
|
|||
|
Sleep 2s
|
|||
|
Click Element ${Option_Compress}
|
|||
|
Log 点击压缩
|
|||
|
Sleep 2s
|
|||
|
|
|||
|
重删
|
|||
|
Sleep 2s
|
|||
|
Click Element ${Option_Dedup}
|
|||
|
Log 点击重删
|
|||
|
Sleep 2s
|
|||
|
|
|||
|
备份缓存
|
|||
|
[Arguments] ${path}
|
|||
|
元素点击 ${Oracle_Cache_Pach} 点击启动本地备份缓存 定位本地备份缓存失败
|
|||
|
元素输入 ${Cache_Path} ${path} 定位缓存路径输入框失败
|
|||
|
元素点击 ${Oracle_backup_CachePath} 缓存路径设置完毕 定位缓存路径设置确定按钮失败
|
|||
|
|
|||
|
取消备份缓存
|
|||
|
|
|||
|
立即执行_Oracle
|
|||
|
[Arguments] ${bk_type} #立即备份执行备份类型
|
|||
|
元素点击 ${Timed_DataProtect} 点击进入定时数据保护页面 定位定时数据保护失败
|
|||
|
元素点击 ${dpm_Protection strategy} 切换到定时保护策略栏 定位定时保护策略功能栏失败
|
|||
|
Sleep 2s
|
|||
|
元素点击 xpath=//td[text()="${random_strategyName}"]/..//span[text()="立即执行"] 点击策略立即执行 定位立即执行失败
|
|||
|
元素点击 ${Exe_Oracle_Bk} 点击展开立即执行下拉框 定位立即执行备份类型失败
|
|||
|
Run Keyword If "${bk_type}"=="完全" 立即执行_完全备份
|
|||
|
... ELSE IF "${bk_type}"=="差量" 立即执行_差量备份
|
|||
|
... ELSE IF "${bk_type}"=="增量" 立即执行_增量备份
|
|||
|
... ELSE IF "${bk_type}"=="日志" 立即执行_归档日志备份
|
|||
|
Sleep 2s
|
|||
|
元素点击 ${ExecutePolicy_execute} 点击立即执行确定按钮成功 点击立即执行确定按钮失败
|
|||
|
Sleep 5s
|
|||
|
元素点击 ${Complie_confirm} 点击确定按钮 定位确定按钮失败
|
|||
|
元素点击 ${BackupSet} 点击进入备份集一栏 定位备份集栏失败
|
|||
|
元素输入 ${Input_Policy_Name} ${random_strategyName} 输入策略名
|
|||
|
FOR ${n} IN RANGE 10
|
|||
|
Click Element ${Button_Searchbk}
|
|||
|
${bk_status} Run Keyword And Return Status Wait Until Element Is Visible Xpath=//td[text()="${random_strategyName}"]/../td[contains(text(),"${bk_type}")]/../td[text()="已完成"]
|
|||
|
Run Keyword If "${bk_status}"=="True" Exit For Loop
|
|||
|
... ELSE Log 备份未完成
|
|||
|
Sleep 60s
|
|||
|
END
|
|||
|
Run Keyword If ${bk_status}==False Fail
|
|||
|
... ELSE Log 备份成功
|
|||
|
Sleep 15s
|
|||
|
|
|||
|
立即执行_完全备份
|
|||
|
Sleep 2s
|
|||
|
Click Element ${Now Full_Bacup}
|
|||
|
Log 勾选完全备份
|
|||
|
|
|||
|
立即执行_增量备份
|
|||
|
Sleep 2s
|
|||
|
Click Element ${Now Add_Backup}
|
|||
|
Log 勾选增量备份
|
|||
|
|
|||
|
立即执行_差量备份
|
|||
|
Sleep 2s
|
|||
|
Click Element ${Now Difference_Backup}
|
|||
|
Log 勾选差量备份
|
|||
|
|
|||
|
立即执行_归档日志备份
|
|||
|
Sleep 2s
|
|||
|
Click Element ${Now GD_Backup}
|
|||
|
Log 勾选归档日志备份
|
|||
|
|
|||
|
备份集属性校验
|
|||
|
[Arguments] ${encryption} ${compress} ${deduped} ${cache}
|
|||
|
[Documentation] 功能:对备份成功的备份集进行备份集属性校验
|
|||
|
...
|
|||
|
... 使用方法:备份集属性校验 是否加密(Y/N)是否压缩(Y/N)是否重删(Y/N)是否缓存(Y/N)
|
|||
|
...
|
|||
|
... 变量:${encryption}是否加密(Y/N)| ${compress}是否压缩(Y/N) | ${deduped}是否重删(Y/N) | ${cache}是否缓存(Y/N)
|
|||
|
sleep 2s
|
|||
|
元素点击 Xpath=//td[text()="${random_strategyName}"]/..//span[text()="详情"] 点击展开详情 定位详情失败
|
|||
|
sleep 5s
|
|||
|
Run Keyword If ${encryption}==1 加密属性校验_是
|
|||
|
... ELSE 加密属性校验_否
|
|||
|
Run Keyword If ${compress}==1 压缩属性校验_是
|
|||
|
... ELSE 压缩属性校验_否
|
|||
|
Run Keyword If ${deduped}==1 重删属性校验_是
|
|||
|
... ELSE 重删属性校验_否
|
|||
|
Run Keyword If ${cache}==1 缓存属性校验_是
|
|||
|
... ELSE 缓存属性校验_否
|
|||
|
元素点击 ${Attr_Cancel} 点击取消关闭备份集详情弹窗 定位取消按钮失败
|
|||
|
Log 备份集属性确认完毕
|
|||
|
Sleep 2s
|
|||
|
|
|||
|
加密属性校验_是
|
|||
|
Element Should Contain ${Encryption_Attr} 是
|
|||
|
Log 加密属性校验完毕
|
|||
|
|
|||
|
加密属性校验_否
|
|||
|
Element Should Contain ${Encryption_Attr} 否
|
|||
|
Log 备份集未加密
|
|||
|
|
|||
|
压缩属性校验_是
|
|||
|
Element Should Contain ${Compress_Attr} 是
|
|||
|
Log 压缩属性校验完毕
|
|||
|
|
|||
|
压缩属性校验_否
|
|||
|
Element Should Contain ${Compress_Attr} 否
|
|||
|
Log 备份集未压缩
|
|||
|
|
|||
|
重删属性校验_是
|
|||
|
Element Should Contain ${Mysql_Deduped_Attr} 是
|
|||
|
Log 重删属性校验完毕
|
|||
|
|
|||
|
重删属性校验_否
|
|||
|
Element Should Contain ${Mysql_Deduped_Attr} 否
|
|||
|
Log 备份集未重删
|
|||
|
|
|||
|
缓存属性校验_是
|
|||
|
Element Should Contain ${Cache_Attr} 是
|
|||
|
Log 缓存属性校验完毕
|
|||
|
|
|||
|
缓存属性校验_否
|
|||
|
Element Should Contain ${Cache_Attr} 否
|
|||
|
Log 备份集未设置缓存
|
|||
|
|
|||
|
删除Oracle数据表_12c
|
|||
|
[Arguments] ${Oracle_TableName1} ${DBInstance_lin}
|
|||
|
[Documentation] 功能:连接Oracle数据库,删除原有表
|
|||
|
...
|
|||
|
... 使用方法:删除Oracle数据表 表名 实例名
|
|||
|
...
|
|||
|
... 变量: ${Oracle_TableName1}表名 | ${DBInstance_lin} 实例名
|
|||
|
log 连接数据库
|
|||
|
Connect To Database Using Custom Params cx_Oracle '${DBUser_12c}','${DBPwd_12c}','${DBInstance_lin}'
|
|||
|
${rowcount} Row Count select * from user_tables where table_name=upper('${Oracle_TableName1}')
|
|||
|
Run Keyword If ${rowcount} >= 1 Execute Sql String drop table ${Oracle_TableName1}
|
|||
|
Disconnect From Database
|
|||
|
|
|||
|
创建Oracle数据表_12c
|
|||
|
[Arguments] ${Oracle_TableName1} ${DBInstance_lin}
|
|||
|
[Documentation] 功能:连接Oracle数据库,删除原有表、新建表后插入数据
|
|||
|
...
|
|||
|
... 使用方法:创建Oracle数据表 表名 实例名
|
|||
|
...
|
|||
|
... 变量: ${Oracle_TableName1}表名 \ \ ${DBInstance_lin} 实例名
|
|||
|
log 删除表
|
|||
|
删除Oracle数据表_12c ${Oracle_TableName1} ${DBInstance_lin_12c}
|
|||
|
log 连接数据库
|
|||
|
Connect To Database Using Custom Params cx_Oracle '${DBUser_12c}','${DBPwd_12c}','${DBInstance_lin}'
|
|||
|
log 获取行数
|
|||
|
${rowcount} Row Count select * from user_tables where table_name=upper('${Oracle_TableName1}')
|
|||
|
Run Keyword If ${rowcount} <=0 Execute Sql String create table ${Oracle_TableName1}(id char(50),name varchar(200))
|
|||
|
Execute Sql String insert into ${Oracle_TableName1}(id,name)values('1','yuyang')
|
|||
|
Execute Sql String insert into ${Oracle_TableName1}(id,name)values('2','yuyang2')
|
|||
|
Execute Sql String commit
|
|||
|
${rownum} Row Count select * from ${Oracle_TableName1}
|
|||
|
Set Suite Variable ${rownum}
|
|||
|
Log ${rownum}
|
|||
|
Disconnect From Database
|
|||
|
|
|||
|
校验Oracle数据表_12c
|
|||
|
[Arguments] ${Oracle_TableName1} ${DBInstance_lin}
|
|||
|
[Documentation] 功能:连接Oracle数据库,获取恢复后的表的行数和删除数据前表的行数做对比,一致则数据校验一致,否则恢复数据校验失败
|
|||
|
...
|
|||
|
... 使用方法:创建Oracle数据表 表名 实例名
|
|||
|
...
|
|||
|
... 变量: ${Oracle_TableName1}表名 \ \ ${DBInstance_lin} 实例名
|
|||
|
log 连接数据库
|
|||
|
Connect To Database Using Custom Params cx_Oracle '${DBUser_12c}','${DBPwd_12c}','${DBInstance_lin}'
|
|||
|
log 获取行数
|
|||
|
${result} Row Count select * from ${Oracle_TableName1}
|
|||
|
Execute Sql String select * from ${Oracle_TableName1}
|
|||
|
Disconnect From Database
|
|||
|
Run Keyword If "${result}"=="${rownum}" log 数据校验一致,恢复成功
|
|||
|
... ELSE Fail 数据校验不一致,恢复失败
|
|||
|
|
|||
|
插入Oracle数据_12c
|
|||
|
[Arguments] ${Oracle_TableName1} ${DBInstance_lin}
|
|||
|
log 连接数据库
|
|||
|
Connect To Database Using Custom Params cx_Oracle '${DBUser_12c}','${DBPwd_12c}','${DBInstance_lin}'
|
|||
|
log 获取行数
|
|||
|
${rowcount} Row Count select * from user_tables where table_name=upper('${Oracle_TableName1}')
|
|||
|
Run Keyword If ${rowcount} >=1 Execute Sql String insert into ${Oracle_TableName1} select * from ${Oracle_TableName1}
|
|||
|
${rownum} Row Count select * from ${Oracle_TableName1}
|
|||
|
Set Suite Variable ${rownum}
|
|||
|
Log ${rownum}
|
|||
|
Disconnect From Database
|