Oracle Database 19c Security Hardening – Part 15

Building an Automated Oracle Security Assessment Framework

Over the previous articles, we’ve covered the key areas of Oracle Database security:

  • User and password management
  • Privilege reviews
  • Unified Auditing
  • Transparent Data Encryption (TDE)
  • RMAN backup security
  • Database links
  • Oracle Scheduler
  • Optional components
  • Data Pump
  • Patch management

Each topic included SQL queries and recommendations, but running them one by one is time-consuming, especially in environments with dozens or hundreds of databases.

A better approach is to automate the assessment.

In this final article, we’ll design a lightweight framework that gathers security information, evaluates it against best practices, and generates a report that can be used during routine health checks or security audits.

Why Automate Security Assessments?

Security configurations change over time.

A new application may require additional privileges. A temporary account may never be removed. A database link created for a migration project may remain in place long after the project ends.

Without regular reviews, these changes can accumulate and weaken your security posture.

Automation helps ensure that the same checks are performed consistently across every database.

Framework Architecture

The framework can be organized into three simple phases:

             +---------------------+
             |  Collect Information |
             +----------+----------+
                        |
                        v
             +---------------------+
             | Evaluate Compliance |
             +----------+----------+
                        |
                        v
             +---------------------+
             | Generate Report     |
             +---------------------+

Each phase is independent, making it easy to add or remove checks over time.

Phase 1 – Collect Information

The first phase gathers data from the database.

Examples include:

CategoryView
UsersDBA_USERS
RolesDBA_ROLE_PRIVS
System PrivilegesDBA_SYS_PRIVS
Password ProfilesDBA_PROFILES
Audit PoliciesAUDIT_UNIFIED_ENABLED_POLICIES
EncryptionV$ENCRYPTION_WALLET
Patch LevelDBA_REGISTRY_SQLPATCH
SchedulerDBA_SCHEDULER_JOBS
Database LinksDBA_DB_LINKS
Directory ObjectsDBA_DIRECTORIES

Each query should return factual information only. Avoid mixing collection and evaluation logic.

Phase 2 – Evaluate Security Controls

Once the data has been collected, compare it against your organization’s security standards.

Examples:

ControlExpected Result
PUBLIC database linksNone
Users with DBA roleApproved administrators only
TDE WalletOPEN
RMAN EncryptionEnabled
Unified AuditingEnabled
Scheduler External JobsApproved only
Directory ObjectsDocumented
Patch LevelCurrent supported RU

Each check should return one of three values:

  • PASS – Configuration meets the standard.
  • WARNING – Review recommended.
  • FAIL – Immediate action required.

This simple classification makes reports easy to understand.

Phase 3 – Generate the Report

The final report should summarize the database’s security posture.

Example:

Security ControlResultNotes
Administrative AccountsPASSFour approved DBAs
Password PolicyPASSSecure profile applied
Unified AuditingPASSStandard policies enabled
Transparent Data EncryptionPASSWallet open
RMAN EncryptionPASSAES256 enabled
Database LinksWARNINGOne PUBLIC database link
SchedulerPASSNo external jobs
Directory ObjectsWARNINGTwo undocumented directories
Patch LevelFAILRelease Update behind policy

This format is suitable for both DBAs and auditors.

Assign a Security Score

A numerical score can help track improvements over time.

Example:

ResultScore
PASS10
WARNING5
FAIL0

If the assessment contains ten controls:

  • 90–100: Excellent
  • 75–89: Good
  • 60–74: Needs Improvement
  • Below 60: High Risk

The score should support the assessment, not replace it. A single failed critical control, such as missing encryption or outdated patches, deserves attention regardless of the overall score.

Organize the Toolkit

A simple directory structure keeps the framework manageable.

oracle-security-toolkit/
│
├── sql/
│   ├── users.sql
│   ├── roles.sql
│   ├── auditing.sql
│   ├── tde.sql
│   ├── rman.sql
│   ├── scheduler.sql
│   ├── datapump.sql
│   ├── dblink.sql
│   └── patches.sql
│
├── reports/
│
├── logs/
│
└── run_healthcheck.sql

As new security checks are developed, they can be added without changing the overall framework.

Automate with SQL*Plus

A master SQL*Plus script can execute every check and save the results.

Example:

SPOOL reports/security_report.txt

PROMPT =====================================
PROMPT Oracle 19c Security Assessment Report
PROMPT =====================================

@sql/users.sql
@sql/roles.sql
@sql/auditing.sql
@sql/tde.sql
@sql/rman.sql
@sql/dblink.sql
@sql/scheduler.sql
@sql/datapump.sql
@sql/patches.sql

SPOOL OFF

Running a single script is much easier than remembering dozens of individual queries.

Extend the Framework

Once the basic framework is in place, consider adding:

  • Password age analysis.
  • Inactive user detection.
  • Excessive system privileges.
  • Tablespaces without encryption.
  • Expired Oracle Wallet certificates.
  • Failed Scheduler jobs.
  • Invalid database objects.
  • Listener configuration checks.
  • Oracle Net encryption verification.
  • Data Guard security checks.

The framework should evolve with your environment.

Schedule Regular Assessments

Security reviews should not depend on someone remembering to run them.

Common schedules include:

FrequencyRecommended Checks
WeeklyPrivileged accounts, failed jobs
MonthlyFull security assessment
QuarterlyPatch compliance and configuration review
After major changesComplete health check

Consistency is more valuable than complexity.

Share the Results

A security report is most effective when it is shared with the right stakeholders.

Typical recipients include:

  • Database administrators.
  • Infrastructure teams.
  • Security teams.
  • IT managers.
  • Internal auditors.

Each group may focus on different findings, but everyone benefits from a common report.

Security Checklist

Before considering the framework complete, verify that:

  • All key security areas are covered.
  • Results are easy to understand.
  • PASS/WARNING/FAIL criteria are documented.
  • Reports are archived for comparison.
  • Reviews are scheduled regularly.
  • Findings are tracked until resolved.

Common Mistakes

Collecting Too Much Information

Focus on information that leads to action. Hundreds of pages of output are less useful than a concise report with clear recommendations.

Ignoring Trends

Comparing reports over time often reveals gradual privilege growth or configuration drift.

Treating Every Finding Equally

Prioritize issues based on business impact. A missing Release Update generally deserves more attention than an unused directory object.

Not Updating the Toolkit

Oracle evolves over time. Review the framework after upgrades, new security features, or changes to organizational policies.

Conclusion

Security is not achieved by running a script once or applying a single patch. It is the result of consistent processes, regular reviews, and continuous improvement.

An automated assessment framework helps DBAs verify that security controls remain effective as databases evolve. It also provides a repeatable method for demonstrating compliance and identifying risks before they become incidents.

Whether you manage one database or hundreds, automation makes security reviews faster, more consistent, and easier to maintain.

Bookmark the permalink.
Loading Facebook Comments ...

Leave a Reply