3 liens privés
Vider les tables du schéma de performances :
truncate table events_statements_current;
truncate table events_statements_history;
truncate table events_statements_summary_by_digest;
- dans la page, affichage des requêtes pendant 60 secondes :
use performance_schema;
update setup_consumers set enabled='YES' where name IN ('events_statements_history','events_statements_current','statements_digest');
truncate table events_statements_current; truncate table events_statements_history; truncate table events_statements_summary_by_digest;
do sleep(60);
select now(),(count_star/(select sum(count_star) FROM events_statements_summary_by_digest) * 100) as pct, count_star, left(digest_text,150) as stmt, digest from events_statements_summary_by_digest order by 2 desc;
update setup_consumers set enabled='NO' where name IN ('events_statements_history','events_statements_current','statements_digest');
define CPT_CODE=&1 --10000
set serveroutput on;
create or replace
procedure reset_seq( p_seq_name in varchar2, future_value in number)
is
l_val number;
owner varchar2(100);
begin
execute immediate 'select table_owner||''.''||synonym_name from user_synonyms where synonym_name=''' || p_seq_name ||'''' into owner;
execute immediate 'select ' || owner || '.nextval from dual' INTO l_val;
execute immediate 'alter sequence ' || owner || ' increment by -' || l_val || ' minvalue 0';
execute immediate 'select ' || owner || '.nextval from dual' INTO l_val;
execute immediate 'alter sequence ' || owner || ' increment by ' || future_value || ' minvalue 0';
execute immediate 'select ' || owner || '.nextval from dual' INTO l_val;
execute immediate 'alter sequence ' || owner || ' increment by 1 minvalue 0';
end;
/
execute reset_seq('CPT_CODE, 500000);
drop procedure reset_seq;