docs/content/stable/yugabyte-voyager/migrate/oracle.md
Create a role and a database user, and provide the user with READ access to all the resources which need to be migrated.
Create a role that has the privileges as listed in the following table:
| Permission | Object type in the source schema |
|---|---|
SELECT | VIEW, SEQUENCE, TABLE PARTITION, TABLE, SYNONYM, MATERIALIZED VIEW |
EXECUTE | TYPE |
Change the <SCHEMA_NAME> appropriately in the following snippets, and run the following steps as a privileged user.
CREATE ROLE <SCHEMA_NAME>_reader_role;
BEGIN
FOR R IN (SELECT owner, object_name FROM all_objects WHERE owner=UPPER('<SCHEMA_NAME>') and object_type in ('VIEW','SEQUENCE','TABLE PARTITION','SYNONYM','MATERIALIZED VIEW'))
LOOP
EXECUTE IMMEDIATE 'grant select on '||R.owner||'."'||R.object_name||'" to <SCHEMA_NAME>_reader_role';
END LOOP;
END;
/
BEGIN
FOR R IN (SELECT owner, object_name FROM all_objects WHERE owner=UPPER('<SCHEMA_NAME>') and object_type ='TABLE' MINUS SELECT owner, table_name from all_nested_tables where owner = UPPER('<SCHEMA_NAME>'))
LOOP
EXECUTE IMMEDIATE 'grant select on '||R.owner||'."'||R.object_name||'" to <SCHEMA_NAME>_reader_role';
END LOOP;
END;
/
BEGIN
FOR R IN (SELECT owner, object_name FROM all_objects WHERE owner=UPPER('<SCHEMA_NAME>') and object_type = 'TYPE')
LOOP
EXECUTE IMMEDIATE 'grant execute on '||R.owner||'."'||R.object_name||'" to <SCHEMA_NAME>_reader_role';
END LOOP;
END;
/
GRANT SELECT_CATALOG_ROLE TO <SCHEMA_NAME>_reader_role;
GRANT SELECT ANY DICTIONARY TO <SCHEMA_NAME>_reader_role;
GRANT SELECT ON SYS.ARGUMENT$ TO <SCHEMA_NAME>_reader_role;
Create a user ybvoyager and grant CONNECT and <SCHEMA_NAME>_reader_role to the user:
CREATE USER ybvoyager IDENTIFIED BY password;
GRANT CONNECT TO ybvoyager;
GRANT <SCHEMA_NAME>_reader_role TO ybvoyager;
If you're using accelerated data export, run the additional grant as follows:
GRANT FLASHBACK ANY TABLE TO ybvoyager;
If you're using accelerated data export, the log_mode should be archivelog.
Check the value for log_mode using the following command for Oracle/Oracle RDS:
SELECT LOG_MODE FROM V$DATABASE;
If the log_mode value is NOARCHIVELOG, run the following commands:
For Oracle
sqlplus /nolog
SQL>alter system set db_recovery_file_dest_size = 10G;
SQL>alter system set db_recovery_file_dest = '<oracle_path>/oradata/recovery_area' scope=spfile;
SQL> connect / as sysdba
SQL> Shutdown immediate
SQL> Startup mount
SQL> Alter database archivelog;
SQL> Alter database open;
For Oracle RDS
Note that the following step assumes you're using SQL*Plus or a compatible Oracle client that supports EXEC. If your client doesn't support EXEC, use the standard SQL CALL syntax instead.
exec rdsadmin.rdsadmin_util.set_configuration('archivelog retention hours',24);
Verify using archive log list.
If you want yb-voyager to connect to the source database over SSL, refer to SSL Connectivity. Note that you can use only one of the following arguments when connecting to your Oracle instance:
| Configuration file source parameter | CLI Flag | Description |
|---|---|---|
| db-schema | --source-db-schema | Schema name of the source database. |
| oracle-db-sid | --oracle-db-sid | Oracle System Identifier you can use while exporting data from Oracle instances. |
| oracle-tns-alias | --oracle-tns-alias | TNS (Transparent Network Substrate) alias configured to establish a secure connection with the server. |