扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
set echo off feed off ver off pages 0 spool audon.sql select ’audit select on ’||owner||’.’||object_name||’ by access;’ from dba_objects where object_type in (’VIEW’,’TABLE’) and owner in (’ORDADM’); spool off set echo on feed on ver on |
audit select on ORDADM.DOCTOR_ORDERS by access; audit select on ORDADM.GROUP_ORDER_ITEMS by access; audit select on ORDADM.GROUP_ORDER_MASTER by access; audit select on ORDADM.ORDERS by access; audit select on ORDADM.ORDERS_COSTS by access; audit select on ORDADM.ORDERS_SHEET_IMAGE by access; audit select on ORDADM.VITAL_SIGNS_REC by access; |
create table aud_summary ( obj_name varchar2(30), owner varchar2(30), hits number); |
insert into aud_summary select obj_name,owner,count(*) from dba_audit_object group by obj_name,owner; |
set echo off feed off ver off pages 0 spool audoff.sql select ’noaudit select on ’||owner||’.’||object_name|| ’ by access;’ from dba_objects where object_type in (’VIEW’,’TABLE’) and owner in (’ORDADM’); spool off set echo on feed on ver on |
delete sys.aud$ |
col obj_name form a30 col owner form a20 col hits form 99,990 selec obj_name,owner,hits from aud_summary; OBJ_NAME OWNER COUNT(*) ----------- ------------- ---------- DOCTOR_ORDERS ORDADM 30309 DRUG_STOCK PHARMACY 11094 GROUP_ORDER_ITEMS ORDADM 1030 GROUP_ORDER_MASTER ORDADM 1196 ORDERS ORDADM 40421 ORDERS_COSTS ORDADM 10109 |
表 | 行数 | 命中率 |
doctor_orders | 2052709 | 30309 |
drug_stock | 2511 | 11094 |
group_order_item | 3800 | 1030 |
group_order_master | 186 | 1196 |
orders | 1633010 | 40421 |
orders_costs | 2403214 | 10109 |
Analyze table ORDADM.ORDERS estimate statistics sample 20 percent; |
select table_name,column_name,num_distinct from DBA_TAB_COLUMNS where owner like ’ORDADM’; |
列 | 不同的值 |
PATIENT_ID | 28720 |
VISIT_ID | 2 |
ORDER_NO | 395 |
ORDER_SUB_NO | 10 |
ORDER_CLASS | 9 |
ORDER_CODE | 825 |
ORDER_TEXT | 1551 |
ORDERING_DEPT | 15 |
START_DATE_TIME | 1194176 |
STOP_DATE_TIME | 636798 |
Create Table orders ( PATIENT_ID varchar2(10) not null, ORDER_NO number(4), ORDER_SUB_NO number(2), .............. ORDER_CLASS char(1), ORDER_TEXT varchar2(80), ORDER_CODE varchar2(10), ............. START_DATE_TIME date STOP_DATE_TIME date ................. ORDERING_DEPT varchar2(8) storage (initial 100M next 1M) PARTITION BY RANGE(START_DATE_TIME) SUBPARTITION BY HASH(ORDER_CODE) SUBPARTITIONS 3 STORE IN (ordersub1, ordersub 2, ordersub 3) (PARTITION orders200212 VALUES LESS THAN (to_date(’2003-01-01 00:00: 00’,’yyyy-mm-dd hh24:mi:ss’)) tablespace Tsp_Orders, PARTITION orders200301 VALUES LESS THAN (to_date(’2003-02-01 00:00: 00’,’yyyy-mm-dd hh24:mi:ss’)) tablespace Tsp_Orders,, PARTITION orders 200302 VALUES LESS THAN (to_date(’2003-03-01 00:00: 00’,’yyyy-mm-dd hh24:mi:ss’)) tablespace Tsp_Orders,, ..................... PARTITION orders200402 VALUES LESS THAN (to_date(’2004-03-01 00:00: 00’,’yyyy-mm-dd hh24:mi:ss’)) tablespace Tsp_Orders (SUBPARTITION ordersub1 TABLESPACE Tsp_Orders, SUBPARTITION ordersub 2 TABLESPACE Tsp_Orders, SUBPARTITION ordersub3 TABLESPACE Tsp_Orders)); |
ALTER TABLE Orders ADD CONSTRAINT Pk_Orders KEY (Patient_id, Visit_id,Order_no,Order_sub_no) USING INDEX PCTFREE 5 TABLESPACE Tsp_Orders; |
分区名 | 记录数 |
orders200301 | 87311 |
orders2200302 | 87553 |
orders2200303 | 107533 |
............ | |
orders200401 | 124812 |
Alter Table orders Add partition orders200403 Aalues less (to_date(’2004-04-01 00:00:00’,’yyyy-mm-dd hh24: mi:ss’)) Tablespace Tsp_Orders; |
Alter Table table_name Drop Partition partition_name; |
Alter Table table_name Truncate Partition partition_name Storage; |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。