-
What is Oracle Database Replication?
-
Why Should You Replicate Oracle Database?
-
Types of Database Replication In Oracle
-
How to Replicate An Oracle Database?
-
Safely backing up Oracle Database with Vinchin
-
Oracle Database Replication FAQs
-
Conclusion
This article provides an overview of Oracle database replication. It covers concepts, architectures, implementation steps, and operational best practices. You learn how replication ties to RPO and RTO. You see core methods: Data Guard, GoldenGate, materialized views, and legacy options. You also learn monitoring, alerting, and security for replication.
What is Oracle Database Replication?
Oracle captures changes at a source database and applies them on one or more target databases. It supports synchronous mode that waits for commit confirmation, and asynchronous mode that sends changes without waiting. Synchronous yields near-zero data loss but adds latency. Asynchronous reduces latency but risks minimal data gaps if failure occurs. Oracle uses redo transport, log mining, or materialized view logs depending on method. Consistency models vary: immediate for synchronous, eventual for asynchronous.
Replication ties to RPO (Recovery Point Objective) and RTO (Recovery Time Objective). Synchronous modes support near-zero RPO. Asynchronous balances RPO against network distance. You choose based on business needs and infrastructure. You also plan RTO: how fast you can bring a replica online. These objectives guide method selection and configuration.
Why Should You Replicate Oracle Database?
Replication meets core Ops priorities: disaster recovery, high availability, load balancing, and business continuity. It also aids analytics and migrations.
Disaster Recovery and RPO/RTO: Replication stores copies in remote sites. In a failure, you switch to standby. Synchronous replication yields minimal data loss (near-zero RPO). Asynchronous suits long-distance sites with modest RPO. You measure RTO by how quickly you switch roles. Testing failover verifies RTO goals.
High Availability: A standby database can take over via switchover or failover. Data Guard provides managed apply services for fast transitions. GoldenGate can build active-active setups for some cases. You reduce planned and unplanned downtime. You meet SLAs and boost service reliability.
Load Balancing and Reporting: Active Data Guard lets you open a standby for reads. You offload reporting to reduce load on the primary. Materialized views can serve local reporting with periodic refresh. You improve performance for end users and analytics teams.
Business Continuity and Maintenance: You can apply patches or upgrades on standby while the primary runs. After testing, you switch roles. You minimize downtime for maintenance. You can migrate platforms by replicating to a new environment.
Data Distribution: You replicate data to remote offices or cloud zones. Materialized views or GoldenGate can send subsets or filtered data. You support distributed applications with local copies.
Testing and Development: You maintain a replica for QA or development. You refresh it regularly from production. Teams can test changes without risking the primary.
Types of Database Replication In Oracle
Oracle offers several methods. Each suits distinct use cases and has trade-offs in RPO, RTO, complexity, and licensing. Below is a comparison summary:
Method | RPO | RTO | Use Case | Complexity | Licensing | Status | Oracle Version |
Data Guard | Data Guard | Fast failover/switchover | HA/DR for Oracle only | Moderate | Included in EE | Current | 11g onwards |
GoldenGate | Near-zero to configurable | Varies; depends on apply | Logical replication, heterogeneous, migrations, active-active | High | Separate license | Current | 11g onwards |
Materialized Views | Scheduled lag | Depends on refresh | Reporting, caches, minimal sync | Low | Included in EE | Current | 11g onwards |
Advanced Replication | Moderate; conflict risk | Slow for conflict resolution | Multi-master legacy | High | Included in EE | Legacy/Superseded | 11g,12c |
Streams | Near-zero to async | Fast | Deprecated logical replication | High | Included but deprecated | Deprecated | Deprecated in 12c, desupported 19c |
How to Replicate An Oracle Database?
The following overviews guide setup and operations. Always consult Oracle documentation for your version and environment.
Prerequisites and Planning
Before any replication setup: verify network connectivity, ensure sufficient bandwidth, and secure links. Confirm Oracle editions and licensing allow chosen methods. Prepare backups via RMAN. Assign dedicated users with correct privileges. Plan for storage on standby or trail destinations. Define RPO and RTO targets. Test in staging first. Document runbooks for setup, monitoring, and failover.
1. Data Guard Setup
Data Guard offers managed standby for HA/DR. You can use Broker or manual configuration. Active Data Guard adds read-only capability.
Primary Database Preparation
Enable ARCHIVELOG mode and FORCE LOGGING. Create standby redo logs: one more than the number of redo log groups. Set DB_UNIQUE_NAME on primary and standby. Configure LOG_ARCHIVE_DEST_n entries: primary sends redo to standby destinations. Set FAL_SERVER and FAL_CLIENT for gap resolution. Ensure initialization parameters align on both sides.
Standby Creation
Use RMAN DUPLICATE TARGET DATABASE FOR STANDBY from primary or perform backup and restore on standby host. Adjust init parameters in standby init file: DB_NAME matches primary, DB_UNIQUE_NAME differs. Configure control file autobackup. Ensure network entries in tnsnames.ora and listener.ora are correct.
Broker vs Manual Configuration
Broker (DGMGRL) simplifies management. You create a DG configuration, add primary and standby, set protection mode (MAXAVAIL, MAXPERFORMANCE, MAXPROTECTION). Broker handles validation, role transitions, and status monitoring. Manual setup uses SQL and RMAN commands: you edit init parameters, start managed recovery with ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT
. Broker is recommended for most setups.
Redo Transport Modes
SYNC mode (SYNC or FASTSYNC) waits for confirmation from standby, enabling near-zero data loss. ASYNC sends redo without wait, tolerates network latency but risks loss. Configure protection mode per RPO needs. Monitor transport lag via V$ARCHIVE_DEST_STATUS and V$DATAGUARD_STATS.
Apply Services and Active Data Guard
On standby, MRP (Managed Recovery Process) applies redo. With Active Data Guard, you open standby read-only: ALTER DATABASE OPEN READ ONLY
. Queries run on standby without affecting apply. Monitor apply lag via V$ARCHIVE_DEST_STATUS with APPLIED_TIME.
Role Transitions
Test switchover: planned switch where primary becomes standby. Use DGMGRL SWITCHOVER TO standby
. Test failover: unplanned, primary unreachable. Use DGMGRL FAILOVER TO standby
. After role change, reconfigure original as new standby. Document procedures and test regularly.
Monitoring and Alerting
Query V$ARCHIVE_DEST_STATUS and V$DATAGUARD_STATS for transport and apply lag. Use DGMGRL SHOW CONFIGURATION for overall status. Set alerts when lag exceeds threshold. Monitor SRL usage and space on standby. Monitor network errors in alert logs. Automate notifications via scripts or monitoring tools.
Common Issues and Troubleshooting
Network outages cause redo gaps. Use FAL_SERVICE to fetch missing logs. Resolve with ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL
then restart recovery. Insufficient standby redo logs cause slow apply. Archive log retention must account for standby consumption. Version mismatches block apply; ensure patch levels align. Test failover to validate setup.
2. GoldenGate Setup
GoldenGate provides logical replication. It works across heterogeneous systems. It uses Extract, trail files, Pump (optional), and Replicat processes.
Source Preparation
Enable supplemental logging: ALTER DATABASE ADD SUPPLEMENTAL LOG DATA
and ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS
or ADD TRANDATA
on tables. This ensures necessary change data in redo. Create GoldenGate user with required privileges.
Installing GoldenGate
Install GoldenGate binaries on source and target servers. Use matching versions aligned with Oracle Database version. Configure Manager process with port settings.
Configure Extract and Trail Files
Create Extract group: define source database and tables. Specify trail file location. Use Integrated Extract for Oracle for efficiency. Configure checkpoint tables in target schema to track progress. Optionally set up data pump Extract to push trails to targets.
Target Configuration
Create Replicat group: define target database and tables. Configure credential store or alias for secure authentication. Use parameter files to map source to target schemas and tables. Handle transformations or filtering in parameter files.
DDL Handling
GoldenGate can replicate DDL with appropriate settings but requires careful planning. Use DDL INCLUDEMAPPING
or script-based approaches. Validate that target schema supports new structures.
Starting and Monitoring Processes
Start Manager, Extract, Pump, and Replicat processes via GGSCI. Use INFO ALL
to check status and lag. Check report files for errors. Monitor lag metrics and throughput. Use heartbeat tables to detect stall.
Advanced Use Cases
Bidirectional replication requires conflict detection and resolution. Use Globalization Support for character sets. For heterogeneous targets, configure mapping accordingly.
Security
Secure trail files with OS-level permissions. Use encrypted network links or Secure Sockets for transport. Use GoldenGate credential store for passwords. Consider Oracle Key Vault integration.
Monitoring and Alerting
Query INFO EXTRACT
and INFO REPLICAT
for lag and status. Parse report files for errors. Set thresholds for lag; alert when exceeded. Monitor checkpoint tables for lags. Use scripts or monitoring tools to gather metrics.
Common Issues and Troubleshooting
Missing supplemental logging causes data loss. Capture gaps if redo logs overwritten; plan archive log retention. DDL changes may fail if unmatched. Network issues disrupt trail delivery. Check Manager logs for errors. Monitor disk space for trails. Test failover scenarios.
Rolling Upgrades
For GoldenGate upgrades, coordinate stop/start of Extract and Replicat. Use phased upgrade to avoid downtime. Validate compatibility with new Oracle patches.
3. Materialized Views Setup
Materialized views copy data at intervals. They suit reporting or caches.
Prerequisites
On source, create materialized view logs on tables: CREATE MATERIALIZED VIEW LOG ON schema.table WITH ROWID
. This enables fast refresh.
Create Materialized View
On target, CREATE MATERIALIZED VIEW mv_name REFRESH FAST ON DEMAND AS SELECT ... FROM schema.table@dblink;
. Use ON COMMIT
for immediate refresh on source commits if acceptable.
Refresh Options
Use FAST refresh when logs exist; COMPLETE refresh otherwise. Schedule refresh via Oracle Scheduler: DBMS_SCHEDULER.CREATE_JOB
. Monitor LAST_REFRESH_DATE in DBA_MVIEWS.
Monitoring and Issues
Check DBA_MVIEW_REFRESH_TIMES for history. Handle refresh errors due to network or data type mismatches. Ensure privileges on source links. Manage stale data by choosing refresh frequency.
Use Cases
Near-real-time reporting in distributed sites. Cache reference data. Offload queries from primary.
4. Advanced Replication Setup (Legacy)
Advanced Replication uses replication groups and jobs. It supports multi-master but is legacy. New projects should use GoldenGate.
Key Steps
Define replication group via DBMS_REPCAT. Add master sites. Define replicated objects. Configure conflict resolution methods. Schedule propagation jobs. Monitor via DBA_REPCAT or Oracle-supplied views.
Limitations
Does not support new Oracle features like multitenant. Complex setup and conflict handling. Limited vendor support. Superseded by GoldenGate.
5. Streams (Deprecated)
Oracle Streams provided logical replication. It was deprecated in 12c and desupported in 19c. Do not use for new deployments. Use GoldenGate for similar needs.
Safely backing up Oracle Database with Vinchin
With replication in place, backups remain essential. Replication handles availability but not all failures. You still need regular, consistent backups. Vinchin Backup & Recovery is a professional, enterprise-level database backup solution that supports most mainstream databases—Oracle, MySQL, SQL Server, MariaDB, PostgreSQL, and PostgresPro.
It offers many capabilities; key highlights include cloud backup and tape archiving, full and incremental backups with archived log support for Oracle, scheduled backup with data compression and deduplication, restore to a new server with point-in-time recovery, and ransomware protection, among other features. For Oracle specifically, it adds Oracle compression, block change tracking support, skipping accessible files, and skipping offline files to optimize backup jobs.
The Vinchin web console is simple and intuitive. Backing up Oracle involves four clear steps:
1. Select the database to back up,
2. Choose the backup storage,
3. Define the backup strategy,
4. Submit the job.
The interface guides you with clear labels and prompts. You can monitor job progress, view logs, and adjust schedules in the console without complex commands.
With a global customer base and high product ratings, Vinchin offers a 60-day full-featured free trial—click the button to download the installer and deploy easily.
Oracle Database Replication FAQs
Q1: How do I monitor Data Guard apply lag?
Use SQL: SELECT DEST_ID, DEST_NAME, STATUS, RECEIVED_TIME, APPLIED_TIME FROM V$ARCHIVE_DEST_STATUS WHERE STATUS NOT IN ('DEFERRED','INACTIVE')
; check V$DATAGUARD_STATS for lag metrics.
Q2: How to resolve gaps when redo transport fails?
Run ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL
; then fetch missing logs via FAL_SERVER; restart recovery: ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT
.
Q3: How to test GoldenGate failover?
Stop Extract on source; promote target as new source; adjust Extract parameter to capture from new source; restart processes; after fix, reconfigure original as target.
Q4: How does replication impact primary performance?
SYNC mode adds commit latency; ASYNC adds minimal. GoldenGate capture adds redo generation and CPU. Monitor AWR and system metrics; size resources accordingly.
Q5: How to choose between Data Guard and GoldenGate?
Use Data Guard for core HA/DR within Oracle. Use GoldenGate for logical replication, heterogeneous targets, filtering, zero-downtime migrations, and multi-master scenarios.
Conclusion
Oracle replication boosts availability, resilience, and scalability. Data Guard and GoldenGate meet most enterprise needs. Materialized views suit reporting, while legacy options remain in limited use. Effective operations demand clear RPO/RTO goals, thorough testing, and proactive monitoring. Secure replication with encryption and credentials.
Always pair replication with reliable backups. Vinchin offers a robust backup solution for Oracle. Try its free trial to secure your environment.
Share on: