Source Oracle pluggable database (PDB) #
This page contains instructions for setting up Oracle PDB as data source. Oracle PDB is a crucial part of Oracle multitenant architecture.
Arcion supports both snapshot and realtime replication for Oracle PDB.
Grant PDB permissions #
-
Ensure that you’re connected as a common user with privileges granted on both
CDB$ROOT
, the CDC container, and the PDB. -
Provide following additional permissions:
GRANT SET CONTAINER TO <USERNAME> CONTAINER=ALL; GRANT SELECT ON DBA_PDBS to <USERNAME> CONTAINER=ALL;
-
Change the open mode of the PDB to
READ WRITE
:ALTER PLUGGABLE DATABASE $PDB_NAME OPEN READ WRITE FORCE;
Get the current SCN #
Take note of the current system change number (SCN) with the following SQL command:
select CURRENT_SCN from v$database;
The output is similar to the following:
CURRENT_SCN
-----------
2401901
Configure snapshot replication #
For snapshot mode, follow these steps.
1. Set up connection configuration #
For connecting to the PDB database, provide its connection details to Replicant in the following format:
type: ORACLE
host: HOST
port: PORT_NUMBER
service-name: "SERVICE_NAME"
username: "USERNAME"
password: "PASSWORD"
max-connections: 30
max-retries: 10
retry-wait-duration-ms: 1000
Replace the following:
HOST
: the Oracle PDB hostPORT_NUMBER
: the port number of the PDB hostSERVICE_NAME
: the service name for the PDBUSERNAME
: the username that connects to the PDBPASSWORD
: the password associated withUSERNAME
The following is a sample configuration:
type: ORACLE
host: 10.0.0.18
port: 1521
service-name: "ORCLPDB1"
username: 'alex'
password: 'alex1234'
max-connections: 30
max-retries: 10
retry-wait-duration-ms: 1000
2. Set up Extractor configuration #
For Extractor configuration, you can use the same parameters as a traditional Oracle database source. For more information, see Parameters related to snapshot mode and Snapshot mode in Extractor reference.
3. Run Replicant #
Run Replicant with the snapshot
option, specifying the connection, Extractor, and Applier configuration files. For example:
./bin/replicant snapshot \
./conf/conn/oracle_multitenant_pdb.yaml ./conf/conn/yugabyte.yaml \
--extractor ./conf/src/oracle_common.yaml \
--applier ./conf/dst/yugabyte.yaml \
--filter ./filter/oracle19c_filter.yaml
For more information about running Replicant in snapshot mode, see Replicant snapshot mode.
Configure realtime replication #
For realtime mode, follow these steps.
1. Set up connection configuration #
For realtime replication, you need to connect to the multitenant container database (CDB). Using the pdb-connection
field, you also need to pass the PDB connection details.
The following is the configuration structure:
type: ORACLE
host: CDB_HOST
port: CDB_PORT_NUMBER
service-name: "CDB_SERVICE_NAME"
username: "CDB_USERNAME"
password: "CDB_PASSWORD"
max-connections: 30
max-retries: 10
retry-wait-duration-ms: 1000
continuous-log-mining: {true|false}
pdb-connection:
host: PDB_HOST
port: PDB_PORT_NUMBER
service-name: "PDB_SERVICE_NAME"
username: "PDB_USERNAME"
password: "PDB_PASSWORD"
max-connections: 10
pdb-name: PDB_NAME
continuous-log-mining: {true|false}
Replace the following:
CDB_HOST
: the Oracle CDB hostCDB_PORT_NUMBER
: the port number of the CDB hostCDB_SERVICE_NAME
: the service name for the CDBCDB_USERNAME
: the username that connects to the CDBCDB_PASSWORD
: the password associated withCDB_USERNAME
PDB_HOST
: the Oracle PDB hostPDB_PORT_NUMBER
: the port number of the PDB hostPDB_SERVICE_NAME
: the service name for the PDBPDB_USERNAME
: the username that connects to the PDBPDB_PASSWORD
: the password associated withPDB_USERNAME
The following is a sample configuration:
type: ORACLE
host: 10.0.0.18
port: 1521
service-name: "ORCLCDB"
username: 'alex'
password: 'alex1234'
max-connections: 30
max-retries: 10
retry-wait-duration-ms: 1000
continuous-log-mining: false
pdb-connection:
host: 10.0.0.18
port: 1521
service-name: "ORCLPDB1"
username: 'alex'
password: 'alex1234'
max-connections: 10
pdb-name: ORCLPDB1
continuous-log-mining: false
2. Fetch schemas #
Before starting realtime replication, you need to fetch the schemas first by connecting to the PDB:
./bin/replicant fetch-schemas \
./conf/conn/oracle_multitenant_pdb.yaml \
--filter ./filter/oracle_filter.yaml \
--output-file ./oracle_schema.yaml
You can pass a different location for the output file.
3. Set up Extractor configuration #
For Extractor configuration, you need to specify your configuration under the realtime
section of the Extractor configuration file. The following steps are specific to Oracle PDB:
I. Specify the heartbeat table and schema details #
Create the heartbeat table in the CDB and pass its details using the heartbeat
parameter. For example:
realtime:
heartbeat:
enable: true
schema: "C##REPLICANT"
interval-ms: 10000
II. Specify the starting SCN #
Notice that we get the current SCN in the first section. For realtime replication, you need to specify that SCN as the starting SCN in the realtime
section of the Extractor configuration file:
realtime:
start-position:
start-scn: 2393338
The reason for this is to apply anything that happens after the snapshot starts.
The rest of the Extractor parameters available to you are the same as a traditional Oracle database source. For more information, see Parameters related to realtime mode and Realtime mode Extractor reference.
4. Run Replicant #
As the last step, run Replicant with the necessary options and arguments. Remember to use the --src-schemas
option to specify the schema we fetch in the second step.
./bin/replicant real-time \
./conf/conn/oracle_multitenant_pdb.yaml \
./conf/conn/yugabyte.yaml \
--extractor ./conf/src/oracle_common.yaml \
--applier ./conf/dst/yugabyte.yaml \
--filter ./filter/oracle_filter.yaml \
--src-schemas ./output/oracle_schema.yaml
In the preceding example, we run Replicant with the following options and arguments:
- The connection configuration files of the source and the target
- The Extractor configuration file with the
--extractor
option - The Applier configuration file with the
--applier
option - A filter file with the
--filter
option
For more information about running Replicant in realtime mode, see Replicant realtime mode.