Backup and Restore

Backup and Restore

From 21c to 19c

What you need:

  1. Both Wallets on different directories located

  2. instantclient

  3. sqlcl

#Switch to different Wallet 

export TNS_ADMIN=/usr/lib/oracle/network/prod

#Dump the Data
/usr/lib/oracle/21/client64/bin/expdp admin/xxxyyy@prod schemas="tom,carlogdata" directory=data_pump_dir dumpfile=full.dmp reuse_dumpfiles=YES exclude=STATISTICS version=19.1

But my CARLOG_DATA Table isn't imported - without an error? - Version ? issue ?
JSON DataType Support in Oracle 21c (not in 19c!)

But if we need this table, i do so, we need to clone the carlog_data table with datatype CLOB:

--insert into carlog_data_blob select * from carlog_data;
insert into carlog_data_clob select status_date,to_clob(json_data),json_type,errorstack,appusername,id from carlog_data;

alter table rename carlog_data to carlog_data_json_blob;
alter table rename carlog_data_clob to carlog_data;

Now the export contains the table (but not the carlog_data_json!)

#Copy the Dump from data_pump_dir to the bucketfs
/home/oracle/sqlcl/bin/sql /NOLOG -cloudconfig $TNS_ADMIN/Wallet_PROD.zip @/home/oracle/backup_scripts/move_dump_file_prod.sql full.dmp

Restore on Instance 2 (19c) - DWH

Now we need to transfer the bucketfs file full.dmp into data oracle datapump directory:

/home/oracle/sqlcl/bin/sql /NOLOG -cloudconfig $TNS_ADMIN/dwh/Wallet_MYDWH.zip @bucket_to_datapump_dwh.sql

File transfer okay - i just use dbms_cloud.bulk_download

#Switch to different Wallet 
export TNS_ADMIN=/usr/lib/oracle/network/dwh

#Clean the schema before with drop schema cascade!

#Dump the Data
/usr/lib/oracle/21/client64/bin/impdp admin/xxxyyy@prod directory=data_pump_dir dumpfile=full.dmp table_exists_action=replace

Okay. now all is transfered to good old Oracle 19c