VC15 DataPump MasterDeck FINAL
VC15 DataPump MasterDeck FINAL
VC15 DataPump MasterDeck FINAL
royfswonger
@royfswonger
mikedietrich
@mikedietrichde
https://mikedietrichde.com
dohdatabase
@dohdatabase
https://dohdatabase.com
rodrigoaraujorge
@rodrigojorgedba
https://dbarj.com.br/en
william-beauregard-3053791
klaus-gronau-39a43aa9
https://MikeDietrichDE.com/slide
s
INTRO
VERIFICATIO
N
UPGRADE
STATISTICS PARTITIONS
CHARACTERSE
MOVE T
LOBS AUTONOMOUS
10 Copyright © 2023, Oracle and/or its affiliates
"Oracle Data Pump technology enables
very high-speed movement of data and
metadata from one database to another."
Fewer Bugs
Important patches are included.
Monitor for bugs that affects many customers.
Faster Patching
The bundle patch changes the way Data Pump
is patched. Subsequent patches apply faster.
INTRO
VERIFICATIO
N
UPGRADE
STATISTICS PARTITIONS
CHARACTERSE
MOVE T
LOBS AUTONOMOUS
27 Copyright © 2023, Oracle and/or its affiliates
You can use Data Pump to move data
into a newer release of Oracle Database
• Oracle recommends upgrading the database using AutoUpgrade
Suitable when
• Going to multitenant
• Re-organization is required
Considerations
• Longer downtime
INTRO
VERIFICATIO
N
UPGRADE
STATISTICS PARTITIONS
CHARACTERSE
MOVE T
LOBS AUTONOMOUS
31 Copyright © 2023, Oracle and/or its affiliates
To migrate your data, you typically
use Data Pump in schema or full mode
INTRO
VERIFICATIO
N
UPGRADE
STATISTICS PARTITIONS
CHARACTERSE
MOVE T
LOBS AUTONOMOUS
37 Copyright © 2023, Oracle and/or its affiliates
1 Include statistics in Data Pump
"
AIX to Exadata using cross-platform transportable tablespace without
stats.
Index statistics
EXCLUDE=STATISTICS
Statistics preferences
Column usage
information
Index statistics
EXCLUDE=STATISTICS Statistics
preferences
Column usage
information
Index statistics
EXCLUDE=STATISTICS
Statistics preferences
Column usage
information
• Potentially a problem
• Fragmented tables
• Changing block size
• Changing character set
• Compress or decompress
...
Column usage
Included Missing Missing
information
INTRO
VERIFICATIO
N
UPGRADE
STATISTICS PARTITIONS
CHARACTERSE
MOVE T
LOBS AUTONOMOUS
59 Copyright © 2023, Oracle and/or its affiliates
A short history of
binary data types
SecureFile LOBs
10g
BasicFile LOBs
8i
SecureFile LOBs
10g
BasicFile LOBs
8i •
•
Performance constraints
Data Pump can act with one worker only
• Max size: (4GB - 1) * DB_BLOCK_SIZE
SecureFile LOBs
10g •
•
Improved performance
Data Pump can act with multiple workers
• Deduplication, encryption and more
• Max size: same as with CLOB/BLOB
DB_SECUREFILE
• NEVER
• PERMITTED
• PREFERRED LOBs are created as SecureFile LOBs unless explicitly stated
• ALWAYS
• IGNORE
250MB
250MB
250MB
250MB
exec DBMS_STATS.GATHER_TABLE_STATS('HUGO','TAB1');
TAB1
Worker 6 Status:
Process Name: DW05
State: EXECUTING
Worker
Processes Object Schema: HUGO
Object Name: TAB1
Object Type: SCHEMA_EXPORT/...
Completed Objects: 1
Total Objects: 1
Completed Rows: 85
Worker Parallelism: 1
TAB1 TAB1
DEGREE DEGREE
_____________ _____________
1 8
No relief
TAB1
Worker 1 Status:
Process Name: DW08
State: EXECUTING
TAB1
Segments Extents
TAB1
Table Columns
OBJECT_NAME OBJECT_TYPE
____________________________ ______________
TAB1 TABLE
SYS_IL0000070285C00002$$ INDEX
SYS_LOB0000070285C00002$$ LOB
begin
DBMS_STATS.SET_TABLE_STATS (
ownname => 'HUGO',
tabname => 'TAB1',
numrows => 10000000,
numblks => 1000000);
end;
/
TAB1
Worker 2 Status:
Process Name: DW01
State: EXECUTING
Full export:
• Directory definition gets exported/imported
• You must copy the files
Schema export:
• You must create the directory within the database
• You must copy the files
Table export:
• You must create the directory within the database
• You must copy the files
INTRO
VERIFICATIO
N
UPGRADE
STATISTICS PARTITIONS
CHARACTERS
MOVE ET
LOBS AUTONOMOUS
94 Copyright © 2023, Oracle and/or its affiliates
Character Sets | Brief Introduction
Unicode
Encoding
UTF-32
UTF-16
UTF-8
UTF-32 0x0000006
UTF-16 0x0061
UTF-8 0x61
US7ASCII to AL32UTF8
WE8ISO8859P15 to AL32UTF8
Migrating to superset
US7ASCII No data loss
Cause: Oracle Data Pump import converted a metadata object from the
export database character set into the target database character set
prior to processing the object. Some characters could not be converted
to the target database character set and so the default replacement
character was used.
Fix: No specific user action is required. This type of data loss can
occur if the target database character set is not a superset of the
export database character set.
Use AL32UTF8
• National character set AL32UTF16
1 2 3
SCAN REPORT FIX
Non-intrusive scan Types of findings: Before migration
of the database • Need no conversion or as part of the
migration
• Needs conversion
• Invalid binary
representation
• Exceeds column limit
• Exceeds data type limit
INTRO
VERIFICATIO
N
UPGRADE
STATISTICS PARTITIONS
CHARACTERSE
MOVE T
LOBS AUTONOMOU
119 Copyright © 2023, Oracle and/or its affiliates
S
Data Pump is the ideal tool
to move to Autonomous Database
Integrated with:
• Zero Downtime Migration
• SQL Developer
• Database Migration Service
Without Object
Storage
Note:
curl does not support wildcards or substitution characters. Use multiple curl
commands or a script that supports substitution characters
Without Object
Storage
INTRO
VERIFICATIO
N
UPGRADE
STATISTICS PARTITIONS
CHARACTERSE
MOVE T
LOBS AUTONOMOUS
153 Copyright © 2023, Oracle and/or its affiliates
Parallel | Metadata Import - Recap
METADATA – non-
METADATA - parallel parallel
Sub-
Partition Package Constraint Types, Schemas,
Partition Indexes ...
s Bodies s Procedural objects
s
DATA - parallel
XML Doc 2
Worker 2 User81
User82
…
impdp User160
XML Doc
Worker 3 3
User161
User162
Worker 4
Idle
A recap
Table
Partition
Subpartition Unknown One worker only
Table
Partition
Subpartition Unknown One worker only
table_exists_action=truncate
TRUNCATE
From the timestamps we can see that each partition is imported serially
Table
Partition
Subpartition Unknown One worker only
REPLACE
Table
Partition
Subpartition Unknown One worker only
TRUST_EXISTING_TABLE_PARTITIONS (1)
Again we see partitions imported in parallel, but the existing table was re-used
TRUST_EXISTING_TABLE_PARTITIONS (2)
INTRO
VERIFICATIO
N
UPGRADE
STATISTICS PARTITIONS
CHARACTERSE
MOVE T
LOBS AUTONOMOUS
173 Copyright © 2023, Oracle and/or its affiliates
Data Pump Error Messages
Are there error messages we can ignore?
…
ORA-31684: Object type USER:"KGRONAU" already exists
…
ORA-39111: Dependent object type
ALTER_FUNCTION:"KGRONAU"."GETDDL_F$" skipped, base object type
FUNCTION:"KGRONAU"."TPGETDDL_F$" already exists
…
ORA-39082: Object type VIEW:"KGRONAU"."MyCaseSensitiveView" created with compilation
warnings
Processing object type SCHEMA_EXPORT/PACKAGE/PACKAGE_BODY
ORA-39346: data loss in character set conversion for object
...
ORA-01653: unable to extend table KGRONAU.MYTABLE by 8192 in tablespace KGRONAU
ORA-39171: Job is experiencing a resumable wait.
...
ORA-12899: value too large for column COD_PAIS_A2 (actual: 3, maximum: 2)
...
ORA-39083: Object type REF_CONSTRAINT:“KGRONAU"."R_CALCEVIK" failed to create with error:
ORA-02298: cannot validate (SCDAT.R_GLTRANS_CALCEVIK) - parent keys not found
Job "KGRONAU"."Q2_AGG_MYTMN_SENTM_10"
successfully completed at Thu Aug 11 00:23:34 2022 elapsed 0 00:03:59
...
W-1 Completed 1 TABLE objects in 17 seconds
W-1 Completed by worker 1 1 TABLE objects in 17 seconds
W-1 Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
…
W-1 . . imported "KGRONAU"."AGG_MYTMN_SENTMSG_D1":"AGG_MYTMN_SENTMSG_D1_20071024" 13.34 KB
231 rows in 2 seconds using external_table
W-1 . . imported "KGRONAU"."AGG_MYTMN_SENTMSG_D1":"AGG_MYTMN_SENTMSG_D1_20071029" 13.34 KB
0 out of 231 rows in 0 seconds using external_table
W-1 . . imported "KGRONAU"."AGG_MYTMN_SENTMSG_D1":"AGG_MYTMN_SENTMSG_D1_20071008" 13.26 KB
0 out of 228 rows in 0 seconds using external_table
...
W-1 Processing object type TABLE_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
W-1 Completed 30 OBJECT_GRANT objects in 0 seconds
W-1 Completed by worker 1 30 OBJECT_GRANT objects in 0 seconds
W-1 Completed 98 TABLE_EXPORT/TABLE/TABLE_DATA objects in 2 seconds
…
Job "KGRONAU"."Q2_AGG_MYTMN_SENTM_10" successfully completed at Thu Aug 11 00:23:34 2022
elapsed 0 00:03:59
cat MyImpDp.dplog | grep -w imported | grep -w rows | awk '{print $5,$8}' >myfile
…
"KGRONAU"."AGG_MYTMN_SENTMSG_D1":"AGG_MYTMN_SENTMSG_D1_20071024" 231
"KGRONAU"."AGG_MYTMN_SENTMSG_D1":"AGG_MYTMN_SENTMSG_D1_20071029" 0
…
Export Datapump:
cat expdp.dplog |grep -w exported | grep -w rows |awk ... >>rowcount.txt
cat rowcount.txt |sort -k 1 >>rowcount_src.txt
Import Datapump:
cat impdp.dplog |grep -w imported | grep -w rows |awk ... >>rowcount.txt
cat rowcount.txt |sort -k 1 >>rowcount_trg.txt
Differences:
diff rowcount_src.txt rowcount_trg.txt
ROWCOUNT_STMTS
------------------------------------------------------------------
SELECT /*+ PARALLEL(16) */ 'KGRONAU.DUMMY number of rows: '|| count(1) from
KGRONAU."DUMMY";
minus
where owner='KGRONAU'
and constraint_name not like 'BIN%'
group by table_name
minus
select table_name,count(table_name) from dba_constraints
where owner='KGRONAU'
and constraint_name not like 'BIN%'
group by table_name;
TABLE_NAME COUNT(TABLE_NAME)
------------------------- -----------------
MYTABLE 1
199 Copyright © 2023, Oracle and/or its affiliates
Comparison possibilities
DBMS_COMPARISON
DBMS_COMPARISON.CREATE_COMPARISON
DBMS_COMPARISON.COMPARE
(DBMS_COMPARISON.CONVERGE)
GoldenGate Veridata
https://www.oracle.com/at/a/ocom/docs/middleware/
veridata-datasheet.pdf
DBMS_CRYPTO package
STANDARD_HASH function
Validation is
time consuming
• 200+ videos
• No marketing
• No buzzword
• All tech
Link
https://MikeDietrichDE.com
https://DOHdatabase.com
https://www.dbarj.com.br/en
Webinars:
https://MikeDietrichDE.com/videos
YouTube channel:
OracleDatabaseUpgradesandMigrations