US6 - Move - To - The - Cloud
US6 - Move - To - The - Cloud
US6 - Move - To - The - Cloud
Vice President
Database Upgrade,
Utilities & Patching
@RoyFSwonger
Mike Dietrich
https://dohdatabase.com
@dohdatabase
dohdatabase
Autonomous Database
• SQL commands
• Data types
• Features
• Free of charge
• Usage:
• Small-scale apps
• Development
• Testing
Watch on YouTube
Direct Autonomous
Database
Stage Object
Storage
Death Metal
Demo | Data Set
Watch on YouTube
1. 2. 3. 4. 5. 6.
SQL Developer Web SQL Developer SQL*Loader Data Pump DBMS_CLOUD MV2ADB
Works on:
• CSV
• XML
• JSON
• XLS/XLSX
• Avro
Quickstart lab
Watch on YouTube
1. 2. 3. 4. 5. 6.
SQL Developer Web SQL Developer SQL*Loader Data Pump DBMS_CLOUD MV2ADB
Watch on YouTube
1. 2. 3. 4. 5. 6.
SQL Developer Web SQL Developer SQL*Loader Data Pump DBMS_CLOUD MV2ADB
Highly configurable
Loads from:
• Local file
Works on:
• CSV
• Text
Watch on YouTube
1. 2. 3. 4. 5. 6.
SQL Developer Web SQL Developer SQL*Loader Data Pump DBMS_CLOUD MV2ADB
Loads from:
• Oracle Database (database link)
• OCI Object Storage
Pro tip: Use SQL Developer
Parameter MAX_DATAPUMP_PARALLEL_PER_JOB is 50 -
and can't be changed
Watch on YouTube
1. 2. 3. 4. 5. 6.
SQL Developer Web SQL Developer SQL*Loader Data Pump DBMS_CLOUD MV2ADB
PL/SQL interface
Loads from:
• OCI Object Storage
• Amazon AWS S3
• Microsoft Azure Object Store
Works on:
• CSV
• Data Pump
• ORC
• Parquet
• Avro
• Zipped files
Quickstart lab
Troubleshooting
Coming to on-premises
Documentation
Watch on YouTube
1. 2. 3. 4. 5. 6.
SQL Developer Web SQL Developer SQL*Loader Data Pump DBMS_CLOUD MV2ADB
Loads from:
• Oracle Database
Documentation: Doc ID 2463574.1
Pro Tip:
Check log file to find out how MV2ADB uses
Data Pump
Exclude statistics
EXTRA_EXPDP=EXCLUDE=STATISTICS
Watch on YouTube
SQL Developer
DBMS_CLOUD
DBMS_CLOUD
SQL*Loader
SQL*Loader
Data Pump
Data Pump
MV2ADB
MV2ADB
DATA FORMAT DATA SOURCE
CSV x x x x x Local file x x x x x x
Text x x Object storage x x x x
Text - advanced x Amazon S3 x
XML x Amazon S3 compatible source x
JSON x Azure BLOB x
Delimited x x x
Data Pump x x x
Excel x
ORC x
Parquet x
Avro x x
Statements
replayed
Initial copy
Statements
captured
INSERT INTO ...
Supports:
• Oracle Database 11.2.0.4 and higher
• DBCS, ExaCS, ATP, ADW
Pro Tip: Watch a short intro on YouTube
Watch on YouTube
https://cloudmarketplace.oracle.com
Watch on YouTube
Watch on YouTube
Uses SODA
Watch on YouTube
Via ORDS
Watch on YouTube
CONNECT ADB_ADVISOR/ADB_ADVISOR
SET SERVEROUTPUT ON FORMAT WRAPPED
SET LINES 3000
EXEC ADB_ADVISOR.REPORT(schemas=>'METAL',adb_type=>'ADW');
Pro Tip:
Other migration targets are ATD, ATPD
and ADWD
Cloud Premigration Advisor Tool (CPAT) Analyzes Databases for Suitability of Cloud Migration (Doc ID 2758371.1)
• Successor to the Schema Advisor
------------------------------------------------------------------------------------------
==========================================================================================
Premigration Advisor
Cloud Premigration Advisor Tool
Check(CPAT)
Details List
Report
------------------------------------------------------------------------------------------
==========================================================================================
Report ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Details
Check Name:
~~~~~~~~~~~~~~ has_user_defined_objects_in_sys
CPAT Check Result:Version:
Application BLOCKER 22.1.4-1
CPAT ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Checks Version: 22.1.4-1
Description:
Target Cloud Type: User-defined
ATPD objects in SYS and SYSTEM schemas will not migrate.
Failure
Migration Impact: Any applications
Method(s): DATAPUMP relying on user-defined objects in SYS and SYSTEM will fail.
Action:
Report Generated On: User-defined objects were detected in SYS/SYSTEM schemas. Consider moving them
2021-04-05T17:48:03Z
Report Result: out prior to the migration.
BLOCKER
Database Relevant
Details Objects:
OWNER OBJECT_NAME
~~~~~~~~~~~~~~~~ SUBOBJECT_NAME OBJECT_TYPE
Source ------ -------------------------
Database Container Name: ORCLPDB1-------------- ------------------
Source SYS MY_VERIFICATION_FUNCTION
Database Host Name: 4bea9faa8231 FUNCTION
Source SYSTEM IDXSIZE_UQ2
Instance Name: ORCLCDB INDEX
SYSTEM IDXSIZE_UQ3 INDEX
SYSTEM ISEQ$$_83287 SEQUENCE
Optionally,
• Finetune uploads using --parallel-upload-count and --part-size
• Include or exclude files selectively using patterns and --include and --exclude
$ more export.par
DIRECTORY=my_data_pump_dir
DUMPFILE=dumpfile%U.dmp
LOGFILE=logfile.log
Always use a parameter file SCHEMAS=HR
EXCLUDE=STATISTICS
LOGTIME=ALL
METRICS=YES
FLASHBACK_TIME=SYSTIMESTAMP
PARALLEL=4
FILESIZE=5G
TRANSFORM=OMIT_ENCRYPTION_CLAUSE:Y
$ expdp parfile=export.par
Applies to export and import
$ more export.par
DIRECTORY=my_data_pump_dir
DUMPFILE=dumpfile%U.dmp
LOGFILE=logfile.log
Always export to multiple files SCHEMAS=HR
EXCLUDE=STATISTICS
LOGTIME=ALL
METRICS=YES
FLASHBACK_TIME=SYSTIMESTAMP
PARALLEL=4
FILESIZE=5G
TRANSFORM=OMIT_ENCRYPTION_CLAUSE:Y
$ more export.par
DIRECTORY=my_data_pump_dir
DUMPFILE=dumpfile%U.dmp
LOGFILE=logfile.log
Always use schema mode SCHEMAS=HR
EXCLUDE=STATISTICS
LOGTIME=ALL
METRICS=YES
FLASHBACK_TIME=SYSTIMESTAMP
PARALLEL=4
FILESIZE=5G
TRANSFORM=OMIT_ENCRYPTION_CLAUSE:Y
$ expdp parfile=export.par
Applies to export
$ more export.par
DIRECTORY=my_data_pump_dir
DUMPFILE=dumpfile%U.dmp
LOGFILE=logfile.log
Always exclude statistics SCHEMAS=HR
EXCLUDE=STATISTICS
LOGTIME=ALL
METRICS=YES
FLASHBACK_TIME=SYSTIMESTAMP
PARALLEL=4
FILESIZE=5G
TRANSFORM=OMIT_ENCRYPTION_CLAUSE:Y
$ expdp parfile=export.par
Applies to export and import
$ more export.par
DIRECTORY=my_data_pump_dir
DUMPFILE=dumpfile%U.dmp
LOGFILE=logfile.log
Always include diagnostics SCHEMAS=HR
EXCLUDE=STATISTICS
LOGTIME=ALL
METRICS=YES
FLASHBACK_TIME=SYSTIMESTAMP
PARALLEL=4
FILESIZE=5G
TRANSFORM=OMIT_ENCRYPTION_CLAUSE:Y
No diagnostics
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
. . imported "METAL"."ALBUMS" 988.8 KB 28069 rows
. . imported "METAL"."BANDS" 3.444 MB 37723 rows
. . imported "METAL"."REVIEWS" 66.47 MB 21510 rows
All diagnostics
16-OCT-20 17:26:57.158: Processing object type SCHEMA_EXPORT/TABLE/TABLE
16-OCT-20 17:26:58.262: Startup took 1 seconds
16-OCT-20 17:26:58.264: Startup took 1 seconds
16-OCT-20 17:26:59.082: Completed 3 TABLE objects in 1 seconds
16-OCT-20 17:26:59.082: Completed by worker 1 1 TABLE objects in 1 seconds
16-OCT-20 17:26:59.082: Completed by worker 2 1 TABLE objects in 0 seconds
16-OCT-20 17:26:59.082: Completed by worker 3 1 TABLE objects in 0 seconds
16-OCT-20 17:26:59.313: Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
16-OCT-20 17:27:01.943: . . imported "METAL"."ALBUMS" 988.8 KB 28069 rows in 2 seconds using external_table
16-OCT-20 17:27:03.778: . . imported "METAL"."BANDS" 3.444 MB 37723 rows in 2 seconds using external_table
16-OCT-20 17:27:12.644: . . imported "METAL"."REVIEWS" 66.47 MB 21510 rows in 13 seconds using external_table
$ more export.par
DIRECTORY=my_data_pump_dir
DUMPFILE=dumpfile%U.dmp
LOGFILE=logfile.log
Always make consistent exports SCHEMAS=HR
EXCLUDE=STATISTICS
LOGTIME=ALL
METRIC=YES
FLASHBACK_TIME=SYSTIMESTAMP
PARALLEL=4
FILESIZE=5G
TRANSFORM=OMIT_ENCRYPTION_CLAUSE:Y
$ expdp parfile=export.par
Applies to export only
$ more export.par
DIRECTORY=my_data_pump_dir
DUMPFILE=dumpfile%U.dmp
LOGFILE=logfile.log
Always use parallel SCHEMAS=HR
EXCLUDE=STATISTICS
LOGTIME=ALL
Enterprise Edition only METRIC=YES
FLASHBACK_TIME=SYSTIMESTAMP
PARALLEL=4
FILESIZE=5G
TRANSFORM=OMIT_ENCRYPTION_CLAUSE:Y
Applies to export and import
$ more export.par
DIRECTORY=my_data_pump_dir
DUMPFILE=dumpfile%U.dmp
LOGFILE=logfile.log
Always remove column encryption SCHEMAS=HR
EXCLUDE=STATISTICS
LOGTIME=ALL
METRIC=YES
FLASHBACK_TIME=SYSTIMESTAMP
PARALLEL=4
FILESIZE=5G
TRANSFORM=OMIT_ENCRYPTION_CLAUSE:Y
$ expdp parfile=export.par
Applies to import only
$ more export.par
DIRECTORY=my_data_pump_dir
DUMPFILE=dumpfile%U.dmp
LOGFILE=logfile.log
SCHEMAS=HR
Consider using compression EXCLUDE=STATISTICS
LOGTIME=ALL
Advanced Compression Option license required METRIC=YES
FLASHBACK_TIME=SYSTIMESTAMP
PARALLEL=4
FILESIZE=5G
COMPRESSION=ALL
COMPRESSION_ALGORITHM=MEDIUM
Example 1 Example 2
File Size MB Ratio Time File Size MB Ratio Time
NONE 5500 1 4m 54s NONE 5800 1 2m 33s
ALL BASIC 622 8,9 4m 58s ALL BASIC 705 8,2 3m 3s
ALL LOW 702 7,8 5m 24s ALL LOW 870 6,6 8m 11s
ALL MEDIUM 567 9,7 4m 55s ALL MEDIUM 701 8,2 3m 1s
ALL HIGH 417 13,2 5m 13s ALL HIGH 509 11,3 12m 16s
$ expdp tables=v1
$ impdp dumpfile=http://...../exp01.dmp,
http://...../exp02.dmp,
Use wildcards for URL based http://...../expnn.dmp
file names
$ impdp dumpfile=http://...../exp%u.dmp
TRANSFORM=DWCS_CVT_IOTS:Y
TRANSFORM=CONSTRAINT_USE_DEFAULT_INDEX:Y
TRANSFORM=SEGMENT_ATTRIBUTES:N
REMAP_TABLESPACE=%:DATA
Transform IOTs to tables EXCLUDE=INDEX,CLUSTER,INDEXTYPE,
aaaaaaaaMATERIALIZED_VIEW,
aaaaaaaaMATERIALIZED_VIEW_LOG,
aaaaaaaaMATERIALIZED_ZONEMAP,DB_LINK
DATA_OPTIONS=GROUP_PARTITION_TABLE_DATA
PARTITION_OPTIONS=MERGE
TRANSFORM=DWCS_CVT_IOTS:Y
TRANSFORM=CONSTRAINT_USE_DEFAULT_INDEX:Y
TRANSFORM=SEGMENT_ATTRIBUTES:N
Enforce proper naming standard by REMAP_TABLESPACE=%:DATA
using constraint name for PK and FK EXCLUDE=INDEX,CLUSTER,INDEXTYPE,
aaaaaaaaMATERIALIZED_VIEW,
indexes aaaaaaaaMATERIALIZED_VIEW_LOG,
aaaaaaaaMATERIALIZED_ZONEMAP,DB_LINK
DATA_OPTIONS=GROUP_PARTITION_TABLE_DATA
PARTITION_OPTIONS=MERGE
TRANSFORM=DWCS_CVT_IOTS:Y
TRANSFORM=CONSTRAINT_USE_DEFAULT_INDEX:Y
TRANSFORM=SEGMENT_ATTRIBUTES:N
REMAP_TABLESPACE=%:DATA
Remove segment customization EXCLUDE=INDEX,CLUSTER,INDEXTYPE,
aaaaaaaaMATERIALIZED_VIEW,
aaaaaaaaMATERIALIZED_VIEW_LOG,
aaaaaaaaMATERIALIZED_ZONEMAP,DB_LINK
DATA_OPTIONS=GROUP_PARTITION_TABLE_DATA
PARTITION_OPTIONS=MERGE
TRANSFORM=DWCS_CVT_IOTS:Y
TRANSFORM=CONSTRAINT_USE_DEFAULT_INDEX:Y
TRANSFORM=SEGMENT_ATTRIBUTES:N
Remap any tablespace to REMAP_TABLESPACE=%:DATA
EXCLUDE=INDEX,CLUSTER,INDEXTYPE,
DATA tablespace aaaaaaaaMATERIALIZED_VIEW,
aaaaaaaaMATERIALIZED_VIEW_LOG,
aaaaaaaaMATERIALIZED_ZONEMAP,DB_LINK
DATA_OPTIONS=GROUP_PARTITION_TABLE_DATA
PARTITION_OPTIONS=MERGE
For expdp:
EXCLUDE=INDEX,CLUSTER,INDEXTYPE,
MATERIALIZED_VIEW,
MATERIALIZED_VIEW_LOG,
MATERIALIZED_ZONEMAP,DB_LINK
DATA_OPTIONS=GROUP_PARTITION_TABLE_DATA
For expdp:
EXCLUDE=CLUSTER,DB_LINK
No need to transform
TRANSFORM=LOB_STORAGE:SECUREFILE
Applies to import
Watch on YouTube
Pro Tip: It is a full client, so you
Kris Rice: SQLcl and OCI Cloud Shell can use impdp and expdp as well
2020
2026
2024
2025
2022
2023
2027
2010
2014
2016
2018
2019
2015
2017
2013
2021
2012
2011
MARKET
Oracle 11.2 Waived EXTENDED EXTENDED DRIVEN
Oracle 18
(12.2.0.2)
Oracle 19 EXTENDED
(12.2.0.3)
Premier Support Waived Extended Support Paid Extended Support Market Driven Support Limited Error Correction
ExaCC (Gen 1 + 2)
DBCS (OCI-C + OCI)
ExaCS (OCI)
2022
Restrictions:
• Only one CDB - the pre-created one
• PDB management is up to the user
• Can't upgrade OS or GI or database
• Can't install another Oracle Home
• COMPATIBLE is always default - unless
• Drop and create database not supported (drop and restore is)
Restrictions:
• As many CDBs as you want
• PDB management is up to the user
• Can't upgrade OS or GI
• DATA disk group, max. 16 TB
• Only one database edition
• Only one database pr. Oracle Home
Restrictions:
• As many CDBs as you want
• PDB management is up to the user
For VM and BM
Watch on YouTube
Blog post
DBCS tooling don't care about PDBs - create and drop as you want
Learn encryption:
• Simple
• Reliable
• Scalable
• Secure
• Proven
• Free
Network connectivity
• Always and transparently encrypted
PHYSICAL LOGICAL
Source Database
Physical Migration | Overview
Provision target database in OCI
ZDM host
ZDM host
SSH
ZDM host
Object Storage
ZDM host
Object Storage
ZDM host
Object Storage
SQLNet
Source Database Target Database
Physical Migration | Overview
At your will, switchover sessions
ZDM host
Object Storage
SQLNet
Source Database Target Database
Physical Migration | Demo
Watch on YouTube
Watch on YouTube
PHYSICAL LOGICAL
Source Database
Logical Migration | Overview
Provision target database in OCI
ZDM host
ZDM host
SSH
ZDM host
GoldenGate
GoldenGate
ZDM host
Object Storage
Source Database
Target Database
Logical Migration | Overview
Data Pump import from object storage
GoldenGate
ZDM host
Object Storage
Source Database
Target Database
Logical Migration | Overview
Configure apply on target
GoldenGate
ZDM host
Object Storage
Source Database
Target Database
Logical Migration | Overview
At your will, switchover sessions
GoldenGate
ZDM host
Object Storage
Source Database
Target Database
Wrapping Up | Blog Posts
YouTube Playlist
Redo
apply
Primary
database
Standby
database
Data Guard Support for Heterogeneous Primary and Physical Standbys in Same Data Guard Configuration (Doc ID 413484.1)
PLATFORM_NAME ENDIAN_FORMAT
____________________________________ ________________
Apple Mac OS (x86-64) Little
HP IA Open VMS Little
HP Open VMS Little
HP Tru64 UNIX Little
Linux IA (32-bit) Little
Linux IA (64-bit) Little
Linux x86 64-bit Little
Microsoft Windows IA (32-bit) Little
Microsoft Windows IA (64-bit) Little
Microsoft Windows x86 64-bit Little
Solaris Operating System (x86) Little
Solaris Operating System (x86-64) Little
Basics
Big-endian Little-endian
Source: https://en.wikipedia.org/wiki/Endianness
PLATFORM_NAME ENDIAN_FORMAT
____________________________________ ________________
AIX-Based Systems (64-bit) Big
Apple Mac OS Big
HP-UX (64-bit) Big
HP-UX IA (64-bit) Big
IBM Power Based Linux Big
IBM zSeries Based Linux Big
Linux OS (S64) Big
Solaris[tm] OE (32-bit) Big
Solaris[tm] OE (64-bit) Big
RMAN DBMS_FILE_TRANSFER
Supported in newest version of Perl scripts Not supported in Perl scripts version 4
Stored in Stored in
SYSTEM tablespace user tablespaces
SYSTEM DATA
SYSTEM DATA
• Database version
• Database architecture (non-CDB / CDB)
Methods
Data Pump
Full Transportable
Export/Import
New, empty
Tablespace
Meta plug-in
data transfer 19c PDB
Source database (users, tables, indexes, triggers, PL/SQL ...)
12.1.0.2
SYSTEM SYSTEM
Watch on YouTube
Data Pump
Full Transportable
Export/Import
New, empty
Tablespace
Meta plug-in
data transfer 19c PDB
Source database (users, tables, indexes, triggers, PL/SQL ...)
12.1.0.2
SYSTEM SYSTEM
Final
Level
Level10incremental
imagefile backup
backup
Tablespaces
DATA DATA
Convert
Different data file
Set read-only on restore
endian format
Watch on YouTube
Data Pump
Full Transportable
Export/Import
Source Target
Primary
Tablespace plug-in
Redo
via redo apply
Tablespaces Target
Restore Standby
Step by Step Process of Migrating non-CDBs and PDBs Using ASM for File Storage (Doc ID 1576755.1)
Checklist
Database Creation Blog post on how to create a database in OCI with custom
Backup / Recovery COMPATIBLE setting
TDE
PERL Scripts
Recommendation
• Keep production CDB on AL32UTF8
• Provision temporary CDB with desired character set
• Create new empty PDB in temporary CDB
• Clone custom PDB to production CDB
Documentation
Documentation
Database Creation Enable Block Change Tracking on source for incremental backups
Backup / Recovery
SQL> SELECT status, filename FROM V$BLOCK_CHANGE_TRACKING;
TDE SQL> ALTER DATABASE ENABLE BLOCK CHANGE TRACKING;
PERL Scripts
• Conversion on destination is usually faster than on source
• Requires
• Enterprise Edition (on-prem)
• Enterprise Edition Extreme Performance (DBCS)
• Exadata
• Automate
• To ensure consistency and avoid human error
• Clean-up procedure
• In case of failure and rollback
• To repeat tests
• Ensure that source database gets offlined afterwards
Advanced
Photo by Alexander Andrews on Unsplash
Exclude statistics
EXCLUDE=TABLE_STATISTICS,INDEX_STATISTICS
ORA-39083 And ORA-04042 Errors On DBMS_DEFER_SYS When Importing Into 12.2 Database (Doc ID 2335846.1)
• Master Note for Transportable Tablespaces (TTS) -- Common Questions and Issues (Doc ID 1166564.1)
• Transportable Tablespace (TTS) Restrictions and Limitations: Details, Reference, and Version Where Applicable
(Doc ID 1454872.1)
• MOS Note: 2471245.1 - V4 PERL Scripts to reduce Transportable Tablespace Downtime using Cross Platform
Incremental Backup
• MOS Note:1389592.1 – 11G – Reduce Transportable Tablespace Downtime using Cross Platform Incremental
Backup
• MOS Note: 2005729.1 – 12C – Reduce Transportable Tablespace Downtime using Cross Platform Incremental
Backup
"
SecureFiles is the default storage mechanism for LOBs starting with Oracle Database 12c, and Oracle strongly recommends
SecureFiles for storing and managing LOBs, rather then BasicFiles. BasicFiles will be deprecated in a future release.
Database SecureFiles and Large Objects Developer's Guide
Importing as BasicFiles
10-OCT-20 21:43:21.848: W-3 . . imported "SCHEMA"."TABLE" 31.83 GB 681025 rows in 804 seconds using direct_path
Importing as SecureFiles
15-OCT-20 18:16:48.663: W-13 . . imported "SCHEMA"."TABLES" 31.83 GB 681025 rows in 261 seconds using external_table
Watch on YouTube
Exclude statistics
EXTRA_EXPDP=EXCLUDE=STATISTICS
Note: use of compression and encryption by ZDM does not require additional licenses for the Advanced
Security Option or Advanced Compression Option
It is time to wrap up
Simplicity Downtime
Migration | More Information
PERFORMANCE TESTING
Using the Oracle Cloud for Upgrades and Migrations