报表分片运算调度控制台

CREATE OR REPLACE PACKAGE qms_rpt_operating_station_pub AS
/******************************************************************************
NAME: qms_rpt_operating_station_pub
PURPOSE: 报表分片运算调度控制台

REVISIONS:
Ver Date Author Description
--------- ---------- --------------- ------------------------------------
1.0 2015/7/25 zhangwq7 1. Created this package.
******************************************************************************/

g_slicing_cal_job_count NUMBER := 3; ---分片job数
g_sliced_data_cal_job_count NUMBER := 10; --分片数据运算job数
g_total_data_cal_job_count NUMBER := 5; --总体数据预算job数
g_report_job_remark_length NUMBER := 4000; --job备注的长度
g_slice_interval NUMBER := 1;
PROCEDURE log(p_report_job_id VARCHAR2
,p_report_id VARCHAR2
,p_silace_id VARCHAR2
,p_remark VARCHAR2) ;
/******************************************************************************
NAME: sliceing_cal_scheduling
PURPOSE: 把待运算报表JOB切片调度
******************************************************************************/
PROCEDURE slicing_cal_scheduling(p_report_job_id VARCHAR2
,p_mod_num NUMBER);

/******************************************************************************
NAME: sliced_data_cal_scheduling
PURPOSE: 把待运算的切片JOB调度(报表已经完成切片)
******************************************************************************/
PROCEDURE sliced_data_cal_scheduling(p_report_job_id VARCHAR2
,p_mod_num NUMBER);

/******************************************************************************
NAME: total_data_cal_scheduling
PURPOSE: 把待运算的总体报表结果JOB调度(报表已经完成切片运算)
******************************************************************************/
PROCEDURE total_data_cal_scheduling(p_report_job_id VARCHAR2
,p_mod_num NUMBER);

/******************************************************************************
NAME: common_slicing_cal
PURPOSE: 通用的报表切片逻辑
******************************************************************************/
PROCEDURE common_slicing_cal(p_report_id VARCHAR2);

/******************************************************************************
NAME: main
PURPOSE: 报表分片运算调度控制台入口
******************************************************************************/
PROCEDURE main;
END;
/
CREATE OR REPLACE PACKAGE BODY qms_rpt_operating_station_pub AS
/******************************************************************************
NAME: qms_rpt_operating_station_pub
PURPOSE: 报表分片运算调度控制台

REVISIONS:
Ver Date Author Description
--------- ---------- --------------- ------------------------------------
1.0 2015/7/25 zhangwq7 1. Created this package.
******************************************************************************/

/******************************************************************************
NAME: headquarters
PURPOSE: 司令部
******************************************************************************/
PROCEDURE log(p_report_job_id VARCHAR2
,p_report_id VARCHAR2
,p_silace_id VARCHAR2
,p_remark VARCHAR2) IS
BEGIN
INSERT INTO qms_report_job_log
(report_job_id
,report_id
,silace_id
,p_remark
,log_date)
VALUES
(p_report_job_id
,p_report_id
,p_silace_id
,substr(p_remark, 1, 4000)
,SYSDATE);
END;

/******************************************************************************
NAME: headquarters
PURPOSE: 司令部
******************************************************************************/
PROCEDURE headquarters IS
v_job_type VARCHAR2(200);
v_job_what VARCHAR2(500);
v_report_job_id VARCHAR2(32);
v_dbms_job_id NUMBER;
BEGIN
--把已经完成的job remove
UPDATE qms_report_job qrj
SET job_end = SYSDATE
,remark = substr(‘当前job不存于user_jobs,‘ || remark,
1,
g_report_job_remark_length)
WHERE job_end IS NULL
AND NOT EXISTS
(SELECT 1 FROM user_jobs WHERE job = qrj.job_id);

COMMIT;
/* 系统会自行移除job
FOR c IN (SELECT id
,job_id
,remark
FROM qms_report_job qrj
WHERE job_end IS NULL
AND EXISTS
(SELECT 1
FROM user_jobs
WHERE job = qrj.job_id
AND (broken = ‘Y‘ OR last_date IS NULL))) LOOP
BEGIN
dbms_job.remove(c.job_id);

UPDATE qms_report_job
SET job_end = SYSDATE
,remark = substr(‘dbms_job.remove成功,‘ || remark,
1,
g_report_job_remark_length)
WHERE id = c.id;
EXCEPTION
WHEN OTHERS THEN
v_sqlerrm := substr(SQLERRM, 1, 200);

UPDATE qms_report_job
SET job_end = SYSDATE
,remark = substr(‘dbms_job.remove失败,‘ || v_sqlerrm || ‘,‘ ||
remark,
1,
g_report_job_remark_length)
WHERE id = c.id;
END;

COMMIT;
END LOOP;
*/

----报表切片job走起begin-------------------
v_job_type := ‘qms_rpt_operating_station_pub.slicing_cal_scheduling‘;

--根据job配置数跑切片job
FOR c IN (SELECT row_num
FROM (SELECT rownum - 1 row_num
FROM user_col_comments
WHERE rownum <= g_slicing_cal_job_count) t /*待跑的mod*/
WHERE NOT EXISTS (SELECT 1
FROM qms_report_job
WHERE mod_num = t.row_num
AND job_end IS NULL
AND job_type = v_job_type) /*排除正在跑的mod*/
AND EXISTS
(SELECT 1
FROM qms_report_request_log2
WHERE progress_status = ‘I‘ and state = ‘A‘
AND MOD(report_sequence, g_slicing_cal_job_count) =
t.row_num) /*待跑数据的余数落在待跑的mod里*/
ORDER BY row_num) LOOP
v_report_job_id := sys_guid();
v_job_what := v_job_type || ‘(‘‘‘ || v_report_job_id || ‘‘‘,‘ ||
c.row_num || ‘);‘;

BEGIN
dbms_job.submit(v_dbms_job_id, v_job_what, SYSDATE);

INSERT INTO qms_report_job
(id
,mod_num
,job_type
,job_what
,job_id
,job_start)
VALUES
(v_report_job_id
,c.row_num
,v_job_type
,v_job_what
,v_dbms_job_id
,SYSDATE);

COMMIT;
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
END LOOP;

----报表切片job end-------------------

----报表切片数据计算job走起begin-------------------
v_job_type := ‘qms_rpt_operating_station_pub.sliced_data_cal_scheduling‘;

--根据job配置数跑切片job
FOR c IN (SELECT row_num
FROM (SELECT rownum - 1 row_num
FROM user_col_comments
WHERE rownum <= g_sliced_data_cal_job_count) t /*待跑的mod*/
WHERE NOT EXISTS (SELECT 1
FROM qms_report_job
WHERE mod_num = t.row_num
AND job_end IS NULL
AND job_type = v_job_type) /*排除正在跑的mod*/
AND EXISTS
(SELECT 1
FROM qms_calculate_criteria_slice2 qccs
,qms_report_request_log2 qrrl
,qms_report_type qrt
WHERE qrt.report_type = qrrl.report_type
AND qccs.qms_report_request_log_id = qrrl.id
AND qccs.progress_status = ‘I‘
AND qrrl.progress_status IN (‘R‘, ‘S‘)
AND qccs.status = ‘1‘
AND qccs.progress_cur_qty = 0
AND MOD(qccs.report_sequence,
g_sliced_data_cal_job_count) = t.row_num) /*待跑数据的余数落在待跑的mod里*/
ORDER BY row_num) LOOP
v_report_job_id := sys_guid();
v_job_what := v_job_type || ‘(‘‘‘ || v_report_job_id || ‘‘‘,‘ ||
c.row_num || ‘);‘;

BEGIN
dbms_job.submit(v_dbms_job_id, v_job_what, SYSDATE);

INSERT INTO qms_report_job
(id
,mod_num
,job_type
,job_what
,job_id
,job_start)
VALUES
(v_report_job_id
,c.row_num
,v_job_type
,v_job_what
,v_dbms_job_id
,SYSDATE);

COMMIT;
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
END LOOP;

----报表切片数据计算job end-------------------

----报表总体数据计算job走起begin-------------------
v_job_type := ‘qms_rpt_operating_station_pub.total_data_cal_scheduling‘;

--根据job配置数跑切片job

FOR c IN (SELECT row_num
FROM (SELECT rownum - 1 row_num
FROM user_col_comments
WHERE rownum <= g_total_data_cal_job_count) t /*待跑的mod*/
WHERE NOT EXISTS (SELECT 1
FROM qms_report_job
WHERE mod_num = t.row_num
AND job_end IS NULL
AND job_type = v_job_type) /*排除正在跑的mod*/
AND EXISTS
(SELECT 1
FROM qms_report_request_log2 qrrl
,qms_report_type qrt
WHERE qrt.report_type = qrrl.report_type
AND qrrl.progress_status IN (‘S‘, ‘R‘)
AND MOD(report_sequence, g_total_data_cal_job_count) =
t.row_num
AND NOT EXISTS
(SELECT 1
FROM qms_calculate_criteria_slice2 qccs
WHERE qccs.qms_report_request_log_id = qrrl.id
AND qccs.progress_status NOT IN (‘E‘, ‘D‘))) /*待跑数据的余数落在待跑的mod里*/
ORDER BY row_num) LOOP
v_report_job_id := sys_guid();
v_job_what := v_job_type || ‘(‘‘‘ || v_report_job_id || ‘‘‘,‘ ||
c.row_num || ‘);‘;

BEGIN
dbms_job.submit(v_dbms_job_id, v_job_what, SYSDATE);

INSERT INTO qms_report_job
(id
,mod_num
,job_type
,job_what
,job_id
,job_start)
VALUES
(v_report_job_id
,c.row_num
,v_job_type
,v_job_what
,v_dbms_job_id
,SYSDATE);

COMMIT;
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
END LOOP;
----报表总体数据计算job end-------------------
END;

/******************************************************************************
NAME: sliceing_cal_scheduling
PURPOSE: 把待运算报表JOB切片调度
******************************************************************************/
PROCEDURE slicing_cal_scheduling(p_report_job_id VARCHAR2
,p_mod_num NUMBER) IS
v_execute_what VARCHAR2(500);
v_sqlerrm VARCHAR2(500);
v_progress_status VARCHAR2(50);
v_sqlcount NUMBER;
BEGIN
--把失效的报表排除掉
UPDATE qms_report_request_log2 qrrl
SET report_created_date = SYSDATE
,progress_status = ‘C‘
,progress_desc = ‘qms_report_type配置了此类报表无效.‘
WHERE report_type IN
(SELECT report_type
FROM qms_report_type qrt
WHERE qrt.report_type = qrrl.report_type
AND nvl(qrt.state, ‘X‘) != ‘A‘)
AND qrrl.progress_status = ‘I‘;

COMMIT;

FOR c IN (SELECT qrt.slicing_proc
,qrrl.id
FROM qms_report_request_log2 qrrl
,qms_report_type qrt
WHERE qrt.report_type = qrrl.report_type
AND qrrl.progress_status = ‘I‘
AND MOD(report_sequence, g_slicing_cal_job_count) =
p_mod_num
AND NOT EXISTS
(SELECT 1
FROM qms_calculate_criteria_slice2 qccs
WHERE qccs.qms_report_request_log_id = qrrl.id)
ORDER BY qrrl.datetime_created) LOOP
--锁定数据
SELECT progress_status
INTO v_progress_status
FROM qms_report_request_log2
WHERE id = c.id
FOR UPDATE;
log(p_report_job_id,c.id,‘1. slicing_status‘,‘progress_status = S‘);
UPDATE qms_report_request_log2
SET progress_status = ‘S‘
WHERE id = c.id
AND progress_status = ‘I‘;

v_sqlcount := SQL%ROWCOUNT;
COMMIT;

IF v_sqlcount > 0 THEN
v_execute_what := ‘begin ‘ || c.slicing_proc || ‘(‘‘‘ || c.id ||
‘‘‘);end;‘;
dbms_output.put_line(v_execute_what);
v_sqlerrm := ‘切片调度‘;

log(p_report_job_id,c.id,‘2. slicing_what‘,v_execute_what);
BEGIN
EXECUTE IMMEDIATE v_execute_what;

log(p_report_job_id,c.id,‘3. slicing_executed‘,v_execute_what);
EXCEPTION
WHEN OTHERS THEN
v_sqlerrm := ‘切片调度失败,‘ || substr(SQLERRM, 1, 150);

UPDATE qms_report_request_log2
SET progress_status = ‘E‘
,progress_desc = v_sqlerrm
WHERE id = c.id;
END;

log(p_report_job_id,
c.id,
NULL,
v_execute_what || ‘,‘ || v_sqlerrm);

COMMIT;
END IF;
END LOOP;
END;

/******************************************************************************
NAME: sliced_data_cal_scheduling
PURPOSE: 把待运算的切片JOB调度(报表已经完成切片)
******************************************************************************/
PROCEDURE sliced_data_cal_scheduling(p_report_job_id VARCHAR2
,p_mod_num NUMBER) IS
v_execute_what VARCHAR2(500);
v_sqlerrm VARCHAR2(500);
v_progress_status VARCHAR(50);
v_sqlcount NUMBER;
BEGIN
--报表运行过程中只要有一片是错误的,则此报表就是错误的
UPDATE qms_report_request_log2 rrl
SET rrl.progress_status = ‘E‘
WHERE rrl.id IN
(SELECT DISTINCT qrrl.id
FROM qms_calculate_criteria_slice2 qccs
,qms_report_request_log2 qrrl
WHERE qccs.qms_report_request_log_id = qrrl.id
AND qrrl.progress_status IN (‘R‘, ‘S‘)
AND qccs.progress_status = ‘E‘
AND MOD(qccs.report_sequence, g_sliced_data_cal_job_count) =
p_mod_num);

UPDATE qms_calculate_criteria_slice2 ccs
SET ccs.progress_status = ‘C‘
WHERE ccs.id IN
(SELECT DISTINCT qccs.id
FROM qms_calculate_criteria_slice2 qccs
,qms_report_request_log2 qrrl
WHERE qccs.qms_report_request_log_id = qrrl.id
AND qrrl.progress_status = ‘E‘
AND qccs.progress_status = ‘I‘
AND MOD(qccs.report_sequence, g_sliced_data_cal_job_count) =
p_mod_num);

COMMIT;

--片数据运算
FOR c IN (SELECT qrt.sliced_data_proc
,qccs.id
,qrrl.id AS report_id
FROM qms_calculate_criteria_slice2 qccs
,qms_report_request_log2 qrrl
,qms_report_type qrt
WHERE qrt.report_type = qrrl.report_type
AND qccs.qms_report_request_log_id = qrrl.id
AND qccs.progress_status = ‘I‘
AND qrrl.progress_status IN (‘R‘, ‘S‘)
AND qccs.status = ‘1‘
AND qccs.progress_cur_qty = 0
AND MOD(qccs.report_sequence, g_sliced_data_cal_job_count) =
p_mod_num
ORDER BY qrrl.datetime_created
,qccs.qms_report_request_log_id) LOOP
--锁定资料
SELECT progress_status
INTO v_progress_status
FROM qms_calculate_criteria_slice2
WHERE id = c.id
FOR UPDATE;

UPDATE qms_calculate_criteria_slice2
SET progress_status = ‘S‘
WHERE id = c.id
AND progress_status = ‘I‘;

v_sqlcount := SQL%ROWCOUNT;
COMMIT;

IF v_sqlcount > 0 THEN
v_sqlerrm := ‘切片运算‘;

BEGIN
v_execute_what := ‘begin ‘ || c.sliced_data_proc || ‘(‘‘‘ || c.id ||
‘‘‘);end;‘;

EXECUTE IMMEDIATE v_execute_what;
EXCEPTION
WHEN OTHERS THEN
v_sqlerrm := ‘切片运算调度失败,‘ || substr(SQLERRM, 1, 150);

UPDATE qms_calculate_criteria_slice2
SET progress_status = ‘E‘
,progress_desc = v_sqlerrm
WHERE id = c.id;
END;

log(p_report_job_id,
c.report_id,
c.id,
v_execute_what || ‘,‘ || v_sqlerrm);
COMMIT;
END IF;
END LOOP;
END;

/******************************************************************************
NAME: total_data_cal_scheduling
PURPOSE: 把待运算的总体报表结果JOB调度(报表已经完成切片运算)
******************************************************************************/
PROCEDURE total_data_cal_scheduling(p_report_job_id VARCHAR2
,p_mod_num NUMBER) IS
v_execute_what VARCHAR2(500);
v_sqlerrm VARCHAR2(200);
v_progress_status VARCHAR(50);
v_sqlcount NUMBER;
BEGIN
FOR c IN (SELECT qrt.total_data_proc
,qrrl.id
FROM qms_report_request_log2 qrrl
,qms_report_type qrt
WHERE qrt.report_type = qrrl.report_type
AND qrrl.progress_status IN ( ‘R‘)
AND MOD(report_sequence, g_total_data_cal_job_count) =
p_mod_num
AND NOT EXISTS
(SELECT 1
FROM qms_calculate_criteria_slice2 qccs
WHERE qccs.qms_report_request_log_id = qrrl.id
AND qccs.progress_status NOT IN (‘E‘, ‘D‘))
ORDER BY qrrl.datetime_created) LOOP
--锁定资料
SELECT progress_status
INTO v_progress_status
FROM qms_report_request_log2
WHERE id = c.id
FOR UPDATE;

UPDATE qms_report_request_log2
SET progress_status = ‘R‘
WHERE id = c.id
AND progress_status IN (‘S‘, ‘R‘);

v_sqlcount := SQL%ROWCOUNT;
COMMIT;

IF v_sqlcount > 0 THEN
v_sqlerrm := ‘总体运算.‘;

BEGIN
v_execute_what := ‘begin ‘ || c.total_data_proc || ‘(‘‘‘ || c.id ||
‘‘‘);end;‘;

EXECUTE IMMEDIATE v_execute_what;
EXCEPTION
WHEN OTHERS THEN
v_sqlerrm := ‘总体运算失败,‘ || substr(SQLERRM, 1, 150);

UPDATE qms_report_request_log2
SET progress_status = ‘E‘
,progress_desc = v_sqlerrm
WHERE id = c.id;
END;

log(p_report_job_id,
c.id,
NULL,
v_execute_what || ‘,‘ || v_sqlerrm);
COMMIT;
END IF;
END LOOP;
END;

/******************************************************************************
NAME: common_slicing_cal
PURPOSE: 通用的报表切片逻辑
******************************************************************************/
PROCEDURE common_slicing_cal(p_report_id VARCHAR2) IS
v_fault_date_from DATE;
v_fault_date_to DATE;
v_temp_date_from DATE;
v_temp_date_to DATE;
v_days NUMBER;
v_days2 NUMBER;
v_times NUMBER := 0;
i NUMBER;
x_ret_msg VARCHAR(4000);
v_guid VARCHAR2(32);
v_total_days NUMBER := 0;
v_criteria_slice_row qms_calculate_criteria_slice2%ROWTYPE;
vv_temp_date VARCHAR2(20);
v_slice_interval NUMBER := g_slice_interval;

CURSOR cur_c IS
SELECT *
FROM qms_report_request_log2
WHERE progress_status = ‘S‘
AND id = p_report_id;
BEGIN
FOR cur IN cur_c LOOP
BEGIN
IF cur.report_type IN (‘KEY_PARTS_FAILURE_DIST‘) THEN
v_slice_interval := 30;
END IF;

BEGIN
v_fault_date_from := to_date(qms_rpt_utl.get_criteria_by_key(cur.id,
‘SETUP_DATE_FROM‘),
‘yyyy-MM-dd hh24:mi:ss‘);

v_fault_date_to := to_date(qms_rpt_utl.get_criteria_by_key(cur.id,
‘SETUP_DATE_TO‘),
‘yyyy-MM-dd hh24:mi:ss‘);

IF v_fault_date_from IS NULL THEN
v_fault_date_from := to_date(qms_rpt_utl.get_criteria_by_key(cur.id,
‘PRODUCE_DATE_FROM‘),
‘yyyy-MM-dd hh24:mi:ss‘);

v_fault_date_to := to_date(qms_rpt_utl.get_criteria_by_key(cur.id,
‘PRODUCE_DATE_TO‘),
‘yyyy-MM-dd hh24:mi:ss‘);
END IF;

qms_rpt_utl.calc_day_interval(p_begin_date => v_fault_date_from,
p_end_date => v_fault_date_to,
p_interval => v_slice_interval,
x_day_interval => v_days,
x_trunc => v_times);

v_temp_date_from := v_fault_date_from;

FOR i IN 1 .. v_times LOOP
SELECT v_temp_date_from + v_slice_interval
INTO v_temp_date_to
FROM dual;

IF (v_temp_date_to > v_fault_date_to) THEN
v_temp_date_to := v_fault_date_to;
END IF;

SELECT sys_guid() INTO v_guid FROM dual;

SELECT round(to_number(v_temp_date_to - v_temp_date_from))
INTO v_days2
FROM dual;

--切片按日期分段查询,格式化日期格式-----------------------------------
vv_temp_date := to_char(v_temp_date_from, ‘yyyy/MM/DD‘) ||
‘ 00:00:00‘;
v_temp_date_from := to_date(vv_temp_date,
‘yyyy/MM/DD hh24:mi:ss‘);

vv_temp_date := to_char(v_temp_date_to, ‘yyyy/MM/DD‘) ||
‘ 23:59:59‘;
v_temp_date_to := to_date(vv_temp_date, ‘yyyy/MM/DD hh24:mi:ss‘);

IF v_days2 >= 0 THEN
v_criteria_slice_row.id := v_guid;
v_criteria_slice_row.qms_report_request_log_id := cur.id;
v_criteria_slice_row.slice_date_from := v_temp_date_from;
v_criteria_slice_row.slice_date_to := v_temp_date_to;
v_criteria_slice_row.progress_status := ‘I‘;
v_criteria_slice_row.progress_cur_qty := 0;
v_criteria_slice_row.progress_total_qty := v_days2 + 1;
v_criteria_slice_row.status := ‘1‘;
v_criteria_slice_row.datetime_created := SYSDATE;

SELECT seq_report.nextval
INTO v_criteria_slice_row.report_sequence
FROM dual;

INSERT INTO qms_calculate_criteria_slice2
VALUES v_criteria_slice_row;

v_total_days := v_total_days +
v_criteria_slice_row.progress_total_qty;
END IF;

v_temp_date_from := v_temp_date_to + 1;
END LOOP;

UPDATE qms_report_request_log2
SET progress_status = ‘S‘
,progress_total_qty = v_total_days
WHERE id = cur.id;

COMMIT;
EXCEPTION
WHEN OTHERS THEN
x_ret_msg := SQLERRM;

UPDATE qms_report_request_log2
SET progress_status = ‘E‘
,progress_desc = x_ret_msg
WHERE id = cur.id;
END;
END;
END LOOP;

COMMIT;
EXCEPTION
WHEN OTHERS THEN
NULL;
END;

/******************************************************************************
NAME: main
PURPOSE: 报表分片运算调度控制台入口
******************************************************************************/
PROCEDURE main IS
BEGIN
headquarters;
END;
END;
/

  

-- Create table
create table QMS_REPORT_REQUEST_LOG2
(
  id                     VARCHAR2(32) not null,
  evaluate_no            NVARCHAR2(80) not null,
  report_type            NVARCHAR2(400) not null,
  report_created_date    DATE default SYSDATE not null,
  request_user           VARCHAR2(200),
  state                  CHAR(1) default ‘A‘ not null,
  user_created           VARCHAR2(60) default ‘SYS‘ not null,
  datetime_created       DATE default SYSDATE not null,
  user_modified          VARCHAR2(60),
  datetime_modified      DATE,
  report_desc            VARCHAR2(400),
  progress_status        VARCHAR2(20),
  progress_desc          VARCHAR2(180),
  progress_cur_qty       NUMBER,
  progress_total_qty     NUMBER,
  report_sequence        NUMBER,
  total_records          NUMBER,
  datetime_calc_finished DATE,
  config_id              VARCHAR2(32)
)
tablespace QMSD
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );
-- Add comments to the columns
comment on column QMS_REPORT_REQUEST_LOG2.config_id
  is ‘推送配置ID‘;

  

-- Create table
create table QMS_CALCULATE_CRITERIA
(
  id                        VARCHAR2(32) default SYS_GUID() not null,
  qms_report_request_log_id NVARCHAR2(80) not null,
  parameter_key             VARCHAR2(80) not null,
  parameter_value           NVARCHAR2(400) not null,
  state                     CHAR(1) default ‘A‘ not null,
  user_created              VARCHAR2(60) default ‘SYS‘ not null,
  datetime_created          DATE default SYSDATE not null,
  user_modified             VARCHAR2(60),
  datetime_modified         DATE,
  order_by                  NUMBER
)
tablespace QMSD
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );
-- Add comments to the columns
comment on column QMS_CALCULATE_CRITERIA.qms_report_request_log_id
  is ‘评估编号‘;
comment on column QMS_CALCULATE_CRITERIA.parameter_key
  is ‘参数名‘;
comment on column QMS_CALCULATE_CRITERIA.parameter_value
  is ‘参数值‘;
-- Create/Recreate indexes
create index QMS_CALCULATE_CRITERIA_IX1 on QMS_CALCULATE_CRITERIA (QMS_REPORT_REQUEST_LOG_ID)
  tablespace QMSD
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );
-- Create/Recreate primary, unique and foreign key constraints
alter table QMS_CALCULATE_CRITERIA
  add constraint QMS_CALCULATE_CRITERIA_PK primary key (ID)
  using index
  tablespace QMSD
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );
-- Grant/Revoke object privileges
grant select on QMS_CALCULATE_CRITERIA to QMS_READYONLY;
-- Create table
create table QMS_CALCULATE_CRITERIA_SLICE2
(
  id                        VARCHAR2(32) not null,
  qms_report_request_log_id VARCHAR2(32) not null,
  slice_date_from           DATE,
  slice_date_to             DATE,
  progress_status           CHAR(1),
  user_created              VARCHAR2(60),
  datetime_created          DATE,
  user_modified             VARCHAR2(60),
  datetime_modified         DATE,
  order_by                  NUMBER,
  progress_desc             VARCHAR2(180),
  progress_cur_qty          NUMBER,
  progress_total_qty        NUMBER,
  exec_group                VARCHAR2(80),
  report_sequence           NUMBER,
  status                    VARCHAR2(20),
  start_date                DATE,
  end_date                  DATE,
  state                     CHAR(1),
  slice_group               VARCHAR2(32)
)
tablespace QMSD
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );

  

-- Create table
create table QMS_REPORT_TYPE
(
  report_type      NVARCHAR2(400) not null,
  report_title     VARCHAR2(400),
  slicing_proc     VARCHAR2(100),
  sliced_data_proc VARCHAR2(100),
  total_data_proc  VARCHAR2(100),
  state            CHAR(1) default ‘A‘ not null
)
tablespace QMSD
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );
-- Add comments to the columns
comment on column QMS_REPORT_TYPE.report_type
  is ‘报表代码‘;
comment on column QMS_REPORT_TYPE.report_title
  is ‘报表描述‘;
comment on column QMS_REPORT_TYPE.slicing_proc
  is ‘可调用的报表切片的Procedure‘;
comment on column QMS_REPORT_TYPE.sliced_data_proc
  is ‘可调用的每片运算Procedure‘;
comment on column QMS_REPORT_TYPE.total_data_proc
  is ‘可调用的总体运算Procedure‘;
comment on column QMS_REPORT_TYPE.state
  is ‘A,有效;其他,无效‘;
-- Create/Recreate primary, unique and foreign key constraints
alter table QMS_REPORT_TYPE
  add constraint QMS_REPORT_TYPE_PK primary key (REPORT_TYPE)
  using index
  tablespace QMSD
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );

  

时间: 2024-10-23 22:34:26

报表分片运算调度控制台的相关文章

混合运算(控制台)

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; namespace ConsoleApplication2 { class Program { static int sun; private static int x, y, z; private static string f; private s

FineReport报表和水晶报表的比较

FineReport报表和水晶报表的比较 FineReport报表软件针对复杂格式的报表数据及Web报表的展现,通过多源分片.不规则分组.双向扩展来轻松拖拽做复杂格式的报表,制作报表从此摆脱了复杂的SQL和表达式,不需要编程,大大提高了报表制作的效率. 相对于水晶报表(Crystal Report),FineReport报表无论是在报表设计,数据展现,还是表单,应用集成等方面,都具有明显的优势. 报表设计 在报表设计方面,FineReport报表工具的优势主要体现在以下几个方面: 多数据源 Fi

spring的定时调度

项目中要用到一个报表的运算服务器,项目一运行,就会启动相关的运算方法. 想了一圈,java web项目,spring是个万金油,什么都叫由它来管理.一查,还真有这个定时调度的功能. spring提供两种触发器,一个是CronTriggerBean,一个是SimpleTriggerBean. 好懒,长话短说吧. 环境: spring + ibatis,首先配置spring配置文件.写service层(具体的运算方法就写在这). 1). CronTriggerBea <!-- 定义job -->

利用好缓存实,现实时报表实时报表

如何才能实更加快速的访问报表,又不增加服务器的负担呢? 如果连续多次重复访问同一报表被时,服务器的运算消耗将会增加,报表展现所需的时间也会增长.假如能够把第一次算出的报表缓存下来,再次访问时直接从缓存中读取,这样则可以减轻服务器的负担,从而缩短用户的等待时间.快逸报表提供了缓存的机制,可通过设置reportConfig.xml中的缓存参数控制缓存的使用,实现实时报表. 在reportConfig.xml中提供了缓存参数,我就来给大家详细说明: alwaysReloadDefine: 是否每次都重

分布式开源调度框架TBSchedule原理与应用

主要内容: 第一部分 TBSchedule基本概念及原理 1. 概念介绍 2. 工作原理 3. 源代码分析 4. 与其它开源调度框架对照 第二部分 TBSchedule分布式调度演示样例 1. TBSchedule源代码下载 2. 引入源代码Demo开发演示样例 3. 控制台配置任务调度 4. selectTasks方法參数说明 5. 创建调度策略參数说明 6. 创建任务參数说明 第一部分 TBSchedule基本概念及原理 1. 概念介绍 TBSchedule是一个支持分布式的调度框架.能让一

润乾集算报表提升性能之并行取数

有时报表在展现或导出时需要从数据库中取出较多数据,而JDBC的取数速度一向比较慢,有可能超过报表其它运算环节的耗时,导致整个报表的生成过程效率极低.下面我们看如何利用润乾集算报表的并行计算机制提高JDBC的取数性能. 所谓并行取数是指,使用多线程技术在报表工具与数据库建立多个连接,同时读取一份源数据,这需要将源数据分段,每个线程(数据库连接)读取其中一段内容,最后将所有线程的结果合并得到总目标数据的过程. 集算报表内置了并行机制可以很容易完成并行取数任务,从而提升报表性能,这里以oracle为例

报表性能优化方案之报表计算时间

1. 问题描述 完成报表取数后,设计器会对数据库返回的数据进行扩展.分组.列表.汇总等运算,好的模板制作习惯往往可以优化报表的计算时间. 以下示例报表开发工具:FineReport. 2. 解决方案 2.1 空白单元格应用 报表中,只要一个单元格里有设置就会占用一份内存,而空白的单元格几乎是不占任何内存的.报表中由于布局的需要,不可避免地会出现一些只起到占位作用而无需其他的设置的单元格:尽量将这些单元格设成空白单元格,这样能够有效的减少内存的占用,加快报表的运算速度. 2.2 慎用隐藏行列 报表

JSP 应用、控制台输出

1.定义运算"¥":-控制台输出 2.数学运算:-控制台输出 3.鸡兔同笼:-控制台输出 4. 定义运算"¥":-控制台输出 A¥B=1.{A(若A>B)} 2.{1(若A=B)} 3.{B(若A<B)} 例如:3.5¥2=3.5   1¥1.2=1.2   7¥7=1 则(1.1¥2.333-0.333¥0.2)/0.8¥0.8=? 答案:2 创建TestNewCalc类: public class TestNewCalc { //创建TestNewC

以太坊分片Sharding FAQ

简介 目前,在所有的区块链协议中每个节点存储所有的状态(账户余额,合约代码和存储等等)并且处理所有的交易.这提供了大量的安全性,但极大的限制了可扩展性:区块链不能处理比一个单节点更多的交易.很大程度上因为这个原因,比特币被限制在每秒3-7笔交易,以太坊每秒7-15笔交易,等等.然后,这提出了一个问题:是否有方法创建一个新的机制,只让一个小集合的节点来验证每笔交易?只要有足够多的节点验证每笔交易那么系统依然是高度安全的,但又足够少使得系统系统可以并行处理很多的交易,我们是否可以使用这种技术来大大增