Hi All,
In this post i have shared Cross-Platform Database Migration (across same endian) using RMAN backupset in 12C
High level steps :
Step 1: Connect to Source database and open it read only |
Step2: Take backup of the Source database : |
Step 3: On the destination server (Windows) create the pfile and the oracle service |
Step 4: Restore the database from the backup |
Step 5: Get the controlfile recreation script from the source database Solaris taken in step 2 |
Step 6: Alter the database open resetlogs |
Pre-requisite:
- To perform cross-platform data transport using backup sets, the version of the destination database must be Oracle Database 12c Release 1 (12.1) or later.
- The COMPATIBLE parameter in the server parameter file of the source database and the destination database must be set to 12.0.0 or higher.
- The source database must be open in read-only mode.
- The DBMS_TDB.CHECK_DB procedure must run successfully.
- When you transport entire database the source platform and the destination platform must use the same endian format.
- When endian formats are different format you can transport tablespace/datafiles.
- TO PLATFORM and FOR TRANSPORT clauses are not supported in Oracle Database 10g Release 2 (10.2) or Oracle Database 11g, you can transport data from these versions of the database to Oracle Database 12c Release 1 (12.1).
Please refer Note 1644693.1 How to restore a pre-12c backup to a cross-platform, Cross-endian 12c database
This new 12c functionality uses different keyword used in the backup command:
TO PLATFORM: Perform conversion on the source database.
FOR TRANSPORT: Performs conversion on the destination database so offloads the load from source database.
In the below example:
Source database :- Solaris Operating System (x86-64) (Little Endian format)
Source database name : Source
Destination database :- Microsoft Windows x86 64-bit (Little Endian format)
User test1 is created and is granted SYSBACKUP privilege.
Step 1: Connect to Source database and open it read only
The source database is the database that contains the data that needs to be transported to a different platform.
In this example, the test1 user is granted the SYSBACKUP privilege in the source database, prod_source.
RMAN> Connect target "test1 AS SYSBACKUP";
target database Password:
connected to target database: source (DBID=2390246677)
using target database control file instead of recovery catalog
RMAN> Shutdown immediate
database closed
database dismounted
Oracle instance shut down
connected to target database (not started)
Oracle instance started
database mounted
RMAN> Alter database open read only ;
Statement processed
Step2: Take backup of the Source database :
To Take advantage of parallelism you can configure parallelism in RMAN configuration. Otherwise, by default one channel would be used to take the backup.
In the Below example we are using FOR TRANSPORT Instead of TO PLATFORM. So the conversion would be done on destination database during restore.
FOR TRANSPORT
FORMAT '/u01/app/oracle/oradata/source/%U'
database ;
Finished backup at 23-Feb-25
Copy the backuppiece created to the destination server. The backuppieces created in the above example are:
/u01/app/oracle/oradata/source/03q7kr31_1_1
/u01/app/oracle/oradata/source/02q7kr31_1_1
/u01/app/oracle/oradata/source/01q7kr31_1_1
Take a controlfile backup to trace which would be used in step 5 to recreate the controlfile on destination server
SQL>Alter session set tracefile_identifier='create';
SQL>Alter database backup controlfile to trace resetlogs;
SQL>Show parameter user_dump
Go to this location
ls -lrt *create.trc
Copy this trace to Destination database
Step 3: On the destination server (Windows) create the pfile and the oracle service
1. Create the Oracle service and the pfile to be used.
Pfile should have below value
Control_files=<new location on destination database>
compatible=<same as source>
DB_CREATE_FILE_DEST=<Location where you want your datafiles to be restored>
Add other parameters as per your environment
2. Connect to the destination database, to which the database must be transported, as TARGET
.
Please ensure DB_CREATE_FILE_DEST is set in the init.ora else you would get error
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 08/05/2015 10:12:45
RMAN-05088: DB_CREATE_FILE_DEST is not set
RMAN> CONNECT TARGET /;
RMAN> Startup nomount;
Step 4: Restore the database from the backup
The restore phase will restore only the datafile and not the controlfile.
RMAN>
RESTORE
FROM PLATFORM 'Solaris Operating System (x86-64)'
FOREIGN DATABASE TO NEW
FROM BACKUPSET 'D:\04q7kr31_1_1'
BACKUPSET 'D:\03q7kr31_1_1'
BACKUPSET 'D:\02q7kr31_1_1'
BACKUPSET 'D:\01q7kr31_1_1' ;
Sample output:
Finished restore at 23-Feb-25
Step 5: Get the controlfile recreation script from the source database Solaris taken in step 2
Since destination database is already in no mounted state. Just run the script to recreate controlfile.
Change the path of the redo log to specify the path that exist on destination server.
Change the path of the datafile to the path they were restored to in step 4.
Here is a sample script
MAXLOGFILES 50
MAXLOGMEMBERS 5
MAXDATAFILES 100
MAXINSTANCES 1
MAXLOGHISTORY 292
LOGFILE
GROUP 1 'D:\SOURCE\DATAFILE\redo01.log' SIZE 100M BLOCKSIZE 512, ==============>ModifIed as per destination location
GROUP 2 'D:\SOURCE\DATAFILE\redo02.log' SIZE 100M BLOCKSIZE 512,
GROUP 3 'D:\SOURCE\DATAFILE\redo03.log' SIZE 100M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'D:\SOURCE\DATAFILE\O1_MF_SYSTEM_BW38QPT8_.DBF', ==============>Modified as per the restore on destination in step 4
'D:\SOURCE\DATAFILE\O1_MF_SYSAUX_BW38QPTG_.DBF',
'D:\SOURCE\DATAFILE\O1_MF_UNDOTBS1_BW38QPTP_.DBF',
'D:\SOURCE\DATAFILE\O1_MF_USERS_BW38QPTY_.DBF'
CHARACTER SET WE8MSWIN1252;
SQL>Connect target /
Run the create controlfile script
SQL>Alter database mount ;
SQL>Select name from v$datafile :
Should show all the datafiles in correct path where they were restored on destination
SQL>Select member from v$logfile ;
Ensure this path exist
Step 6: Alter the database open resetlogs
Statement processed
Add temp file
SQL> alter tablespace temp add tempfile size 100M;
Thanks,
Srini
No comments:
Post a Comment
No one has ever become poor by giving