Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql mns之前,他们似乎很有希望。然而,它不会有和触发器一样的“安全问题”吗?在触发器中,“流氓管理员”可以禁用散列计算触发器,这样数据的更改就不会反映在散列中。在阅读更多关于虚拟列的内容后,我看不出有什么好处,因为我的情况是,每次都会重新计算虚拟列的值。此外_Sql_Oracle_Plsql_Database Performance_Oracle12c - Fatal编程技术网

Sql mns之前,他们似乎很有希望。然而,它不会有和触发器一样的“安全问题”吗?在触发器中,“流氓管理员”可以禁用散列计算触发器,这样数据的更改就不会反映在散列中。在阅读更多关于虚拟列的内容后,我看不出有什么好处,因为我的情况是,每次都会重新计算虚拟列的值。此外

Sql mns之前,他们似乎很有希望。然而,它不会有和触发器一样的“安全问题”吗?在触发器中,“流氓管理员”可以禁用散列计算触发器,这样数据的更改就不会反映在散列中。在阅读更多关于虚拟列的内容后,我看不出有什么好处,因为我的情况是,每次都会重新计算虚拟列的值。此外,sql,oracle,plsql,database-performance,oracle12c,Sql,Oracle,Plsql,Database Performance,Oracle12c,mns之前,他们似乎很有希望。然而,它不会有和触发器一样的“安全问题”吗?在触发器中,“流氓管理员”可以禁用散列计算触发器,这样数据的更改就不会反映在散列中。在阅读更多关于虚拟列的内容后,我看不出有什么好处,因为我的情况是,每次都会重新计算虚拟列的值。此外,有人可以直接删除虚拟列。最好是创建一个物理列并创建一个触发器来计算物理列的值。流氓管理员可以对其进行篡改,但不会以您无法检测到的方式进行。触发条件要糟糕得多:DBA可以直接将散列更新为他们需要的任何内容,以隐藏他们的更新。 cursor ha


mns之前,他们似乎很有希望。然而,它不会有和触发器一样的“安全问题”吗?在触发器中,“流氓管理员”可以禁用散列计算触发器,这样数据的更改就不会反映在散列中。在阅读更多关于虚拟列的内容后,我看不出有什么好处,因为我的情况是,每次都会重新计算虚拟列的值。此外,有人可以直接删除虚拟列。最好是创建一个物理列并创建一个触发器来计算物理列的值。流氓管理员可以对其进行篡改,但不会以您无法检测到的方式进行。触发条件要糟糕得多:DBA可以直接将散列更新为他们需要的任何内容,以隐藏他们的更新。
cursor hash_cur is
select /*+ PARALLEL(4)*/ dbms_crypto.mac(column1_in_raw_type, HMAC_SH512, string_to_raw('COLUMN1_NAME')) as COLUMN1_NAME
       ...
from TABLE_NAME;

open hash_cur;
fetch hash_cur bulk collect into hashes;
close hash_cur;

for i in 1..hashes.count
loop
  rec := hashes(i);
  record_xor = rec.COLUMN1;
  record_xor = bit_xor(record_xor, rec.COLUMN2);
  ...
  record_xor = bit_xor(record_xor, rec.COLUMNN);

  table_xor = bit_xor(table_xor, record_xor);
end loop;
select sum(ORA_HASH(col1||col2||col3)) as hash from my_table
CREATE OR REPLACE TYPE matt_hash_aggregate_impl AS OBJECT
(
  hash_value RAW(32000),
  CONSTRUCTOR FUNCTION matt_hash_aggregate_impl(SELF IN OUT NOCOPY matt_hash_aggregate_impl ) RETURN SELF AS RESULT,  
-- Called to initialize a new aggregation context
-- For analytic functions, the aggregation context of the *previous* window is passed in, so we only need to adjust as needed instead 
-- of creating the new aggregation context from scratch
  STATIC FUNCTION ODCIAggregateInitialize (sctx IN OUT matt_hash_aggregate_impl) RETURN NUMBER,
-- Called when a new data point is added to an aggregation context  
  MEMBER FUNCTION ODCIAggregateIterate (self IN OUT matt_hash_aggregate_impl, value IN raw ) RETURN NUMBER,
-- Called to return the computed aggragate from an aggregation context
  MEMBER FUNCTION ODCIAggregateTerminate (self IN matt_hash_aggregate_impl, returnValue OUT raw, flags IN NUMBER) RETURN NUMBER,
-- Called to merge to two aggregation contexts into one (e.g., merging results of parallel slaves) 
  MEMBER FUNCTION ODCIAggregateMerge (self IN OUT matt_hash_aggregate_impl, ctx2 IN matt_hash_aggregate_impl) RETURN NUMBER,
  -- ODCIAggregateDelete
  MEMBER FUNCTION ODCIAggregateDelete(self IN OUT matt_hash_aggregate_impl, value raw) RETURN NUMBER  
);

/

CREATE OR REPLACE TYPE BODY matt_hash_aggregate_impl IS

CONSTRUCTOR FUNCTION matt_hash_aggregate_impl(SELF IN OUT NOCOPY matt_hash_aggregate_impl ) RETURN SELF AS RESULT IS
BEGIN
  SELF.hash_value := null;
  RETURN;
END;


STATIC FUNCTION ODCIAggregateInitialize (sctx IN OUT matt_hash_aggregate_impl) RETURN NUMBER IS
BEGIN
  sctx := matt_hash_aggregate_impl ();
  RETURN ODCIConst.Success;
END;


MEMBER FUNCTION ODCIAggregateIterate (self IN OUT matt_hash_aggregate_impl, value IN raw ) RETURN NUMBER IS
BEGIN
  IF self.hash_value IS NULL THEN
    self.hash_value := dbms_crypto.hash(value, dbms_crypto.hash_sh1);
  ELSE 
      self.hash_value := dbms_crypto.hash(self.hash_value || value, dbms_crypto.hash_sh1);
  END IF;
  RETURN ODCIConst.Success;
END;

MEMBER FUNCTION ODCIAggregateTerminate (self IN matt_hash_aggregate_impl, returnValue OUT raw, flags IN NUMBER) RETURN NUMBER IS
BEGIN
  returnValue := dbms_crypto.hash(self.hash_value,dbms_crypto.hash_sh1);
  RETURN ODCIConst.Success;
END;

MEMBER FUNCTION ODCIAggregateMerge (self IN OUT matt_hash_aggregate_impl, ctx2 IN matt_hash_aggregate_impl) RETURN NUMBER IS
BEGIN
    self.hash_value := dbms_crypto.hash(self.hash_value || ctx2.hash_value, dbms_crypto.hash_sh1);
  RETURN ODCIConst.Success;
END;

-- ODCIAggregateDelete
MEMBER FUNCTION ODCIAggregateDelete(self IN OUT matt_hash_aggregate_impl, value raw) RETURN NUMBER IS
BEGIN
  raise_application_error(-20001, 'Invalid operation -- hash aggregate function does not support windowing!');
END;  

END;
/

CREATE OR REPLACE FUNCTION matt_hash_aggregate ( input raw) RETURN raw
PARALLEL_ENABLE AGGREGATE USING matt_hash_aggregate_impl;
/
create table mattmsi as select * from mtl_system_items where rownum <= 200000;
alter table mattmsi add compliance_hash generated always as ( dbms_crypto.hash(to_clob(inventory_item_id || segment1 || last_update_date || created_by || description), 3 /*dbms_crypto.hash_sh1*/) ) VIRTUAL not null ;
create index msi_compliance_hash_n1 on mattmsi (compliance_hash);  
SELECT matt_hash_aggregate(compliance_hash) from (select compliance_hash from mattmsi order by compliance_hash);