Skip to content

Commit f64461b

Browse files
authored
DOCSP-48670-update-oracle-prereqs (#247)
* DOCSP-48670-update-oracle-prereqs * Fixing code-block definition. * Adding sub-steps to Create Tablespaces in Continous Jobs tab. * Further editing and formatting for Create Tablespaces new step. * Minor edits from internal feedback. * Edits for external feedback.
1 parent 8ef4b86 commit f64461b

File tree

2 files changed

+148
-8
lines changed

2 files changed

+148
-8
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ a. Create a service account:
1414
.. code-block:: sql
1515
:copyable: true
1616
17-
CREATE USER '<user>'@'localhost' IDENTIFIED BY '<password>';
17+
CREATE USER <user> IDENTIFIED BY "<password>";
1818
1919
#. Confirm that the service account owns the tables in the migration job.
2020

@@ -59,4 +59,4 @@ a. Create a service account:
5959
GRANT SELECT_CATALOG_ROLE TO <user>;
6060
GRANT SELECT ANY TABLE TO <user>;
6161
GRANT SELECT ON V_$DATABASE TO <user>;
62-
GRANT FLASHBACK ANY TABLE TO <user>;
62+
GRANT FLASHBACK ANY TABLE TO <user>;

source/jobs/prerequisites/oracle.txt

Lines changed: 146 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,14 @@ About this Task
3333
architecture, see `Overview of Container Databases and Pluggable Databases <https://oracle-base.com/articles/12c/multitenant-overview-container-database-cdb-12cr1>`__.
3434
- Some commands differ based on whether the database is single or
3535
multi-tenant. In a multi-tenant database, permissions must
36-
include the suffix ``CONTAINER=ALL``.
36+
include the suffix ``CONTAINER=ALL``. To check whether the database is
37+
multi-tenant or not, run the following SQL query:
38+
39+
.. code-block:: sql
40+
:copyable: true
41+
42+
SELECT cdb AS is_multitenant FROM v$database;
43+
3744
- You can't run a continuous migration job against Oracle Database Express
3845
Edition (XE), because XE doesn't support the necessary logs.
3946

@@ -77,7 +84,7 @@ Steps
7784
GRANT CREATE TABLE TO <user>;
7885
GRANT LOCK ANY TABLE TO <user>;
7986
GRANT CREATE SEQUENCE TO <user>;
80-
GRANT SELECT ON DBA_TABLESPACES TO <user>;
87+
GRANT SELECT ON DBA_TABLESPACES TO <user>;
8188
GRANT EXECUTE ON DBMS_LOGMNR TO <user>;
8289
GRANT EXECUTE ON DBMS_LOGMNR_D TO <user>;
8390
GRANT SELECT ON V_$LOG TO <user>;
@@ -90,11 +97,11 @@ Steps
9097
GRANT SELECT ON V_$ARCHIVE_DEST_STATUS TO <user>;
9198
GRANT SELECT ON V_$TRANSACTION TO <user>;
9299
GRANT SELECT ON V_$MYSTAT TO <user>;
93-
GRANT SELECT ON V_$STATNAME TO <user>;
100+
GRANT SELECT ON V_$STATNAME TO <user>;
94101

95102
.. step:: Turn on archive logging
96103

97-
a. To see if archive logging is already enabled, run the following query:
104+
a. To check if archive logging is already enabled, run the following query:
98105

99106
.. code-block:: sql
100107
:copyable: true
@@ -120,7 +127,7 @@ Steps
120127
STARTUP MOUNT
121128
ALTER DATABASE ARCHIVELOG;
122129
ALTER DATABASE OPEN;
123-
130+
124131
.. step:: Enable supplemental logging
125132

126133
a. Enable supplemental logging on the database:
@@ -136,7 +143,140 @@ Steps
136143
:copyable: true
137144

138145
ALTER TABLE schemaName.tableName ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS;
139-
/* Additional ALTER TABLE STATEMENTS... */
146+
/* Additional ALTER TABLE STATEMENTS... */
147+
148+
.. step:: Create tablespaces
149+
150+
a. Create the required tablespaces:
151+
152+
.. code-block:: sql
153+
:copyable: true
154+
155+
CONNECT sys/oraclepw@PDB_NAME as sysdba;
156+
CREATE TABLESPACE logminer_tbs DATAFILE '/opt/oracle/oradata/CDB_NAME/PDB_NAME/logminer_tbs.dbf'
157+
SIZE 25M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
158+
159+
CONNECT sys/password@CDB_NAME as sysdba;
160+
CREATE TABLESPACE logminer_tbs DATAFILE '/opt/oracle/oradata/CDB_NAME/logminer_tbs.dbf'
161+
SIZE 25M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
162+
163+
A continuous migration in a multi-tenant architecture requires
164+
a tablespace in each pluggable database and in the container
165+
database.
166+
167+
#. Assign quota for the tablespaces to the service user:
168+
169+
.. code-block:: sql
170+
:copyable: true
171+
172+
ALTER USER <user> DEFAULT TABLESPACE LOGMINER_TBS QUOTA UNLIMITED ON LOGMINER_TBS CONTAINER=ALL;
173+
174+
.. tab:: Continuous Jobs (Amazon RDS)
175+
:tabid: enable-continuous-jobs-rds
176+
177+
.. important::
178+
179+
This procedure applies to Oracle instances which are hosted on
180+
Amazon RDS.
181+
182+
.. procedure::
183+
:style: normal
184+
185+
.. step:: Set up user permissions
186+
187+
.. include:: /includes/fact-data-prep-oracle-step1.rst
188+
189+
d. Grant additional permissions to the service account
190+
to run continuous migration jobs.
191+
192+
Append ``CONTAINER=ALL`` if you're migrating a multi-tenant container database.
193+
194+
.. code-block:: sql
195+
:copyable: true
196+
197+
GRANT FLASHBACK ANY TABLE TO <user>;
198+
GRANT EXECUTE_CATALOG_ROLE TO <user>;
199+
GRANT SELECT ANY TRANSACTION TO <user>;
200+
GRANT LOGMINING TO <user>;
201+
GRANT CREATE TABLE TO <user>;
202+
GRANT LOCK ANY TABLE TO <user>;
203+
GRANT CREATE SEQUENCE TO <user>;
204+
205+
CALL rdsadmin.rdsadmin_util.grant_sys_object('V_$DATABASE', '<user>', 'SELECT');
206+
CALL rdsadmin.rdsadmin_util.grant_sys_object('DBA_LOG_GROUPS', '<user>', 'SELECT');
207+
CALL rdsadmin.rdsadmin_util.grant_sys_object('DBMS_LOGMNR', '<user>', 'EXECUTE');
208+
CALL rdsadmin.rdsadmin_util.grant_sys_object('DBMS_LOGMNR_D', '<user>', 'EXECUTE');
209+
CALL rdsadmin.rdsadmin_util.grant_sys_object('V_$LOG', '<user>', 'SELECT');
210+
CALL rdsadmin.rdsadmin_util.grant_sys_object('V_$LOG_HISTORY', '<user>', 'SELECT');
211+
CALL rdsadmin.rdsadmin_util.grant_sys_object('V_$LOGMNR_LOGS', '<user>', 'SELECT');
212+
CALL rdsadmin.rdsadmin_util.grant_sys_object('V_$LOGMNR_CONTENTS', '<user>', 'SELECT');
213+
CALL rdsadmin.rdsadmin_util.grant_sys_object('V_$LOGMNR_PARAMETERS', '<user>', 'SELECT');
214+
CALL rdsadmin.rdsadmin_util.grant_sys_object('V_$LOGFILE', '<user>', 'SELECT');
215+
CALL rdsadmin.rdsadmin_util.grant_sys_object('V_$ARCHIVED_LOG', '<user>', 'SELECT');
216+
CALL rdsadmin.rdsadmin_util.grant_sys_object('V_$ARCHIVE_DEST_STATUS', '<user>', 'SELECT');
217+
CALL rdsadmin.rdsadmin_util.grant_sys_object('V_$TRANSACTION', '<user>', 'SELECT');
218+
219+
If an RDS instance is multi-tenant, an additional permission is required for tablespaces:
220+
221+
.. code-block:: sql
222+
:copyable: true
223+
224+
CALL rdsadmin.rdsadmin_util.grant_sys_object('DBA_TABLESPACES', '<user>', 'SELECT');
225+
226+
.. step:: Turn on archive logging
227+
228+
a. To check if archive logging is already enabled, run the following query:
229+
230+
.. code-block:: sql
231+
:copyable: true
232+
233+
SELECT LOG_MODE FROM V$DATABASE;
234+
235+
This outputs ``ARCHIVELOG`` if logging is enabled, or
236+
``NOARCHIVELOG`` if it isn't.
237+
238+
#. If archive logging isn't already enabled, enable it.
239+
240+
Relational Migrator can automatically generate code to enable
241+
logging. The following code is an example. If you're migrating a
242+
multi-tenant database, run these commands on the container/
243+
master database.
244+
245+
.. code-block:: sql
246+
:copyable: true
247+
248+
CALL rdsadmin.rdsadmin_util.set_configuration('archivelog retention hours', 24);
249+
250+
.. step:: Enable supplemental logging
251+
252+
a. Enable supplemental logging on the database:
253+
254+
.. code-block:: sql
255+
:copyable: true
256+
257+
CALL rdsadmin.rdsadmin_util.alter_supplemental_logging('ADD');
258+
259+
#. Enable supplemental logging for every table in the migration:
260+
261+
.. code-block:: sql
262+
:copyable: true
263+
264+
ALTER TABLE schemaName.tableName ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS;
265+
/* Additional ALTER TABLE STATEMENTS... */
266+
267+
.. step:: Create tablespaces
268+
269+
Create the required tablespaces:
270+
271+
.. code-block:: sql
272+
:copyable: true
273+
274+
CREATE TABLESPACE logminer_tbs;
275+
CALL rdsadmin.rdsadmin_util.alter_default_tablespace(tablespace_name => 'logminer_tbs');
276+
277+
A continuous migration in a multi-tenant architecture requires a
278+
tablespace in each pluggable database and in the container database.
279+
Assign the service user a quota on those tablespaces.
140280

141281
Learn More
142282
----------

0 commit comments

Comments
 (0)