Cross Platform Enterprise Manager Repository Migration

There are user requirements for migrating an Enterprise Manager repository across servers - same and cross platforms.

The Enterprise Manager repository migration process is not exactly the same as database migration. In the case of Enterprise Manager Repository migration you must take care of Enterprise Manager specific data, options, and pre-requisites for the repository move. You should make sure data integrity is maintained from both the Enterprise Manager and Oracle database perspective.

This raises the need for defining the process that can be followed by end users for successful and reliable migration of repository in minimum time and with maximum efficiency.

The overall strategy for migration depends on:

  • The source and target database version

  • The amount of data/size of repository

  • Actual data to migrate [selective/full migration]

If the source and target is not on release 12c then export/import is the only way to get the data migrated cross platform.

More details on cross platform transportable tablespace, data pump, and export/import options can be found at the Oracle Technology Network (OTN) or in the Oracle Database Administrator's Guide.

Common Prerequisites

The following lists the common prerequisites for a repository migration:

  • Source and target database must use the same character set and should be at same version.

  • The source and target database platform must be at the same endian format.

  • The target database should meet all the pre-requisites for the Enterprise Manager Repository software requirements mentioned in the Oracle Enterprise Manager Installation Guide.

  • If the source and target database are on release 10gR2 and higher rdbms versions, and provided they are meeting other prerequisites, cross platform transportable database migration can be used for cross platform repository migration.

  • You cannot transport a tablespace to a target database in which a tablespace with the same name already exists. However, you can rename either the tablespace to be transported or the destination tablespace before the transport operation.

  • To plug a transportable tablespace set into an Oracle Database on a different platform, both databases must have compatibility set to at least Release 10.0.

  • Most of the platforms (but not all) are supported for cross-platform tablespace transport. You can query the V$TRANSPORTABLE_PLATFORM view to see the platforms that are supported, and to determine their platform IDs and their endian format (byte ordering).

  • Source and Destination host should have Enterprise Manager Management Agent running and configured to the instance which is to be migrated.

  • If the target database has an Enterprise Manager repository installed, it should be first dropped using RepManager before target database related steps are carried out.

Methodologies

The following sections discuss two methodologies for a repository migration:

Using Cross Platform Transportable Database

Oracle's transportable database feature allows users to quickly move a user tablespace across Oracle databases. It is the most efficient way to move bulk data between databases. With the cross platform transportable database, you can transport tablespaces across platforms.

Cross platform transportable database allows a database to be migrated from one platform to another (use with Data Pump or Import/Export). The following set of steps for migration using Transportable Database can be used for migrations between same-endian platforms:

  1. Verify whether migration is possible on the destination platform from v$db_transportable_platform.

    SQL> select platform_name from v$db_transportable_platform;

    You may see a list of platforms similar to the list below:

    Microsoft Windows IA (32-bit)
    Linux IA (32-bit)
    HP Tru64 UNIX
    Linux IA (64-bit)
    HP Open VMS
    Microsoft Windows IA (64-bit)
    Linux x86 64-bit
    Microsoft Windows x86 64-bit
    Solaris Operating System (x86)
    HP IA Open VMS
    Solaris Operating System (x86-64)
    
  2. Verify that the external tables and files exist in the database.
    SQL> set serveroutput on
    SQL> declare x boolean;
      2  begin x := dbms_tdb.check_external;
      3  end;
      4  /

    The following output results:

    The following external tables exist in the database:
    SH.SALES_TRANSACTIONS_EXT
    The following directories exist in the database:
    SYS.SUBDIR, SYS.SS_OE_XMLDIR, SYS.MEDIA_DIR, SYS.LOG_FILE_DIR,
    SYS.DATA_FILE_DIR, SYS.XMLDIR, SYS.DATA_PUMP_DIR, SYS.ORACLE_OCM_CONFIG_DIR
    The following BFILEs exist in the database:
    PM.PRINT_MEDIA
    

    Enter the following command:

    SQL> select directory_path from dba_directories;

    The following output results:

    DIRECTORY_PATH
    --------------------------------------------------------------------------------
    /home/oracle/app/oracle/product/11.2.0/dbhome_1/demo/schema/order_entry//2002/Sep
    /home/oracle/app/oracle/product/11.2.0/dbhome_1/demo/schema/order_entry/
    /home/oracle/app/oracle/product/11.2.0/dbhome_1/demo/schema/log/
    /home/oracle/app/oracle/product/11.2.0/dbhome_1/demo/schema/sales_history/
    /ade/b/1191423112/oracle/rdbms/xml
    /home/oracle/app/oracle/product/11.2.0/dbhome_1/demo/schema/product_media/
    /home/oracle/app/oracle/admin/orcl/dpdump/
    /home/oracle/app/oracle/product/11.2.0/dbhome_1/ccr/state
     
    8 rows selected.
    

    Enter the following command:

    SQL> select directory_path||'/'||location External_file_path from dba_directories a, dba_external_locations b where a.directory_name=b.directory_name;

    The following output results:

    EXTERNAL_FILE_PATH
    ----------------------------------------------------------------------------
    /home/oracle/app/oracle/product/11.2.0/dbhome_1/demo/schema/sales_history//sale1v3.dat
    

    Enter the following command:

    SQL> @tgt_get_bfile_dirs.sql

    The following output results:

    The following directories contain external files for BFILE columns
    Copy the files within these directories to the same path on the target system
     
    /home/oracle/app/oracle/product/11.2.0/dbhome_1/demo/schema/product_media/
     
    There are 1 directories, 4 total BFILEs
     
    SQL> @tgt_get_bfiles.sql
    External files for BFILE column AD_GRAPHIC in table PM.PRINT_MEDIA
    /home/oracle/app/oracle/product/11.2.0/dbhome_1/demo/schema/product_media//monitor.jpg
    /home/oracle/app/oracle/product/11.2.0/dbhome_1/demo/schema/product_media//mousepad.jpg
    /home/oracle/app/oracle/product/11.2.0/dbhome_1/demo/schema/product_media//keyboard.jpg
    /home/oracle/app/oracle/product/11.2.0/dbhome_1/demo/schema/product_media//modem.jpg
  3. Stop the OMS.

    emctl stop oms -all

    Enter the following SQL commands:

    SQL> shutdown immediate
    Database closed.
    Database dismounted.
    ORACLE instance shut down.
     
    SQL> startup mount;
    ORACLE instance started.
     
    Total System Global Area 1473089536 bytes
    Fixed Size                  1336596 bytes
    Variable Size            1124076268 bytes
    Database Buffers          335544320 bytes
    Redo Buffers               12132352 bytes
    Database mounted.
    
  4. Open the database in read-only mode.

    SQL> alter database open read only;

    Enter the following SQL commands:

    SQL> set serveroutput on
    SQL> declare
      2  retcode boolean;
      3  begin
      4  retcode := dbms_tdb.check_db('Linux IA (64-bit)',dbms_tdb.skip_none);
      5  end;
      6  /
     
    SQL> declare
      2  retcode boolean;
      3  begin
      4  retcode := dbms_tdb.check_db('Linux x86 64-bit',dbms_tdb.skip_none);
      5  end;
      6  /
     
    PL/SQL procedure successfully completed.
    
  5. Generate the RMAN conversion script.
    [oracle]$ ./rman
    Recovery Manager: Release 11.2.0.1.0 - Production on Fri dd-mm-yy 12:10:29 2012
    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
    RMAN> connect target /
    connected to target database: ORCL (DBID=1308105793)
    RMAN> convert database on target platform
    2> convert script '/tmp/convert_mydb.rman'
    3> transport script '/tmp/transport_mydb.sql'
    4> new database 'mydb'
    5> format '/tmp/mydb%U'
    6> db_file_name_convert '/home/oracle/app/oracle/oradata/mydb/','/tmp';
     
    Starting conversion at source at dd-mm-yy
    using target database control file instead of recovery catalog
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: SID=135 device type=DISK
     
    External table SH.SALES_TRANSACTIONS_EXT found in the database
     
    Directory SYS.SUBDIR found in the database
    Directory SYS.SS_OE_XMLDIR found in the database
    Directory SYS.MEDIA_DIR found in the database
    Directory SYS.LOG_FILE_DIR found in the database
    Directory SYS.DATA_FILE_DIR found in the database
    Directory SYS.XMLDIR found in the database
    Directory SYS.DATA_PUMP_DIR found in the database
    Directory SYS.ORACLE_OCM_CONFIG_DIR found in the database
     
    BFILE PM.PRINT_MEDIA found in the database
     
    User SYS with SYSDBA and SYSOPER privilege found in password file
    channel ORA_DISK_1: starting to check datafiles
    input datafile file number=00001 name=/home/oracle/app/oracle/oradata/orcl/system01.dbf
    channel ORA_DISK_1: datafile checking complete, elapsed time: 00:00:00
    channel ORA_DISK_1: starting to check datafiles
    input datafile file number=00002 name=/home/oracle/app/oracle/oradata/orcl/sysaux01.dbf
    channel ORA_DISK_1: datafile checking complete, elapsed time: 00:00:00
    channel ORA_DISK_1: starting to check datafiles
    input datafile file number=00007 name=/home/oracle/app/oracle/oradata/orcl/mgmt.dbf
    channel ORA_DISK_1: datafile checking complete, elapsed time: 00:00:00
    channel ORA_DISK_1: starting to check datafiles
    input datafile file number=00003 name=/home/oracle/app/oracle/oradata/orcl/undotbs01.dbf
    channel ORA_DISK_1: datafile checking complete, elapsed time: 00:00:00
    channel ORA_DISK_1: starting to check datafiles
    input datafile file number=00008 name=/home/oracle/app/oracle/oradata/orcl/mgmt_ad4j.dbf
    channel ORA_DISK_1: datafile checking complete, elapsed time: 00:00:00
    channel ORA_DISK_1: starting to check datafiles
    input datafile file number=00005 name=/home/oracle/app/oracle/oradata/orcl/example01.dbf
    channel ORA_DISK_1: datafile checking complete, elapsed time: 00:00:00
    channel ORA_DISK_1: starting to check datafiles
    input datafile file number=00006 name=/home/oracle/app/oracle/oradata/orcl/mgmt_depot.dbf
    channel ORA_DISK_1: datafile checking complete, elapsed time: 00:00:00
    channel ORA_DISK_1: starting to check datafiles
    input datafile file number=00004 name=/home/oracle/app/oracle/oradata/orcl/users01.dbf
    channel ORA_DISK_1: datafile checking complete, elapsed time: 00:00:00
    Edit init.ora file /tmp/init_mydb00nbs6dl_1_0.ora. This PFILE will be used to create the database on the target platform
    Run RMAN script /tmp/convert_mydb.rman on target platform to convert datafiles
    Run SQL script /tmp/transport_mydb.sql on the target platform to create database
    To recompile all PL/SQL modules, run utlirp.sql and utlrp.sql on the target platform
    To change the internal database identifier, use DBNEWID Utility
    Finished conversion at source at dd-mm-yy
    
  6. Copy all the required files to a temporary location and mount on the target machine.
    convert_mydb.rman
    init_mydb.ora
    transport_mydb.sql (and other data files listed in rman script [convert_mydb.rman] and redolog files)
    
  7. Execute the scripts generated in Step 5 on the target machine.

    The RMAN script contains convert datafile commands. The SQL script contains control file creation, invalidating objects, and recompiling objects. On the target machine, execute the following:

    RMAN> connect target /

    RMAN> @/home/oracle/migrate/convert_mydb.rman

  8. Ensure the database is up and running and the database is registered with the listener.

    RMAN> STARTUP NOMOUNT PFILE = '/home/oracle/migrate/init_mydb00nbs6dl_1_0.ora'; database is already started

  9. Start the OMS to ensure the admin server is up.

    [oracle]$ ./emctl status oms

    [oracle]$ ./emctl start oms

  10. Stop the OMS.

    [oracle]$ ./emctl stop oms

  11. Update repository database connection details.

    [oracle]$ ./emctl config oms -store_repos_details -repos_conndesc "(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=myhost.myco.com)(PORT=1521)))(CONNECT_DATA=(SID=mydb)))" -repos_user SYSMAN -repos_pwd Oracle123

    If there are multiple Oracle Management Services in this environment, run this store_repos_details command on all of them.

  12. Restart the OMS.

    [oracle]$ ./emctl start oms

    [oracle]$ ./emctl status oms

    Oracle Enterprise Manager Cloud Control 12c Release 12.1.0.4.0
    Copyright (c) 1996, 2013 Oracle Corporation.  All rights reserved.
    WebTier is Up
    Oracle Management Server is Up
    
  13. Relocate Management Services and the Repository target.

Migration Using Physical Standby

The following steps describe the process you can use to migrate a repository using Physical Standby. This method can be used when the source and target platforms are supported. See My Oracle Support Note:413484.1 for details of which platform combinations are supported.

  1. Install the database ORACLE_HOME on the target machine. The binaries should be the same version as the source.

    If the target machine is Windows, install and configure CYGWIN on the Windows box for Management Agent deployment.

  2. Deploy the Management Agent to the target server.
  3. Create a Physical Standby as described in the Data Guard documentation.
  4. Configure the Data Guard broker as described in the Data Guard Broker documentation.
  5. Shutdown the OMS.

    emctl stop oms -all

  6. Check the OMS connect descriptor.

    ./emctl config oms -list_repos_details

  7. Switchover the database using dgmgrl.

    Use the following commands:

    DGMGRL> switchover to target_db
    verify
    show configuration
    show database target_db
    show database source_db
    
  8. Start the OMS admin server.

    emctl start oms -admin_only

  9. Update connect descriptor to point to the Standby Database.

    eemctl config oms -store_repos_details -repos_conndesc "(DESC= )" -repos_user sysman

    [oracle]$ ./emctl config oms -store_repos_details -repos_conndesc "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=sample2.mycompany.com)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=test_win)))" -repos_user sysman
        Oracle Enterprise Manager Cloud Control 12c Release 12.1.0.4.0
        Copyright (c) 1996, 2013 Oracle Corporation. All rights reserved.
        Enter Repository User's Password :
        Successfully updated datasources and stored repository details in Credential Store.
    

    If there are multiple Oracle Management Services in this environment, run this store_repos_details command on all of them.

  10. Stop all the Oracle Management Services.

    emctl stop oms -all

  11. Start the OMS.

    emctl start oms

  12. Relocate Oracle Management Services and the Repository.

    emctl config emrep -conn_desc

    [oracle]$ ./emctl config emrep -conn_desc "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=sample2.mycompany)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=test_win)))"
    Oracle Enterprise Manager Cloud Control 12c Release 12.1.0.4.0
    Copyright (c) 1996, 2013 Oracle Corporation. All rights reserved.
    Please enter repository password:
    Enter password :
    Login successful
    Moved all targets from sample.mycompany.com:3872 to sample2.mycompany.com:3872
    Command completed successfully!
    Enter password :
    Login successful
    Moved all targets from sample.mycompany.com:3872 to sample2.mycompany.com:3872
    Command completed successfully!
    
  13. Create a backup of the OMS (on the OMS where the Admin server is running).

    $ <ORACLE_HOME>/bin/emctl exportconfig oms [-sysman_pwd <sysman password>]

    Specify the directory in which to store backup file

    [-dir <backup dir>]

    Specify the following parameter if the OMS was installed using a virtual hostname (using ORACLE_HOSTNAME=<virtual_hostname>)

    [-keep_host]

Post Migration Verification

These verification steps should be carried out post migration to ensure that the migration was completely successful:

  • Verify any discrepancy in objects by comparing source and target databases through Enterprise Manager.

  • Verify the migrated database through Enterprise Manager to determine whether the database is running without any issues.

  • Verify the repository operations, dbms jobs and whether any management system errors are reported.

  • Verify that all Enterprise Manager functionalities are working correctly after the migration.

  • Make sure Management Services and the Repository target is properly relocated by verifying it through Enterprise Manager.