SlideShare a Scribd company logo
1 of 20
1
12c
2
the focus ...
the day to day stuff
Feature
data redaction
SQL> desc ACCOUNTS
Name Null? Type
----------------------------- -------- ------------
ID NUMBER(8)
NAME VARCHAR2(30)
EMAIL_ADDRESS VARCHAR2(30)
SQL> select * from ACCOUNTS;
ID NAME EMAIL_ADDRESS
-------- -------------------- -------------------
1 Suzanne suzy_q@yahoo.com
2 John Smith john.smith@hotmail.com
...
SQL> begin
2 dbms_redact.add_policy (
3 object_schema => user,
4 object_name => 'ACCOUNTS',
5 column_name => 'EMAIL_ADDRESS',
6 policy_name => 'diddle_email',
7 expression =>
8 q'{SYS_CONTEXT('USERENV','ISDBA')='FALSE'}',
9 function_type => dbms_redact.regexp,
10 regexp_pattern =>
11 dbms_redact.re_pattern_email_address,
12 regexp_replace_string =>
13 dbms_redact.re_redact_email_name,
14 regexp_position => dbms_redact.re_beginning,
15 regexp_occurrence => dbms_redact.re_all
16 );
17 end;
18 /
lots of options here
SQL> conn scott/tiger
Connected.
SQL> select * from ACCOUNTS;
ID NAME EMAIL_ADDRESS
-------- -------------------- -------------------
1 Suzanne xxxx@yahoo.com
2 John Smith xxxx@hotmail.com
...
SQL> conn system/manager
Connected.
SQL> select * from ACCOUNTS;
ID NAME EMAIL_ADDRESS
-------- -------------------- -------------------
1 Suzanne suzy_q@yahoo.com
2 John Smith john.smith@hotmail.com
...
8
examples
SQL> SELECT *
2 FROM demo.customers
3 ORDER BY id;
CUSTOMER_ID CARD_NO CARD_STRING EXPIRY_DA SEC_CODE
----------- ----------------- ------------------- --------- ----------
4000 1234123412341234 1234-1234-1234-1234 05-MAY-16 123
4001 2345234523452345 2345-2345-2345-2345 05-MAY-16 234
4002 3456345634563456 3456-3456-3456-3456 05-MAY-16 345
4003 4567456745674567 4567-4567-4567-4567 05-MAY-16 456
4004 5678567856785678 5678-5678-5678-5678 05-MAY-16 567
SQL> BEGIN
2 DBMS_REDACT.add_policy(
3 object_schema => 'DEMO',
4 object_name => 'CUSTOMERS',
5 column_name => 'CARD_NO',
6 policy_name => 'REDACT_CARD_INFO',
7 function_type => DBMS_REDACT.full,
8 expression => '1=1'
9 );
10 END;
11 /
PL/SQL procedure successfully completed.
SQL> SELECT *
2 FROM demo.customers
3 ORDER BY id;
CUSTOMER_ID CARD_NO CARD_STRING EXPIRY_DA SEC_CODE
----------- ----------------- ------------------- --------- ----------
4000 0 1234-1234-1234-1234 05-MAY-16 123
4001 0 2345-2345-2345-2345 05-MAY-16 234
4002 0 3456-3456-3456-3456 05-MAY-16 345
4003 0 4567-4567-4567-4567 05-MAY-16 456
4004 0 5678-5678-5678-5678 05-MAY-16 567
SQL> BEGIN
2 DBMS_REDACT.alter_policy (
3 object_schema => 'DEMO',
4 object_name => 'CUSTOMERS',
5 column_name => 'CARD_NO',
6 policy_name => 'REDACT_CARD_INFO',
7 action => DBMS_REDACT.modify_column,
8 function_type => DBMS_REDACT.partial,
9 function_parameters => '1,1,12'
10 );
11 END;
12 /
PL/SQL procedure successfully completed.
SQL> SELECT *
2 FROM demo.customers
3 ORDER BY id;
CUSTOMER_ID CARD_NO CARD_STRING EXPIRY_DA SEC_CODE
----------- ----------------- ------------------- --------- ----------
4000 1111111111111234 1234-1234-1234-1234 05-MAY-16 123
4001 1111111111112345 2345-2345-2345-2345 05-MAY-16 234
4002 1111111111113456 3456-3456-3456-3456 05-MAY-16 345
4003 1111111111114567 4567-4567-4567-4567 05-MAY-16 456
4004 1111111111115678 5678-5678-5678-5678 05-MAY-16 567
SQL> BEGIN
2 DBMS_REDACT.alter_policy (
3 object_schema => 'DEMO',
4 object_name => 'CUSTOMERS',
5 column_name => 'CARD_STRING',
6 policy_name => 'REDACT_CARD_INFO',
7 action => DBMS_REDACT.add_column,
8 function_type => DBMS_REDACT.partial,
9 function_parameters => 'VVVVFVVVVFVVVVFVVVV,VVVV-VVVV-VVVV-VVVV,#,1,12'
10 );
11 END;
12 /
PL/SQL procedure successfully completed.
SQL>
SQL> SELECT *
2 FROM demo.customers
3 ORDER BY id;
CUSTOMER_ID CARD_NO CARD_STRING EXPIRY_DA SEC_CODE
----------- ----------------- ------------------- --------- ----------
4000 1111111111111234 ####-####-####-1234 05-MAY-16 123
4001 1111111111112345 ####-####-####-2345 05-MAY-16 234
4002 1111111111113456 ####-####-####-3456 05-MAY-16 345
4003 1111111111114567 ####-####-####-4567 05-MAY-16 456
4004 1111111111115678 ####-####-####-5678 05-MAY-16 567
SQL> BEGIN
2 DBMS_REDACT.alter_policy (
3 object_schema => 'DEMO',
4 object_name => 'CUSTOMERS',
5 column_name => 'EXPIRY_DATE',
6 policy_name => 'REDACT_CARD_INFO',
7 action => DBMS_REDACT.add_column,
8 function_type => DBMS_REDACT.partial,
9 function_parameters => 'm1d1Y'
10 );
11 END;
12 /
PL/SQL procedure successfully completed.
SQL> SELECT *
2 FROM demo.customers
3 ORDER BY id;
CUSTOMER_ID CARD_NO CARD_STRING EXPIRY_DA SEC_CODE
----------- ----------------- ------------------- --------- ----------
4000 1111111111111234 ####-####-####-1234 01-JAN-16 123
4001 1111111111112345 ####-####-####-2345 01-JAN-16 234
4002 1111111111113456 ####-####-####-3456 01-JAN-16 345
4003 1111111111114567 ####-####-####-4567 01-JAN-16 456
4004 1111111111115678 ####-####-####-5678 01-JAN-16 567
14
take care with clients
SQL> desc ACCOUNTS
Name Null? Type
----------------------------- -------- ------------
ID NUMBER(8)
NAME VARCHAR2(30)
EMAIL_ADDRESS VARCHAR2(30)
SQL> declare
2 p_query varchar2(32767)
3 := 'select * from accounts';
4
5 l_cur int := dbms_sql.open_cursor;
6 l_descTbl dbms_sql.desc_tab;
7 l_colCnt number;
8 begin
9 dbms_sql.parse(l_cur,p_query,dbms_sql.native);
10 dbms_sql.describe_columns(l_cur,l_colCnt,l_descTbl);
11
12 for i in 1 .. l_colCnt loop
13 dbms_output.put_line(
14 rpad(l_descTbl(i).col_name,20)||
15 lpad(l_descTbl(i).col_max_len,6));
16 end loop;
17 end;
18 /
ID 22
NAME 30
EMAIL_ADDRESS 4000
17
take care with security
SQL> create or replace
2 procedure HACKER is
3 buf varchar(40);
4 t char;
5 x number;
6 i number;
7 c number;
8 begin
9 i := 0;
10 c := 1;
11 while c < 17 loop
12 select count(*)
13 into x
14 from demo.customers
15 where substr(card_no,c,1)=to_char(i)
16 and customer_id = 4000;
17 if x > 0 then
18 c := c+1; buf := buf || to_char(i); i := 0;
21 else
22 i := i+1;
23 end if;
24 end loop;
25 dbms_output.put_line('CC: ' || buf);
26 end;
Procedure created.
SQL> exec HACKER
CC: 1234123412341234
19
take care with price
12c Mini Lesson - Data Redaction

More Related Content

What's hot

Oracle dbms_xplan.display_cursor format
Oracle dbms_xplan.display_cursor formatOracle dbms_xplan.display_cursor format
Oracle dbms_xplan.display_cursor formatFranck Pachot
 
Connor McDonald 11g for developers
Connor McDonald 11g for developersConnor McDonald 11g for developers
Connor McDonald 11g for developersInSync Conference
 
Permissions script for SQL Permissions
Permissions script for SQL PermissionsPermissions script for SQL Permissions
Permissions script for SQL PermissionsTobias Koprowski
 
Bcdinfo
BcdinfoBcdinfo
Bcdinfovazy12
 

What's hot (6)

Oracle dbms_xplan.display_cursor format
Oracle dbms_xplan.display_cursor formatOracle dbms_xplan.display_cursor format
Oracle dbms_xplan.display_cursor format
 
Connor McDonald 11g for developers
Connor McDonald 11g for developersConnor McDonald 11g for developers
Connor McDonald 11g for developers
 
Permissions script for SQL Permissions
Permissions script for SQL PermissionsPermissions script for SQL Permissions
Permissions script for SQL Permissions
 
Oracle 11g caracteristicas poco documentadas 3 en 1
Oracle 11g caracteristicas poco documentadas 3 en 1Oracle 11g caracteristicas poco documentadas 3 en 1
Oracle 11g caracteristicas poco documentadas 3 en 1
 
Bcdinfo
BcdinfoBcdinfo
Bcdinfo
 
Employ leave dtb
Employ leave dtbEmploy leave dtb
Employ leave dtb
 

Similar to 12c Mini Lesson - Data Redaction

OpenWorld Sep14 12c for_developers
OpenWorld Sep14 12c for_developersOpenWorld Sep14 12c for_developers
OpenWorld Sep14 12c for_developersConnor McDonald
 
Most important "trick" of performance instrumentation
Most important "trick" of performance instrumentationMost important "trick" of performance instrumentation
Most important "trick" of performance instrumentationCary Millsap
 
SQL Macros - Game Changing Feature for SQL Developers?
SQL Macros - Game Changing Feature for SQL Developers?SQL Macros - Game Changing Feature for SQL Developers?
SQL Macros - Game Changing Feature for SQL Developers?Andrej Pashchenko
 
SQLチューニング総合診療Oracle CloudWorld出張所
SQLチューニング総合診療Oracle CloudWorld出張所SQLチューニング総合診療Oracle CloudWorld出張所
SQLチューニング総合診療Oracle CloudWorld出張所Hiroshi Sekiguchi
 
11thingsabout11g 12659705398222 Phpapp01
11thingsabout11g 12659705398222 Phpapp0111thingsabout11g 12659705398222 Phpapp01
11thingsabout11g 12659705398222 Phpapp01Karam Abuataya
 
11 Things About11g
11 Things About11g11 Things About11g
11 Things About11gfcamachob
 
Oracle Database 12c Application Development
Oracle Database 12c Application DevelopmentOracle Database 12c Application Development
Oracle Database 12c Application DevelopmentSaurabh K. Gupta
 
Connor McDonald Partitioning
Connor McDonald PartitioningConnor McDonald Partitioning
Connor McDonald PartitioningInSync Conference
 
UKOUG - 25 years of hints and tips
UKOUG - 25 years of hints and tipsUKOUG - 25 years of hints and tips
UKOUG - 25 years of hints and tipsConnor McDonald
 
OpenWorld 2018 - Common Application Developer Disasters
OpenWorld 2018 - Common Application Developer DisastersOpenWorld 2018 - Common Application Developer Disasters
OpenWorld 2018 - Common Application Developer DisastersConnor McDonald
 
SQL Tuning 101 - Sep 2013
SQL Tuning 101 - Sep 2013SQL Tuning 101 - Sep 2013
SQL Tuning 101 - Sep 2013Connor McDonald
 
Date data type and Globalization in Oracle
Date data type and Globalization in OracleDate data type and Globalization in Oracle
Date data type and Globalization in OracleMasoud Haji Hassan Pour
 
EvolveExecutionPlans.pdf
EvolveExecutionPlans.pdfEvolveExecutionPlans.pdf
EvolveExecutionPlans.pdfPraveenPolu1
 
All on Adaptive and Extended Cursor Sharing
All on Adaptive and Extended Cursor SharingAll on Adaptive and Extended Cursor Sharing
All on Adaptive and Extended Cursor SharingMohamed Houri
 
Managing Statistics for Optimal Query Performance
Managing Statistics for Optimal Query PerformanceManaging Statistics for Optimal Query Performance
Managing Statistics for Optimal Query PerformanceKaren Morton
 

Similar to 12c Mini Lesson - Data Redaction (20)

5 Cool Things About SQL
5 Cool Things About SQL5 Cool Things About SQL
5 Cool Things About SQL
 
OpenWorld Sep14 12c for_developers
OpenWorld Sep14 12c for_developersOpenWorld Sep14 12c for_developers
OpenWorld Sep14 12c for_developers
 
Most important "trick" of performance instrumentation
Most important "trick" of performance instrumentationMost important "trick" of performance instrumentation
Most important "trick" of performance instrumentation
 
SQL Macros - Game Changing Feature for SQL Developers?
SQL Macros - Game Changing Feature for SQL Developers?SQL Macros - Game Changing Feature for SQL Developers?
SQL Macros - Game Changing Feature for SQL Developers?
 
Flashback ITOUG
Flashback ITOUGFlashback ITOUG
Flashback ITOUG
 
SQLチューニング総合診療Oracle CloudWorld出張所
SQLチューニング総合診療Oracle CloudWorld出張所SQLチューニング総合診療Oracle CloudWorld出張所
SQLチューニング総合診療Oracle CloudWorld出張所
 
11thingsabout11g 12659705398222 Phpapp01
11thingsabout11g 12659705398222 Phpapp0111thingsabout11g 12659705398222 Phpapp01
11thingsabout11g 12659705398222 Phpapp01
 
11 Things About11g
11 Things About11g11 Things About11g
11 Things About11g
 
Oracle Database 12c Application Development
Oracle Database 12c Application DevelopmentOracle Database 12c Application Development
Oracle Database 12c Application Development
 
MV sql profile and index
MV sql profile and indexMV sql profile and index
MV sql profile and index
 
Connor McDonald Partitioning
Connor McDonald PartitioningConnor McDonald Partitioning
Connor McDonald Partitioning
 
UKOUG - 25 years of hints and tips
UKOUG - 25 years of hints and tipsUKOUG - 25 years of hints and tips
UKOUG - 25 years of hints and tips
 
OpenWorld 2018 - Common Application Developer Disasters
OpenWorld 2018 - Common Application Developer DisastersOpenWorld 2018 - Common Application Developer Disasters
OpenWorld 2018 - Common Application Developer Disasters
 
SQL Tuning 101 - Sep 2013
SQL Tuning 101 - Sep 2013SQL Tuning 101 - Sep 2013
SQL Tuning 101 - Sep 2013
 
Date data type and Globalization in Oracle
Date data type and Globalization in OracleDate data type and Globalization in Oracle
Date data type and Globalization in Oracle
 
Sql 3
Sql 3Sql 3
Sql 3
 
EvolveExecutionPlans.pdf
EvolveExecutionPlans.pdfEvolveExecutionPlans.pdf
EvolveExecutionPlans.pdf
 
All on Adaptive and Extended Cursor Sharing
All on Adaptive and Extended Cursor SharingAll on Adaptive and Extended Cursor Sharing
All on Adaptive and Extended Cursor Sharing
 
Oracle SQL Tuning
Oracle SQL TuningOracle SQL Tuning
Oracle SQL Tuning
 
Managing Statistics for Optimal Query Performance
Managing Statistics for Optimal Query PerformanceManaging Statistics for Optimal Query Performance
Managing Statistics for Optimal Query Performance
 

More from Connor McDonald

Sangam 19 - PLSQL still the coolest
Sangam 19 - PLSQL still the coolestSangam 19 - PLSQL still the coolest
Sangam 19 - PLSQL still the coolestConnor McDonald
 
Sangam 19 - Analytic SQL
Sangam 19 - Analytic SQLSangam 19 - Analytic SQL
Sangam 19 - Analytic SQLConnor McDonald
 
Sangam 19 - Successful Applications on Autonomous
Sangam 19 - Successful Applications on AutonomousSangam 19 - Successful Applications on Autonomous
Sangam 19 - Successful Applications on AutonomousConnor McDonald
 
Sangam 2019 - The Latest Features
Sangam 2019 - The Latest FeaturesSangam 2019 - The Latest Features
Sangam 2019 - The Latest FeaturesConnor McDonald
 
UKOUG 2019 - SQL features
UKOUG 2019 - SQL featuresUKOUG 2019 - SQL features
UKOUG 2019 - SQL featuresConnor McDonald
 
APEX tour 2019 - successful development with autonomous
APEX tour 2019 - successful development with autonomousAPEX tour 2019 - successful development with autonomous
APEX tour 2019 - successful development with autonomousConnor McDonald
 
APAC Groundbreakers 2019 - Perth/Melbourne
APAC Groundbreakers 2019 - Perth/Melbourne APAC Groundbreakers 2019 - Perth/Melbourne
APAC Groundbreakers 2019 - Perth/Melbourne Connor McDonald
 
OOW19 - Flashback, not just for DBAs
OOW19 - Flashback, not just for DBAsOOW19 - Flashback, not just for DBAs
OOW19 - Flashback, not just for DBAsConnor McDonald
 
OOW19 - Read consistency
OOW19 - Read consistencyOOW19 - Read consistency
OOW19 - Read consistencyConnor McDonald
 
OOW19 - Slower and less secure applications
OOW19 - Slower and less secure applicationsOOW19 - Slower and less secure applications
OOW19 - Slower and less secure applicationsConnor McDonald
 
OOW19 - Killing database sessions
OOW19 - Killing database sessionsOOW19 - Killing database sessions
OOW19 - Killing database sessionsConnor McDonald
 
OOW19 - Ten Amazing SQL features
OOW19 - Ten Amazing SQL featuresOOW19 - Ten Amazing SQL features
OOW19 - Ten Amazing SQL featuresConnor McDonald
 
Latin America Tour 2019 - 18c and 19c featues
Latin America Tour 2019   - 18c and 19c featuesLatin America Tour 2019   - 18c and 19c featues
Latin America Tour 2019 - 18c and 19c featuesConnor McDonald
 
Latin America tour 2019 - Flashback
Latin America tour 2019 -  FlashbackLatin America tour 2019 -  Flashback
Latin America tour 2019 - FlashbackConnor McDonald
 
Latin America Tour 2019 - 10 great sql features
Latin America Tour 2019  - 10 great sql featuresLatin America Tour 2019  - 10 great sql features
Latin America Tour 2019 - 10 great sql featuresConnor McDonald
 
Latin America Tour 2019 - pattern matching
Latin America Tour 2019 - pattern matchingLatin America Tour 2019 - pattern matching
Latin America Tour 2019 - pattern matchingConnor McDonald
 
Latin America Tour 2019 - slow data and sql processing
Latin America Tour 2019  - slow data and sql processingLatin America Tour 2019  - slow data and sql processing
Latin America Tour 2019 - slow data and sql processingConnor McDonald
 
OG Yatra - upgrading to the new 12c+ optimizer
OG Yatra - upgrading to the new 12c+ optimizerOG Yatra - upgrading to the new 12c+ optimizer
OG Yatra - upgrading to the new 12c+ optimizerConnor McDonald
 
OG Yatra - 25 years of hints and tips
OG Yatra - 25 years of hints and tipsOG Yatra - 25 years of hints and tips
OG Yatra - 25 years of hints and tipsConnor McDonald
 

More from Connor McDonald (20)

Sangam 19 - PLSQL still the coolest
Sangam 19 - PLSQL still the coolestSangam 19 - PLSQL still the coolest
Sangam 19 - PLSQL still the coolest
 
Sangam 19 - Analytic SQL
Sangam 19 - Analytic SQLSangam 19 - Analytic SQL
Sangam 19 - Analytic SQL
 
Sangam 19 - Successful Applications on Autonomous
Sangam 19 - Successful Applications on AutonomousSangam 19 - Successful Applications on Autonomous
Sangam 19 - Successful Applications on Autonomous
 
Sangam 2019 - The Latest Features
Sangam 2019 - The Latest FeaturesSangam 2019 - The Latest Features
Sangam 2019 - The Latest Features
 
UKOUG 2019 - SQL features
UKOUG 2019 - SQL featuresUKOUG 2019 - SQL features
UKOUG 2019 - SQL features
 
APEX tour 2019 - successful development with autonomous
APEX tour 2019 - successful development with autonomousAPEX tour 2019 - successful development with autonomous
APEX tour 2019 - successful development with autonomous
 
APAC Groundbreakers 2019 - Perth/Melbourne
APAC Groundbreakers 2019 - Perth/Melbourne APAC Groundbreakers 2019 - Perth/Melbourne
APAC Groundbreakers 2019 - Perth/Melbourne
 
OOW19 - Flashback, not just for DBAs
OOW19 - Flashback, not just for DBAsOOW19 - Flashback, not just for DBAs
OOW19 - Flashback, not just for DBAs
 
OOW19 - Read consistency
OOW19 - Read consistencyOOW19 - Read consistency
OOW19 - Read consistency
 
OOW19 - Slower and less secure applications
OOW19 - Slower and less secure applicationsOOW19 - Slower and less secure applications
OOW19 - Slower and less secure applications
 
OOW19 - Killing database sessions
OOW19 - Killing database sessionsOOW19 - Killing database sessions
OOW19 - Killing database sessions
 
OOW19 - Ten Amazing SQL features
OOW19 - Ten Amazing SQL featuresOOW19 - Ten Amazing SQL features
OOW19 - Ten Amazing SQL features
 
Latin America Tour 2019 - 18c and 19c featues
Latin America Tour 2019   - 18c and 19c featuesLatin America Tour 2019   - 18c and 19c featues
Latin America Tour 2019 - 18c and 19c featues
 
Latin America tour 2019 - Flashback
Latin America tour 2019 -  FlashbackLatin America tour 2019 -  Flashback
Latin America tour 2019 - Flashback
 
Latin America Tour 2019 - 10 great sql features
Latin America Tour 2019  - 10 great sql featuresLatin America Tour 2019  - 10 great sql features
Latin America Tour 2019 - 10 great sql features
 
Latin America Tour 2019 - pattern matching
Latin America Tour 2019 - pattern matchingLatin America Tour 2019 - pattern matching
Latin America Tour 2019 - pattern matching
 
Latin America Tour 2019 - slow data and sql processing
Latin America Tour 2019  - slow data and sql processingLatin America Tour 2019  - slow data and sql processing
Latin America Tour 2019 - slow data and sql processing
 
ANSI vs Oracle language
ANSI vs Oracle languageANSI vs Oracle language
ANSI vs Oracle language
 
OG Yatra - upgrading to the new 12c+ optimizer
OG Yatra - upgrading to the new 12c+ optimizerOG Yatra - upgrading to the new 12c+ optimizer
OG Yatra - upgrading to the new 12c+ optimizer
 
OG Yatra - 25 years of hints and tips
OG Yatra - 25 years of hints and tipsOG Yatra - 25 years of hints and tips
OG Yatra - 25 years of hints and tips
 

Recently uploaded

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 

Recently uploaded (20)

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 

12c Mini Lesson - Data Redaction

  • 2. 2 the focus ... the day to day stuff
  • 4. SQL> desc ACCOUNTS Name Null? Type ----------------------------- -------- ------------ ID NUMBER(8) NAME VARCHAR2(30) EMAIL_ADDRESS VARCHAR2(30) SQL> select * from ACCOUNTS; ID NAME EMAIL_ADDRESS -------- -------------------- ------------------- 1 Suzanne suzy_q@yahoo.com 2 John Smith john.smith@hotmail.com ...
  • 5. SQL> begin 2 dbms_redact.add_policy ( 3 object_schema => user, 4 object_name => 'ACCOUNTS', 5 column_name => 'EMAIL_ADDRESS', 6 policy_name => 'diddle_email', 7 expression => 8 q'{SYS_CONTEXT('USERENV','ISDBA')='FALSE'}', 9 function_type => dbms_redact.regexp, 10 regexp_pattern => 11 dbms_redact.re_pattern_email_address, 12 regexp_replace_string => 13 dbms_redact.re_redact_email_name, 14 regexp_position => dbms_redact.re_beginning, 15 regexp_occurrence => dbms_redact.re_all 16 ); 17 end; 18 / lots of options here
  • 6. SQL> conn scott/tiger Connected. SQL> select * from ACCOUNTS; ID NAME EMAIL_ADDRESS -------- -------------------- ------------------- 1 Suzanne xxxx@yahoo.com 2 John Smith xxxx@hotmail.com ...
  • 7. SQL> conn system/manager Connected. SQL> select * from ACCOUNTS; ID NAME EMAIL_ADDRESS -------- -------------------- ------------------- 1 Suzanne suzy_q@yahoo.com 2 John Smith john.smith@hotmail.com ...
  • 9. SQL> SELECT * 2 FROM demo.customers 3 ORDER BY id; CUSTOMER_ID CARD_NO CARD_STRING EXPIRY_DA SEC_CODE ----------- ----------------- ------------------- --------- ---------- 4000 1234123412341234 1234-1234-1234-1234 05-MAY-16 123 4001 2345234523452345 2345-2345-2345-2345 05-MAY-16 234 4002 3456345634563456 3456-3456-3456-3456 05-MAY-16 345 4003 4567456745674567 4567-4567-4567-4567 05-MAY-16 456 4004 5678567856785678 5678-5678-5678-5678 05-MAY-16 567
  • 10. SQL> BEGIN 2 DBMS_REDACT.add_policy( 3 object_schema => 'DEMO', 4 object_name => 'CUSTOMERS', 5 column_name => 'CARD_NO', 6 policy_name => 'REDACT_CARD_INFO', 7 function_type => DBMS_REDACT.full, 8 expression => '1=1' 9 ); 10 END; 11 / PL/SQL procedure successfully completed. SQL> SELECT * 2 FROM demo.customers 3 ORDER BY id; CUSTOMER_ID CARD_NO CARD_STRING EXPIRY_DA SEC_CODE ----------- ----------------- ------------------- --------- ---------- 4000 0 1234-1234-1234-1234 05-MAY-16 123 4001 0 2345-2345-2345-2345 05-MAY-16 234 4002 0 3456-3456-3456-3456 05-MAY-16 345 4003 0 4567-4567-4567-4567 05-MAY-16 456 4004 0 5678-5678-5678-5678 05-MAY-16 567
  • 11. SQL> BEGIN 2 DBMS_REDACT.alter_policy ( 3 object_schema => 'DEMO', 4 object_name => 'CUSTOMERS', 5 column_name => 'CARD_NO', 6 policy_name => 'REDACT_CARD_INFO', 7 action => DBMS_REDACT.modify_column, 8 function_type => DBMS_REDACT.partial, 9 function_parameters => '1,1,12' 10 ); 11 END; 12 / PL/SQL procedure successfully completed. SQL> SELECT * 2 FROM demo.customers 3 ORDER BY id; CUSTOMER_ID CARD_NO CARD_STRING EXPIRY_DA SEC_CODE ----------- ----------------- ------------------- --------- ---------- 4000 1111111111111234 1234-1234-1234-1234 05-MAY-16 123 4001 1111111111112345 2345-2345-2345-2345 05-MAY-16 234 4002 1111111111113456 3456-3456-3456-3456 05-MAY-16 345 4003 1111111111114567 4567-4567-4567-4567 05-MAY-16 456 4004 1111111111115678 5678-5678-5678-5678 05-MAY-16 567
  • 12. SQL> BEGIN 2 DBMS_REDACT.alter_policy ( 3 object_schema => 'DEMO', 4 object_name => 'CUSTOMERS', 5 column_name => 'CARD_STRING', 6 policy_name => 'REDACT_CARD_INFO', 7 action => DBMS_REDACT.add_column, 8 function_type => DBMS_REDACT.partial, 9 function_parameters => 'VVVVFVVVVFVVVVFVVVV,VVVV-VVVV-VVVV-VVVV,#,1,12' 10 ); 11 END; 12 / PL/SQL procedure successfully completed. SQL> SQL> SELECT * 2 FROM demo.customers 3 ORDER BY id; CUSTOMER_ID CARD_NO CARD_STRING EXPIRY_DA SEC_CODE ----------- ----------------- ------------------- --------- ---------- 4000 1111111111111234 ####-####-####-1234 05-MAY-16 123 4001 1111111111112345 ####-####-####-2345 05-MAY-16 234 4002 1111111111113456 ####-####-####-3456 05-MAY-16 345 4003 1111111111114567 ####-####-####-4567 05-MAY-16 456 4004 1111111111115678 ####-####-####-5678 05-MAY-16 567
  • 13. SQL> BEGIN 2 DBMS_REDACT.alter_policy ( 3 object_schema => 'DEMO', 4 object_name => 'CUSTOMERS', 5 column_name => 'EXPIRY_DATE', 6 policy_name => 'REDACT_CARD_INFO', 7 action => DBMS_REDACT.add_column, 8 function_type => DBMS_REDACT.partial, 9 function_parameters => 'm1d1Y' 10 ); 11 END; 12 / PL/SQL procedure successfully completed. SQL> SELECT * 2 FROM demo.customers 3 ORDER BY id; CUSTOMER_ID CARD_NO CARD_STRING EXPIRY_DA SEC_CODE ----------- ----------------- ------------------- --------- ---------- 4000 1111111111111234 ####-####-####-1234 01-JAN-16 123 4001 1111111111112345 ####-####-####-2345 01-JAN-16 234 4002 1111111111113456 ####-####-####-3456 01-JAN-16 345 4003 1111111111114567 ####-####-####-4567 01-JAN-16 456 4004 1111111111115678 ####-####-####-5678 01-JAN-16 567
  • 14. 14 take care with clients
  • 15. SQL> desc ACCOUNTS Name Null? Type ----------------------------- -------- ------------ ID NUMBER(8) NAME VARCHAR2(30) EMAIL_ADDRESS VARCHAR2(30)
  • 16. SQL> declare 2 p_query varchar2(32767) 3 := 'select * from accounts'; 4 5 l_cur int := dbms_sql.open_cursor; 6 l_descTbl dbms_sql.desc_tab; 7 l_colCnt number; 8 begin 9 dbms_sql.parse(l_cur,p_query,dbms_sql.native); 10 dbms_sql.describe_columns(l_cur,l_colCnt,l_descTbl); 11 12 for i in 1 .. l_colCnt loop 13 dbms_output.put_line( 14 rpad(l_descTbl(i).col_name,20)|| 15 lpad(l_descTbl(i).col_max_len,6)); 16 end loop; 17 end; 18 / ID 22 NAME 30 EMAIL_ADDRESS 4000
  • 17. 17 take care with security
  • 18. SQL> create or replace 2 procedure HACKER is 3 buf varchar(40); 4 t char; 5 x number; 6 i number; 7 c number; 8 begin 9 i := 0; 10 c := 1; 11 while c < 17 loop 12 select count(*) 13 into x 14 from demo.customers 15 where substr(card_no,c,1)=to_char(i) 16 and customer_id = 4000; 17 if x > 0 then 18 c := c+1; buf := buf || to_char(i); i := 0; 21 else 22 i := i+1; 23 end if; 24 end loop; 25 dbms_output.put_line('CC: ' || buf); 26 end; Procedure created. SQL> exec HACKER CC: 1234123412341234