需要很少的查询来在CPU上生成负载,并最终将其最大负载为100%。 查询执行后应该能够产生较高的CPU使用率。
答案 0 :(得分:1)
试试
declare
l_job_out integer;
l_what dba_jobs.what%type;
l_cpus_to_hog CONSTANT integer :=4;
l_loop_count varchar2(10) := '500000000';
begin
/*
** Create some jobs to load the CPU
*/
for l_job in 1..l_cpus_to_hog loop
dbms_job.submit(
job => l_job_out
, what => 'declare a number := 1; begin for i in 1..'||l_loop_count||' loop a := ( a + i )/11; end loop; end;'
);
commit;
dbms_output.put_line( 'job - '|| l_job_out );
select what into l_what
from dba_jobs
where job = l_job_out;
dbms_output.put_line( 'what - '|| l_what );
end loop;
end;