Activate replication with an Oracle hot backup on a quiet database
Use this procedure to use an Oracle hot backup to establish a target Oracle instance and activate replication if user activity can be stopped while the procedure is performed. This procedure can be used for all replication configurations.
Preliminary considerations
Read these points before you proceed.
Supported databases
Oracle source and Oracle target
Supported replication strategies
All but high-availability. This procedure is not appropriate for a high-availability strategy because it requires the source database to be quieted while the backup is taken and the configuration file is being activated.
Certain limitations apply:
Consolidated replication (many sources to one target) |
To establish consolidated replication, the use of a hot backup from all source systems is not possible. A backup from one source will override the data that was applied by a backup from a different source. You can use a hot backup of one of the source instances to establish a target instance, and then use another copy method to apply the objects from the other source instances. Possible methods include:
|
Windows systems |
To use a hot backup between Windows systems, the target system must have an instance already created containing an identical ORACLE_SID and directory structure created with the Oracle creation tools. Oracle runs as a service on Windows, and the Registry entries must exist before starting the database recovery process. The database can start empty, because the hot backup will populate it. |
Requirements
- [Unix and Linux systems] Verify that the ORACLE_SID and ORACLE_HOME in the oratab file are correct for the instance you will be establishing with the hot backup. The SID must be the SID used in the routing map in the configuration file that you will be activating.
- Read the requirements before you start this procedure. For more information, see Requirements for activating a configuration.
- Users must stop accessing the production database while the hot backup and configuration activation take place.
- Make certain a SharePlex database account exists in the source database (only). This account usually is created during SharePlex installation. See the SharePlex Installation and Setup Guide for more information.
- Before you start, review this procedure and see the SharePlex Reference Guide for more information about the commands that are used.
Procedure
Note: If you are not using cascading replication, ignore all references to an intermediary system. For more information, see Configure replication through an intermediary system.
- On the source system, complete the Oracle hot backup.
- On the source system, stop user access to the source database by shutting it down and opening it in restricted mode.
-
On the source system, switch the redo logs.
On-premises database:
svrmgr1> alter system switch logfile;
Amazon RDS database:
Run the Amazon RDS procedure rdsadmin.rdsadmin_util.switch_logfile.
- Keep a record of the sequence number of the current log.
- On all systems, start sp_cop and sp_ctrl from the bin sub-directory of the SharePlex product directory.
-
On all systems, verify that sp_cop and sp_ctrl are running.
sp_ctrl> status
-
On the intermediary and target systems, stop Post. Stopping Post allows replicated data to accumulate in the post queue until the databases have been recovered.
sp_ctrl> stop post
-
On the source system, activate the configuration file.
sp_ctrl> activate config filename
-
On the source system, view activation status.
Note: The command retains control of sp_ctrl until activation is finished.
- When the activation is finished, allow users to resume access to the source database.
- List the archive logs on the intermediary and target systems. Delete any logs made after the one for which you made a record.
- On the intermediary and target systems, recover the database to the log number that you recorded. Make sure a full recovery is performed.
- On the intermediary and target systems, open the database.
-
On the intermediary and target systems, run the Database Setup utility for the target instance. When prompted for the SharePlex database user, enter n to choose the existing user and password (these were copied in the backup).
Would you like to create a new SharePlex user [y].n
Notes:
- SharePlex can remain running during the setup process.
- For more information about Database Setup, see Database Setup Utilities in the SharePlex Reference Guide.
- On the intermediary and target systems, run the cleanup.sql script to truncate the SharePlex internal tables. Instructions for running this script are in the SharePlex Reference Guide.
- On the intermediary and target systems, disable triggers on the tables, or run the sp_add_trigger.sql utility script so that the triggers ignore the SharePlex user.
- On the intermediary and target systems, disable check constraints and scheduled jobs that perform DML.
- [Partitioned replication only] If you are using vertically partitioned or horizontally partitioned replication for any tables, delete the unneeded columns and rows from those tables on the intermediary and target systems.
-
[Intermediary system only] On the intermediary system, set the SP_OCT_REPLICATE_POSTER parameter to 1. This directs SharePlex to capture posted changes on that system and replicate them to the target system.
sp_ctrl> set param SP_OCT_REPLICATE_POSTER 1
-
On the intermediary system, activate the configuration file.
sp_ctrl> activate config filename
-
On the intermediary system, monitor activation status.
Note: The command retains control of sp_ctrl until activation is finished.
-
When activation is finished, start the Post process on the intermediary and target systems. All instances are now in synchronization, and SharePlex will continue replicating to maintain synchronization.
sp_ctrl> start post
-
[Optional] If this was only a partial backup, drop the tablespaces that were not copied over during the hot backup.
Activate replication with Oracle transportable tablespaces
Use this procedure to use the Oracle transportable tablespaces feature to establish a target Oracle instance and activate replication. It enables you to synchronize and resynchronize numerous objects quickly and with minimal downtime. It allows you to export just the metadata (data dictionary) and then copy the data files. This method also moves indexes so that there is no need to rebuild them in the target database, and you can move multiple tablespaces at one time.
Note: This document does not provide instructions for how to use transportable tablespaces. This procedure should be performed by someone who has a solid understanding of database copy methods.
Preliminary considerations
Read these points before you proceed.
Supported databases
Oracle source and Oracle target
Supported replication strategies
All replication strategies. This procedure may not appropriate for a high-availability strategy if the source database cannot be quieted even briefly.
Requirements
Naming conventions used
In this procedure, the "source" system is one of the following:
- The source system of a single-direction replication configuration, including cascading replication.
- All source systems of a consolidated replication configuration.
- The trusted source system in a peer-to-peer replication configuration.
- The primary node of a cluster (where the cluster VIP is running).
In this procedure, the "intermediary" system only needs to be part of this procedure if SharePlex will be posting to, and capturing from, an intermediary system in a cascading configuration.
In this procedure, the "target" system is one of the following:
- The target system of a single-direction replication configuration, including cascading and consolidated replication.
- The secondary systems in a peer-to-peer replication configuration.
- The primary node (where the cluster VIP is running) of the target cluster.
In this procedure, the SharePlex commands in the procedure apply to all sp_cop instances that apply to the replication strategy you are using (for example, all sp_cop processes on a target in consolidated replication).
Procedure
-
On the source system, set the source tablespaces that you want to copy to READ ONLY.
svrmgr1> alter tablespace name read only;
-
On the source system, activate the configuration file.
sp_ctrl> activate config filename
- On the source system, start sp_cop and sp_ctrl from the bin sub-directory of the SharePlex product directory.
-
On the source system, verify that sp_cop and sp_ctrl are running.
sp_ctrl> status
-
On the intermediary and target systems, stop Post. Stopping Post allows replicated data to accumulate in the post queue until the databases have been recovered.
sp_ctrl> stop post
- On the source system, export the metadata to an export file.
- When the export is finished, copy the datafiles to another location on the source system. This minimizes the impact on the source database of copying the files to the target system.
-
Set the source tablespaces back to read/write mode.
svrmgr1> alter Tablespace name read write;
- If any of the copied datafiles and tablespaces exist in the intermediary or target database, drop them so that the copied files can be applied.
- Copy the files from the new location on the source system to the intermediary and target systems.
- On the intermediary and target systems, use the Oracle import utility to import the metadata and the tablespace definitions.
- On the intermediary and target systems, set the tablespace(s) to read/write mode.
- On the intermediary and target systems, open the Oracle instances.
-
On the intermediary and target systems, disable triggers on the tables, or run the sp_add_trigger.sql utility script so that the triggers ignore the SharePlex user.
- On the intermediary and target systems, disable check constraints and scheduled jobs that perform DML.
- [Partitioned replication only] If you are using vertically partitioned or horizontally partitioned replication for any tables, delete the unneeded columns and rows from those tables on the intermediary and target systems.
-
[Intermediary system only] Set the SP_OCT_REPLICATE_POSTER parameter to 1. This directs SharePlex to capture posted changes on that system and replicate them to the target system.
sp_ctrl> set param SP_OCT_REPLICATE_POSTER 1
-
[Intermediary system only] Activate the configuration file.
sp_ctrl> activate config filename
-
[High availability] On the target system, stop the Export process.
sp_ctrl> stop export
-
[High availability and peer-to-peer replication] Activate the configuration on the target system(s).
sp_ctrl> activate config filename
-
Start Post on the intermediary and target systems. SharePlex begins executing the SQL statements that have been collecting in the post queue, keeping the source and target data in sync.
sp_ctrl> start post
- [Peer-to-peer replication] Allow users to access the databases on all systems.
Activate replication with cold copy/transfer methods
Use this procedure to synchronize the source and target data with the following utilities:
- Import/Export/Data Pump
- Store/Restore from tape
- FTP
Note: This document does not provide instructions for how to perform the chosen copy method. This procedure should be performed by someone who has a solid understanding of database copy methods.
Preliminary considerations
Read these points before you proceed.
Supported databases
Oracle source and Oracle target
Supported replication strategies
All but high-availability. This procedure is not appropriate for a high-availability strategy because it requires the source database to be quieted while the configuration file is being activated.
Requirements
- [Unix and Linux systems] Verify that the ORACLE_SID and ORACLE_HOME in the oratab file are correct for the instance you will be establishing with the hot backup. The SID must be the SID used in the routing map in the configuration file that you will be activating.
- Read the requirements before you start this procedure. For more information, see Requirements for activating a configuration.
- Users must stop accessing the production database while the copy and configuration activation take place.
- The target instance must exist.
- Make certain SharePlex database accounts exist in the source and target databases. This account usually is created during installation. See the SharePlex Installation and Setup Guide for more information.
- Before you start, review this procedure and see the SharePlex Reference Guide for more information about the commands that are used.
Naming conventions used
In this procedure, the "source" system is one of the following:
- The source system of a single-direction replication configuration, including cascading replication.
- All source systems of a consolidated replication configuration.
- The trusted source system in a peer-to-peer replication configuration.
- The primary node of a cluster (where the cluster VIP is running).
In this procedure, the "intermediary" system only needs to be part of this procedure if SharePlex will be posting to, and capturing from, an intermediary system in a cascading configuration.
In this procedure, the "target" system is one of the following:
- The target system of a single-direction replication configuration, including cascading and consolidated replication.
- The secondary systems in a peer-to-peer replication configuration.
- The primary node (where the cluster VIP is running) of the target cluster.
In this procedure, the SharePlex commands in the procedure apply to all sp_cop instances that apply to the replication strategy you are using (for example, all sp_cop processes on a target in consolidated replication).
Procedure
-
On the source system, stop user access to the objects that are in the replication configuration.
- If deploying consolidated replication, you can either stop access to all of the source systems at once and make the copies at the same time, or you can synchronize each source system one at a time using these instructions.
- If deploying peer-to-peer replication, stop access to all databases in the peer group, including the trusted source.
- Copy the files from the source system to the intermediary and target systems.
- On the source system, start sp_cop and sp_ctrl.
-
On the source system, activate the configuration file (all files if using consolidated replication).
sp_ctrl> activate config filename
- On the intermediary and target systems, start sp_cop and sp_ctrl.
-
On the intermediary and target systems, stop Post. Stopping Post allows any data that gets replicated before the target data is established to collect in the post queue.
sp_ctrl> stop post
- On the source system, allow users to resume access to the source database.
-
On the source system, verify that the sp_cop, Capture, and Read processes are running.
sp_ctrl> status
- Start and mount the intermediary and target databases, but do not allow users access.
- On the intermediary and target systems, apply the copy to the database.
-
On the intermediary and target systems, disable triggers on the tables, or run the sp_add_trigger.sql utility script so that the triggers ignore the SharePlex user.
- On the intermediary and target systems, disable check constraints and scheduled jobs that perform DML.
- [Partitioned replication only] If you are using vertically partitioned or horizontally partitioned replication for any tables, delete the unneeded columns and rows from those tables on the intermediary and target systems.
-
[Intermediary system only] Set the SP_OCT_REPLICATE_POSTER parameter to 1. This directs SharePlex to capture posted changes on that system and replicate them to the target system.
sp_ctrl> set param SP_OCT_REPLICATE_POSTER 1
-
[Intermediary system only] Activate the configuration file.
sp_ctrl> activate config filename
- [Peer-to-peer] Activate the configuration file on the target systems.
-
Start Post on:
- The intermediary system
- The trusted source and all other targets in a peer group
- All other targets
Note: SharePlex will start executing SQL statements that accumulated in the post queue.
- [Peer-to-peer] On the target systems in the peer group, allow users to resume access to the database.
Activate replication from Oracle to Open Target
Use this procedure to synchronize an Oracle source database with an Open Target database. SharePlex replicates the Oracle data changes and maintains them in the Post queue until the target is established with the copy. When the target is ready, you run the SharePlex reconcile feature, which ensures that Post only applies the operations that occurred after the copy and discards operations that were committed to the source before the copy.
Preliminary considerations
Read these points before you proceed.
Supported databases
Oracle source and any supported target
Supported replication strategies
All
Requirements
Procedure
- On the source and target systems, start sp_cop and sp_ctrl from the bin sub-directory of the SharePlex product directory.
-
On source and target systems, verify that the SharePlex processes are running.
sp_ctrl> status
-
On the target system, stop the Post process. This allows replicated data to accumulate in the post queue until the target database is instantiated and reconciled.
sp_ctrl> stop post
-
Activate the configuration on the source system.
sp_ctrl> activate config filename
-
On the source system, monitor activation status.
Note: The command retains control of sp_ctrl until activation is finished.
- When activation is complete, start the hot backup to the staging instance.
-
When the hot backup is finished, switch log files on the primary source system twice.
On-premises database:
svrmgr1> alter system switch logfile;
svrmgr1> alter system switch logfile;
Amazon RDS database:
Run the Amazon RDS procedure rdsadmin.rdsadmin_util.switch_logfile twice.
- Copy the archive logs that were generated by the log switch from the primary instance to the staging instance.
-
Do one of the following:
- If the source is RAC, recover the database on the staging server to the latest SCN of the last archive log that was copied to the staging server.
-
If the source is not RAC, recover to the sequence number of the last archive log that was copied to the staging server.
Note: The next steps apply the replicated changes that occurred after the backup point.
-
Do one of the following:
- Using the copy method of your choice, make a copy of the Oracle data from the staging server to the Open Target database. Wait until the copy is finished before proceeding to the next step.
-
[Optional] If you are using named post queues and are unsure of the queue names, issue the qstatus command and make a note of them.
sp_ctrl> qstatus
- On the target system, disable triggers on the target tables.
- On the target system, disable check constraints and scheduled jobs that perform DML.
-
On the target system, run sp_ctrl, then issue one of the following reconcile commands. If you are using named post queues, issue the command for each one.
-
If the source is non-RAC, reconcile to the log sequence number of the log that you noted previously.
sp_ctrl> reconcile queue queuename for datasource-datadest seq sequence_number
Example: reconcile queue SysA for o.prod1-r.rep1 seq 1234
-
If the source is RAC, reconcile to the SCN that you noted previously.
sp_ctrl> reconcile queue queuename for datasource-datadest scn scn_number
Example: reconcile queue SysA for o.prod1-r.rep1 scn 0123456789
Note: The command retains control of sp_ctrl until the reconcile process is finished.
-
On the target system, start the Post process. The two instances are now in synchronization, and SharePlex will continue replicating to maintain synchronization.
sp_ctrl> start post