Top Banner
Delivering Oracle Success Oracle Database Cross Platform Migration Lucy Feng, DBAK RMOUG QEW November 19, 2010
41

Cross%20Platform%20Database%20Migration

Oct 14, 2014

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Cross%20Platform%20Database%20Migration

Delivering Oracle Success

Oracle Database Cross Platform Migration

Lucy Feng, DBAK

RMOUG QEWNovember 19, 2010

Page 2: Cross%20Platform%20Database%20Migration

© DBAK 2010 2

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

Page 3: Cross%20Platform%20Database%20Migration

© DBAK 2010 3

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

Page 4: Cross%20Platform%20Database%20Migration

© DBAK 2010 4

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

Page 5: Cross%20Platform%20Database%20Migration

© DBAK 2010 5

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

Page 6: Cross%20Platform%20Database%20Migration

© DBAK 2010 6

How XTTS Works

Page 7: Cross%20Platform%20Database%20Migration

© DBAK 2010 7

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 andV$TRANSPORTABLE_PLATFORM

• RMAN Convert performs endian conversion

Page 8: Cross%20Platform%20Database%20Migration

© DBAK 2010 8

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

Page 9: Cross%20Platform%20Database%20Migration

© DBAK 2010 9

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

Page 10: Cross%20Platform%20Database%20Migration

© DBAK 2010 10

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.

Page 11: Cross%20Platform%20Database%20Migration

© DBAK 2010 11

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';

Page 12: Cross%20Platform%20Database%20Migration

© DBAK 2010 12

How XTTS Works

Page 13: Cross%20Platform%20Database%20Migration

© DBAK 2010 13

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.

Page 14: Cross%20Platform%20Database%20Migration

© DBAK 2010 14

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;}

Page 15: Cross%20Platform%20Database%20Migration

© DBAK 2010 15

Servers and data movement

Source server NFS server Target server

Data store

Data store

Gigabit connection

Hypersocket

NFS

Rmanconvert

NFS

Page 16: Cross%20Platform%20Database%20Migration

© DBAK 2010 16

XTTS - PreparationCreate the Destination Database

STARTUP NOMOUNTCREATE DATABASE "CDSPRD"LOGFILEGROUP 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 20001mUNDO TABLESPACE UNDO DATAFILE '+CDSPRD_ORADATA' SIZE 501m autoextend on next

50m maxsize 20001mDEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '+CDSPRD_ORADATA' SIZE 501m

autoextend on next 50m maxsize 20001mMAXLOGFILES 20MAXLOGMEMBERS 5MAXDATAFILES 1000MAXINSTANCES 5MAXLOGHISTORY 2696

CHARACTER SET WE8ISO8859P1;

Page 17: Cross%20Platform%20Database%20Migration

© DBAK 2010 17

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.plbconnect system/manager@@$ORACLE_HOME/rdbms/admin/catdbsyn.sql@@$ORACLE_HOME/sqlplus/admin/pupbld.sqlselect comp_name,version,status from dba_registry;

Page 18: Cross%20Platform%20Database%20Migration

© DBAK 2010 18

XTTS – PreparationGenerate the Conversion ScriptRun from the source database

spool convert.rmanprompt run {select 'CONVERT DATAFILE '''||file_name||''' FROM

PLATFORM ''Linux x86 64-bit'' FORMAT ''+CDSPRD_ORADATA'';'

from dba_tablespaces a, dba_data_files bwhere a.tablespace_name = b.tablespace_nameand a.tablespace_name not in ('SYSTEM','SYSAUX')and contents = 'PERMANENT';prompt }spool off

Page 19: Cross%20Platform%20Database%20Migration

© DBAK 2010 19

XTTS - Preparation

Generate User Creation Script From Source and Run in Target

spool gen_cre_user.sqlselect 'create user '||username||' identified by values

'''||password||''';'from dba_users;spool off

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

Page 20: Cross%20Platform%20Database%20Migration

© DBAK 2010 20

XTTS - Steps

Convert to Read Only

spool tts_ro.sqlselect 'ALTER TABLESPACE '||tablespace_name||' READ

ONLY;'from dba_tablespaceswhere tablespace_name not in ('SYSTEM','SYSAUX')and contents = 'PERMANENT';spool offset heading on feedback on@tts_ro

Page 21: Cross%20Platform%20Database%20Migration

© DBAK 2010 21

XTTS - StepsExport Metadata from the Source Database

expdp userid=\'/ as sysdba\' parfile=tbs_exp.parcat tbs_exp.pardirectory=TBSDIRdumpfile=tbs.dmplogfile=tbsexp.logtransport_full_check=notransport_tablespaces=USERDATA,USERINDEXES,USERS

expdp userid=\'/ as sysdba\' directory=TBSDIR \dumpfile=full.dmp logfile=full.log \content=metadata_only full=y

Page 22: Cross%20Platform%20Database%20Migration

© DBAK 2010 22

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.pardirectory=TBSDIRdumpfile=tbs.dmplogfile=tbsimp.logtransport_datafiles='+CDSPRD_ORADATA/CDSPRD/DATAFILE/USERINDEXES.273.7

22726321','+CDSPRD_ORADATA/CDSPRD/DATAFILE/USERINDEXES.275.7

22726931',…

Page 23: Cross%20Platform%20Database%20Migration

© DBAK 2010 23

XTTS - Steps

Import Metadataimpdp userid=\'/ as sysdba\' directory=TBSDIR dumpfile=full.dmp logfile=full.log

Page 24: Cross%20Platform%20Database%20Migration

© DBAK 2010 24

XTTS - Steps

• Set Tablespaces to Read/Write in Destination Database

• Run Post Conversion stepsSHUTDOWN IMMEDIATESTARTUP UPGRADE@?/rdbms/admin/utlirp.sql@?/rdbms/admin/catupgrd@?/rdbms/admin/utlrp.sql

• Restart database and validate

Page 25: Cross%20Platform%20Database%20Migration

© DBAK 2010 25

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

Page 26: Cross%20Platform%20Database%20Migration

© DBAK 2010 26

XTTS – Check Self Containment

for ts in(select tablespace_namefrom dba_tablespaceswhere tablespace_name not in ('SYSTEM','SYSAUX')and contents = 'PERMANENT')loop…dbms_tts.transport_set_check(checklist,TRUE,TRUE);

select * from transport_set_violations;

Page 27: Cross%20Platform%20Database%20Migration

© DBAK 2010 27

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.

Page 28: Cross%20Platform%20Database%20Migration

© DBAK 2010 28

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.

Page 29: Cross%20Platform%20Database%20Migration

© DBAK 2010 29

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

Page 30: Cross%20Platform%20Database%20Migration

© DBAK 2010 30

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;

Page 31: Cross%20Platform%20Database%20Migration

© DBAK 2010 31

Transportable Database – Steps

Step 2 – Create the RMAN Conversion Script

Sql>spool convert.rmanprompt 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

Page 32: Cross%20Platform%20Database%20Migration

© DBAK 2010 32

Transportable Database – Steps

Step 3 – Startup Nomount and run the Conversion Script from Step 2

Step 4 – Create a new Control File. Get new Datafilenames 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

Page 33: Cross%20Platform%20Database%20Migration

© DBAK 2010 33

Plan for downtime

Shutdown Post stepsFull backup, Daily incremental and

mergeStartup mount

Incremental backup and

merge

Convert and transfer

Database is up

Outage Start

Plan for Downtime

Page 34: Cross%20Platform%20Database%20Migration

© DBAK 2010 34

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

Page 35: Cross%20Platform%20Database%20Migration

© DBAK 2010 35

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 3DB_FILE_NAME_CONVERT '/cds_mnt/cdsprd/','+CDSPRD_ORADATA/';}

Page 36: Cross%20Platform%20Database%20Migration

© DBAK 2010 36

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

Page 37: Cross%20Platform%20Database%20Migration

© DBAK 2010 37

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 datafileswith undo information and recreate the control file and redo logs.

Page 38: Cross%20Platform%20Database%20Migration

© DBAK 2010 38

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

Page 39: Cross%20Platform%20Database%20Migration

© DBAK 2010 39

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

Page 40: Cross%20Platform%20Database%20Migration

© DBAK 2010 40

Contact

Lucy [email protected]

www.dbaknow.com

Page 41: Cross%20Platform%20Database%20Migration

© DBAK 2010 41

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