hapi-fhir/hapi-fhir-jpaserver-uhnfhir.../derby_maintenance.txt

198 lines
9.4 KiB
Plaintext
Raw Normal View History

call SYSCS_UTIL.SYSCS_COMPRESS_TABLE('SA', 'HFJ_SEARCH_RESULT', 1);
CALL SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE( 'SA', 'HFJ_SEARCH_RESULT', 0, 0, 1 );
dd if=/dev/urandom of=/opt/glassfish/tmp.tmp bs=1M count=500
# Reindex
curl -H "Authorization: Bearer " "http://fhirtest.uhn.ca/baseDstu3/\$mark-all-resources-for-reindexing"
# Delete all errored resources
update hfj_res_ver set forced_id_pid = null where res_id in (select res_id from hfj_resource where sp_index_status = 2);
update hfj_resource set forced_id_pid = null where res_id in (select res_id from hfj_resource where sp_index_status = 2);
delete from hfj_history_tag where res_id in (select res_id from hfj_resource where sp_index_status = 2);
delete from hfj_res_ver where res_id in (select res_id from hfj_resource where sp_index_status = 2);
delete from hfj_forced_id where resource_pid in (select res_id from hfj_resource where sp_index_status = 2);
delete from hfj_res_link where src_resource_id in (select res_id from hfj_resource where sp_index_status = 2);
delete from hfj_res_link where target_resource_id in (select res_id from hfj_resource where sp_index_status = 2);
delete from hfj_spidx_coords where res_id in (select res_id from hfj_resource where sp_index_status = 2);
delete from hfj_spidx_date where res_id in (select res_id from hfj_resource where sp_index_status = 2);
delete from hfj_spidx_number where res_id in (select res_id from hfj_resource where sp_index_status = 2);
delete from hfj_spidx_quantity where res_id in (select res_id from hfj_resource where sp_index_status = 2);
delete from hfj_spidx_string where res_id in (select res_id from hfj_resource where sp_index_status = 2);
delete from hfj_spidx_token where res_id in (select res_id from hfj_resource where sp_index_status = 2);
delete from hfj_spidx_uri where res_id in (select res_id from hfj_resource where sp_index_status = 2);
delete from hfj_res_tag where res_id in (select res_id from hfj_resource where sp_index_status = 2);
delete from hfj_search_result where resource_pid in (select res_id from hfj_resource where sp_index_status = 2);
2017-08-31 06:46:26 -04:00
delete from hfj_res_param_present where res_id in (select res_id from hfj_resource where sp_index_status = 2);
delete from hfj_resource where res_id in (select res_id from hfj_resource where sp_index_status = 2);
2017-08-24 13:07:27 -04:00
# Delete resource by id
delete from hfj_res_link where src_resource_id = 16940 or target_resource_id = 16940;
delete from hfj_spidx_date where res_id = 16940;
delete from hfj_spidx_string where res_id = 16940;
delete from hfj_spidx_token where res_id = 16940;
delete from hfj_spidx_uri where res_id = 16940;
delete from hfj_spidx_quantity where res_id = 16940;
delete from hfj_search_result where resource_pid = 16940;
delete from hfj_res_ver where res_id = 16940;
delete from hfj_res_param_present where res_id = 16940;
update hfj_resource set forced_id_pid = null where res_id = 16940;
delete from hfj_forced_id where resource_pid = 16940;
delete from hfj_resource where res_id = 16940;
2017-09-07 23:33:19 -04:00
# Drop all tables
drop table hfj_history_tag cascade constraints;
drop table hfj_res_ver cascade constraints;
drop table hfj_forced_id cascade constraints;
drop table hfj_res_link cascade constraints;
drop table hfj_res_link cascade constraints;
drop table hfj_spidx_coords cascade constraints;
drop table hfj_spidx_date cascade constraints;
drop table hfj_spidx_number cascade constraints;
drop table hfj_spidx_quantity cascade constraints;
drop table hfj_spidx_string cascade constraints;
drop table hfj_spidx_token cascade constraints;
drop table hfj_spidx_uri cascade constraints;
drop table hfj_res_tag cascade constraints;
drop table hfj_search_result cascade constraints;
drop table hfj_res_param_present cascade constraints;
drop table hfj_resource cascade constraints;
drop table hfj_idx_cmp_string_uniq cascade constraints;
drop table hfj_search cascade constraints;
drop table hfj_search_include cascade constraints;
drop table hfj_search_parm cascade constraints;
drop table hfj_subscription cascade constraints;
drop table hfj_subscription_flag_res cascade constraints;
drop table hfj_tag_def cascade constraints;
drop table trm_codesystem cascade constraints;
drop table trm_codesystem_var cascade constraints;
drop table trm_concept cascade constraints;
drop table trm_concept_pc_link cascade constraints;
drop table trm_concept_property cascade constraints;
2017-08-24 13:07:27 -04:00
# Delete all resources
update hfj_res_ver set forced_id_pid = null where res_id in (select res_id from hfj_resource);
update hfj_resource set forced_id_pid = null where res_id in (select res_id from hfj_resource);
delete from hfj_history_tag where res_id in (select res_id from hfj_resource);
delete from hfj_res_ver where res_id in (select res_id from hfj_resource);
delete from hfj_forced_id where resource_pid in (select res_id from hfj_resource);
delete from hfj_res_link where src_resource_id in (select res_id from hfj_resource);
delete from hfj_res_link where target_resource_id in (select res_id from hfj_resource);
delete from hfj_spidx_coords where res_id in (select res_id from hfj_resource);
delete from hfj_spidx_date where res_id in (select res_id from hfj_resource);
delete from hfj_spidx_number where res_id in (select res_id from hfj_resource);
delete from hfj_spidx_quantity where res_id in (select res_id from hfj_resource);
delete from hfj_spidx_string where res_id in (select res_id from hfj_resource);
delete from hfj_spidx_token where res_id in (select res_id from hfj_resource);
delete from hfj_spidx_uri where res_id in (select res_id from hfj_resource);
delete from hfj_res_tag where res_id in (select res_id from hfj_resource);
delete from hfj_search_result where resource_pid in (select res_id from hfj_resource);
delete from hfj_res_param_present where res_id in (select res_id from hfj_resource);
delete from hfj_idx_cmp_string_uniq where res_id in (select res_id from hfj_resource);
delete from hfj_subscription_stats where res_id in (select res_id from hfj_resource);
delete from hfj_resource where res_id in (select res_id from hfj_resource);
# Correct Version issues
update hfj_resource
set res_ver = res_ver + 1
where res_id in (
select distinct res.res_id from hfj_resource res
inner join hfj_res_ver rv on (rv.res_id = res.res_id)
where ((res.res_ver + 1) = (rv.res_ver))
)
2018-05-21 13:07:11 -04:00
# Oracle
2018-03-19 08:51:02 -04:00
drop table hfj_history_tag cascade constraints;
drop table hfj_forced_id cascade constraints;
drop table hfj_res_link cascade constraints;
drop table hfj_spidx_coords cascade constraints;
drop table hfj_spidx_date cascade constraints;
drop table hfj_spidx_number cascade constraints;
drop table hfj_spidx_quantity cascade constraints;
drop table hfj_spidx_string cascade constraints;
drop table hfj_spidx_token cascade constraints;
drop table hfj_spidx_uri cascade constraints;
drop table hfj_res_tag cascade constraints;
drop table hfj_search_result cascade constraints;
drop table hfj_search_include cascade constraints;
drop table hfj_search cascade constraints;
drop table hfj_res_param_present cascade constraints;
drop table hfj_idx_cmp_string_uniq cascade constraints;
drop table hfj_subscription_stats cascade constraints;
drop table trm_concept_property cascade constraints;
drop table trm_concept_pc_link cascade constraints;
drop table trm_concept cascade constraints;
drop table trm_codesystem_ver cascade constraints;
drop table trm_codesystem cascade constraints;
DROP TABLE hfj_resource CASCADE CONSTRAINTS;
DROP TABLE hfj_res_ver CASCADE CONSTRAINTS;
drop table cdr_audit_evt_target_module cascade constraints;
drop table cdr_audit_evt_target_res cascade constraints;
drop table cdr_audit_evt_target_user cascade constraints;
drop table cdr_xact_log_step cascade constraints;
drop table cdr_xact_log cascade constraints;
2017-08-24 13:07:27 -04:00
2018-06-16 14:10:15 -04:00
drop table hfj_history_tag cascade;
drop table hfj_forced_id cascade;
drop table hfj_res_link cascade;
drop table hfj_spidx_coords cascade;
drop table hfj_spidx_date cascade;
drop table hfj_spidx_number cascade;
drop table hfj_spidx_quantity cascade;
drop table hfj_spidx_string cascade;
drop table hfj_spidx_token cascade;
drop table hfj_spidx_uri cascade;
drop table hfj_res_tag cascade;
drop table hfj_search_result cascade;
drop table hfj_search_include cascade;
drop table hfj_search cascade;
drop table hfj_res_param_present cascade;
drop table hfj_idx_cmp_string_uniq cascade;
drop table hfj_subscription_stats cascade;
drop table trm_concept_property cascade;
drop table trm_concept_pc_link cascade;
drop table trm_concept cascade;
drop table trm_codesystem_ver cascade;
drop table trm_codesystem cascade;
DROP TABLE hfj_resource cascade;
DROP TABLE hfj_res_ver cascade;
drop table hfj_search_parm cascade;
drop table hfj_tag_def cascade;
drop index IDX_FORCEDID_TYPE_FORCEDID;
alter table hfj_forced_id drop constraint idx_forcedid_type_resid;
2018-06-16 14:10:15 -04:00
Upgrading
drop index IDX_SP_STRING;
2018-06-27 18:33:04 -04:00
create index IDX_SP_STRING_HASH_NRM;
create index IDX_SP_STRING_HASH_EXCT;
2018-06-16 14:10:15 -04:00
drop index IDX_SP_TOKEN;
drop index IDX_SP_TOKEN_UNQUAL;
2018-06-27 18:33:04 -04:00
create index IDX_SP_TOKEN_HASH;
create index IDX_SP_TOKEN_HASH_S;
create index IDX_SP_TOKEN_HASH_SV;
create index IDX_SP_TOKEN_HASH_V;
drop index IDX_SP_DATE;
create index IDX_SP_DATE_HASH;
drop index IDX_SP_QUANTITY;
create index IDX_SP_QUANTITY_HASH;
create index IDX_SP_QUANTITY_HASH_UN;
2018-06-25 10:22:49 -04:00
drop index IDX_FORCEDID_TYPE_FORCEDID;
alter table hfj_forced_id drop constraint idx_forcedid_type_resid;
2018-06-25 10:22:49 -04:00
create index IDX_FORCEDID_TYPE_FID;
2018-06-27 18:33:04 -04:00
drop index IDX_SP_NUMBER;
create index IDX_SP_NUMBER_HASH_VAL;
2018-06-29 14:32:08 -04:00
drop column SP_ID from table HFJ_RES_PARAM_PRESENT;
drop index IDX_SEARCHPARM_RESTYPE_SPNAME;
drop index IDX_RESPARMPRESENT_SPID_RESID;
drop table HFJ_SEARCH_PARM;