#1 Install the backup module in the source and target dbsystem using these instructions.
#2 Backup the source database to OSS.
Specify a password for the backup.
rman <<EOF
connect target /
CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS 'SBT_LIBRARY=/home/oracle/bkp/lib/libopc.so, SBT_PARMS=(OPC_PFILE=/home/oracle/bkp/config)';
CONFIGURE DEFAULT DEVICE TYPE TO SBT_TAPE;
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE TO '%F';
CONFIGURE ENCRYPTION FOR DATABASE ON;
SET ENCRYPTION IDENTIFIED BY "<pwd>" ONLY;
BACKUP DATABASE PLUS ARCHIVELOG;;
EOF
#3 Save the init.ora on the target db
sqlplus -s / as SYSDBA <<EOF
CREATE PFILE='?/dbs/init<instance>.ora' FROM SPFILE;
EOF
#4 Drop the target database
sqlplus / as SYSDBA <<EOF
SHUTDOWN IMMEDIATE;
STARTUP MOUNT EXCLUSIVE RESTRICT;
DROP DATABASE;
EOF
#5 Setup the wallet autologin
Transfer the source database wallet on the target dbsystem, on the /tmp directory, create the autologin wallet with:
cd /opt/oracle/dcs/commonstore/wallets/<db unique name>/tde
mv ewallet.p12 ewallet.p12.sav
mv cwallet.sso cwallet.sso.sav
cp /tmp/ewallet.p12 .
orapki wallet create -wallet /opt/oracle/dcs/commonstore/wallets/<db unique name>/tde -pwd <Source TDE password> -auto_login
#6 CLean ASM
running asmcmd, remove any files that belong to the previous incarnation of the target database.
#7 Extract the backup metadata from the rman backup on OSS:
python /home/oracle/bkp/lib/odbsrmt.py --mode=rman-listfile --credential='<user>'/'<auth_token>' --host=https://swiftobjectstorage.me-dubai-1.oraclecloud.com/v1/<namespace> --container=<bucket> --forcename=duplicate_db.xml --dir=/home/oracle/bkp --dbid=<dbid>
odbsrmt.py: ALL outputs will be written to [/home/oracle/bkp/duplicate_db.xml]
odbsrmt.py: Processing container wcc-backups...
cloud_slave_processors: Thread Thread_0 starting to download metadata XML files...
cloud_slave_processors: Thread Thread_0 successfully done
odbsrmt.py: ALL outputs have been written to [/home/oracle/bkp/duplicate_db.xml]
#8 Remove the database from the clusterware
srvctl stop database -d <dbu>
srvctl remove database -d <dbu>
#9 Start the db in nomount and run the man duplicate
Replace at least the following parameters to handle db name, domain name change, etc:
sqlplus / AS SYSDBA <<EOF
SHUTDOWN IMMEDIATE;
STARTUP NOMOUNT PFILE='?/dbs/init<instance>.ora';
EOF
rman <<EOF
CONNECT AUXILIARY /
SET DECRYPTION IDENTIFIED BY 'welc0me0SC##';
run {
ALLOCATE AUXILIARY CHANNEL c1 DEVICE TYPE sbt PARMS 'SBT_LIBRARY=/home/oracle/bkp/lib/libopc.so, SBT_PARMS=(OPC_PFILE=/home/oracle/bkp/config)';
ALLOCATE AUXILIARY CHANNEL c2 DEVICE TYPE sbt PARMS 'SBT_LIBRARY=/home/oracle/bkp/lib/libopc.so, SBT_PARMS=(OPC_PFILE=/home/oracle/bkp/config)';
ALLOCATE AUXILIARY CHANNEL c3 DEVICE TYPE sbt PARMS 'SBT_LIBRARY=/home/oracle/bkp/lib/libopc.so, SBT_PARMS=(OPC_PFILE=/home/oracle/bkp/config)';
ALLOCATE AUXILIARY CHANNEL c4 DEVICE TYPE sbt PARMS 'SBT_LIBRARY=/home/oracle/bkp/lib/libopc.so, SBT_PARMS=(OPC_PFILE=/home/oracle/bkp/config)';
SET NEWNAME FOR DATABASE TO '+DATA';
DUPLICATE DATABASE <sourcedb> TO <targetdb>
LOGFILE GROUP 1 ('+RECO') SIZE 100M REUSE
,GROUP 2 ('+RECO') SIZE 100M REUSE
,GROUP 3 ('+RECO') SIZE 100M REUSE
,GROUP 4 ('+RECO') SIZE 100M REUSE
BACKUP LOCATION FROM FILE '/home/oracle/bkp/duplicate_db.xml'
SPFILE
SET sga_target='12G'
SET audit_file_dest='/u01/app/oracle/admin/<unq>/adump'
SET wallet_root='/opt/oracle/dcs/commonstore/wallets/<unq>'
SET db_unique_name='<unq>'
SET db_domain='<domain>'
SET pga_aggregate_target='4G';
}
EOF
#10 Run datapatch
$ORACLE_HOME/OPatch/datapatch