Skip to content

DOCSP-48670-update-oracle-prereqs #247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions source/includes/fact-data-prep-oracle-step1.rst
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ a. Create a service account:
.. code-block:: sql
:copyable: true

CREATE USER '<user>'@'localhost' IDENTIFIED BY '<password>';
CREATE USER <user> IDENTIFIED BY "<password>";

#. Confirm that the service account owns the tables in the migration job.

@@ -59,4 +59,4 @@ a. Create a service account:
GRANT SELECT_CATALOG_ROLE TO <user>;
GRANT SELECT ANY TABLE TO <user>;
GRANT SELECT ON V_$DATABASE TO <user>;
GRANT FLASHBACK ANY TABLE TO <user>;
GRANT FLASHBACK ANY TABLE TO <user>;
152 changes: 146 additions & 6 deletions source/jobs/prerequisites/oracle.txt
Original file line number Diff line number Diff line change
@@ -33,7 +33,14 @@
architecture, see `Overview of Container Databases and Pluggable Databases <https://oracle-base.com/articles/12c/multitenant-overview-container-database-cdb-12cr1>`__.
- Some commands differ based on whether the database is single or
multi-tenant. In a multi-tenant database, permissions must
include the suffix ``CONTAINER=ALL``.
include the suffix ``CONTAINER=ALL``. To check whether the database is
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider "To examine whether..."

multi-tenant or not, run the following SQL query:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

personal take on the previous feedback (but take it with a pinch of salt): I would not phrase it like this

To examine whether the database is multi-tenant or not

for a simple check / confirmation. this is not an exploration or a detailed investigation but rather a very simple check "true / false"

i think "to check" would be a better fit here


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

SELECT cdb AS is_multitenant FROM v$database;

- You can't run a continuous migration job against Oracle Database Express
Edition (XE), because XE doesn't support the necessary logs.

@@ -77,7 +84,7 @@
GRANT CREATE TABLE TO <user>;
GRANT LOCK ANY TABLE TO <user>;
GRANT CREATE SEQUENCE TO <user>;
GRANT SELECT ON DBA_TABLESPACES TO <user>;
GRANT SELECT ON DBA_TABLESPACES TO <user>;
GRANT EXECUTE ON DBMS_LOGMNR TO <user>;
GRANT EXECUTE ON DBMS_LOGMNR_D TO <user>;
GRANT SELECT ON V_$LOG TO <user>;
@@ -90,11 +97,11 @@
GRANT SELECT ON V_$ARCHIVE_DEST_STATUS TO <user>;
GRANT SELECT ON V_$TRANSACTION TO <user>;
GRANT SELECT ON V_$MYSTAT TO <user>;
GRANT SELECT ON V_$STATNAME TO <user>;
GRANT SELECT ON V_$STATNAME TO <user>;

.. step:: Turn on archive logging

a. To see if archive logging is already enabled, run the following query:
a. To check if archive logging is already enabled, run the following query:

.. code-block:: sql
:copyable: true
@@ -120,7 +127,7 @@
STARTUP MOUNT
ALTER DATABASE ARCHIVELOG;
ALTER DATABASE OPEN;

.. step:: Enable supplemental logging

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

ALTER TABLE schemaName.tableName ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS;
/* Additional ALTER TABLE STATEMENTS... */
/* Additional ALTER TABLE STATEMENTS... */

.. step:: Create tablespaces

a. Create the required tablespaces:

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

CONNECT sys/oraclepw@PDB_NAME as sysdba;
CREATE TABLESPACE logminer_tbs DATAFILE '/opt/oracle/oradata/CDB_NAME/PDB_NAME/logminer_tbs.dbf'
SIZE 25M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED

CONNECT sys/password@CDB_NAME as sysdba;
CREATE TABLESPACE logminer_tbs DATAFILE '/opt/oracle/oradata/CDB_NAME/logminer_tbs.dbf'
SIZE 25M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;

A continuous migration in a multi-tenant architecture requires
a tablespace in each pluggable database and in the container
database.

#. Assign quota for the tablespaces to the service user:

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

ALTER USER <user> DEFAULT TABLESPACE LOGMINER_TBS QUOTA UNLIMITED ON LOGMINER_TBS CONTAINER=ALL;

.. tab:: Continuous Jobs (Amazon RDS)
:tabid: enable-continuous-jobs-rds

.. important::

This procedure applies to Oracle instances which are hosted on
Amazon RDS.

.. procedure::
:style: normal

Check failure on line 183 in source/jobs/prerequisites/oracle.txt

GitHub Actions / TDBX Vale rules

[vale] reported by reviewdog 🐶 [MongoDB.Accessibility] Don't use language (such as 'normal') that defines people by their disability. Raw Output: {"message": "[MongoDB.Accessibility] Don't use language (such as 'normal') that defines people by their disability.", "location": {"path": "source/jobs/prerequisites/oracle.txt", "range": {"start": {"line": 183, "column": 18}}}, "severity": "ERROR"}

.. step:: Set up user permissions

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

np: it might make more sense to put the next sentence before the ordered step list, potentially in a "important" banner:

This procedure applies to Oracle instances which are hosted on Amazon RDS

  1. Set up user permissions
    ...


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

d. Grant additional permissions to the service account

Check failure on line 189 in source/jobs/prerequisites/oracle.txt

GitHub Actions / TDBX Vale rules

[vale] reported by reviewdog 🐶 [MongoDB.ConciseTerms] 'more' is preferred over 'additional'. Raw Output: {"message": "[MongoDB.ConciseTerms] 'more' is preferred over 'additional'.", "location": {"path": "source/jobs/prerequisites/oracle.txt", "range": {"start": {"line": 189, "column": 22}}}, "severity": "ERROR"}
to run continuous migration jobs.

Append ``CONTAINER=ALL`` if you're migrating a multi-tenant container database.

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

GRANT FLASHBACK ANY TABLE TO <user>;
GRANT EXECUTE_CATALOG_ROLE TO <user>;
GRANT SELECT ANY TRANSACTION TO <user>;
GRANT LOGMINING TO <user>;
GRANT CREATE TABLE TO <user>;
GRANT LOCK ANY TABLE TO <user>;
GRANT CREATE SEQUENCE TO <user>;

CALL rdsadmin.rdsadmin_util.grant_sys_object('V_$DATABASE', '<user>', 'SELECT');
CALL rdsadmin.rdsadmin_util.grant_sys_object('DBA_LOG_GROUPS', '<user>', 'SELECT');
CALL rdsadmin.rdsadmin_util.grant_sys_object('DBMS_LOGMNR', '<user>', 'EXECUTE');
CALL rdsadmin.rdsadmin_util.grant_sys_object('DBMS_LOGMNR_D', '<user>', 'EXECUTE');
CALL rdsadmin.rdsadmin_util.grant_sys_object('V_$LOG', '<user>', 'SELECT');
CALL rdsadmin.rdsadmin_util.grant_sys_object('V_$LOG_HISTORY', '<user>', 'SELECT');
CALL rdsadmin.rdsadmin_util.grant_sys_object('V_$LOGMNR_LOGS', '<user>', 'SELECT');
CALL rdsadmin.rdsadmin_util.grant_sys_object('V_$LOGMNR_CONTENTS', '<user>', 'SELECT');
CALL rdsadmin.rdsadmin_util.grant_sys_object('V_$LOGMNR_PARAMETERS', '<user>', 'SELECT');
CALL rdsadmin.rdsadmin_util.grant_sys_object('V_$LOGFILE', '<user>', 'SELECT');
CALL rdsadmin.rdsadmin_util.grant_sys_object('V_$ARCHIVED_LOG', '<user>', 'SELECT');
CALL rdsadmin.rdsadmin_util.grant_sys_object('V_$ARCHIVE_DEST_STATUS', '<user>', 'SELECT');
CALL rdsadmin.rdsadmin_util.grant_sys_object('V_$TRANSACTION', '<user>', 'SELECT');

If an RDS instance is multi-tenant, an additional permission is required for tablespaces:

Check failure on line 219 in source/jobs/prerequisites/oracle.txt

GitHub Actions / TDBX Vale rules

[vale] reported by reviewdog 🐶 [MongoDB.ConciseTerms] 'more' is preferred over 'additional'. Raw Output: {"message": "[MongoDB.ConciseTerms] 'more' is preferred over 'additional'.", "location": {"path": "source/jobs/prerequisites/oracle.txt", "range": {"start": {"line": 219, "column": 55}}}, "severity": "ERROR"}

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

CALL rdsadmin.rdsadmin_util.grant_sys_object('DBA_TABLESPACES', '<user>', 'SELECT');

.. step:: Turn on archive logging

a. To check if archive logging is already enabled, run the following query:

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

SELECT LOG_MODE FROM V$DATABASE;

This outputs ``ARCHIVELOG`` if logging is enabled, or
``NOARCHIVELOG`` if it isn't.

#. If archive logging isn't already enabled, enable it.

Relational Migrator can automatically generate code to enable
logging. The following code is an example. If you're migrating a
multi-tenant database, run these commands on the container/
master database.

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

CALL rdsadmin.rdsadmin_util.set_configuration('archivelog retention hours', 24);

.. step:: Enable supplemental logging

a. Enable supplemental logging on the database:

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

CALL rdsadmin.rdsadmin_util.alter_supplemental_logging('ADD');

#. Enable supplemental logging for every table in the migration:

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

ALTER TABLE schemaName.tableName ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS;
/* Additional ALTER TABLE STATEMENTS... */

.. step:: Create tablespaces

Create the required tablespaces:

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

CREATE TABLESPACE logminer_tbs;
CALL rdsadmin.rdsadmin_util.alter_default_tablespace(tablespace_name => 'logminer_tbs');

A continuous migration in a multi-tenant architecture requires a
tablespace in each pluggable database and in the container database.
Assign the service user a quota on those tablespaces.

Learn More
----------