What is Parallel Media Recovery?
Parallel Media Recovery is a mechanism in Oracle that allows multiple parallel processes (or recovery slaves) to recover redo logs concurrently in a physical standby database. This process improves recovery time by leveraging multiple CPU cores on the standby system to read and apply redo logs simultaneously. With the evolution of Oracle versions, the implementation and control of parallel recovery have become more sophisticated, offering better scalability and flexibility.
Basics of Media Recovery?
Media recovery involves applying archived redo logs from primary database to physical standby database to keep it in sync with the primary. In a physical standby, recovery is typically managed by the Managed Recovery Process (MRP). MRP applies redo logs continuously from the archive to maintain data consistency between the primary and the standby.
Without parallel recovery, MRP applies redo logs sequentially, which can be slow, especially in high-transaction environments. This is where Parallel Media Recovery becomes vital.
Parallel media recovery was introduced in Oracle 10g. In this version, Oracle automatically determines the number of parallel processes based on the number of CPUs available on the system. Oracle 11g brought further improvements, particularly in decoupling parallel recovery from parallel query processes, which were used in previous versions.
Start Parallel Media Recovery:
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE PARALLEL 12 DISCONNECT FROM SESSION;
This command instructs Oracle to use 12 parallel recovery slaves for media recovery, and recovery process will disconnect from the session after starting.
Monitor the parallel recovery process through the Oracle alert log. Here's an example output:
Attempt to start background Managed Standby Recovery process (SID)
Mon Feb 23 02:03:24 2021
MRP0: Background Managed Standby Recovery process started (SID)
started logmerger process
Mon Feb 23 02:03:29 2021
Managed Standby Recovery not using Real Time Apply
Mon Feb 23 02:03:50 2021
Parallel Media Recovery started with 12 slaves
Canceling Parallel Recovery:
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
Switching Between Parallel and Serial Recovery:
If you want to disable parallel recovery and revert to serial recovery, use the command below:
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT noparallel;
This command disables parallelism (noparallel) and switches the recovery to a serial mode, where only one process applies redo logs.
Best Practices for Parallel Media Recovery:
While Parallel Media Recovery can significantly speed up the recovery process, it’s essential to use it judiciously. Here are some best practices:
Allow Oracle to Determine Parallelism: Rather than manually setting the parallel degree, it is generally recommended to let Oracle automatically manage the degree of parallelism based on system resources. This helps avoid overloading the system and ensures optimal recovery performance.
Leverage Data Guard Broker for Configuration: If you’re using Data Guard Broker, you can configure the ApplyParallel property to control parallel recovery. In Oracle 11.1 and later, we can set the ApplyParallel property to AUTO (enabled) or NO (disabled). In Oracle 11.2 and higher, you can specify the exact number of parallel recovery slaves via the PARALLEL attribute.
Example:
ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=STANDBY' PARALLEL 8;
Monitor and Adjust Based on System Performance: Always monitor system performance and adjust parallelism if necessary. For systems with limited CPU resources, setting too many parallel processes could negatively impact overall system performance.
Use Real-Time Apply with Caution: While Real-Time Apply can apply redo logs as they are generated, it might not always be compatible with parallel recovery. Ensure your system requirements are met before enabling this feature.
Optimize Redo Log Archiving: Efficient redo log archiving and transmission are essential to maximize the effectiveness of Parallel Media Recovery. Ensure that the redo logs from the primary are transmitted quickly to the standby database for recovery.
Troubleshooting Parallel Media Recovery:
If Parallel Media Recovery is not functioning as expected, here are a few steps to diagnose the issue:
Check Alert Logs: Always review the alert logs for messages related to recovery, such as issues with log shipping, file access, or insufficient resources.
Monitor the Processes: Use Oracle views like V$RECOVERY_PROGRESS and V$MANAGED_STANDBY to check the status of recovery processes and ensure the parallel slaves are running as expected.
Review Configuration Parameters: Ensure that the parallel_max_servers and related parameters are correctly configured and not restricting parallel recovery.
Test Performance: Run performance tests by changing the parallel degree to see how the system responds. You can adjust parallelism based on the results to achieve optimal recovery speed.
Monday, 29 March 2021
Optimizing Physical Standby Recovery with Parallel Media Recovery
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment