【Oracle123】自动批量生成测试数据
背景:
系统需要改进PT,针对数据库性能需要模拟线上百万级数据量。
参考:
直接生成数据:https://www.cnblogs.com/liuweihua/archive/2012/05/05/2484444.html
插入大量数据:https://blog.csdn.net/weixin_33796205/article/details/86327128
生成唯一guid:https://blog.csdn.net/jgj0129/article/details/53583348
Sample1:
select rownum as id,
to_char(sysdate + rownum / 24 / 3600, 'yyyy-mm-dd hh24:mi:ss') as inc_datetime,
trunc(dbms_random.value(0, 100)) as random_id,
dbms_random.string('x', 20) random_string,
sys_guid() guid
from dual
connect by level <= 10;
Sample2:
select lower(rawtohex(SYS_GUID())) GUID from user_table; --生成guid不唯一
select (select lower(rawtohex(SYS_GUID())) from DUAL) GUID from user_table; --生成guid相同