{"id":112048,"date":"2026-08-17T12:00:00","date_gmt":"2026-08-17T12:00:00","guid":{"rendered":"https:\/\/www.red-gate.com\/simple-talk\/?p=112048"},"modified":"2026-08-03T15:55:26","modified_gmt":"2026-08-03T15:55:26","slug":"how-to-implement-deep-data-security-deepsec-in-oracle-26ai-complete-step-by-step-guide-part-one","status":"publish","type":"post","link":"https:\/\/www.red-gate.com\/simple-talk\/databases\/oracle-databases\/how-to-implement-deep-data-security-deepsec-in-oracle-26ai-complete-step-by-step-guide-part-one\/","title":{"rendered":"How to implement Deep Data Security (DeepSec) in Oracle 26ai: complete step-by-step guide (part one)"},"content":{"rendered":"\n<p>So you\u2019ve been tasked with deploying a Generative AI, <a href=\"https:\/\/www.red-gate.com\/simple-talk\/ai\/how-to-stop-ai-hallucinations-in-enterprise-rag-systems-a-complete-guide\/\" target=\"_blank\" rel=\"noreferrer noopener\">RAG (retrieval-augmented generation)<\/a>, or Agentic AI application. Have you thought about how to secure your most sensitive <a href=\"https:\/\/www.ibm.com\/think\/topics\/structured-vs-unstructured-data\" target=\"_blank\" rel=\"noreferrer noopener\">structured data<\/a> &#8211; as well as your vectorized <em>unstructured<\/em> data? <\/p>\n\n\n\n<p><strong>The good news is, it\u2019s relatively simple to implement complex security policies through the latest release \u00adof <a href=\"https:\/\/blogs.oracle.com\/database\/oracle-deep-data-security-is-now-available-in-oracle-ai-database-26ai\" target=\"_blank\" rel=\"noreferrer noopener\">Oracle Database 26ai Deep Data Security (DeepSec)<\/a>.<\/strong> <\/p>\n\n\n\n<p><strong>In this guide, part one of <a href=\"https:\/\/www.red-gate.com\/simple-talk\/collections\/oracle-26ai-deep-data-security-deepsec-the-complete-guide\/\" target=\"_blank\" rel=\"noreferrer noopener\">my Oracle 26ai Deep Data Security (DeepSec) series<\/a>, I&#8217;ll show you how &#8211; and will explain everything you need to know along the way.<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-welcome-to-a-security-nightmare\">Welcome to a security nightmare <\/h2>\n\n\n\n<p>Imagine this scenario. You\u2019re the only <a href=\"https:\/\/www.red-gate.com\/simple-talk\/databases\/oracle-databases\/\" target=\"_blank\" rel=\"noreferrer noopener\">Oracle<\/a> DBA on a team of seasoned application developers, and you\u2019ve just received a new mandate from the Chief of Police. Passed down from the new Mayor, the mandate involves implementing an AI-enabled chatbot that\u2019ll access public and private information about crimes committed within the City.<\/p>\n\n\n\n<p>The Chief wants to make it simpler for authorized personnel &#8211; such as district commanders, detectives, cops on the beat, criminologists, reporters, etc &#8211; to review data on crimes dating back to 2001. The Chief also knows that there is sensitive data within the <em>current<\/em> database that not everyone should see. <\/p>\n\n\n\n<p>So, he needs you to guarantee one thing: only law enforcement personnel with proper permissions and clearances should see that information.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-how-do-you-achieve-this-level-of-privacy\">How do you achieve this level of privacy?<\/h3>\n\n\n\n<p>The basic <a href=\"https:\/\/www.red-gate.com\/blog\/how-to-use-er-diagram\/\" target=\"_blank\" rel=\"noreferrer noopener\">ERD (entity relationship diagram)<\/a> below shows how crime data is organized within the CPD schema. The callouts illustrate the complexity of the <a href=\"https:\/\/www.red-gate.com\/simple-talk\/data-security-privacy-compliance\/\" target=\"_blank\" rel=\"noreferrer noopener\">data security<\/a> policies you\u2019ll need to implement to ensure each user only sees the data they\u2019re permitted to see.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"938\" height=\"537\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-16.png\" alt=\"An image showing Chicago Police Department (CPD) schema and security requirements.\" class=\"wp-image-112049\" srcset=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-16.png 938w, https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-16-300x172.png 300w, https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-16-768x440.png 768w\" sizes=\"auto, (max-width: 938px) 100vw, 938px\" \/><figcaption class=\"wp-element-caption\"><em>Chicago Police Department (CPD) schema and security requirements.<\/em><\/figcaption><\/figure>\n\n\n\n<p>Implementing data security requirements already looks a bit tricky, even with only five database objects.\u00a0Now imagine how difficult it would be to build a comprehensive <a href=\"https:\/\/www.red-gate.com\/simple-talk\/databases\/sql-server\/security\/securing-your-databases-in-2026-best-practices-for-the-evolving-threat-landscape\/\" target=\"_blank\" rel=\"noreferrer noopener\">security strategy<\/a> with only a series of database views that restrict viewing of specific <em>rows<\/em> within some tables for each user, based on which police district(s) they&#8217;re currently assigned to. <\/p>\n\n\n\n<p>All while simultaneously hiding content of specific <em>columns<\/em> within <em>other<\/em> <em>tables<\/em>, of course.<\/p>\n\n\n\n<p>Another crucial requirement is the ability to <em>immediately<\/em> <em>reassign<\/em> security privileges whenever a law enforcement officer (LEO) needs to urgently view data. <\/p>\n\n\n\n<p>Perhaps they&#8217;ve been assigned to investigating crimes in one or more police district, or they&#8217;re restricted from viewing crime data that\u2019s been marked as sensitive, secret, or confidential. They now need access to the data, and fast.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-what-about-when-it-all-goes-wrong\">What about when it all goes wrong?<\/h3>\n\n\n\n<p>We\u2019ve all watched enough police procedurals to know what happens when it goes wrong for a LEO. Let&#8217;s say, for example, they&#8217;re suddenly under investigation for bribery. The immediate result? They need to be blocked &#8211; urgently &#8211; from seeing internal affair reports on their potentially illicit activity.<\/p>\n\n\n\n<p>What about a copper whose close friend has been accused of domestic violence? Perhaps the friend wants to find out what particulars their victim has reported? Worse still, maybe even find out in which shelter the victim now resides?<\/p>\n\n\n\n<p><strong>In all of these cases, the implications of poor security administration are potentially devasting. Fortunately, you&#8217;re reading this article, so the answer is simple. You must implement Oracle 26ai Deep Data Security (DeepSec).<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-why-data-security-is-a-complex-web-of-limiting-access\">Why data security is a complex web of limiting access<\/h2>\n\n\n\n<p>I first began investigating Oracle database security features a few years ago, during a stint as DBA for an <a href=\"https:\/\/docs.oracle.com\/en\/database\/oracle\/oracle-database\/19\/\" target=\"_blank\" rel=\"noreferrer noopener\">Oracle Database 19c<\/a> project. The DBA team I advised needed to implement a sure-fire method to limit users from viewing or changing data they shouldn\u2019t.<\/p>\n\n\n\n<p>The team had already attempted to implement <a href=\"https:\/\/www.red-gate.com\/simple-talk\/databases\/oracle-databases\/virtual-private-database-part-1\/\" target=\"_blank\" rel=\"noreferrer noopener\">Virtual Private Database (VPD)<\/a>, but with limited success. They&#8217;d rolled back their efforts after extreme frustration, and with good reason. Their complex data security requirements spanned <em>dozens<\/em> of tables, views, and <a href=\"https:\/\/www.red-gate.com\/simple-talk\/databases\/oracle-databases\/introduction-to-materialized-views-query-rewrite\/\" target=\"_blank\" rel=\"noreferrer noopener\">materialized views<\/a> across multiple schemas.<\/p>\n\n\n\n<p>After some research, I helped them prototype a new security model using <a href=\"https:\/\/docs.oracle.com\/en\/database\/oracle\/oracle-database\/21\/dbfsg\/indroducing-oracle-database-real-application-security.html\" target=\"_blank\" rel=\"noreferrer noopener\">Real Application Security (RAS)<\/a>, VPD&#8217;s successor.<\/p>\n\n\n\n<p>We also needed to tackle unexpected issues to implement RAS. We needed it to enforce <a href=\"https:\/\/www.red-gate.com\/simple-talk\/databases\/sql-server\/sql-server-row-level-security-introduction\/\" target=\"_blank\" rel=\"noreferrer noopener\">row-level<\/a> and column-level security within several robust and complex <a href=\"https:\/\/www.oracle.com\/apex\/\" target=\"_blank\" rel=\"noreferrer noopener\">Application Express (APEX)<\/a> applications. It didn\u2019t help that, at the time, reliable documentation on how to integrate RAS with APEX was lacking.<\/p>\n\n\n\n<section id=\"my-first-block-block_06ce2e4fd63e5e3ba50362b86619d749\" class=\"my-first-block alignwide\">\n    <div class=\"bg-brand-600 text-base-white py-5xl px-4xl rounded-sm bg-gradient-to-r from-brand-600 to-brand-500 red\">\n        <div class=\"gap-4xl items-start md:items-center flex flex-col md:flex-row justify-between\">\n            <div class=\"flex-1 col-span-10 lg:col-span-7\">\n                <h3 class=\"mt-0 font-display mb-2 text-display-sm\">Protect your data. Demonstrate compliance.<\/h3>\n                <div class=\"child:last-of-type:mb-0\">\n                                            With Redgate, stay ahead of threats with real-time monitoring and alerts, protect sensitive data with automated discovery &#038; masking, and demonstrate compliance with traceability across every environment.                                    <\/div>\n            <\/div>\n                                            <a href=\"https:\/\/www.red-gate.com\/solutions\/use-cases\/security-and-compliance\/\" class=\"btn btn--secondary btn--lg\" aria-label=\"Learn more: Protect your data. Demonstrate compliance.\">Learn more<\/a>\n                    <\/div>\n    <\/div>\n<\/section>\n\n\n<h3 class=\"wp-block-heading\" id=\"h-that-wasn-t-all\">That wasn&#8217;t all&#8230;<\/h3>\n\n\n\n<p>There was one final wrinkle &#8211; my client\u2019s user base, which also included several \u201cpower users\u201d. These users typically used either <a href=\"https:\/\/en.wikipedia.org\/wiki\/SQL_Plus\" target=\"_blank\" rel=\"noreferrer noopener\">SQL*Plus<\/a> or <a href=\"https:\/\/www.red-gate.com\/simple-talk\/databases\/oracle-databases\/sql-developer-a-great-tool-and-better-ways-to-use-it\/\" target=\"_blank\" rel=\"noreferrer noopener\">SQL Developer<\/a> to access their production database directly. They would then extract data in read-only mode for their own <a href=\"https:\/\/www.red-gate.com\/simple-talk\/databases\/sql-server\/data-warehouse-load-patterns\/\" target=\"_blank\" rel=\"noreferrer noopener\">data warehouses<\/a> or analytics. This meant we had to configure these power users as external RAS users.<\/p>\n\n\n\n<p>Further, my client didn\u2019t have the funding (or expertise) to set up an <a href=\"https:\/\/curity.io\/resources\/learn\/identity-management-system\/\" target=\"_blank\" rel=\"noreferrer noopener\">identity management system<\/a> like Microsoft Active Directory (AD) or <a href=\"https:\/\/www.oracle.com\/uk\/security\/identity-management\/\" target=\"_blank\" rel=\"noreferrer noopener\">Oracle Identity Access Management (IAM)<\/a>. We therefore had to rebuild the security control mechanisms that were stored within their central database.<\/p>\n\n\n\n<p>Last year I wrote about <a href=\"https:\/\/blog.viscosityna.com\/twelve-days-of-christmas-26ai\/on-the-fourth-day-of-26ai-viscosity-gave-to-me\" target=\"_blank\" rel=\"noreferrer noopener\">how RAS would be deployed in this scenario for the CPD schema within an Oracle 26ai database<\/a>. I followed it up by <a href=\"https:\/\/blog.viscosityna.com\/twelve-days-of-christmas-26ai\/on-the-fifth-day-of-26ai-viscosity-gave-to-me\" target=\"_blank\" rel=\"noreferrer noopener\">explaining how RAS worked in concert with an AI chatbot deployed through Oracle APEX to limit end users from viewing outside their range of privileges<\/a>.<\/p>\n\n\n\n<p>That\u2019s a good counterpoint to what I\u2019ll be showing in this article, as well as future entries in the series. I suggest having a look at them before reading on.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-how-to-implement-oracle-deepsec\">How to implement Oracle DeepSec<\/h2>\n\n\n\n<p>The good news is, if you\u2019re working with <a href=\"https:\/\/docs.oracle.com\/en\/database\/oracle\/apex\/24.2\/\" target=\"_blank\" rel=\"noreferrer noopener\">APEX 24.2<\/a> <em>and<\/em> Oracle Database 26ai, DeepSec is easy to implement. It&#8217;s also perfect for limiting access to data at both the row and column level with APEX applications.<\/p>\n\n\n\n<p>Let&#8217;s focus on a typical workflow (below) to implement Oracle DeepSec. I&#8217;ll run through the whole process step-by-step, in detail.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"936\" height=\"495\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image.gif\" alt=\"An image showing a Oracle DeepSec implementation strategy.\" class=\"wp-image-112050\"\/><figcaption class=\"wp-element-caption\"><em>Oracle DeepSec implementation strategy<\/em>.<\/figcaption><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-prerequisites-and-assumptions-before-getting-started\">Prerequisites and assumptions before getting started<\/h3>\n\n\n\n<p>The rest of this article assumes the following prerequisite steps have already been completed:<\/p>\n\n\n<div class=\"block-core-list\">\n<ul class=\"wp-block-list\">\n<li>A <a href=\"https:\/\/docs.oracle.com\/en\/cloud\/paas\/autonomous-database\/serverless\/adbsb\/autonomous-always-free-23ai.html\" target=\"_blank\" rel=\"noreferrer noopener\">26ai Autonomous Database (ADB)<\/a> has already been created. It must be patched to version 23.26.2 to enable DeepSec features.<br><br><\/li>\n\n\n\n<li>The CPD schema has already been created, populated with data, and all constraints and indexes have been applied. <em>You can review the scripts to create and populate the CPD schema from this <a href=\"http:\/\/jimthewhyguy.com\/repository\/CPD_\" target=\"_blank\" rel=\"noreferrer noopener\">Github repository<\/a>.<\/em><\/li>\n<\/ul>\n<\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"h-how-to-set-oracle-deepsec-user-limits-step-1\">How to set Oracle DeepSec user limits (step 1)<\/h3>\n\n\n\n<p><strong>First, create a new table (called it <code>DEEPSEC_SECURED_USERS<\/code>) within the CPD schema. <\/strong><\/p>\n\n\n\n<p>This is to hold specific security permissions and other information about each application user:<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:tsql decode:true \">DROP TABLE IF EXISTS cpd.deepsec_secured_users PURGE;\nCREATE TABLE IF NOT EXISTS cpd.deepsec_secured_users(\n    rsu_username  VARCHAR2(25)  NOT NULL\n   ,rsu_keytype   VARCHAR2(12)  NOT NULL\n   ,rsu_keyvalue  VARCHAR2(12)  NOT NULL\n   ,rsu_comment   VARCHAR2(128) \n);\n\nALTER TABLE cpd.deepsec_secured_users\n  ADD CONSTRAINT deepsec_secured_users_pk\n  PRIMARY KEY (rsu_username, rsu_keytype, rsu_keyvalue)\n  USING INDEX (\n    CREATE UNIQUE INDEX cpd.deepsec_secured_users_pk_idx\n        ON cpd.deepsec_secured_users (rsu_username, rsu_keytype, rsu_keyvalue)\n    );<\/pre><\/div>\n\n\n\n<p>You&#8217;ll need to populate this control table with data for each user, like what I did below:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"847\" height=\"1024\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-17-847x1024.png\" alt=\"A table showing end user permissions.\" class=\"wp-image-112051\" srcset=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-17-847x1024.png 847w, https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-17-248x300.png 248w, https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-17-768x928.png 768w, https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-17.png 939w\" sizes=\"auto, (max-width: 847px) 100vw, 847px\" \/><figcaption class=\"wp-element-caption\"><em>End user permissions. Note that only a few entries are shown here.<\/em><\/figcaption><\/figure>\n\n\n<div class=\"block-core-list\">\n<ul class=\"wp-block-list\">\n<li>In this example, <code>LSNELLING<\/code> is the current Chief of Police. They have access to data from <em>all<\/em> CPD Districts, permission to view data in <em>all<\/em> columns, and permission to view rows at <em>all<\/em> four security levels.<br><br><\/li>\n\n\n\n<li>Meanwhile, research assistant <code>SNGUYEN<\/code> only has access to data in a few districts &#8211; but <em>can<\/em> see report information at all four security levels.<br><br><\/li>\n\n\n\n<li>User <code>WJACKSON<\/code> has extremely limited permissions as they\u2019ve recently been reassigned to a new district due to ongoing Internal Affairs investigations.<br><br><\/li>\n\n\n\n<li>Finally, <code>NKURCHAWSKA<\/code> is a student research assistant so has very limited privileges for just a few districts. They also can&#8217;t view any detailed report information.<\/li>\n<\/ul>\n<\/div>\n\n\n<p>Now, it&#8217;s on to creating Oracle DeepSec end users.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-how-to-create-oracle-deepsec-end-users-step-2\">How to create Oracle DeepSec end users (step 2)<\/h3>\n\n\n\n<p>Since I\u2019m working on an OCI-based 26ai autonomous database, for this example I\u2019ll use the <code>ADMIN<\/code> account as my Oracle DeepSec administrator account. However, if you want to further isolate security administration to another user, you could also create a separate account &#8211; say, <code>SECADM<\/code> for my example.<\/p>\n\n\n\n<p><strong>On how to create Oracle DeepSec end users, you must firstly create DeepSec user accounts for each of them using the <code>CREATE END USER<\/code> command.<\/strong> Here&#8217;s how that works with my four example users:<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:tsql decode:true \">CREATE END USER \"LSNELLING\"   IDENTIFIED BY \"S3c-re_P5w0rd\";\nCREATE END USER \"NKURCHAWSKA\" IDENTIFIED BY \"S3c-re_P5w0rd\";\nCREATE END USER \"SNGUYEN\"     IDENTIFIED BY \"S3c-re_P5w0rd\";\nCREATE END USER \"WJACKSON     IDENTIFIED BY \"S3c-re_P5w0rd\"; <\/pre><\/div>\n\n\n\n<p>It\u2019s important to note these are not regular <em>database<\/em> user accounts &#8211; they are specific to DeepSec security only. You use these DeepSec user accounts to connect to your database. It&#8217;s the same whether you&#8217;re using <a href=\"https:\/\/www.red-gate.com\/simple-talk\/databases\/oracle-databases\/sqlcl-the-new-challenger-for-the-sql-plus-crown\/\" target=\"_blank\" rel=\"noreferrer noopener\">SQLcl<\/a>, SQL*Plus, SQLDeveloper, or another database application written in APEX, <a href=\"https:\/\/www.red-gate.com\/simple-talk\/development\/dotnet-development\/10-reasons-python-better-than-c-sharp\/\" target=\"_blank\" rel=\"noreferrer noopener\">Python<\/a>, or Java.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-how-to-create-database-roles-in-oracle-deepsec-step-3\">How to create database roles in Oracle DeepSec (step 3)<\/h3>\n\n\n\n<p><strong>To grant Oracle DeepSec access to specific tables within a schema, you need to create database roles that grant the required system privileges and different levels of access to database objects.<\/strong><\/p>\n\n\n\n<p>For my example, I created the following three database roles within the CPD schema:<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:tsql decode:true \">-- Create a standard database role allowing CREATE SESSION access only \nCREATE ROLE adb_connect; \nGRANT CREATE SESSION TO adb_connect;\n\n-- Create a standard database role for read-only access to fact tables \nCREATE ROLE cpd_readonly; \nGRANT adb_connect TO cpd_readonly; \nGRANT SELECT ON cpd.cpd_districts TO cpd_readonly; \nGRANT SELECT ON cpd.iucr_codes TO cpd_readonly; \nGRANT SELECT ON cpd.leo_resources TO cpd_readonly; \nGRANT SELECT ON cpd.ods_secured_users TO cpd_readonly;\n\n-- Create a standard database role for full DML access to fact tables \nCREATE ROLE cpd_fulldml; \nGRANT adb_connect TO cpd_fulldml; \nGRANT cpd_readonly TO cpd_fulldml;\nGRANT INSERT, UPDATE, DELETE ON cpd.cpd_districts TO cpd_fulldml; \nGRANT INSERT, UPDATE, DELETE ON cpd.iucr_codes TO cpd_fulldml; \nGRANT INSERT, UPDATE, DELETE ON cpd.leo_resources TO cpd_fulldml; \nGRANT INSERT, UPDATE, DELETE ON cpd.ods_secured_users TO cpd_fulldml;<\/pre><\/div>\n\n\n<div class=\"block-core-list\">\n<ul class=\"wp-block-list\">\n<li>Role <code>ADB_CONNECT<\/code><strong> <\/strong>just grants <code>CREATE SESSION<\/code> permissions.<br><br><\/li>\n\n\n\n<li>Role <code>CPD_READONLY<\/code> grants read-only access to the CPD schema\u2019s reference tables.<br><br><\/li>\n\n\n\n<li>And role <code>CPD_FULLDML<\/code> grants additional DML (data manipulation language) access to those same reference tables.<\/li>\n<\/ul>\n<\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"h-how-to-create-data-roles-in-oracle-deepsec-step-4\">How to create data roles in Oracle DeepSec (step 4)<\/h3>\n\n\n\n<p><strong>To enable Oracle DeepSec end user accounts to access database objects, you must create individual DeepSec data roles and grant them the required access.<\/strong><\/p>\n\n\n\n<p>For my example, I granted them access via the traditional database roles I just created:<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:tsql decode:true \" >DROP DATA ROLE cpd_dwro_role;\nCREATE DATA ROLE cpd_dwro_role; \nGRANT cpd_readonly TO cpd_dwro_role;\n\nDROP DATA ROLE cpd_full_role; \nCREATE DATA ROLE cpd_full_role;\nGRANT cpd_fulldml TO cpd_full_role;\n\nGRANT DATA ROLE cpd_dwro_role TO cpd_full_role;\nGRANT DATA ROLE cpd_dwro_role TO nkurchawska, snguyen, wjackson;\nGRANT DATA ROLE cpd_full_role TO lsnelling; <\/pre><\/div>\n\n\n<div class=\"block-core-list\">\n<ul class=\"wp-block-list\">\n<li>DeepSec data role <code>CPD_DWRO_ROLE<\/code><strong> <\/strong>enables read-only access via database role <code>CPD_READONLY<\/code><strong>.<\/strong><br><br><\/li>\n\n\n\n<li>DeepSec data role <code>CPD_FULL_ROLE<\/code> enables DML access via database role <code>CPD_FULLDML<\/code>. It also receives read access via a grant to <code>CPD_DWRO_ROLE<\/code>.<\/li>\n<\/ul>\n<\/div>\n\n\n<p>I then granted each DeepSec end user account the desired security permissions. End users <code>NKURCHAWSKA<\/code>, <code>SNGUYEN<\/code>, and <code>WJACKSON<\/code> receive just read-only capabilities but, since they\u2019re the Chief of Police, end user <code>LSNELLING<\/code> receives full DML privileges.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-how-to-create-oracle-deepsec-data-grants-that-limit-data-access-step-5\">How to create Oracle DeepSec data grants that limit data access (step 5)<\/h3>\n\n\n\n<p>It\u2019s now time to create your very first Oracle DeepSec objects. For my example, I&#8217;ll be creating three <em>dynamic roles<\/em> that  I&#8217;ll later use to assign privileges to DeepSec users as they log into the APEX application.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-the-chicago-crimes-table\">The CHICAGO_CRIMES table<\/h4>\n\n\n\n<p>In my example, the <code>GRANT<\/code> below enforces restrictions on <em>rows<\/em> within my table <code>CHICAGO_CRIMES<\/code>, based on <em>which district(s)<\/em> a user is allowed to access:<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:tsql decode:true \" >DROP DATA GRANT IF EXISTS cpd.limit_chicago_crimes_viewing_based_on_district;\nCREATE OR REPLACE DATA GRANT cpd.limit_chicago_crimes_viewing_based_on_district\n  AS \n    SELECT \n        ON cpd.chicago_crimes\n     WHERE district IN (\n         SELECT TO_NUMBER(rsu_keyvalue)\n           FROM cpd.ods_secured_users \n          WHERE rsu_keytype = 'DISTRICT'\n            AND rsu_username = ORA_END_USER_CONTEXT.username)\n  TO cpd_dwro_role; <\/pre><\/div>\n\n\n\n<p>This is an excellent example of the powerful simplicity of Oracle DeepSec&#8217;s data security policies.<\/p>\n\n\n<div class=\"block-core-list\">\n<ul class=\"wp-block-list\">\n<li>Since no specific column names are mentioned in that first <code>SELECT<\/code> statement, all columns in the <code>CHICAGO_CRIMES<\/code> table will be viewable by any DeepSec end user that\u2019s been granted the <code>CPD_DWRO_ROLE<\/code> DeepSec security role.<br><br><\/li>\n\n\n\n<li>After a database connection is established, the DeepSec object <code>ORA_END_USER_CONTEXT<\/code> \u2019s username attribute contains the end user name.<br><br><\/li>\n\n\n\n<li>The <code>WHERE<\/code> clause limits the corresponding DeepSec end user granted the <code>CPD_DWRO_ROLE<\/code> to <em>only<\/em> viewing rows with a matching value for <code>DISTRICT<\/code> (found in the <code>ODS_SECURED_USERS<\/code> table for each end user.)<\/li>\n<\/ul>\n<\/div>\n\n\n<h4 class=\"wp-block-heading\" id=\"h-the-chicago-reports-table\">The CHICAGO_REPORTS table<\/h4>\n\n\n\n<p>In a similar fashion, I can build and apply a <code>DATA GRANT<\/code> for the <code>CRIME_REPORTS<\/code> table that limits access to rows with a matching value for the <code>SENSITIVITY<\/code> column, as found in <code>ODS_SECURED_USERS<\/code> for the connected DeepSec end user below:<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:tsql decode:true \" >DROP DATA GRANT IF EXISTS cpd.limit_crime_reports_viewing_based_on_sensitivity;\nCREATE OR REPLACE DATA GRANT cpd.limit_crime_reports_viewing_based_on_sensitivity\n  AS\n    SELECT \n        ON cpd.crime_reports\n     WHERE sensitivity IN (\n         SELECT rsu_keyvalue\n           FROM cpd.ods_secured_users \n          WHERE rsu_keytype = 'SENSITIVITY'\n            AND rsu_username = ORA_END_USER_CONTEXT.username)\n       AND crime_id IN (SELECT crime_id FROM cpd.chicago_crimes)\n  TO cpd_dwro_role;<\/pre><\/div>\n\n\n\n<div id=\"callout-block_d24dda9310ef2811e2afd494633fcec1\" class=\"callout alignnone\">\n    <div class=\"child-last:mb-0 child-first:mt-0 bg-gray-50 dark:bg-gray-950 p-4xl my-3xl\">\n\n<p><strong>An important note on this data grant<\/strong> <strong>(the restriction linking <code>CRIME_ID<\/code> from <code>CRIME_REPORTS<\/code> to its parent table)<\/strong><\/p>\n\n\n\n<p>Since the prior data grant against <code>CHICAGO_CRIMES<\/code> will limit an end user to viewing rows in specific districts, that additional clause ensures only related rows in <code>CRIME_REPORTS<\/code> will be viewable based on the foreign key constraint on <code>CRIME_ID<\/code>.<\/p>\n\n<\/div>\n<\/div> \n\n\n<h4 class=\"wp-block-heading\" id=\"h-the-chicago-vectors-table\">The CHICAGO_VECTORS table<\/h4>\n\n\n\n<p>The last <code>DATA GRANT<\/code> enforces restrictions on the <code>CRIME_VECTORS<\/code> table in my example:<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:tsql decode:true \" >DROP DATA GRANT IF EXISTS cpd.limit_crime_vector_viewing;\nCREATE OR REPLACE DATA GRANT cpd.limit_crime_vector_viewing\n  AS \n    SELECT\n        ON cpd.crime_vectors\n     WHERE (\n         SELECT rsu_keyvalue\n           FROM cpd.ods_secured_users \n          WHERE rsu_keytype = 'VISIBILITY'\n            AND rsu_username = ORA_END_USER_CONTEXT.username) = 'PII'\n      AND doc_id IN (SELECT doc_id FROM cpd.crime_reports)\n  TO cpd_dwro_role;<\/pre><\/div>\n\n\n\n<p>This limits access to rows <em>within<\/em> the table, based on whether the end user has a value of <a href=\"https:\/\/www.ibm.com\/think\/topics\/pii\" target=\"_blank\" rel=\"noreferrer noopener\">PII (personally-identifiying information)<\/a> for the <code>VISIBILITY<\/code> column as found in <code>ODS_SECURED_USERS<\/code>.<\/p>\n\n\n\n<section id=\"my-first-block-block_77516efd632f651df88777353b210f54\" class=\"my-first-block alignwide\">\n    <div class=\"bg-brand-600 text-base-white py-5xl px-4xl rounded-sm bg-gradient-to-r from-brand-600 to-brand-500 red\">\n        <div class=\"gap-4xl items-start md:items-center flex flex-col md:flex-row justify-between\">\n            <div class=\"flex-1 col-span-10 lg:col-span-7\">\n                <h3 class=\"mt-0 font-display mb-2 text-display-sm\">Subscribe to the Simple Talk newsletter<\/h3>\n                <div class=\"child:last-of-type:mb-0\">\n                                            Get selected articles, event information, podcasts and other industry content delivered straight to your inbox.                                    <\/div>\n            <\/div>\n                                            <a href=\"https:\/\/www.red-gate.com\/simple-talk\/subscribe\/\" class=\"btn btn--secondary btn--lg\" aria-label=\"Subscribe: Subscribe to the Simple Talk newsletter\">Subscribe<\/a>\n                    <\/div>\n    <\/div>\n<\/section>\n\n\n<h3 class=\"wp-block-heading\" id=\"h-how-to-test-oracle-deepsec-data-grants-step-6\">How to test Oracle DeepSec data grants (step 6)<\/h3>\n\n\n\n<p><strong>You can ensure your security polices are configured properly by running some simple SQL queries against tables with Oracle DeepSec <code>DATA GRANT<\/code>&#8216;s in place. <\/strong><\/p>\n\n\n\n<p>In my example, since the <code>CPD_DWRO_ROLE<\/code> role has already been granted to the Oracle DeepSec end users I\u2019ve created, any restrictions and limitations I\u2019ve enabled will take immediate effect.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-how-to-prove-the-restrictions-work-as-intended-test-query-1\">How to prove the restrictions work as intended (test query #1)<\/h4>\n\n\n\n<p>The test query below, for my example, is relatively simple:<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:tsql decode:true \" >COL district    FORMAT 9999 HEADING \"District\"\nCOL sensitivity FORMAT A12 HEADING \"Sensitivity\"\nCOL crmcnt      FORMAT 99999 HEADING \"Crime|Count\"\nCOL doclen      FORMAT 999,999,999 HEADING \"Document|Sizes\"\nCOL emblen      FORMAT 999,999,999 HEADING \"Embedding|Sizes\"\n\nTTITLE LEFT \"Crime Vector Chunks + Embeddings Within District + Sensitivity\"\n\nSELECT\n  CC.district\n, CR.sensitivity\n, COUNT(CC.crime_id) AS crmcnt\n, SUM(LENGTH(CR.crime_document)) AS doclen\n, SUM(LENGTH(CV.embeddings)) AS emblen\n  FROM \n    cpd.chicago_crimes CC\n   ,cpd.crime_reports CR\n   ,cpd.crime_vectors CV\n WHERE CC.crime_id = CR.crime_id\n   AND CV.doc_id = CR.doc_id\nGROUP BY CC.district, CR.sensitivity\nORDER BY 1,2;<\/pre><\/div>\n\n\n\n<p>It joins together my <code>CHICAGO_CRIMES<\/code>, <code>CRIME_REPORTS<\/code>, and <code>CRIME_VECTORS<\/code> tables, retrieving information from all three to prove that the Oracle DeepSec limitations are working properly.<\/p>\n\n\n\n<p>I can now use this query to demonstrate that the restrictions I put in place for my four end users <em>actually work as they should<\/em> (based on the DeepSec data grants I\u2019ve built so far.)<\/p>\n\n\n\n<p>Here\u2019s what\u2019s returned when I log into my database as one of my DeepSec <code>END USER<\/code>s &#8211; <code>LSNELLING<\/code> &#8211; and run this query:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"853\" height=\"688\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-18.png\" alt=\"An image showing what's returned when Jim logs into his database as one of his Oracle DeepSec end users.\" class=\"wp-image-112055\" srcset=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-18.png 853w, https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-18-300x242.png 300w, https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-18-768x619.png 768w\" sizes=\"auto, (max-width: 853px) 100vw, 853px\" \/><figcaption class=\"wp-element-caption\"><em>The results for <code>LSNELLING<\/code>.<\/em><\/figcaption><\/figure>\n\n\n\n<p>This end user can see information from every row in the database because they&#8217;re the <em>owner<\/em> of the data. They can see all districts, all sensitivity levels, and any information in the document embeddings.<\/p>\n\n\n\n<p>When end user <code>SNGUYEN<\/code> connects and runs this same query, however, they see something quite different:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"859\" height=\"439\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-19.png\" alt=\"The results for SNGUYEN.\" class=\"wp-image-112056\" srcset=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-19.png 859w, https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-19-300x153.png 300w, https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-19-768x392.png 768w\" sizes=\"auto, (max-width: 859px) 100vw, 859px\" \/><figcaption class=\"wp-element-caption\"><em>The results for <code>SNGUYEN<\/code>.<\/em><\/figcaption><\/figure>\n\n\n\n<p>This is because they can only see information for the districts and sensitivity levels they\u2019re permitted to see.<\/p>\n\n\n\n<p>End user <code>WJACKSON<\/code> sees a completely different result as well:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"847\" height=\"180\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-20.png\" alt=\"What end user WJACKSON sees.\" class=\"wp-image-112057\" srcset=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-20.png 847w, https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-20-300x64.png 300w, https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-20-768x163.png 768w\" sizes=\"auto, (max-width: 847px) 100vw, 847px\" \/><figcaption class=\"wp-element-caption\"><em>The results for <code>WJACKSON.<\/code><\/em><\/figcaption><\/figure>\n\n\n\n<p><code>WJACKSON<\/code> can only see information for districts 8 and 10. This is because, if you remember, they\u2019ve been transferred between the two districts due to an ongoing Internal Affairs investigation.<\/p>\n\n\n\n<p>Note, also, that their sensitivity levels were adjusted to limit their viewing of reports deemed <code>CONFIDENTIAL<\/code> or <code>SECRET<\/code>.<\/p>\n\n\n\n<p>Finally, when end user <code>NKURCHAWSKA<\/code> connects and runs this same query, the results are dramatically different than those of the other users:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"847\" height=\"180\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-21.png\" alt=\"\" class=\"wp-image-112058\" srcset=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-21.png 847w, https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-21-300x64.png 300w, https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-21-768x163.png 768w\" sizes=\"auto, (max-width: 847px) 100vw, 847px\" \/><figcaption class=\"wp-element-caption\"><em>The results for <code>NKURCHAWSKA<\/code>.<\/em><\/figcaption><\/figure>\n\n\n\n<p>This user doesn&#8217;t have permission to access <em>any<\/em> data in the <code>CRIME_VECTORS<\/code> table, as defined in the <code>LIMIT_CRIME_VECTOR_VIEWING<\/code> DeepSec data grant. So, because my test query links data from all three tables, there are literally <em>no<\/em> results to return. A <code>NULL<\/code> set is returned as a result.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-how-to-simulate-ai-chatbot-search-results-test-query-2\">How to simulate AI chatbot search results (test query #2)<\/h3>\n\n\n\n<p>I\u2019m not quite ready to deploy an AI <a href=\"https:\/\/www.ibm.com\/think\/topics\/chatbots\" target=\"_blank\" rel=\"noreferrer noopener\">chatbot<\/a> yet \u2013 that&#8217;s for the next article in this series &#8211; so I built a simple query to leverage the existing embeddings within the <code>CRIME_VECTORS<\/code> table:<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:tsql decode:true \">COL district    FORMAT 9999       HEADING \"District\" \nCOL sensitivity FORMAT A12        HEADING \"Sensitivity\" \nCOL doc_id      FORMAT 9999999    HEADING \"Doc ID\" \nCOL chunk_id    FORMAT 999        HEADING \"Chk|ID\" \nCOL distance    FORMAT 99.999999  HEADING \"Vector|Distance\u201d\nCOL doc_chunk   FORMAT A60        HEADING \"Document Chunk\" WRAP\n\nTTITLE CENTER \"VECTOR_DISTANCE Evaluations For Mention of CORRUPTION\"\n\nWITH embeddings_found AS (\n SELECT VECTOR_EMBEDDING(\n   ADMIN.MINILML12V2 \n   USING 'corruption' AS DATA) AS embedding \n   FROM DUAL) \nSELECT\n  CC.district\n, CR.sensitivity\n, CV.doc_id \n, CV.chunk_id \n, VECTOR_DISTANCE(CV.embeddings, EF.embedding, COSINE) AS distance\n, CV.doc_chunk \n  FROM cpd.chicago_crimes CC \n  JOIN cpd.crime_reports CR ON CR.crime_id = CC.crime_id \n  JOIN cpd.crime_vectors CV ON CV.doc_id = CR.doc_id \n  CROSS JOIN embeddings_found EF \n ORDER BY VECTOR_DISTANCE(CV.embeddings, EF.embedding, COSINE)\n FETCH APPROXIMATE FIRST 3 ROWS ONLY WITH TARGET ACCURACY 95;<\/pre><\/div>\n\n\n<div class=\"block-core-list\">\n<ul class=\"wp-block-list\">\n<li>I\u2019ve once again joined the <code>CHICAGO_CRIMES<\/code>, <code>CRIME_REPORTS<\/code>, and <code>CRIME_VECTORS<\/code> tables together, this time by using a <a href=\"https:\/\/www.red-gate.com\/simple-talk\/databases\/postgresql\/understanding-sql-join-types\/#:~:text=last%20two%20rows.-,Cross%20Join%3A,-Cross%20join%20(also\" target=\"_blank\" rel=\"noreferrer noopener\"><code>CROSS JOIN<\/code> (Cartesian)<\/a> operation to retrieve from the <code>CRIME_VECTORS.EMBEDDINGS<\/code> column.<br><br><\/li>\n\n\n\n<li>The query then uses the <code>VECTOR_DISTANCE<\/code> function to compare the <a href=\"https:\/\/www.datacamp.com\/tutorial\/cosine-distance\" target=\"_blank\" rel=\"noreferrer noopener\">cosine distance<\/a> between the requested <em>search token<\/em> \u2013 in this case, what the AI <a href=\"https:\/\/www.ibm.com\/think\/topics\/large-language-models\" target=\"_blank\" rel=\"noreferrer noopener\">LLM (large language model)<\/a> determines is relevant to the concept of <em>corruption.<\/em><br><br><\/li>\n\n\n\n<li>Finally, the <code>FETCH APPROXIMATE<\/code> clause instructs the query to look for relevant results with a confidence level of 95%, returning only the top three results within what\u2019s returned.<\/li>\n<\/ul>\n<\/div>\n\n\n<div id=\"callout-block_d24dda9310ef2811e2afd494633fcec1\" class=\"callout alignnone\">\n    <div class=\"child-last:mb-0 child-first:mt-0 bg-gray-50 dark:bg-gray-950 p-4xl my-3xl\">\n\n<p><strong>Don&#8217;t miss this useful trick<\/strong><\/p>\n\n\n\n<p>For my example, I need to grant permissions to the LLM I used to create the corresponding embeddings for the document chunks. This is to allow it to connect to my database and access those embeddings within <code>CRIME_VECTORS<\/code>. <\/p>\n\n\n\n<p>To do this: <code>GRANT SELECT ON MINING MODEL ADMIN.MINILML12V2 TO adb_connect;<\/code><\/p>\n\n<\/div>\n<\/div> \n\n\n<h4 class=\"wp-block-heading\" id=\"h-what-do-the-deepsec-users-see\">What do the DeepSec users see?<\/h4>\n\n\n\n<p>One of my DeepSec example users, <code>LSNELLING<\/code>, sees these results:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"569\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-22.png\" alt=\"The results for LSNELLING.\" class=\"wp-image-112062\" srcset=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-22.png 975w, https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-22-300x175.png 300w, https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-22-768x448.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><figcaption class=\"wp-element-caption\"><em>The results for <code>LSNELLING<\/code>.<\/em><\/figcaption><\/figure>\n\n\n\n<p>Here, the top three document chunks returned are classified as <code>SECRET<\/code>, so the Chief of Police has a considerably wider view of corrupt activity within his jurisdiction (including some LEOs and even alderpersons!)<\/p>\n\n\n\n<p>End user <code>SNGUYEN<\/code>, on the other hand, has a more limited view at a district level &#8211; receiving this set of results instead:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"519\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-23.png\" alt=\"The results for SNGUYEN.\" class=\"wp-image-112063\" srcset=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-23.png 975w, https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-23-300x160.png 300w, https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-23-768x409.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><figcaption class=\"wp-element-caption\"><em>The results for <code>SNGUYEN<\/code>.<\/em><\/figcaption><\/figure>\n\n\n\n<p>The vector distance scores are also higher here than of those for <code>LSNELLING<\/code>, indicating lower relevance to the context being searched.<\/p>\n\n\n\n<p>Differing further are the results for <code>WJACKSON<\/code>, who has even narrower permissions for both district <em>and<\/em> sensitivity levels:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"366\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-25.png\" alt=\"The results for WJACKSON.\" class=\"wp-image-112065\" srcset=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-25.png 975w, https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-25-300x113.png 300w, https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2026\/07\/image-25-768x288.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><figcaption class=\"wp-element-caption\"><em>The results for <code>WJACKSON<\/code>.<\/em><\/figcaption><\/figure>\n\n\n\n<p>Lastly, what would user <code>NKURCHAWSKA<\/code> see? Well, since they don&#8217;t have permission to access <code>CRIME_VECTORS<\/code>, the embeddings are also inaccessible to the simulated chatbot interaction. And &#8211; just as I demonstrated for the first test query &#8211; no results are returned.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-next-steps-implementing-deepsec-in-oracle-26ai-database-applications-and-how-to-do-so\">Next steps: implementing DeepSec in Oracle 26ai database applications (and how to do so)<\/h2>\n\n\n\n<p>If you\u2019re thinking this has been a <em>lot<\/em> to absorb, you\u2019re correct! The good news is, DeepSec is <em>dramatically<\/em> easier to implement than any of its Oracle Database predecessors. Better still, it&#8217;s more powerful.<\/p>\n\n\n\n<p>In Part 2 of the series, I\u2019ll explain how to implement Oracle DeepSec security constraints to limit access to sensitive information across a schema. <\/p>\n\n\n\n<p>To do so, I&#8217;ll continue with my Chicago Police Department example schema in a sample database application. It&#8217;ll include how to deploy and use single sign-on (SSO) credentials to manage end user access.<\/p>\n\n\n\n<section id=\"my-first-block-block_a3086f99a0afa98f56fb2bf3d10bff48\" class=\"my-first-block alignwide\">\n    <div class=\"bg-brand-600 text-base-white py-5xl px-4xl rounded-sm bg-gradient-to-r from-brand-600 to-brand-500 red\">\n        <div class=\"gap-4xl items-start md:items-center flex flex-col md:flex-row justify-between\">\n            <div class=\"flex-1 col-span-10 lg:col-span-7\">\n                <h3 class=\"mt-0 font-display mb-2 text-display-sm\">Simple Talk is brought to you by Redgate Software<\/h3>\n                <div class=\"child:last-of-type:mb-0\">\n                                            Take control of your databases with the trusted Database DevOps solutions provider. Automate with confidence, scale securely, and unlock growth through AI.                                    <\/div>\n            <\/div>\n                                            <a href=\"https:\/\/www.red-gate.com\/solutions\/overview\/\" class=\"btn btn--secondary btn--lg\" aria-label=\"Discover how Redgate can help you: Simple Talk is brought to you by Redgate Software\">Discover how Redgate can help you<\/a>\n                    <\/div>\n    <\/div>\n<\/section>\n\n\n<section id=\"faq\" class=\"faq-block my-5xl\">\n    <h2>FAQs: How to implement Oracle DeepSec in Oracle Database 26ai<\/h2>\n\n                        <h3 class=\"mt-4xl\">1. What is Oracle DeepSec in Oracle Database 26ai?<\/h3>\n            <div class=\"faq-answer\">\n                <p class=\"font-claude-response-body break-words whitespace-normal\" dir=\"ltr\">DeepSec (Deep Data Security) is a security framework in Oracle Database 26ai that lets administrators enforce row-level and column-level access controls across structured tables and vectorized data using DeepSec end users, data roles, and data grants.<\/p>\n            <\/div>\n                    <h3 class=\"mt-4xl\">2. How is DeepSec different from VPD or RAS?<\/h3>\n            <div class=\"faq-answer\">\n                <p class=\"font-claude-response-body break-words whitespace-normal\" dir=\"ltr\">DeepSec is designed to be significantly easier to configure than Virtual Private Database (VPD) or Real Application Security (RAS), especially for complex, multi-table security policies, while still supporting granular row- and column-level restrictions.<\/p>\n            <\/div>\n                    <h3 class=\"mt-4xl\">3. What are the main components needed to set up DeepSec?<\/h3>\n            <div class=\"faq-answer\">\n                <p class=\"font-claude-response-body break-words whitespace-normal\" dir=\"ltr\">A typical DeepSec setup includes a control table for user permissions, DeepSec end user accounts, standard database roles for object-level privileges, DeepSec data roles, and data grants that define row-filtering logic.<\/p>\n            <\/div>\n                    <h3 class=\"mt-4xl\">4. Can DeepSec restrict access to vector embeddings used by AI chatbots?<\/h3>\n            <div class=\"faq-answer\">\n                <p class=\"font-claude-response-body break-words whitespace-normal\" dir=\"ltr\">Yes. DeepSec data grants can limit which users or applications can query specific rows in a vector table (such as one holding document embeddings), which controls what an AI chatbot or LLM-powered search can retrieve on a user&#8217;s behalf.<\/p>\n            <\/div>\n                    <h3 class=\"mt-4xl\">5. What Oracle version and patch level are required for DeepSec?<\/h3>\n            <div class=\"faq-answer\">\n                <div role=\"feed\" aria-label=\"Chat messages\" aria-describedby=\"_r_9n_\" data-find-provider-scope=\"\">\n<div data-sizer-excess=\"0\" data-rocksteady-sizer=\"\">\n<div data-rs-index=\"1\" data-index=\"1\" data-last-message=\"true\">\n<div role=\"article\" aria-label=\"Message 2 of 2\">\n<div data-test-render-count=\"1\">\n<div class=\"group group\/message-row\">\n<div class=\"contents\">\n<div class=\"group relative relative pb-[var(--msg-assistant-pb,0.75rem)]\" data-is-streaming=\"false\">\n<div class=\"font-claude-response relative leading-[1.65rem] [&amp;_pre&gt;div]:bg-bg-000\/50 [&amp;_pre&gt;div]:border-0.5 [&amp;_pre&gt;div]:border-border-400 [&amp;_.ignore-pre-bg&gt;div]:bg-transparent [&amp;_.standard-markdown_:is(p,blockquote,h1,h2,h3,h4,h5,h6)]:pl-2 [&amp;_.standard-markdown_:is(p,blockquote,ul,ol,h1,h2,h3,h4,h5,h6)]:pr-8 [&amp;_.progressive-markdown_:is(p,blockquote,h1,h2,h3,h4,h5,h6)]:pl-2 [&amp;_.progressive-markdown_:is(p,blockquote,ul,ol,h1,h2,h3,h4,h5,h6)]:pr-8\">\n<div>\n<div class=\"grid grid-rows-[auto_auto] min-w-0\">\n<div class=\"row-start-2 col-start-1 relative grid grid-rows-[auto_auto] isolate min-w-0\">\n<div class=\"row-start-1 col-start-1 relative z-[2] min-w-0\">\n<div>\n<div>\n<div class=\"standard-markdown grid-cols-1 grid [&amp;_&gt;_*]:min-w-0 gap-3 [&amp;_&gt;_*:last-child]:mb-0 print:block print:[&amp;_&gt;_*_+_*]:mt-3 standard-markdown\">\n<p class=\"font-claude-response-body break-words whitespace-normal\" dir=\"ltr\">This guide uses a 26ai Autonomous Database patched to release 23.26.2, along with Oracle APEX 24.2, as prerequisites for DeepSec features.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div>\n<div class=\"flow-root\">\n<div>\n<div class=\"ml-1 mt-6 flex items-center transition-transform duration-300 ease-out\">\n<div class=\"p-1 -translate-x-px\">\n<div aria-hidden=\"true\">\u00a0<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n            <\/div>\n            <\/section>\n","protected":false},"excerpt":{"rendered":"<p>Learn how Oracle 26ai Deep Data Security (DeepSec) simplifies row- and column-level access control for structured and vector data. A hands-on guide with real SQL examples.&hellip;<\/p>\n","protected":false},"author":346239,"featured_media":112069,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[143523,53,143533,46],"tags":[4168,4170,159409,4459,4619,5765],"coauthors":[159330],"class_list":["post-112048","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-databases","category-featured","category-oracle-databases","category-data-security-privacy-compliance","tag-database","tag-database-administration","tag-jimcdeepsec","tag-oracle","tag-security","tag-security-and-compliance"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/112048","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/users\/346239"}],"replies":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/comments?post=112048"}],"version-history":[{"count":8,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/112048\/revisions"}],"predecessor-version":[{"id":112259,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/112048\/revisions\/112259"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/media\/112069"}],"wp:attachment":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/media?parent=112048"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/categories?post=112048"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/tags?post=112048"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/coauthors?post=112048"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}