Thursday, July 4, 2013

Steps for Moving the Oracle 12c OEM Repository Database to another Database server


Below are the steps for moving the OEM repository database to another server and the same is tested in UAT environment  successfully without any issues(without db upgrade).
  1. Shut down the OMS
  2. Create a backup of the database
  3. Transfer the backup to the destination host
  4. Restore database and upgrade to 11.2.0.3
  5. Update OEM configuration
  6. Start OMS
My new database host is called nalxorrbcp03.

 1.Shut down the OMS
Login in navxorxxnp01.ascorp.com server and run the below command.
/u01/app/oracle/cloud_middleware/oms/bin/emctl status oms
/u01/app/oracle/cloud_middleware/oms/bin/emctl stop oms
2.Create a backup of the database
 [oracle@nolxorrrcp05 ~]$ rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on Mon Oct 17 14:54:33 2011

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: OPDBREP (DBID=3987577832, not open)

RMAN> run {
allocate channel c1 device type disk format '/u03/oradata/backup/opdbrep/%U';
backup as compressed backupset database;
backup current controlfile;
}
2> 3> 4> 5>
using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=248 instance=emrep1 device type=DISK

Starting backup at 10-JAN-13
channel c1: starting compressed full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00007 name=+DATA01P/opdbrep/datafile/mgmt_tablespace.269.764589287
input datafile file number=00001 name=+DATA01P/opdbrep/datafile/system.256.764546085
input datafile file number=00002 name=+DATA01P/opdbrep/datafile/sysaux.257.764546087
input datafile file number=00005 name=+DATA01P/opdbrep/datafile/undotbs2.264.764546211
input datafile file number=00008 name=+DATA01P/opdbrep/datafile/mgmt_ad4j_ts.270.764589289
input datafile file number=00003 name=+DATA01P/opdbrep/datafile/undotbs1.258.764546089
input datafile file number=00006 name=+DATA01P/opdbrep/datafile/mgmt_ecm_depot_ts.268.764589285
input datafile file number=00004 name=+DATA01P/opdbrep/datafile/users.259.764546089
channel c1: starting piece 1 at 10-JAN-13
channel c1: finished piece 1 at 10-JAN-13
piece handle=/u03/oradata/backup/opdbrep/02mpb7hn_1_1 tag=TAG20111017T145446 comment=NONE
channel c1: backup set complete, elapsed time: 00:01:35
Finished backup at 10-JAN-13

Starting backup at 10-JAN-13
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
including current control file in backup set
channel c1: starting piece 1 at 10-JAN-13
channel c1: finished piece 1 at 10-JAN-13
piece handle=/u03/oradata/backup/opdbrep/03mpb7km_1_1 tag=TAG20111017T145622 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:03
Finished backup at 10-JAN-13

Starting Control File and SPFILE Autobackup at 10-JAN-13
piece handle=/u03/oradata/backup/opdbrep/c-3987577832-20111017-00 comment=NONE
Finished Control File and SPFILE Autobackup at 10-JAN-13
released channel: c1

RMAN> exit
That takes care of almost everything. Since I’m lazy I also used SQL plus to create a backup of the controlfile as well as a textual representation of the spfile:
SQL> alter database backup controlfile to '/u03/oradata/backup/opdbrep/controlfile';

Database altered.

SQL> create pfile='/u03/oradata/backup/opdbrep/pfile' from spfile;

File created 

3.Transfer the backup to the destination host
Transfer the backup to destination host i.e. nalxorrbcp03 using scp unix command.
4. Transfer Restore the database and upgrade to 11.2.0.3
With that done, and all required directories created, it’s time to start the new database instance in “nomount mode” and fire up an RMAN session. I exported my ORACLE_SID to opdbrep1.
[oracle@opdbrep dbs]$ rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on Mon Oct 17 15:02:09 2011

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: OPDBREP (not mounted)

RMAN> restore controlfile from '/u03/oradata/backup/opdbrep/controlfile';

Starting restore at 10-JAN-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=246 device type=DISK
channel ORA_DISK_1: copied control file copy
output file name=/u01/oradata/EMREP/controlfile/o1_mf_79rfcgh8_.ctl
Finished restore at 10-JAN-13

RMAN> alter database mount;

 database mounted
released channel: ORA_DISK_1

 RMAN> restore database ;
Starting restore at 10-JAN-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=246 device type=DISK
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to +DATA01P/emrep/datafile/system.256.764546085
channel ORA_DISK_1: restoring datafile 00002 to +DATA01P/emrep/datafile/sysaux.257.764546087
channel ORA_DISK_1: restoring datafile 00003 to +DATA01P/emrep/datafile/undotbs1.258.764546089
channel ORA_DISK_1: restoring datafile 00004 to +DATA01P/emrep/datafile/users.259.764546089
channel ORA_DISK_1: restoring datafile 00005 to +DATA01P/emrep/datafile/undotbs2.264.764546211
channel ORA_DISK_1: restoring datafile 00006 to +DATA01P/emrep/datafile/mgmt_ecm_depot_ts.268.764589285
channel ORA_DISK_1: restoring datafile 00007 to +DATA01P/emrep/datafile/mgmt_tablespace.269.764589287
channel ORA_DISK_1: restoring datafile 00008 to +DATA01P/emrep/datafile/mgmt_ad4j_ts.270.764589289
channel ORA_DISK_1: reading from backup piece /u03/oradata/backup/opdbrep/02mpb7hn_1_1
channel ORA_DISK_1: piece handle=/u03/oradata/backup/opdbrep/02mpb7hn_1_1 tag=TAG20111017T145446
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:01:25
Finished restore at 10-JAN-13

RMAN> alter database open;
database opened

RMAN> exit

This is pretty straight forward and should be familiar to every database administrator:
  1. Restore the controlfile from the backup created earlier
  2. Mount the database
  3. Restore the database
  4. Open the database resetlogs (if nessasary)
  Upgrade the database.
Note:
Update the database to 11.2.0.3 as per the upgrade steps.

5.Update the OEM configuration
Now it’s time to update the OMS configuration. This operation is vi-less, the configuration is now viewed and modified via emctl (since Grid Control 12.1):
Login in navxorxxnp01.ascorp.com server and run the below command.
[/home/oracle:oracle@navxorxxnp01] /u01/app/oracle/cloud_middleware/oms/bin/emctl config oms -list_repos_details
Oracle Enterprise Manager Cloud Control 12c Release 12.1.0.1.0
Copyright (c) 1996, 2011 Oracle Corporation.  All rights reserved.
Repository Connect Descriptor : (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.20.3.113)(PORT=1527)))(LOAD_BALANCE=ON)(CONNECT_DATA=(SERVICE_NAME=opdbrep)))
Repository User : SYSMAN
The next command updates the configuration. Keep the warning in mind: if you have multiple management servers you need to run this command on each.
[/home/oracle:oracle@navxorxxnp01] /u01/app/oracle/cloud_middleware/oms/bin/emctl config oms -store_repos_details -repos_port 1531 -repos_sid opdbrep -repos_host nalxorrbcp03-vip.ascorp.com -repos_user SYSMAN -repos_pwd Oemgc2011
Oracle Enterprise Manager Cloud Control 12c Release 12.1.0.1.0
Copyright (c) 1996, 2011 Oracle Corporation.  All rights reserved.
Successfully updated datasources and stored repository details in Credential Store.
If there are multiple OMSs in this environment, run this store_repos_details command on all of them.
And finally, restart all the OMSs using 'emctl stop oms -all' and 'emctl start oms'.

6.Start the OMS
[/home/oracle:oracle@navxorxxnp01] /u01/app/oracle/cloud_middleware/oms/bin/emctl emctl start oms
Oracle Enterprise Manager Cloud Control 12c Release 12.1.0.1.0
Copyright (c) 1996, 2011 Oracle Corporation.  All rights reserved.
Starting WebTier...
WebTier Successfully Started
Starting Oracle Management Server...
Oracle Management Server Successfully Started
Oracle Management Server is Up
[oracle@oem12oms ~]$
 ---------------------------------------------------------------------------------------------------------------
Login to OEM and check for monitoring targets. If Management Services and Repository is down then we have to update configuration with new connection string as mentioned below steps.
https://navxorxxnu01.ascorp.com:7799/em/adf/images/t.gif
 

Login to OEM with sysman and click setup --> Management Services and Repository.


  Next click on OMS and Repository --> Target Setup --> Monitoring Configuration
  

 Update the selected part with below connection string entry and click ok.

(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST= nalxorrbcp03-vip.ascorp.com)(PORT=1531)))(CONNECT_DATA=(SID=opdbrep)))

  Click ok.
 

If services are not showing as up then refresh the page with refresh symbol.

1 comment:

  1. Hi ,

    THis means new host should be up.
    Cant we use same steps if we are planning to decommission the source host

    ReplyDelete