Skip to content

Commit ebadd35

Browse files
authored
DOCSP-34264 Add Oracle Prereq Content (#92)
* DOCSP-34264 Add Oracle PreReq Page Content
1 parent 2a9105d commit ebadd35

File tree

2 files changed

+179
-1
lines changed

2 files changed

+179
-1
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
The following code creates a new Oracle service account
2+
for Relational Migrator to connect to the Oracle
3+
instance. Alternatively, you can use an existing Oracle
4+
service account to connect to Relational Migrator with
5+
the appropriate permissions.
6+
7+
a. Create a service account:
8+
9+
.. code-block:: sql
10+
:copyable: true
11+
12+
CREATE USER '<user>'@'localhost' IDENTIFIED BY '<password>';
13+
14+
#. Grant select permissions to the service account:
15+
16+
The required permission for the service account depend on whether
17+
the tables are owned by the service account used to run the sync job.
18+
To check table ownership run the following query:
19+
20+
.. code-block:: sql
21+
:copyable: true
22+
23+
SELECT TABLE_NAME, OWNER
24+
FROM ALL_TABLES
25+
WHERE TABLE_NAME ='<table_name>'
26+
ORDER BY OWNER, TABLE_NAME;
27+
28+
If the service account *is* the table owner:
29+
30+
.. code-block:: sql
31+
:copyable: true
32+
33+
GRANT CREATE SESSION TO <user>;
34+
GRANT SELECT ON V_$DATABASE TO <user>;
35+
36+
If the service account *is not* the table owner:
37+
38+
.. code-block:: sql
39+
:copyable: true
40+
41+
GRANT CREATE SESSION TO <user>;
42+
GRANT SELECT_CATALOG_ROLE TO <user>;
43+
GRANT SELECT <table> TO <user>;
44+
GRANT SELECT ON V_$DATABASE TO <user>;
45+
GRANT FLASHBACK ON <table> TO user;

source/prerequisites/oracle.txt

Lines changed: 134 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,137 @@ Configure Migration Prerequisites for Oracle
1010
:depth: 1
1111
:class: singlecol
1212

13-
Oracle.
13+
To run sync 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 sync job:
20+
21+
.. include:: /includes/fact-short-sync-job-desc.rst
22+
23+
For details on supported versions of Oracle, see
24+
:ref:`supported-databases`.
25+
26+
About this Task
27+
---------------
28+
29+
- If your migrating from an Oracle 12c instance, you must run commands as
30+
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.
38+
39+
Steps
40+
-----
41+
42+
.. tabs::
43+
44+
.. tab:: Snapshot Jobs
45+
:tabid: enable-snapshot-jobs
46+
47+
.. procedure::
48+
:style: normal
49+
50+
.. step:: Set up user permissions
51+
52+
.. include:: /includes/fact-data-prep-oracle-step1.rst
53+
54+
.. tab:: Continuous Jobs
55+
:tabid: enable-continuous-jobs
56+
57+
.. procedure::
58+
:style: normal
59+
60+
.. step:: Set up user permissions
61+
62+
.. include:: /includes/fact-data-prep-oracle-step1.rst
63+
64+
c. Grant additional permissions to the service account
65+
to run continuous sync jobs:
66+
67+
.. code-block:: sql
68+
:copyable: true
69+
70+
GRANT SET CONTAINER TO <user>;
71+
GRANT EXECUTE_CATALOG_ROLE TO <user>;
72+
GRANT SELECT ANY TRANSACTION TO <user>;
73+
GRANT LOGMINING TO <user>;
74+
GRANT CREATE TABLE TO <user>;
75+
GRANT LOCK <table> TO <user>;
76+
GRANT CREATE SEQUENCE TO <user>;
77+
GRANT SELECT ON DBA_TABLESPACES TO <user>;
78+
GRANT EXECUTE ON DBMS_LOGMNR TO <user>;
79+
GRANT EXECUTE ON DBMS_LOGMNR_D TO <user>;
80+
GRANT SELECT ON V_$LOG TO <user>;
81+
GRANT SELECT ON V_$LOG_HISTORY TO <user>;
82+
GRANT SELECT ON V_$LOGMNR_LOGS TO <user>;
83+
GRANT SELECT ON V_$LOGMNR_CONTENTS TO <user>;
84+
GRANT SELECT ON V_$LOGMNR_PARAMETERS TO <user>;
85+
GRANT SELECT ON V_$LOGFILE TO <user>;
86+
GRANT SELECT ON V_$ARCHIVED_LOG TO <user>;
87+
GRANT SELECT ON V_$ARCHIVE_DEST_STATUS TO <user>;
88+
GRANT SELECT ON V_$TRANSACTION TO <user>;
89+
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;
106+
107+
.. tip::
108+
109+
To check if ``LogMiner`` is already enabled, run the
110+
following query:
111+
112+
.. code-block:: sql
113+
:copyable: true
114+
115+
SELECT LOG_MODE FROM V_$DATABASE;
116+
117+
.. step:: Enable supplemental logging
118+
119+
a. To run continuous sync jobs against Oracle, you must
120+
enable supplemental logging at the database level:
121+
122+
.. code-block:: sql
123+
:copyable: true
124+
125+
ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
126+
127+
#. You must also enable supplemental logging for every
128+
table in the migration:
129+
130+
.. code-block:: sql
131+
:copyable: true
132+
133+
ALTER TABLE schemaName.tableName ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS;
134+
/* Additional ALTER TABLE STATEMENTS... */
135+
136+
Learn More
137+
----------
138+
139+
- Relational Migrator relies on the open-source Debezium connector to
140+
capture row-level changes. For more details, see `Debezium Oracle
141+
<https://debezium.io/documentation/reference/stable/connectors/oracle.html#_preparing_the_databas>`__
142+
- For details on enabling archive logging, see `Managing Archived Redo Logs
143+
<https://docs.oracle.com/cd/B19306_01/server.102/b14231/archredo.htm>`__.
144+
- For additional troubleshooting and debugging information, see the
145+
`Debezium Oracle help blog post
146+
<https://debezium.io/blog/2022/09/30/debezium-oracle-series-part-1/#configure-oracle-users>`__.

0 commit comments

Comments
 (0)