Thursday, August 27, 2026

OCI Data Safe for Oracle DBAs: Security Assessment, User Assessment and Activity Auditing

 

OCI Data Safe for Oracle DBAs: Security Assessment, User Assessment and Activity Auditing

Introduction

Database security is one of those areas that can easily get pushed behind regular DBA activities such as monitoring, performance tuning, backup, patching and incident handling.

But in production environments, security needs regular attention as well.

As the number of databases and users increases, it becomes difficult to manually review every security configuration, user privilege and database activity. This is where OCI Data Safe can help.

OCI Data Safe provides a centralized way to perform security assessments, review database users and monitor database activity.

This article focuses on three areas that are particularly useful for Oracle DBAs:

  • Security Assessment

  • User Assessment

  • Activity Auditing

The main focus here is how these capabilities can be used as part of regular DBA activities rather than treating database security as a one-time exercise.



1. Security Assessment

A database can be healthy from an availability and performance perspective while still having security gaps.

For example, a database may be running without any issues, but there could be:

  • Unnecessary privileges

  • Weak security configurations

  • Unused database accounts

  • Incorrect password policies

  • Missing auditing configurations

  • Security-related parameters that need attention

OCI Data Safe Security Assessment helps identify these types of security findings.

The assessment provides visibility into the security configuration of the target Oracle database and highlights areas that may require attention.

Instead of manually checking a large number of database security settings, the assessment provides a centralized view of the findings.



2. Reviewing Security Assessment Findings

One important point with security assessments is that every finding should not be treated as an immediate production change.

A recommendation may be technically correct, but the database may have a specific application dependency.

For example, changing a database parameter can potentially affect an application, integration or existing process.

A practical approach is:

Review → Validate → Plan → Implement → Reassess

For each important finding, the following points should be considered:

  • What is the security concern?

  • Is the finding applicable to the environment?

  • Is there any application dependency?

  • What is the impact of making the change?

  • Does the change require downtime?

  • Has the change been tested in a lower environment?

  • Is approval required before implementing it?

This approach helps avoid making security changes without understanding their operational impact.

3. Security Assessment Score

OCI Data Safe provides an overall view of the database security posture.

The score can be useful for tracking improvement over time.

However, the score should not be the only thing considered during a security review.

For example, a database may have a good overall score but still have one important finding that needs immediate attention.

It is therefore better to look at the individual findings and understand their impact instead of focusing only on the final score.

The assessment can also be used as a baseline.

After remediation, another assessment can be performed to confirm whether the security posture has improved.

4. User Assessment

Database users and privileges are another important part of database security.

In large environments, database accounts can accumulate over time.

Some users may have been created for temporary activities, some may belong to old applications, and some may no longer be required.

There can also be cases where users have more privileges than they actually need.

OCI Data Safe User Assessment helps provide better visibility into database users and their security-related characteristics.

This makes it easier to identify accounts that require further review.



5. What to Review During User Assessment

Some of the areas that deserve attention during a user review include:

Inactive or unused accounts

Old accounts should be reviewed to determine whether they are still required.

If an account is no longer needed, the appropriate process can be followed to disable or remove it.

Highly privileged users

Accounts with powerful privileges should receive additional attention.

Examples include:

  • SYS

  • SYSTEM

  • DBA-privileged accounts

  • Application accounts with administrative privileges

  • Service accounts with unnecessary privileges

Application accounts

Application users should generally have only the privileges required by the application.

Providing broad privileges just to avoid application errors can create unnecessary security exposure.

Old accounts

Accounts created for previous applications, projects or temporary activities can remain in the database if they are not reviewed regularly.

Periodic user assessment helps identify these accounts.

6. Principle of Least Privilege

The principle of least privilege is very important when managing database users.

A user should have only the access required to perform the assigned activity.

For example, a reporting account that only needs to read data should not have unnecessary administrative privileges.

Similarly, an application account should not be given DBA-level access simply because it makes troubleshooting easier.

From an operational perspective, excessive privileges can sometimes make things easier in the short term.

From a security perspective, they increase the potential impact if the account is compromised.

Regular user reviews help maintain better control over this.

7. Activity Auditing

Security assessment helps identify configuration-related issues.

User assessment helps understand database access.

But there is another important question:

What is actually happening inside the database?

This is where activity auditing becomes useful.

Database activity auditing provides information about activities performed against the database.

Depending on the auditing configuration and database capabilities, audit information can help answer questions such as:

  • Who accessed the database?

  • Which user performed the activity?

  • When did the activity happen?

  • Which object was accessed?

  • What type of operation was performed?

  • Was the operation successful or unsuccessful?

This information can be useful for both security investigations and operational troubleshooting.


8. Activity Auditing in Real DBA Scenarios

Auditing is not limited to security teams.

It can also be useful during regular DBA investigations.

Example 1: Unexpected Data Change

Suppose an application team reports that some data in a production table was changed unexpectedly.

Instead of only trying to identify the person who may have made the change, audit information can be reviewed to understand the database activity around that time.

Example 2: Unexpected Login

If an unexpected login is reported for a production database, audit records can provide additional information about the account and activity.

Example 3: Object Changes

If a database object was modified unexpectedly, audit information can help during the investigation.

Example 4: Compliance Requirements

Some environments require database activities to be monitored and retained for audit or compliance purposes.

Centralized auditing can make this process easier to manage.

9. Security Assessment, User Assessment and Auditing Together

These three areas provide different views of database security.

CapabilityWhat it helps answer
Security AssessmentIs the database configuration secure?
User AssessmentWho has access and what privileges do they have?
Activity AuditingWhat activities are taking place in the database?

Looking at them together provides a much better picture.

The approach can be viewed as:

Configuration → Access → Activity

First, understand the security configuration.

Next, review who has access.

Finally, understand what activities are being performed.

This gives a more complete security review instead of focusing on only one area.

10. A Practical DBA Review Process

A simple periodic review can be followed for production databases.

Step 1: Review the Security Assessment

Check the latest assessment results and identify important findings.

Step 2: Prioritize the findings

Not every recommendation will have the same level of importance.

Critical and high-impact findings should receive priority.

Step 3: Review database users

Look for:

  • Inactive accounts

  • Unused accounts

  • Highly privileged users

  • Excessive privileges

  • Old application accounts

  • Service accounts

Step 4: Review audit activity

Check whether the required database activities are being captured.

Step 5: Investigate unusual activity

Any unexpected login, privilege usage or database activity can be investigated further.

Step 6: Remediate approved findings

Apply the required changes through the organization's change management process.

Step 7: Reassess

Run another assessment after remediation and compare the results.

This creates a continuous cycle rather than a one-time security check.

11. Security Changes Should Be Planned Carefully

One area that should not be overlooked is the relationship between security and application availability.

A security recommendation may suggest changing a database configuration, privilege or authentication setting.

Before implementing it in production, the following should be considered:

  • Application compatibility

  • Database dependencies

  • Connection configuration

  • Scheduled jobs

  • Monitoring tools

  • Integration systems

  • Existing security controls

  • Change management requirements

  • Rollback plan

Security improvements should not introduce unexpected production issues.

Testing the change before production implementation is always preferable where possible.

12. Building Security Into Regular DBA Activities

Database security should not be treated as an activity that happens only during an audit.

It can be included in regular DBA operations.

For example:

Daily / Weekly

  • Review important database activity

  • Investigate unusual access

  • Monitor security-related alerts

Monthly

  • Review database users

  • Review privileged accounts

  • Check inactive accounts

  • Review important security findings

Periodic

  • Perform Security Assessment

  • Review User Assessment

  • Review audit configuration

  • Track remediation

  • Reassess after major changes

The exact frequency can depend on the organization's security and compliance requirements.

13. Practical DBA Security Checklist

The following checklist can be used during a database security review:

  • Review the latest Security Assessment

  • Identify critical security findings

  • Validate findings against the application requirements

  • Review privileged database accounts

  • Review inactive and unused users

  • Check application and service accounts

  • Review unnecessary privileges

  • Verify auditing requirements

  • Review unusual database activity

  • Track security remediation actions

  • Follow change management for production changes

  • Perform reassessment after remediation

  • Maintain security review evidence where required

Conclusion

OCI Data Safe provides useful capabilities for Oracle database security management.

Security Assessment helps identify configuration and security gaps.

User Assessment provides better visibility into database users and privileges.

Activity Auditing helps understand database activity and supports investigation when something unexpected happens.

For DBAs, the important part is not simply generating a security report.

The real value comes from reviewing the findings, understanding the database and application requirements, taking appropriate action and checking the results again.

A simple approach such as:

Assess → Review → Remediate → Monitor → Reassess

can help make database security part of regular DBA operations.

As Oracle environments continue to grow across OCI and other cloud platforms, having a consistent way to review database security becomes increasingly important.

OCI Data Safe can be one of the tools used to bring these security activities together and provide better visibility into the overall database security posture.

Monday, August 17, 2026

Oracle to PostgreSQL Data Migration Using CSV

Oracle to PostgreSQL Data Migration Using CSV

1. Overview

CSV-based migration is one of the simplest and most transparent ways to move table data from Oracle to PostgreSQL. It is useful when the source of data volume is manageable, when a dependency-free method is preferred, or when teams need a repeatable runbook for controlled data movement.

This document explains the end-to-end flow in a blog-friendly format. The sample object names are generic, so the steps can be reused safely without exposing internal or client-specific details.

2. High-Level Migration Flow

Step 

Activity 

Purpose 

Main Output 

1 

Export from Oracle 

Extract selected rows into a CSV file 

CSV file 

2 

Transfer file 

Move the export file to the PostgreSQL server securely 

CSV or compressed CSV 

3 

Prepare PostgreSQL table 

Create a matching target structure 

Target table 

4 

Import and validate 

Load data using COPY and verify results 

Loaded and validated data 

3. Prerequisites

  • Oracle database access with read permission on the source table.

  • PostgreSQL database access with permission to create tables and load data.

  • Sufficient disk space on both source and target servers for the CSV file.

  • Network connectivity between source and target servers for secure file transfer.

  • Agreement on date filters, column mapping, data types, and expected row count.

  • A rollback or cleanup plan in case validation fails.

4. Step 1: Export Data from Oracle

Start by exporting only the required columns and date range. Keeping the export focused reduces file size, improves load performance, and makes validation easier.

In SQL*Plus, CSV formatting can be enabled so that the result is written directly to a structured CSV file.

sqlplus <source_user>/<password>@<source_service_name>

SET HEADING ON

SET FEEDBACK OFF

SET TERMOUT OFF

SET MARKUP CSV ON DELIMITER ',' QUOTE ON

SPOOL /path/to/export/source_table_month.csv

SELECT column_1,

       column_2,

       event_timestamp,

       numeric_value,

       created_timestamp,

       status_code,

       group_id

FROM <source_schema>.<source_table>

WHERE event_timestamp >= TO_DATE('<start_date>', 'YYYY-MM-DD')

  AND event_timestamp <  TO_DATE('<end_date>',   'YYYY-MM-DD');

 

SPOOL OFF

EXIT;

Why this step matters

  • Column-level selection avoids exporting unnecessary data.

  • A date range filter makes the extract repeatable and easier to reconcile.

  • CSV quoting helps preserve values that contain commas or special characters.

  • The spool output becomes the migration input for PostgreSQL.

5. Optional Step: Compress the Export File

If the CSV file is large, compress it before transferring. Compression reduces transfer time and lowers the chance of network interruption during file movement.

gzip /path/to/export/source_table_month.csv

After compression, the file name will usually become source_table_month.csv.gz.

6. Step 2: Transfer the File Securely

Move the CSV or compressed CSV file from the Oracle server to the PostgreSQL server using an approved secure transfer method such as SCP, SFTP, or an enterprise file transfer tool.

scp /path/to/export/source_table_month.csv.gz <target_user>@<target_host>:/path/to/target/folder/

Recommended checks after transfer

  • Confirm that the file exists on the target server.

  • Compare file size between source and target.

  • If checksum validation is available, compare checksum values.

  • Unzip the file before loading if PostgreSQL COPY is reading the plain CSV file.

gunzip /path/to/target/folder/source_table_month.csv.gz

7. Step 3: Prepare the Target Table in PostgreSQL

Before loading the CSV file, create the target table with data types that match the source data. This step is important because Oracle and PostgreSQL data types are not always one-to-one matches.

psql -h <target_host> -U <target_user> -d <target_database>


CREATE TABLE <target_schema>.<target_table> (

    column_1           VARCHAR(100),

    column_2           VARCHAR(100),

    event_timestamp    TIMESTAMP,

    numeric_value      NUMERIC,

    created_timestamp  TIMESTAMP,

    status_code        VARCHAR(50),

    group_id           INTEGER

);

Data type mapping guidance

Oracle Type 

PostgreSQL Type 

Comment 

VARCHAR2 

VARCHAR or TEXT 

Use VARCHAR when a known limit is required. 

NUMBER 

NUMERIC, INTEGER, BIGINT 

Choose based on precision, scale, and expected values. 

DATE 

TIMESTAMP or DATE 

Oracle DATE can include time, so validate carefully. 

TIMESTAMP 

TIMESTAMP 

Confirm timezone handling requirements separately. 

8. Step 4: Import CSV Data into PostgreSQL

PostgreSQL COPY is a fast and commonly used method to load CSV data into a table. The file path must be accessible to the PostgreSQL server process.

COPY <target_schema>.<target_table> (

    column_1,

    column_2,

    event_timestamp,

    numeric_value,

    created_timestamp,

    status_code,

    group_id

)

FROM '/path/to/target/folder/source_table_month.csv'

WITH (

    FORMAT csv,

    HEADER true,

    DELIMITER ',',

    QUOTE '"',

    ESCAPE ''''

);

Common import issues to check

  • File access issue: PostgreSQL must be able to read the file path.

  • Timestamp format mismatch: confirm exported timestamps match PostgreSQL expectations.

  • Delimiter or quote issue: validate the CSV configuration if rows fail to load.

  • Numeric conversion issue: check blank values, special characters, and precision requirements.

9. Step 5: Validate the Data Load

Validation confirms whether the migration was completed correctly. At minimum, compare row counts, sample records, timestamp boundaries, and numeric values.

-- Check total row count

SELECT COUNT(*) AS target_row_count

FROM <target_schema>.<target_table>;


-- Check timestamp range

SELECT MIN(event_timestamp) AS min_event_time,

       MAX(event_timestamp) AS max_event_time

FROM <target_schema>.<target_table>;


-- Review sample records

SELECT *

FROM <target_schema>.<target_table>

ORDER BY event_timestamp

LIMIT 10;

Validation 

Expected Result 

Action if Failed 

Row count 

Target count matches source count 

Review filters, rejected rows, and duplicate load attempts. 

Date range 

Minimum and maximum timestamp are within expected range 

Check Oracle WHERE clause and timestamp formatting. 

Data sampling 

Sample values match source records 

Compare source and target for selected keys. 

Numeric accuracy 

Decimal and integer values are preserved 

Review NUMERIC precision and CSV formatting. 

10. Step 6: Post-Migration Cleanup

Once validation is successful, complete the housekeeping activities so that the environment remains clean and secure.

  • Archive the CSV file only if required by the retention policy.

  • Remove temporary files from shared paths after approval.

  • Document row counts, validation of queries, and completion time.

  • Apply indexes or constraints after the bulk load if that was part of the migration plan.

  • Notify application or reporting teams that the dataset is ready for use.

11. Summary

This blog provides a simple and repeatable approach for moving Oracle table data to PostgreSQL using CSV files. The key success factors are a controlled export query, secure file transfer, correct target table design, reliable COPY import, and strong post-load validation.

OCI Data Safe for Oracle DBAs: Security Assessment, User Assessment and Activity Auditing

  OCI Data Safe for Oracle DBAs: Security Assessment, User Assessment and Activity Auditing Introduction Database security is one of those a...