解决软件测试过程中需要在oracle中造大量的存量数据的方法具体

目前系统做压力测试,因客户要求在数据库业务表中有3000w的存量数据,于是就有写了下面的sql脚本,记录一下。

每次生成10w条数据,提交300次一共3000w。大概2个半小时!

 

--1988中间表批量造数据脚本
declare
  X integer := 0;
  Y integer := 0;
  URID_Each integer := 0;
  PSS_Each varchar2(64) := '';
  amount float := 0.1;
begin
URID_Each := 1;
FOR X in 1 .. 300 LOOP
  begin
  insert into s3_rtrecments
  (URID, ORGID, NOTECODE, APPLYORGID, PAYDATE, PAYTYPEID, SETTLEMENTMODEID, DEALTYPE, CAPITALUSEID, BUDGETITEMID, OURORGID, OURBANKID, OURBANKLOCATIONS, OURBANKACCOUNTID, OURBANKACCOUNT, OURBANKACCOUNTNAME, OPPBANKID, OPPBANKLOCATIONS, OPPBANKACCOUNT, OPPBANKACCOUNTNAME, OPPBANKAREAID, OPPBANKAREACODE, OPPBANKAREANAME, CELLPHONE, ISPRIVATE, OURCURRENCYID, OURAMOUNT, DIRECTACCESSCODE, COMMANDCODE, PAYSTATE, PAYSENTDATE, PAYMADEDATE, PAYINFOCODE, PAYINFO, ABSTRACT, REQBATCHNO, ASKNUMBER, REQBATCHSERIAL, CERTTYPE, CARDTYPE, CERTNUMBER, CORPACCESSSYSTEMSID, SRCBATCHNO, SRCSERIALNO, SRCNOTECODE, SRCTRANSDATE, SRCTRANSSN, CANCELSTATE, APPROVESTATE, ACCOUNTFLAG, ACCOUNTSTATEDATE, ACCOUNTINFO, VOUCHERCODE, ACCOUNTBATCHNO, CHECKBATCHNO, ISCHECK, CHECKDATE, PURPOSE, DESCRIPTION, MEMO, INSURANCETYPE, ATTRIBUTE1, ATTRIBUTE2, ATTRIBUTE3, ATTRIBUTE4, ATTRIBUTE5, CREATEDBY, CREATEDON, LASTMODIFIEDBY, LASTMODIFIEDON, ROWVERSION, VERIFYCODE, VERIFYCODESENTSTATE, VERIFYCODESENTDATE, DIRECTPAYWAY, ORIGINALPAYINFOCODE, TRADETYPE, EXPIREDATE, PREPAYID, CODEURL, CANCELDATE, CANCELINFO, FEECALMODE, FEEPAYSTATE, FEEPAYMODE, FEERATE, FEEAMOUNT, INSURER, INSURED, SALECHANNEL, ENTITYLEVEL1, ENTITYLEVEL2, ENTITYLEVEL3, SRCPAYMENTCODE, NOTIFYURL, NOTIFYSTATE, NOTIFYTIME, NOTIFYINFO, ISCALSETTLEFEE, CHECKINFO, FEESETTLEMODE, RETURNURL, TERMINALCODE, MERCHANTID, OUTTRADEID, BUSDETAILURL, BUSDETAILSTATE, BUSDETAILTIME, BUSDETAILINFO, OPPBANKACCOUNTSUF, FAILTYPE, ATTRIBUTE6, ATTRIBUTE7, ATTRIBUTE8, ATTRIBUTE9, ATTRIBUTE10, OPENID, ISCHGCHANNEL, OURBANKAREAID, OURBANKAREACODE, NOTIFYATSSTATE, NOTIFYATSINFO, NOTIFYATSTIME, NOTIFYATSBATCHNO, REFUNDSTATE, REFUNDSUCCESSAMOUNT, CIRCPAYMENTNO, NOTIFYSHCIRCSTATE, FIXUSER, SETTLEDATE, INSTEADPAYFLAG, VOUCHERCHECKSTATE, VOUCHERCHECKBATCHNO, INSUREAREACODE, LOCKINGDATE, KEYVERSION)
  select lower(sys_guid()) as URID,
					'' as ORGID,
				 lower(sys_guid()) as NOTECODE,
				 '0_0330'	as APPLYORGID,
				 to_date('23-05-2019', 'dd-mm-yyyy') as PAYDATE,
				 '8a80e2d16778ec5301677c7e5dc4000d'	as PAYTYPEID,
				'' as SETTLEMENTMODEID,
				'' as DEALTYPE,
				'' as CAPITALUSEID,
				'' as BUDGETITEMID,
				'' as OURORGID,
				'' as OURBANKID,
				'' as OURBANKLOCATIONS,
				'' as OURBANKACCOUNTID,
				'' as OURBANKACCOUNT,
				'' as OURBANKACCOUNTNAME,
				'' as OPPBANKID,
				'' as OPPBANKLOCATIONS,
				'' as OPPBANKACCOUNT,
				'' as OPPBANKACCOUNTNAME,
				'' as OPPBANKAREAID,
				'' as OPPBANKAREACODE,
				'' as OPPBANKAREANAME,
				'' as CELLPHONE,
				'' as ISPRIVATE,
				'1'	as OURCURRENCYID,
				'0.01'	as OURAMOUNT,
				''	as DIRECTACCESSCODE,
				''	as COMMANDCODE,
				'1'	as PAYSTATE,
				'' as PAYSENTDATE,
				'' as PAYMADEDATE,
				'' as PAYINFOCODE,
				'' as PAYINFO,
				'' as ABSTRACT,
				'' as REQBATCHNO,
				'' as ASKNUMBER,
				'' as REQBATCHSERIAL,
				'' as CERTTYPE,
				'' as CARDTYPE,
				'' as CERTNUMBER,
				'' as CORPACCESSSYSTEMSID,
				'' as SRCBATCHNO,
				lower(sys_guid())	as SRCSERIALNO,
				'' as SRCNOTECODE,
				'' as SRCTRANSDATE,
				'' as SRCTRANSSN,
				'1'	as CANCELSTATE,
				'2'	as APPROVESTATE,
				'' as ACCOUNTFLAG,
				'' as ACCOUNTSTATEDATE,
				'' as ACCOUNTINFO,
				'' as VOUCHERCODE,
				'' as ACCOUNTBATCHNO,
				'' as CHECKBATCHNO,
				'0'	as ISCHECK,
				'' as CHECKDATE,
				'' as PURPOSE,
				'' as DESCRIPTION,
				'' as MEMO,
				'' as INSURANCETYPE,
				'' as ATTRIBUTE1,
				'' as ATTRIBUTE2,
				'' as ATTRIBUTE3,
				'' as ATTRIBUTE4,
				'' as ATTRIBUTE5,
				'server'	as CREATEDBY,
				to_date('23-05-2019 17:01:52', 'dd-mm-yyyy hh24:mi:ss')	as CREATEDON,
				'server'	as LASTMODIFIEDBY,
				to_date('24-05-2019 17:01:52', 'dd-mm-yyyy hh24:mi:ss')	as LASTMODIFIEDON,
				'1'	as ROWVERSION,
					'' as VERIFYCODE,
					'' as VERIFYCODESENTSTATE,
					'' as VERIFYCODESENTDATE,
					'' as DIRECTPAYWAY,
					'' as ORIGINALPAYINFOCODE,
					'' as TRADETYPE,
					'' as EXPIREDATE,
					'' as PREPAYID,
					'' as CODEURL,
					'' as CANCELDATE,
					'' as CANCELINFO,
					'' as FEECALMODE,
					'' as FEEPAYSTATE,
					'' as FEEPAYMODE,
					'' as FEERATE,
					'' as FEEAMOUNT,
					'' as INSURER,
					'' as INSURED,
					'' as SALECHANNEL,
					'' as ENTITYLEVEL1,
					'' as ENTITYLEVEL2,
					'' as ENTITYLEVEL3,
					'' as SRCPAYMENTCODE,
					'' as NOTIFYURL,
					'' as NOTIFYSTATE,
					'' as NOTIFYTIME,
					'' as NOTIFYINFO,
				'0'	as ISCALSETTLEFEE,
					'' as CHECKINFO,
					'' as FEESETTLEMODE,
					'' as RETURNURL,
					'' as TERMINALCODE,
					'' as MERCHANTID,
					'' as OUTTRADEID,
					'' as BUSDETAILURL,
					'' as BUSDETAILSTATE,
					'' as BUSDETAILTIME,
					'' as BUSDETAILINFO,
					'' as OPPBANKACCOUNTSUF,
					'' as FAILTYPE,
					'' as ATTRIBUTE6,
					'' as ATTRIBUTE7,
					'' as ATTRIBUTE8,
					'' as ATTRIBUTE9,
					'' as ATTRIBUTE10,
					'' as OPENID,
					'' as ISCHGCHANNEL,
					'' as OURBANKAREAID,
					'' as OURBANKAREACODE,
					'' as NOTIFYATSSTATE,
					'' as NOTIFYATSINFO,
					'' as NOTIFYATSTIME,
					'' as NOTIFYATSBATCHNO,
					'' as REFUNDSTATE,
					'' as REFUNDSUCCESSAMOUNT,
					'' as CIRCPAYMENTNO,
					'' as NOTIFYSHCIRCSTATE,
					'' as FIXUSER,
					'' as SETTLEDATE,
					'' as INSTEADPAYFLAG,
					'' as VOUCHERCHECKSTATE,
					'' as VOUCHERCHECKBATCHNO,
					'' as INSUREAREACODE,
					'' as LOCKINGDATE,
					'' as KEYVERSION
    from dual
  connect by level <= 100000;
  commit;
  end;
END LOOP;
End;

 

你可能感兴趣的:(oracle)