Oracle VPD in Action: Building Role-Based Row-Level Security from Scratch
Row-level security is one of those requirements that shows up in almost every enterprise database — Finance shouldn’t see HR’s salary data, HR shouldn’t see Finance’s, and no team should see another’s unless explicitly authorized. Most teams solve this at the application layer, hard-coding WHERE clauses into every query. It works — until someone connects directly through SQL Developer or a reporting tool and bypasses the app entirely. Oracle’s Virtual Private Database (VPD) , also known as Fine-Grained Access Control (FGAC) , solves this properly: it enforces row-level and column-level security inside the database engine itself , so it’s enforced everywhere, every time — no exceptions. In this post, I’ll walk through how I implemented it, mapping database roles to departments on a sample emp_test table. How VPD Works Policy Association – A security policy is bound to a table or view using the DBMS_RLS ...