Friday, June 14, 2013

Using Rman to Migrate database from windows(11.2.0.1) to linux(11.2.0.3)


1 Verify following information on Winodow platform:

SQL> select * from v$version;
SQL> select platform_id, platform_name from v$database;
SQL> show parameter compatible;
SQL> select name from v$datafile;
SQL>  select name from v$controlfile;
SQL> select member from v$logfile;

2 Check platform compatibility between source and target OS(Make sure ENDIAN_FORMAT are same):

SQL> col platform_name format a40
SQL> select * from v$transportable_platform where platform_name = 'Linux x86 64-bit' or platform_name = 'Microsoft Windows x86 64-bit' order by 2;

PLATFORM_ID PLATFORM_NAME                            ENDIAN_FORMAT
----------- ---------------------------------------- --------------
         13 Linux x86 64-bit                         Little
         12 Microsoft Windows x86 64-bit             Little

3 Start the source database in read only mode:

SQL> shutdown immediate;
SQL> startup mount;
SQL> alter database open read only;

4. Check database readiness for transport from Windows to Linux:

SQL> set serveroutput on
SQL> declare
  2  db_ready boolean;
  3  begin
  4  db_ready := dbms_tdb.check_db('Linux x86 64-bit');
  5  end;
  6  /

5. Check if there are any external objects:

PL/SQL procedure successfully completed.

SQL>
SQL> set serveroutput on
SQL> declare
  2  external boolean;
  3  begin
  4  external := dbms_tdb.check_external;
  5  end;
  6  /
The following external tables exist in the database:
SH.SALES_TRANSACTIONS_EXT
The following directories exist in the database:
SYS.ORACLE_OCM_CONFIG_DIR, SYS.DATA_PUMP_DIR, SYS.XMLDIR, SYS.DATA_FILE_DIR,
SYS.LOG_FILE_DIR, SYS.MEDIA_DIR, SYS.SS_OE_XMLDIR, SYS.SUBDIR
The following BFILEs exist in the database:
PM.PRINT_MEDIA

PL/SQL procedure successfully completed.

6. Create a directory(make sure have enough space)  and save the pfile there

Mkdir C:\to_linux

SQL> create pfile='c:\to_linux\initLINXORCL.ora' from spfile;

7. Use rman convert database command:
rman target /

RMAN> CONVERT DATABASE NEW DATABASE 'LINXORCL'
2> transport script 'C:\to_linux\script.sql'
3> to platform 'Linux x86 64-bit'
4> db_file_name_convert 'C:\APP\YCHEN\ORADATA\WINORCL\' 'C:\to_linux\';

File created

8. Transfer C:\to_linux to your target system and create directory for target database


9. Modify the pfile(initLINXORCL and script.sql to reflect the correct structure in target system.

10. Don't run script.sql directly manaully execute following commands from script.sql and upgrade to 11.2.0.3

STARTUP NOMOUNT PFILE='/u01/app/oracle/admin/LINXORCL/initLINXORCL.ora'
CREATE spfile from pfile='/u01/app/oracle/admin/LINXORCL/initLINXORCL.ora';

CREATE CONTROLFILE REUSE SET DATABASE "LINXORCL" RESETLOGS  NOARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 '/u01/app/oracle/admin/LINXORCL/REDO/REDO01.LOG'  SIZE 50M BLOCKSIZE 512,
  GROUP 2 '/u01/app/oracle/admin/LINXORCL/REDO/REDO02.LOG'  SIZE 50M BLOCKSIZE 512,
  GROUP 3 '/u01/app/oracle/admin/LINXORCL/REDO/REDO03.LOG'  SIZE 50M BLOCKSIZE 512
DATAFILE
  '/u01/app/oracle/admin/LINXORCL/DATA/SYSTEM01.DBF',
  '/u01/app/oracle/admin/LINXORCL/DATA/SYSAUX01.DBF',
  '/u01/app/oracle/admin/LINXORCL/DATA/UNDOTBS01.DBF',
  '/u01/app/oracle/admin/LINXORCL/DATA/USERS01.DBF',
  '/u01/app/oracle/admin/LINXORCL/DATA/EXAMPLE01.DBF'
CHARACTER SET WE8MSWIN1252
;
ALTER DATABASE OPEN RESETLOGS UPGRADE; (make sure to open database in upgrade mode)

ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/admin/LINXORCL/DATA/TEMP01.DBF'
     SIZE 20971520  AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;

SHUTDOWN IMMEDIATE 
STARTUP UPGRADE

@catupgrd.sql

SQL> STARTUP

SQL> @utlu112s.sql

SQL> @catuppst.sql

SQL> @utlrp.sql

Verify that all expected packages and classes are valid:

SQL> SELECT count(*) FROM dba_invalid_objects;
SQL> SELECT distinct object_name FROM dba_invalid_objects;


No comments:

Post a Comment