You are on page 1of 41

Delivering Oracle Success

Oracle Database
Cross Platform Migration
Lucy Feng, DBAK

RMOUG QEW
November 19, 2010
Business Requirements
• Migrate all Oracle databases to IBM zSeries based
Linux
• The database servers were on Sun SPARC, Linux or
Solaris x86
• Databases are on 10gR2: 10.2.0.4 or 10.2.0.3
• Multiple databases need to be migrated within 4-hour
window
• Database sizes range from 200 GB to 1.2 TB

© DBAK 2010 2
Options
• Data Guard Standby is not an option because of the
platform difference
• Export/Import or data pump take too long
• Oracle Streams is discarded because of the risk of data
divergence
• The methods chosen are:
– Cross Platform Transportable Tablespace
– Transportable Database

© DBAK 2010 3
Cross Platform Transportable Tablespace
• Transportable Tablespace is a feature introduced
in 8i
• It allows nonsystem tablespaces to be moved
from one database to another by physically
grafting the tablespace datafiles into the control
files on the target database, and then importing
object metadata into the target database’s
dictionary

© DBAK 2010 4
Cross Platform Transportable Tablespace
• Transportable tablespace (TTS) in 8i works between
the same block size
• Oracle 9i removed the block size restriction, but still
required homogeneous operating systems
• Oracle 10g introduced Cross Platform TTS (XTTS)
which allows TTS to function across different
platforms

© DBAK 2010 5
How XTTS Works

© DBAK 2010 6
Endian Format
• Endianness – how multi-byte data is stored in
computer memory
• Two formats – Little Endian and Big Endian
• Dictated by the CPU architecture
– Linux, Windows use Little Endian byte order
– Sun Sparc, HPUX use Big Endian byte order
• Join V$DATABASE and
V$TRANSPORTABLE_PLATFORM
• RMAN Convert performs endian conversion

© DBAK 2010 7
RMAN Convert
• Convert datafile, convert tablespace and convert
database
• Convert tablespace must be run from the source
database
• Convert database can only be used when the source
and target platforms share the same endian format. It
creates a convert script and a transport script

© DBAK 2010 8
RMAN Convert
In addition to convert endian format, RMAN convert also:
• Reformats blocks of undo segments. It is required for
transporting datafiles containing undo segments
between platforms, regardless of endian format.
• Transports datafiles stored in ASM

© DBAK 2010 9
RMAN Convert prerequisite
• Both the source and destination platforms must be
supported by the convert command. Query
V$TRANSPORTABLE_PLATFORM.
• Both source and destination databases must have
COMPATIBLE set to 10.0.0 or higher. Read-only
tablespaces must be made read/write at least once.

© DBAK 2010 10
RMAN Convert Datafile Syntax
RMAN connect to destination database as target:

• CONVERT DATAFILE '/u01/oradata/datafile/undo.dbf'


FROM PLATFORM ''Linux x86 64-bit'' FORMAT
'+OCDPRD_DATA';

© DBAK 2010 11
How XTTS Works

© DBAK 2010 12
Incrementally updated image copy backup
• An image copy is identical to the original file
• RMAN prefers to use an image copy over a backup
set if you have both. There is more overhead in
sorting through a backup set.
• Use switch command to point the database to the
image copy datafile – no need to restore
• RMAN takes an image copy of database as a base
backup, and as subsequent incremental backups are
taken, they are applied (recovered) on the image
copies.

© DBAK 2010 13
Incrementally updated image copy backup
• rman>backup incremental level 1 for recover of copy
with tag 'ROLLING_BAKCUP' database;
• rman>recover copy of database with tag
'ROLLING_BACKUP';
• Point in time recovery of the database cannot be
performed before the last application of the incremental
backup. Delayed merge is common.
rman>run { recover copy of database with tag
'ROLLING_BACKUP';
backup incremental level 1 for recover of copy with tag
'ROLLING_BAKCUP' database;}

© DBAK 2010 14
Servers and data movement
Source server NFS server Target server

Gigabit Hyper
connection socket

NFS
NFS

Data Data
store store
Rman
convert

© DBAK 2010 15
XTTS - Preparation
Create the Destination Database
STARTUP NOMOUNT
CREATE DATABASE "CDSPRD"
LOGFILE
GROUP 1 ('+CDSPRD_ORADATA','+CDSPRD_ARCH') SIZE 500M,
GROUP 2 ('+CDSPRD_ORADATA','+CDSPRD_ARCH') SIZE 500M,
GROUP 3 ('+CDSPRD_ORADATA','+CDSPRD_ARCH') SIZE 500M,
GROUP 4 ('+CDSPRD_ORADATA','+CDSPRD_ARCH') SIZE 500M
DATAFILE
'+CDSPRD_ORADATA' SIZE 501m autoextend on next 50m maxsize 20001m SYSAUX
DATAFILE '+CDSPRD_ORADATA' SIZE 501m autoextend on next 50m maxsize 20001m
UNDO TABLESPACE UNDO DATAFILE '+CDSPRD_ORADATA' SIZE 501m autoextend on next
50m maxsize 20001m
DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '+CDSPRD_ORADATA' SIZE 501m
autoextend on next 50m maxsize 20001m
MAXLOGFILES 20
MAXLOGMEMBERS 5
MAXDATAFILES 1000
MAXINSTANCES 5
MAXLOGHISTORY 2696
CHARACTER SET WE8ISO8859P1
;

© DBAK 2010 16
XTTS - Preparation
Create the Destination Database
@@$ORACLE_HOME/rdbms/admin/catalog.sql
@@$ORACLE_HOME/rdbms/admin/catexp.sql
@@$ORACLE_HOME/rdbms/admin/catproc.sql
@@$ORACLE_HOME/rdbms/admin/utltkprf.sql
@@$ORACLE_HOME/rdbms/admin/catsvrmg.sql
@@$ORACLE_HOME/rdbms/admin/catblock.sql
@@$ORACLE_HOME/rdbms/admin/catio.sql
@@$ORACLE_HOME/rdbms/admin/dbmspool.sql
@@$ORACLE_HOME/rdbms/admin/prvtpool.plb
connect system/manager
@@$ORACLE_HOME/rdbms/admin/catdbsyn.sql
@@$ORACLE_HOME/sqlplus/admin/pupbld.sql
select comp_name,version,status from dba_registry;

© DBAK 2010 17
XTTS – Preparation
Generate the Conversion Script
Run from the source database
spool convert.rman
prompt run {
select 'CONVERT DATAFILE '''||file_name||''' FROM
PLATFORM ''Linux x86 64-bit'' FORMAT
''+CDSPRD_ORADATA'';'
from dba_tablespaces a, dba_data_files b
where a.tablespace_name = b.tablespace_name
and a.tablespace_name not in ('SYSTEM','SYSAUX')
and contents = 'PERMANENT';
prompt }
spool off

© DBAK 2010 18
XTTS - Preparation
Generate User Creation Script From Source and Run in Target
spool gen_cre_user.sql
select 'create user '||username||' identified by values
'''||password||''';'
from dba_users;
spool off

spool gen_alt_user.sql
select 'alter user '||username||' identified by values '''||password||''';'
from dba_users;
spool off

© DBAK 2010 19
XTTS - Steps
Convert to Read Only

spool tts_ro.sql
select 'ALTER TABLESPACE '||tablespace_name||' READ
ONLY;'
from dba_tablespaces
where tablespace_name not in ('SYSTEM','SYSAUX')
and contents = 'PERMANENT';
spool off
set heading on feedback on
@tts_ro

© DBAK 2010 20
XTTS - Steps
Export Metadata from the Source Database
expdp userid=\'/ as sysdba\' parfile=tbs_exp.par
cat tbs_exp.par
directory=TBSDIR
dumpfile=tbs.dmp
logfile=tbsexp.log
transport_full_check=no
transport_tablespaces=USERDATA,USERINDEXES,USERS

expdp userid=\'/ as sysdba\' directory=TBSDIR \


dumpfile=full.dmp logfile=full.log \
content=metadata_only full=y

© DBAK 2010 21
XTTS - Steps
• Execute the Convert Datafile Script in the Target Database
• Import Metadata in Target Database
impdp userid=\'/ as sysdba\' parfile=tbs_imp.par

cat tbs_imp.par
directory=TBSDIR
dumpfile=tbs.dmp
logfile=tbsimp.log
transport_datafiles=
'+CDSPRD_ORADATA/CDSPRD/DATAFILE/USERINDEXES.273.7
22726321',
'+CDSPRD_ORADATA/CDSPRD/DATAFILE/USERINDEXES.275.7
22726931',

© DBAK 2010 22
XTTS - Steps
Import Metadata
impdp userid=\'/ as sysdba\' directory=TBSDIR
dumpfile=full.dmp logfile=full.log

© DBAK 2010 23
XTTS - Steps
• Set Tablespaces to Read/Write in Destination
Database
• Run Post Conversion steps
SHUTDOWN IMMEDIATE
STARTUP UPGRADE
@?/rdbms/admin/utlirp.sql
@?/rdbms/admin/catupgrd
@?/rdbms/admin/utlrp.sql
• Restart database and validate

© DBAK 2010 24
XTTS – Check Self Containment
• Tablespaces transported must be self-contained
• Examples of object relationships that may cause
containment violations:
– A table and its index
– An IOT and its overflow segment
– Table partitions and subpartitions
– A referential integrity

© DBAK 2010 25
XTTS – Check Self Containment
for ts in
(select tablespace_name
from dba_tablespaces
where tablespace_name not in ('SYSTEM','SYSAUX')
and contents = 'PERMANENT')
loop

dbms_tts.transport_set_check(checklist,TRUE,TRUE);

select * from transport_set_violations;

© DBAK 2010 26
Transportable Database (TDB)
• TDB introduced in 10gR2. It is used to automate the
movement of an entire database from one platform
to another.
• The key is the source and the destination platforms
must have the same endian format
• From the Source Database, query
v$db_transportable_platform. If the target platform is
in the output, using TDB is supported.

© DBAK 2010 27
Transportable Database Process
• Check prerequisites
– dbms_tdb.check_external: external tables, directories or
BFILES must be recreated on the target
– dbms_tdb.check_db: database read-only, active or in-doubt
transactions, compatibility 10 or higher, etc.
• Transport the data files – Run convert database command.
Convert database generates a convert script and a transport script.
• Transport environment – Copy the initialization parameters (pfile
or spfile), listener.ora and tnsnames.ora to the target server.
• Start the target database – Start the new database on the target
system. Control file and redo logs will be recreated.

© DBAK 2010 28
Transportable Database In a Nutshell
• Datafiles containing undo information need to be
reformated to fit the target platform. Use RMAN convert
datafile to convert them.
• Ensure datafiles are ready for conversion.
• Prepare the target database as if you are doing a
database clone.
– Prepare pfile or spfile and password file.
– Prepare listener.ora and tnsnames.ora
– Recreate control file and redo logs.
– Open resetlogs

© DBAK 2010 29
Transportable Database – Steps
Step 1 -- Restore Control File, mount and rename
datafiles
rman>startup nomount;
rman>restore controlfile from '/zdb_nfs/ATDPRD/c-
162931418-20090905-01';
rman>alter database mount;
rman>switch database to copy;

© DBAK 2010 30
Transportable Database – Steps
Step 2 – Create the RMAN Conversion Script
Sql>
spool convert.rman
prompt run {
select 'CONVERT DATAFILE '''||f.name||''' FROM PLATFORM
''Solaris[tm] OE (64-bit)'' FORMAT
''+'||d.name||'_ORADATA'';'
from v$dbfile f, v$database d;
prompt }
spool off

© DBAK 2010 31
Transportable Database – Steps
Step 3 – Startup Nomount and run the Conversion Script
from Step 2
Step 4 – Create a new Control File. Get new Datafile
names from ASMCMD. Open Resetlogs
Step 5 – Run Post Conversion Steps
– Recreate TEMP
– Recompile PL/SQL Packages
Step 6 – Ensure Control File and Redo Logs are moved
to ASM

© DBAK 2010 32
Plan for downtime

Plan for Downtime


Outage Database
Start is up

Full backup, Daily Shutdown Incremental Convert and transfer Post steps
incremental and Startup backup and
merge mount merge

© DBAK 2010 33
Speed it up
• Block change tracking – 10g and up
– CTWR backgroup process tracks changed blocks as
redo is generated and writes to a binary file.
– Sql>alter database enable block change tracking
using file ‘+ATDPROD_DATA’;
– Sql>select status, filename, bytes from
v$block_change_tracking

© DBAK 2010 34
Speed it up
• Allocate multiple channels for incremental backup
• Convert in parallel
RUN {
CONVERT DATAFILE
'/cds_mnt/cdsprd/audit_data01.dbf',
'/cds_mnt/cdsprd/index_data01.dbf',
...
'/cds_mnt/cdsprd/user_data01.dbf',
'/cds_mnt/cdsprd/user_data02.dbf'
FROM PLATFORM 'Linux x86 64-bit'
PARALLELISM 3
DB_FILE_NAME_CONVERT '/cds_mnt/cdsprd/','+CDSPRD_ORADATA/'
;}

© DBAK 2010 35
Speed it up
• Convert datafiles of read-only tablespaces in advance
• Ensure NFS mount optimization
– 397194.1 How to optimize NFS Performance with NFS
option

© DBAK 2010 36
Recap
• When the source and the destination platforms are
different and the endian formats are different – create
a receiving database, import metadata and use RMAN
convert to convert datafiles of the transported
tablespaces

• When the source and destination endian formats are


the same – use RMAN convert to convert datafiles
with undo information and recreate the control file and
redo logs.

© DBAK 2010 37
Benefits of XTTS and TDB
• Reduced complexity and errors
– A high-level copy of data
– It moves objects as a unit, unlike table-by-table
methods that could miss objects or rows of data
– No need to create or rebuild indexes
• Reduced downtime

© DBAK 2010 38
E-Business Suite Database
• 454574.1 Cross Platform Transportable
Tablespaces on 11i with 10gR2

• 729309.1 Using Transportable Database to migrate


Oracle E-Business Suite Release 11i using Oracle
Database 10g Release 2 or 11g Enterprise Edition

• 734763.1 Using Transportable Database to


migrate E-Business Suite R12 using Oracle
Database 10gR2 or 11g

© DBAK 2010 39
Contact

Lucy Feng
lfeng@dbaknow.com

www.dbaknow.com

© DBAK 2010 40
About DBAK
• Oracle solution provider
• Co-founded in 2005
• Based in Englewood, CO
• 2008 “Emerging Business of the Year” – South Metro
Denver Chamber of Commerce
• More than 130 implementations, upgrades,
conversions, and support projects for 80+ clients
• Average 15 years of Oracle expertise
• Oracle Gold Partner

© DBAK 2010 41

You might also like