Data Redaction (DBMS_REDACT) Enhancements in Oracle Database 23ai/26ai (23.6)
This article demonstrates a number of the enhancements to Data Redaction in Oracle Database 23ai/26ai (23.6).
oracle 23configurationintermediate
by OracleDba
20 views
This article demonstrates a number of the enhancements to Data Redaction in Oracle Database 23ai/26ai (23.6).
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
conn sys/SysPassword1@//localhost:1521/freepdb1 as sysdba
-- drop exists testuser1 cascade;
create user testuser1 identified by testuser1 quota unlimited on users;
grant connect, resource to testuser1;
grant create view to testuser1;
conn testuser1/testuser1@//localhost:1521/freepdb1
--drop table transactions purge;
create table transactions (
id number generated always as identity,
payment number
);
insert into transactions (payment)
values (100.10),
(100.00),
(300.30),
(400.40),
(1000.10);
commit;
conn sys/SysPassword1@//localhost:1521/freepdb1 as sysdba
begin
dbms_redact.add_policy(
object_schema => 'testuser1',
object_name => 'transactions',
column_name => 'payment',
policy_name => 'redact_payment',
function_type => dbms_redact.nullify,
expression => '1=1'
);
end;
/
conn testuser1/testuser1@//localhost:1521/freepdb1
select * from transactions;
ID PAYMENT
---------- ----------
1
2
3
4
5
SQL>123456789101112131415161718192021222324
create or replace view transactions_v as
select sum(payment) sum_payment
from transactions;
select * from transactions_v;
SUM_PAYMENT
-----------
0
SQL>
select *
from (select sum(payment) sum_payment
from transactions);
SUM_PAYMENT
-----------
0
SQL>
ORA-28094: SQL construct not supported by data redaction1234567891011121314
select round(payment) as round_payment, count(*) as amount
from transactions
group by round(payment);
ROUND_PAYMENT AMOUNT
------------- ----------
0 2
0 1
0 1
0 1
SQL>
ORA-00979: not a GROUP BY expression123456789101112131415161718192021222324252627282930313233
select distinct payment
from transactions
order by payment;
PAYMENT
----------
5 rows selected.
SQL>
select distinct trunc(payment)
from transactions
order by trunc(payment);
TRUNC(PAYMENT)
--------------
0
0
0
0
4 rows selected.
SQL>
ORA-01791: not a SELECTed expression1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
select payment from transactions
union all
select level from dual connect by level <= 5;
PAYMENT
----------
0
0
0
0
0
0
0
0
0
0
10 rows selected.
SQL>
select payment from transactions
union all
select level from dual connect by level <= 5;
PAYMENT
----------
1
2
3
4
5
10 rows selected.
SQL>
select *
from (select payment from transactions
union all
select level from dual connect by level <= 5);
PAYMENT
----------
0
0
0
0
0
0
0
0
0
0
10 rows selected.
SQL>
ORA-28094: SQL construct not supported by data redactionPlease to add comments
No comments yet. Be the first to comment!