Skip to content

Commit ddf47fb

Browse files
Merge pull request #188 from nvillahermosa-mdb/DOCSP-45339-oracle-migration-prereqs
DOCSP-45339 Update Oracle migration prerequisites
2 parents 8507c8c + 2e0629b commit ddf47fb

File tree

3 files changed

+71
-49
lines changed

3 files changed

+71
-49
lines changed

source/includes/fact-data-prep-oracle-step1.rst

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,22 @@ instance. Alternatively, you can use an existing Oracle
44
service account to connect to Relational Migrator with
55
the appropriate permissions.
66

7+
.. tip::
8+
9+
To migrate data from a multi-tenant container database, `create tablespaces
10+
and a Common User <https://oracle-base.com/articles/12c/multitenant-manage-users-and-privileges-for-cdb-and-pdb-12cr1>`__.
11+
712
a. Create a service account:
813

914
.. code-block:: sql
1015
:copyable: true
1116
1217
CREATE USER '<user>'@'localhost' IDENTIFIED BY '<password>';
1318
14-
#. Grant select permissions to the service account:
19+
#. Confirm that the service account owns the tables in the migration job.
1520

16-
The required permission for the service account depend on whether
17-
the tables are owned by the service account used to run the migration job.
18-
To check table ownership run the following query:
21+
Required permissions depend on whether the service account owns the tables
22+
used in the migration job. To check table ownership, run the following query:
1923

2024
.. code-block:: sql
2125
:copyable: true
@@ -25,6 +29,19 @@ a. Create a service account:
2529
WHERE TABLE_NAME ='<table_name>'
2630
ORDER BY OWNER, TABLE_NAME;
2731
32+
#. Grant permissions to the service account.
33+
34+
.. important::
35+
36+
If you're migrating a multi-tenant container database as a
37+
common user, append ``CONTAINER=ALL`` when granting permissions. For
38+
example:
39+
40+
.. code-block:: sql
41+
:copyable: false
42+
43+
GRANT CREATE SESSION TO <user> CONTAINER=ALL;
44+
2845
If the service account *is* the table owner:
2946

3047
.. code-block:: sql
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
- Snapshot migration jobs migrate all the data and then stops.
2-
- Continuous migration job run a snapshot and then enter a CDC stage to
3-
continuously replicate data changes.
1+
- Snapshot migration jobs migrate all data once, and then stop.
2+
- Continuous migration jobs run a snapshot migration and then enter a CDC stage, which
3+
continuously replicates data changes.

source/jobs/prerequisites/oracle.txt

Lines changed: 47 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@ Configure Migration Prerequisites for Oracle
1010
:depth: 1
1111
:class: singlecol
1212

13-
To run migration jobs from an Oracle source database, the database may require
14-
some configuration changes. If Relational Migrator determines the
15-
database needs configuration changes, it automatically generates a
16-
SQL script with the required changes. It is recommended to have a
17-
Database Administrator (DBA) review the commands in this script and
18-
perform their execution on the database server. The
19-
Oracle configurations depend on the type of migration job:
13+
When you migrate data from an Oracle source database, Relational Migrator
14+
automatically checks your database for needed configuration changes and
15+
generates a SQL script to implement them. Have a Database Administrator (DBA)
16+
review the script and run the commands on the database server.
17+
18+
Oracle configuration depends on the type of migration job:
2019

2120
.. include:: /includes/fact-short-sync-job-desc.rst
2221

@@ -28,13 +27,15 @@ About this Task
2827

2928
- If you're migrating from an Oracle 12c instance, you must run commands as
3029
the SYSDBA role.
31-
- In Oracle 12c the concept of a pluggable database was introduced. Some
32-
of these commands can be run on PDB(plugable database) while commands
33-
such as enabling ``ARCHIVELOG`` must be run on the
34-
CDB(container/master database). For details on each architecture,
35-
see `Overview of Container Databases and Pluggable Databases
36-
<https://oracle-base.com/articles/12c/multitenant-overview-container-database-cdb-12cr1>`__.
37-
- Supplemental logging is not allowed in Oracle Express editions.
30+
- Oracle 12c introduced the concept of a pluggable database (PDB). Some
31+
commands can be run on a PDB, while commands like enabling ``ARCHIVELOG``
32+
must be run on the container/master database (CDB). For details on each
33+
architecture, see `Overview of Container Databases and Pluggable Databases <https://oracle-base.com/articles/12c/multitenant-overview-container-database-cdb-12cr1>`__.
34+
- Some commands differ based on whether the database is single or
35+
multi-tenant. In a multi-tenant database, permissions must
36+
include the suffix ``CONTAINER=ALL``.
37+
- You can't run a continuous migration job against Oracle Database Express
38+
Edition (XE), because XE doesn't support the necessary logs.
3839

3940
Steps
4041
-----
@@ -61,8 +62,10 @@ Steps
6162

6263
.. include:: /includes/fact-data-prep-oracle-step1.rst
6364

64-
c. Grant additional permissions to the service account
65-
to run continuous migration jobs:
65+
d. Grant additional permissions to the service account
66+
to run continuous migration jobs.
67+
68+
Append ``CONTAINER=ALL`` if you're migrating a multi-tenant container database.
6669

6770
.. code-block:: sql
6871
:copyable: true
@@ -86,46 +89,48 @@ Steps
8689
GRANT SELECT ON V$ARCHIVED_LOG TO <user>;
8790
GRANT SELECT ON V$ARCHIVE_DEST_STATUS TO <user>;
8891
GRANT SELECT ON V$TRANSACTION TO <user>;
92+
GRANT SELECT ON V_$MYSTAT TO <user>;
93+
GRANT SELECT ON V_$STATNAME TO <user>;
8994

90-
.. step:: Turn on ``LogMiner`` at the database level
91-
92-
To run continous jobs against Oracle, you must enable
93-
``LogMiner`` at the database level. The following code-block
94-
is an example of automatically-generated code, which you
95-
can run manually by substituting your database name:
96-
97-
.. code-block:: sql
98-
:copyable: true
99-
100-
ALTER SYSTEM SET db_recovery_file_dest_size = 10G;
101-
ALTER SYSTEM SET db_recovery_file_dest = '/opt/oracle/oradata/recovery_area' SCOPE=spfile;
102-
SHUTDOWN IMMEDIATE;
103-
STARTUP MOUNT
104-
ALTER DATABASE ARCHIVELOG;
105-
ALTER DATABASE OPEN;
95+
.. step:: Turn on archive logging
10696

107-
.. tip::
97+
a. To see if archive logging is already enabled, run the following query:
98+
99+
.. code-block:: sql
100+
:copyable: true
108101

109-
To check if ``LogMiner`` is already enabled, run the
110-
following query:
102+
SELECT LOG_MODE FROM V$DATABASE;
111103

112-
.. code-block:: sql
113-
:copyable: true
104+
This outputs ``ARCHIVELOG`` if logging is enabled, or
105+
``NOARCHIVELOG`` if it isn't.
106+
107+
#. If archive logging isn't already enabled, enable it.
108+
109+
Relational Migrator can automatically generate code to enable
110+
logging. The following code is an example. If you're migrating a
111+
multi-tenant database, run these commands on the container/
112+
master database.
113+
114+
.. code-block:: sql
115+
:copyable: true
114116

115-
SELECT LOG_MODE FROM V$DATABASE;
117+
ALTER SYSTEM SET db_recovery_file_dest_size = 10G;
118+
ALTER SYSTEM SET db_recovery_file_dest = '/opt/oracle/oradata/recovery_area' scope=spfile;
119+
SHUTDOWN IMMEDIATE;
120+
STARTUP MOUNT
121+
ALTER DATABASE ARCHIVELOG;
122+
ALTER DATABASE OPEN;
116123

117124
.. step:: Enable supplemental logging
118125

119-
a. To run continuous migration jobs against Oracle, you must
120-
enable supplemental logging at the database level:
126+
a. Enable supplemental logging on the database:
121127

122128
.. code-block:: sql
123129
:copyable: true
124130

125131
ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
126132

127-
#. You must also enable supplemental logging for every
128-
table in the migration:
133+
#. Enable supplemental logging for every table in the migration:
129134

130135
.. code-block:: sql
131136
:copyable: true

0 commit comments

Comments
 (0)