05.07.2013 Views

Oracle Database Cross Platform Migration Lucy Feng, DBAK

Oracle Database Cross Platform Migration Lucy Feng, DBAK

Oracle Database Cross Platform Migration Lucy Feng, DBAK

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Delivering <strong>Oracle</strong> Success<br />

<strong>Oracle</strong> <strong>Database</strong><br />

<strong>Cross</strong> <strong>Platform</strong> <strong>Migration</strong><br />

<strong>Lucy</strong> <strong>Feng</strong>, <strong>DBAK</strong><br />

RMOUG QEW<br />

November 19, 2010


Business Requirements<br />

• Migrate all <strong>Oracle</strong> databases to IBM zSeries based<br />

Linux<br />

• The database servers were on Sun SPARC, Linux or<br />

Solaris x86<br />

• <strong>Database</strong>s are on 10gR2: 10.2.0.4 or 10.2.0.3<br />

• Multiple databases need to be migrated within 4-hour<br />

window<br />

• <strong>Database</strong> sizes range from 200 GB to 1.2 TB<br />

© <strong>DBAK</strong> 2010<br />

2


Options<br />

• Data Guard Standby is not an option because of the<br />

platform difference<br />

• Export/Import or data pump take too long<br />

• <strong>Oracle</strong> Streams is discarded because of the risk of data<br />

divergence<br />

• The methods chosen are:<br />

– <strong>Cross</strong> <strong>Platform</strong> Transportable Tablespace<br />

– Transportable <strong>Database</strong><br />

© <strong>DBAK</strong> 2010<br />

3


<strong>Cross</strong> <strong>Platform</strong> Transportable Tablespace<br />

• Transportable Tablespace is a feature introduced<br />

in 8i<br />

• It allows nonsystem tablespaces to be moved<br />

from one database to another by physically<br />

grafting the tablespace datafiles into the control<br />

files on the target database, and then importing<br />

object metadata into the target database’s<br />

dictionary<br />

© <strong>DBAK</strong> 2010<br />

4


<strong>Cross</strong> <strong>Platform</strong> Transportable Tablespace<br />

• Transportable tablespace (TTS) in 8i works between<br />

the same block size<br />

• <strong>Oracle</strong> 9i removed the block size restriction, but still<br />

required homogeneous operating systems<br />

• <strong>Oracle</strong> 10g introduced <strong>Cross</strong> <strong>Platform</strong> TTS (XTTS)<br />

which allows TTS to function across different<br />

platforms<br />

© <strong>DBAK</strong> 2010<br />

5


How XTTS Works<br />

© <strong>DBAK</strong> 2010<br />

6


Endian Format<br />

• Endianness – how multi-byte data is stored in<br />

computer memory<br />

• Two formats – Little Endian and Big Endian<br />

• Dictated by the CPU architecture<br />

– Linux, Windows use Little Endian byte order<br />

– Sun Sparc, HPUX use Big Endian byte order<br />

• Join V$DATABASE and<br />

V$TRANSPORTABLE_PLATFORM<br />

• RMAN Convert performs endian conversion<br />

© <strong>DBAK</strong> 2010<br />

7


RMAN Convert<br />

• Convert datafile, convert tablespace and convert<br />

database<br />

• Convert tablespace must be run from the source<br />

database<br />

• Convert database can only be used when the source<br />

and target platforms share the same endian format. It<br />

creates a convert script and a transport script<br />

© <strong>DBAK</strong> 2010<br />

8


RMAN Convert<br />

In addition to convert endian format, RMAN convert also:<br />

• Reformats blocks of undo segments. It is required for<br />

transporting datafiles containing undo segments<br />

between platforms, regardless of endian format.<br />

• Transports datafiles stored in ASM<br />

© <strong>DBAK</strong> 2010<br />

9


RMAN Convert prerequisite<br />

• Both the source and destination platforms must be<br />

supported by the convert command. Query<br />

V$TRANSPORTABLE_PLATFORM.<br />

• Both source and destination databases must have<br />

COMPATIBLE set to 10.0.0 or higher. Read-only<br />

tablespaces must be made read/write at least once.<br />

© <strong>DBAK</strong> 2010<br />

10


RMAN Convert Datafile Syntax<br />

RMAN connect to destination database as target:<br />

• CONVERT DATAFILE '/u01/oradata/datafile/undo.dbf'<br />

FROM PLATFORM ''Linux x86 64-bit'' FORMAT<br />

'+OCDPRD_DATA';<br />

© <strong>DBAK</strong> 2010<br />

11


How XTTS Works<br />

© <strong>DBAK</strong> 2010<br />

12


Incrementally updated image copy backup<br />

• An image copy is identical to the original file<br />

• RMAN prefers to use an image copy over a backup<br />

set if you have both. There is more overhead in<br />

sorting through a backup set.<br />

• Use switch command to point the database to the<br />

image copy datafile – no need to restore<br />

• RMAN takes an image copy of database as a base<br />

backup, and as subsequent incremental backups are<br />

taken, they are applied (recovered) on the image<br />

copies.<br />

© <strong>DBAK</strong> 2010<br />

13


Incrementally updated image copy backup<br />

• rman>backup incremental level 1 for recover of copy<br />

with tag 'ROLLING_BAKCUP' database;<br />

• rman>recover copy of database with tag<br />

'ROLLING_BACKUP';<br />

• Point in time recovery of the database cannot be<br />

performed before the last application of the incremental<br />

backup. Delayed merge is common.<br />

rman>run { recover copy of database with tag<br />

'ROLLING_BACKUP';<br />

backup incremental level 1 for recover of copy with tag<br />

'ROLLING_BAKCUP' database;}<br />

© <strong>DBAK</strong> 2010<br />

14


Servers and data movement<br />

© <strong>DBAK</strong> 2010<br />

Source server NFS server Target server<br />

Gigabit<br />

connection<br />

NFS<br />

Data<br />

store<br />

NFS<br />

Hyper<br />

socket<br />

Rman<br />

convert<br />

Data<br />

store<br />

15


XTTS - Preparation<br />

Create the Destination <strong>Database</strong><br />

© <strong>DBAK</strong> 2010<br />

STARTUP NOMOUNT<br />

CREATE DATABASE "CDSPRD"<br />

LOGFILE<br />

GROUP 1 ('+CDSPRD_ORADATA','+CDSPRD_ARCH') SIZE 500M,<br />

GROUP 2 ('+CDSPRD_ORADATA','+CDSPRD_ARCH') SIZE 500M,<br />

GROUP 3 ('+CDSPRD_ORADATA','+CDSPRD_ARCH') SIZE 500M,<br />

GROUP 4 ('+CDSPRD_ORADATA','+CDSPRD_ARCH') SIZE 500M<br />

DATAFILE<br />

'+CDSPRD_ORADATA' SIZE 501m autoextend on next 50m maxsize 20001m SYSAUX<br />

DATAFILE '+CDSPRD_ORADATA' SIZE 501m autoextend on next 50m maxsize 20001m<br />

UNDO TABLESPACE UNDO DATAFILE '+CDSPRD_ORADATA' SIZE 501m autoextend on next<br />

50m maxsize 20001m<br />

DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '+CDSPRD_ORADATA' SIZE 501m<br />

autoextend on next 50m maxsize 20001m<br />

MAXLOGFILES 20<br />

MAXLOGMEMBERS 5<br />

MAXDATAFILES 1000<br />

MAXINSTANCES 5<br />

MAXLOGHISTORY 2696<br />

CHARACTER SET WE8ISO8859P1<br />

;<br />

16


XTTS - Preparation<br />

Create the Destination <strong>Database</strong><br />

© <strong>DBAK</strong> 2010<br />

@@$ORACLE_HOME/rdbms/admin/catalog.sql<br />

@@$ORACLE_HOME/rdbms/admin/catexp.sql<br />

@@$ORACLE_HOME/rdbms/admin/catproc.sql<br />

@@$ORACLE_HOME/rdbms/admin/utltkprf.sql<br />

@@$ORACLE_HOME/rdbms/admin/catsvrmg.sql<br />

@@$ORACLE_HOME/rdbms/admin/catblock.sql<br />

@@$ORACLE_HOME/rdbms/admin/catio.sql<br />

@@$ORACLE_HOME/rdbms/admin/dbmspool.sql<br />

@@$ORACLE_HOME/rdbms/admin/prvtpool.plb<br />

connect system/manager<br />

@@$ORACLE_HOME/rdbms/admin/catdbsyn.sql<br />

@@$ORACLE_HOME/sqlplus/admin/pupbld.sql<br />

select comp_name,version,status from dba_registry;<br />

17


XTTS – Preparation<br />

Generate the Conversion Script<br />

Run from the source database<br />

© <strong>DBAK</strong> 2010<br />

spool convert.rman<br />

prompt run {<br />

select 'CONVERT DATAFILE '''||file_name||''' FROM<br />

PLATFORM ''Linux x86 64-bit'' FORMAT<br />

''+CDSPRD_ORADATA'';'<br />

from dba_tablespaces a, dba_data_files b<br />

where a.tablespace_name = b.tablespace_name<br />

and a.tablespace_name not in ('SYSTEM','SYSAUX')<br />

and contents = 'PERMANENT';<br />

prompt }<br />

spool off<br />

18


XTTS - Preparation<br />

Generate User Creation Script From Source and Run in Target<br />

© <strong>DBAK</strong> 2010<br />

spool gen_cre_user.sql<br />

select 'create user '||username||' identified by values<br />

'''||password||''';'<br />

from dba_users;<br />

spool off<br />

spool gen_alt_user.sql<br />

select 'alter user '||username||' identified by values '''||password||''';'<br />

from dba_users;<br />

spool off<br />

19


XTTS - Steps<br />

Convert to Read Only<br />

© <strong>DBAK</strong> 2010<br />

spool tts_ro.sql<br />

select 'ALTER TABLESPACE '||tablespace_name||' READ<br />

ONLY;'<br />

from dba_tablespaces<br />

where tablespace_name not in ('SYSTEM','SYSAUX')<br />

and contents = 'PERMANENT';<br />

spool off<br />

set heading on feedback on<br />

@tts_ro<br />

20


XTTS - Steps<br />

Export Metadata from the Source <strong>Database</strong><br />

© <strong>DBAK</strong> 2010<br />

expdp userid=\'/ as sysdba\' parfile=tbs_exp.par<br />

cat tbs_exp.par<br />

directory=TBSDIR<br />

dumpfile=tbs.dmp<br />

logfile=tbsexp.log<br />

transport_full_check=no<br />

transport_tablespaces=USERDATA,USERINDEXES,USERS<br />

expdp userid=\'/ as sysdba\' directory=TBSDIR \<br />

dumpfile=full.dmp logfile=full.log \<br />

content=metadata_only full=y<br />

21


XTTS - Steps<br />

• Execute the Convert Datafile Script in the Target <strong>Database</strong><br />

• Import Metadata in Target <strong>Database</strong><br />

© <strong>DBAK</strong> 2010<br />

impdp userid=\'/ as sysdba\' parfile=tbs_imp.par<br />

cat tbs_imp.par<br />

directory=TBSDIR<br />

dumpfile=tbs.dmp<br />

logfile=tbsimp.log<br />

transport_datafiles=<br />

'+CDSPRD_ORADATA/CDSPRD/DATAFILE/USERINDEXES.273.7<br />

22726321',<br />

'+CDSPRD_ORADATA/CDSPRD/DATAFILE/USERINDEXES.275.7<br />

22726931',<br />

…<br />

22


XTTS - Steps<br />

Import Metadata<br />

impdp userid=\'/ as sysdba\' directory=TBSDIR<br />

dumpfile=full.dmp logfile=full.log<br />

© <strong>DBAK</strong> 2010<br />

23


XTTS - Steps<br />

• Set Tablespaces to Read/Write in Destination<br />

<strong>Database</strong><br />

• Run Post Conversion steps<br />

SHUTDOWN IMMEDIATE<br />

STARTUP UPGRADE<br />

@?/rdbms/admin/utlirp.sql<br />

@?/rdbms/admin/catupgrd<br />

@?/rdbms/admin/utlrp.sql<br />

• Restart database and validate<br />

© <strong>DBAK</strong> 2010<br />

24


XTTS – Check Self Containment<br />

• Tablespaces transported must be self-contained<br />

• Examples of object relationships that may cause<br />

containment violations:<br />

– A table and its index<br />

– An IOT and its overflow segment<br />

– Table partitions and subpartitions<br />

– A referential integrity<br />

© <strong>DBAK</strong> 2010<br />

25


XTTS – Check Self Containment<br />

for ts in<br />

(select tablespace_name<br />

from dba_tablespaces<br />

where tablespace_name not in ('SYSTEM','SYSAUX')<br />

and contents = 'PERMANENT')<br />

loop<br />

…<br />

dbms_tts.transport_set_check(checklist,TRUE,TRUE);<br />

select * from transport_set_violations;<br />

© <strong>DBAK</strong> 2010<br />

26


Transportable <strong>Database</strong> (TDB)<br />

• TDB introduced in 10gR2. It is used to automate the<br />

movement of an entire database from one platform<br />

to another.<br />

• The key is the source and the destination platforms<br />

must have the same endian format<br />

• From the Source <strong>Database</strong>, query<br />

v$db_transportable_platform. If the target platform is<br />

in the output, using TDB is supported.<br />

© <strong>DBAK</strong> 2010<br />

27


Transportable <strong>Database</strong> Process<br />

• Check prerequisites<br />

– dbms_tdb.check_external: external tables, directories or<br />

BFILES must be recreated on the target<br />

– dbms_tdb.check_db: database read-only, active or in-doubt<br />

transactions, compatibility 10 or higher, etc.<br />

• Transport the data files – Run convert database command.<br />

Convert database generates a convert script and a transport script.<br />

• Transport environment – Copy the initialization parameters (pfile<br />

or spfile), listener.ora and tnsnames.ora to the target server.<br />

• Start the target database – Start the new database on the target<br />

system. Control file and redo logs will be recreated.<br />

© <strong>DBAK</strong> 2010<br />

28


Transportable <strong>Database</strong> In a Nutshell<br />

• Datafiles containing undo information need to be<br />

reformated to fit the target platform. Use RMAN convert<br />

datafile to convert them.<br />

• Ensure datafiles are ready for conversion.<br />

• Prepare the target database as if you are doing a<br />

database clone.<br />

– Prepare pfile or spfile and password file.<br />

– Prepare listener.ora and tnsnames.ora<br />

– Recreate control file and redo logs.<br />

– Open resetlogs<br />

© <strong>DBAK</strong> 2010<br />

29


Transportable <strong>Database</strong> – Steps<br />

Step 1 -- Restore Control File, mount and rename<br />

datafiles<br />

rman>startup nomount;<br />

rman>restore controlfile from '/zdb_nfs/ATDPRD/c-<br />

162931418-20090905-01';<br />

rman>alter database mount;<br />

rman>switch database to copy;<br />

© <strong>DBAK</strong> 2010<br />

30


Transportable <strong>Database</strong> – Steps<br />

© <strong>DBAK</strong> 2010<br />

Step 2 – Create the RMAN Conversion Script<br />

Sql><br />

spool convert.rman<br />

prompt run {<br />

select 'CONVERT DATAFILE '''||f.name||''' FROM PLATFORM<br />

''Solaris[tm] OE (64-bit)'' FORMAT<br />

''+'||d.name||'_ORADATA'';'<br />

from v$dbfile f, v$database d;<br />

prompt }<br />

spool off<br />

31


Transportable <strong>Database</strong> – Steps<br />

Step 3 – Startup Nomount and run the Conversion Script<br />

from Step 2<br />

Step 4 – Create a new Control File. Get new Datafile<br />

names from ASMCMD. Open Resetlogs<br />

Step 5 – Run Post Conversion Steps<br />

– Recreate TEMP<br />

– Recompile PL/SQL Packages<br />

Step 6 – Ensure Control File and Redo Logs are moved<br />

to ASM<br />

© <strong>DBAK</strong> 2010<br />

32


Plan for downtime<br />

© <strong>DBAK</strong> 2010<br />

Full backup, Daily<br />

incremental and<br />

merge<br />

Outage<br />

Start<br />

Shutdown Convert and transfer<br />

Post steps<br />

Startup<br />

mount<br />

Plan for Downtime<br />

Incremental<br />

backup and<br />

merge<br />

<strong>Database</strong><br />

is up<br />

33


Speed it up<br />

© <strong>DBAK</strong> 2010<br />

• Block change tracking – 10g and up<br />

– CTWR backgroup process tracks changed blocks as<br />

redo is generated and writes to a binary file.<br />

– Sql>alter database enable block change tracking<br />

using file ‘+ATDPROD_DATA’;<br />

– Sql>select status, filename, bytes from<br />

v$block_change_tracking<br />

34


Speed it up<br />

• Allocate multiple channels for incremental backup<br />

• Convert in parallel<br />

RUN {<br />

CONVERT DATAFILE<br />

'/cds_mnt/cdsprd/audit_data01.dbf',<br />

'/cds_mnt/cdsprd/index_data01.dbf',<br />

...<br />

'/cds_mnt/cdsprd/user_data01.dbf',<br />

'/cds_mnt/cdsprd/user_data02.dbf'<br />

FROM PLATFORM 'Linux x86 64-bit'<br />

PARALLELISM 3<br />

DB_FILE_NAME_CONVERT '/cds_mnt/cdsprd/','+CDSPRD_ORADATA/'<br />

;}<br />

© <strong>DBAK</strong> 2010<br />

35


Speed it up<br />

• Convert datafiles of read-only tablespaces in advance<br />

• Ensure NFS mount optimization<br />

– 397194.1 How to optimize NFS Performance with NFS<br />

option<br />

© <strong>DBAK</strong> 2010<br />

36


Recap<br />

• When the source and the destination platforms are<br />

different and the endian formats are different – create<br />

a receiving database, import metadata and use RMAN<br />

convert to convert datafiles of the transported<br />

tablespaces<br />

• When the source and destination endian formats are<br />

the same – use RMAN convert to convert datafiles<br />

with undo information and recreate the control file and<br />

redo logs.<br />

© <strong>DBAK</strong> 2010<br />

37


Benefits of XTTS and TDB<br />

• Reduced complexity and errors<br />

– A high-level copy of data<br />

– It moves objects as a unit, unlike table-by-table<br />

methods that could miss objects or rows of data<br />

– No need to create or rebuild indexes<br />

• Reduced downtime<br />

© <strong>DBAK</strong> 2010<br />

38


E-Business Suite <strong>Database</strong><br />

• 454574.1 <strong>Cross</strong> <strong>Platform</strong> Transportable<br />

Tablespaces on 11i with 10gR2<br />

• 729309.1 Using Transportable <strong>Database</strong> to migrate<br />

<strong>Oracle</strong> E-Business Suite Release 11i using <strong>Oracle</strong><br />

<strong>Database</strong> 10g Release 2 or 11g Enterprise Edition<br />

• 734763.1 Using Transportable <strong>Database</strong> to<br />

migrate E-Business Suite R12 using <strong>Oracle</strong><br />

<strong>Database</strong> 10gR2 or 11g<br />

© <strong>DBAK</strong> 2010<br />

39


Contact<br />

© <strong>DBAK</strong> 2010<br />

<strong>Lucy</strong> <strong>Feng</strong><br />

lfeng@dbaknow.com<br />

www.dbaknow.com<br />

40


About <strong>DBAK</strong><br />

• <strong>Oracle</strong> solution provider<br />

• Co-founded in 2005<br />

• Based in Englewood, CO<br />

• 2008 “Emerging Business of the Year” – South Metro<br />

Denver Chamber of Commerce<br />

• More than 130 implementations, upgrades,<br />

conversions, and support projects for 80+ clients<br />

• Average 15 years of <strong>Oracle</strong> expertise<br />

• <strong>Oracle</strong> Gold Partner<br />

© <strong>DBAK</strong> 2010<br />

41

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!