Rename/Upgrade and Relocate EM 12C R3 repository Database

Last week i need to upgrade one of our database, a database for our EM 12C R3.
currently database is running on the same server as EM. and its name is TEST01 🙂

Current :
DB NAME : TEST01
Version : 11.1.0.7.15
Server : prodoem12c
Target :
DB NAME : POEMC
Version : 11.2.0.3.7
Server : lnx00xyz-poemc (its a VCS clustered server)


1. Stop OMS

prodoem12c: TEST01> $OMS_HOME/bin/emctl stop oms -all
Oracle Enterprise Manager Cloud Control 12c Release 3
Copyright (c) 1996, 2013 Oracle Corporation.  All rights reserved.
Stopping WebTier...
WebTier Successfully Stopped
Stopping Oracle Management Server...
Oracle Management Server Already Stopped
AdminServer Successfully Stopped
Oracle Management Server is Down
prodoem12c: TEST01>

2. Check all the location of DB files before shutting down the database

Tablespace Name / File Class  Filename                                                               File Size Auto            Next             Max
----------------------------- ---------------------------------------------------------------- --------------- ---- --------------- ---------------
MGMT_AD4J_TS                  /dbTEST01/db04/oradata/TEST01/mgmt_ad4j.dbf                                  200 YES       52,428,800          32,768
MGMT_ECM_DEPOT_TS             /dbTEST01/db04/oradata/TEST01/mgmt_depot.dbf                                 100 YES       20,971,520          32,768
MGMT_TABLESPACE               /dbTEST01/db04/oradata/TEST01/mgmt.dbf                                     5,050 YES       52,428,800          32,768
SYSAUX                        /dbTEST01/db04/oradata/TEST01/sysaux01.dbf                                 1,540 YES       10,485,760          32,768
SYSTEM                        /dbTEST01/db04/oradata/TEST01/system01.dbf                                   930 YES       10,485,760          32,768
TEMP                          /dbTEST01/db04/oradata/TEST01/temp01.dbf                                     178 YES       10,485,760          32,768
UNDOTBS1                      /dbTEST01/db04/oradata/TEST01/undotbs01.dbf                                  680 YES        5,242,880          32,768
USERS                         /dbTEST01/db04/oradata/TEST01/users01.dbf                                      5 YES        1,310,720          32,768
[ CONTROL FILE    ]           /dbTEST01/db04/oradata/TEST01/control01.ctl
[ CONTROL FILE    ]           /dbTEST01/db04/oradata/TEST01/control02.ctl
[ CONTROL FILE    ]           /dbTEST01/db04/oradata/TEST01/control03.ctl
[ ONLINE REDO LOG ]           /dbTEST01/db04/oradata/TEST01/redo01.log                                     500
[ ONLINE REDO LOG ]           /dbTEST01/db04/oradata/TEST01/redo02.log                                     500
[ ONLINE REDO LOG ]           /dbTEST01/db04/oradata/TEST01/redo03.log                                     500
                                                                                               ---------------
sum                                                                                                     10,183

14 rows selected.

3. Shutdown Database and Listener.

4. On the target server make the same structure as the source. what i did is make the actual directory as i want it then just create a softlink.
something below.

  - mkdir -p /dbPOEMC/db04/oradata/POEMC
  - ln -s /dbPOEMC /dbTEST01
  - ln -s /dbPOEMC/db04/oradata/POEMC /dbPOEMC/db04/oradata/TEST01

5. Copy all files from the target server.

  - scp prodoem12c:/dbTEST01/db04/oradata/TEST01/* .
  - !!don't forget to copy also the archive directory

6. start the database at mount and rename all files. in my case i already edited my pfile and update the location on controlfiles.

SQL> startup mount;
ORACLE instance started.

Total System Global Area 1043886080 bytes
Fixed Size                  2234960 bytes
Variable Size             864028080 bytes
Database Buffers          171966464 bytes
Redo Buffers                5656576 bytes
Database mounted.
SQL> 
  alter database rename file '/dbTEST01/db04/oradata/TEST01/mgmt_ad4j.dbf' to '/dbPOEMC/db04/oradata/POEMC/mgmt_ad4j.dbf';
  alter database rename file '/dbTEST01/db04/oradata/TEST01/mgmt_depot.dbf' to '/dbPOEMC/db04/oradata/POEMC/mgmt_depot.dbf';
  alter database rename file '/dbTEST01/db04/oradata/TEST01/mgmt.dbf' to '/dbPOEMC/db04/oradata/POEMC/mgmt.dbf';
  alter database rename file '/dbTEST01/db04/oradata/TEST01/sysaux01.dbf' to '/dbPOEMC/db04/oradata/POEMC/sysaux01.dbf';
  alter database rename file '/dbTEST01/db04/oradata/TEST01/system01.dbf' to '/dbPOEMC/db04/oradata/POEMC/system01.dbf';
  alter database rename file '/dbTEST01/db04/oradata/TEST01/temp01.dbf' to '/dbPOEMC/db04/oradata/POEMC/temp01.dbf';
  alter database rename file '/dbTEST01/db04/oradata/TEST01/undotbs01.dbf' to '/dbPOEMC/db04/oradata/POEMC/undotbs01.dbf';
  alter database rename file '/dbTEST01/db04/oradata/TEST01/users01.dbf' to '/dbPOEMC/db04/oradata/POEMC/users01.dbf';
  alter database rename file '/dbTEST01/db04/oradata/TEST01/redo01.log' to '/dbPOEMC/db04/oradata/POEMC/redo01.log';
  alter database rename file '/dbTEST01/db04/oradata/TEST01/redo02.log' to '/dbPOEMC/db04/oradata/POEMC/redo02.log';
  alter database rename file '/dbTEST01/db04/oradata/TEST01/redo03.log' to '/dbPOEMC/db04/oradata/POEMC/redo03.log';

7. Open the database and check if everything is working fine.

Tablespace Name / File Class  Filename                                                               File Size Auto            Next             Max
----------------------------- ---------------------------------------------------------------- --------------- ---- --------------- ---------------
MGMT_AD4J_TS                  /dbPOEMC/db04/oradata/POEMC/mgmt_ad4j.dbf                                    200 YES       52,428,800          32,768
MGMT_ECM_DEPOT_TS             /dbPOEMC/db04/oradata/POEMC/mgmt_depot.dbf                                   100 YES       20,971,520          32,768
MGMT_TABLESPACE               /dbPOEMC/db04/oradata/POEMC/mgmt.dbf                                       5,050 YES       52,428,800          32,768
SYSAUX                        /dbPOEMC/db04/oradata/POEMC/sysaux01.dbf                                   1,540 YES       10,485,760          32,768
SYSTEM                        /dbPOEMC/db04/oradata/POEMC/system01.dbf                                     930 YES       10,485,760          32,768
TEMP                          /dbPOEMC/db04/oradata/POEMC/temp01.dbf                                       178 YES       10,485,760          32,768
UNDOTBS1                      /dbPOEMC/db04/oradata/POEMC/undotbs01.dbf                                    680 YES        5,242,880          32,768
USERS                         /dbPOEMC/db04/oradata/POEMC/users01.dbf                                        5 YES        1,310,720          32,768
[ CONTROL FILE    ]           /dbPOEMC/db04/oradata/POEMC/control01.ctl
[ CONTROL FILE    ]           /dbPOEMC/db04/oradata/POEMC/control02.ctl
[ CONTROL FILE    ]           /dbPOEMC/db04/oradata/POEMC/control03.ctl
[ ONLINE REDO LOG ]           /dbPOEMC/db04/oradata/POEMC/redo01.log                                       500
[ ONLINE REDO LOG ]           /dbPOEMC/db04/oradata/POEMC/redo02.log                                       500
[ ONLINE REDO LOG ]           /dbPOEMC/db04/oradata/POEMC/redo03.log                                       500
                                                                                               ---------------
sum                                                                                                     10,183

14 rows selected.

8. Now lets upgrade our database, i always use dbua..:) if you want to do it manually its up to you.

lnx42xyz: TEST01>dbua -silent -sid TEST01
Log files for the upgrade operation are located at: /opt/app/oracle/cfgtoollogs/dbua/TEST01/upgrade1
Performing Pre Upgrade
1% complete
7% complete
Upgrading Oracle Server
8% complete
9% complete
10% complete
10% complete
11% complete
12% complete
13% complete
13% complete
14% complete
15% complete
16% complete
16% complete
17% complete
18% complete
19% complete
20% complete
20% complete
21% complete
22% complete
23% complete
23% complete
24% complete
25% complete
26% complete
Upgrading JServer JAVA Virtual Machine
27% complete
28% complete
29% complete
30% complete
Upgrading Oracle XDK for Java
31% complete
32% complete
Upgrading OLAP Analytic Workspace
33% complete
34% complete
35% complete
36% complete
36% complete
Upgrading OLAP Catalog
38% complete
39% complete
40% complete
Upgrading Oracle Text
41% complete
42% complete
43% complete
Upgrading Oracle XML Database
44% complete
45% complete
46% complete
46% complete
47% complete
Upgrading Oracle Java Packages
49% complete
50% complete
Upgrading Oracle interMedia
51% complete
52% complete
53% complete
53% complete
54% complete
55% complete
Upgrading Spatial
56% complete
57% complete
58% complete
59% complete
60% complete
60% complete
61% complete
62% complete
63% complete
63% complete
64% complete
65% complete
66% complete
66% complete
67% complete
68% complete
69% complete
70% complete
Upgrading Oracle Workspace Manager
71% complete
Upgrading Expression Filter
73% complete
73% complete
74% complete
Upgrading Rule Manager
76% complete
Upgrading Oracle Application Express
77% complete
78% complete
79% complete
80% complete
80% complete
81% complete
82% complete
83% complete
83% complete
84% complete
Upgrading Oracle OLAP API
Performing Post Upgrade
85% complete
86% complete
92% complete
Generating Summary
Database upgrade has been completed successfully, and the database is ready to use.
100% complete
Check the log file "/opt/app/oracle/cfgtoollogs/dbua/logs/silent.log" for upgrade details.
lnx42xyz: TEST01>

Once upgrade is done please do some check and if everything is fine please proceed with next step. rename the database.
9. Rename the database using NID command, Database should be in mount state.


SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.

Total System Global Area 1043886080 bytes
Fixed Size                  2234960 bytes
Variable Size             864028080 bytes
Database Buffers          171966464 bytes
Redo Buffers                5656576 bytes
Database mounted.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

lnx42xyz: TEST01>nid TARGET=SYS DBNAME=POEMC

DBNEWID: Release 11.2.0.3.0 - Production on Wed Oct 9 04:20:04 2013

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

Password:
Connected to database TEST01 (DBID=3627821231)

Connected to server version 11.2.0

Control Files in database:
    /dbPOEMC/db04/oradata/POEMC/control01.ctl
    /dbPOEMC/db04/oradata/POEMC/control02.ctl
    /dbPOEMC/db04/oradata/POEMC/control03.ctl

Change database ID and database name TEST01 to POEMC? (Y/[N]) => Y

Proceeding with operation
Changing database ID from 3627821231 to 3815010361
Changing database name from TEST01 to POEMC
    Control File /dbPOEMC/db04/oradata/POEMC/control01.ctl - modified
    Control File /dbPOEMC/db04/oradata/POEMC/control02.ctl - modified
    Control File /dbPOEMC/db04/oradata/POEMC/control03.ctl - modified
    Datafile /dbPOEMC/db04/oradata/POEMC/system01.db - dbid changed, wrote new name
    Datafile /dbPOEMC/db04/oradata/POEMC/sysaux01.db - dbid changed, wrote new name
    Datafile /dbPOEMC/db04/oradata/POEMC/undotbs01.db - dbid changed, wrote new name
    Datafile /dbPOEMC/db04/oradata/POEMC/users01.db - dbid changed, wrote new name
    Datafile /dbPOEMC/db04/oradata/POEMC/mgmt_depot.db - dbid changed, wrote new name
    Datafile /dbPOEMC/db04/oradata/POEMC/mgmt.db - dbid changed, wrote new name
    Datafile /dbPOEMC/db04/oradata/POEMC/mgmt_ad4j.db - dbid changed, wrote new name
    Datafile /dbPOEMC/db04/oradata/POEMC/temp01.db - dbid changed, wrote new name
    Control File /dbPOEMC/db04/oradata/POEMC/control01.ctl - dbid changed, wrote new name
    Control File /dbPOEMC/db04/oradata/POEMC/control02.ctl - dbid changed, wrote new name
    Control File /dbPOEMC/db04/oradata/POEMC/control03.ctl - dbid changed, wrote new name
    Instance shut down

Database name changed to POEMC.
Modify parameter file and generate a new password file before restarting.
Database ID for database POEMC changed to 3815010361.
All previous backups and archived redo logs for this database are unusable.
Database is not aware of previous backups and archived logs in Recovery Area.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database name and ID.
DBNEWID - Completed succesfully.

lnx42xyz: TEST01>

10. After the NID Database is down. before starting it edit the pfile and change the DB_NAME TO POEMC. or anything that says TEST01 change it to POEMC

11. Start the database

SQL> startup mount;
ORACLE instance started.

Total System Global Area 1043886080 bytes
Fixed Size                  2234960 bytes
Variable Size             742393264 bytes
Database Buffers          293601280 bytes
Redo Buffers                5656576 bytes
Database mounted.
SQL> alter database open resetlogs;

Database altered.

SQL>

CHECK :
ACTION               NAMESPACE       VERSION         BUNDLE_SERIES   COMMENTS
-------------------- --------------- --------------- --------------- ------------------------------
VIEW INVALIDATE                                                      view invalidation
UPGRADE              SERVER          11.2.0.3.0                      Upgraded from 11.1.0.7.0
APPLY                SERVER          11.2.0.3        PSU             PSU 11.2.0.3.7

SQL>

12. Since DB is up and running we can start our OMS and reconfigure it.

prodoem12c: TEST01>emctl start oms
     Oracle Enterprise Manager Cloud Control 12c Release 3
     Copyright (c) 1996, 2013 Oracle Corporation.  All rights reserved.
     Starting Oracle Management Server...
     Starting WebTier...
     WebTier Successfully Started
     Oracle Management Server is not functioning because of the following reason:
     Unexpected error occurred. Check error and log files.
     Check the following log files:
     EM log files: /opt/app/oracle/gc_inst/em/EMGC_OMS1/sysman/log/emctl.log, emoms.trc, emoms_pbs.trc
prodoem12c: TEST01>

For now ignore any error.

13. Reconfigure OMS and point it to new repository location.

emctl config oms -store_repos_details -repos_conndesc '(DESCRIPTION=(ADDRESS_LIST=(FAILOVER=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=lnx00cnc-poemc)(PORT=1521)))(LOAD_BALANCE=ON)(CONNECT_DATA=(SERVICE_NAME=poemc)))' -repos_user sysman -repos_pwd oracle

     prodoem12c: TEST01>ANCE=ON)(CONNECT_DATA=(SERVICE_NAME=poemc)))' -repos_user sysman -repos_pwd oracle                                                                         <
     Oracle Enterprise Manager Cloud Control 12c Release 3
     Copyright (c) 1996, 2013 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'.

prodoem12c: TEST01>emctl stop oms -all
Oracle Enterprise Manager Cloud Control 12c Release 3
Copyright (c) 1996, 2013 Oracle Corporation.  All rights reserved.
Stopping WebTier...
WebTier Successfully Stopped
Stopping Oracle Management Server...
Oracle Management Server Successfully Stopped
AdminServer Successfully Stopped
Oracle Management Server is Down

prodoem12c: TEST01>emctl start oms
Oracle Enterprise Manager Cloud Control 12c Release 3
Copyright (c) 1996, 2013 Oracle Corporation.  All rights reserved.
Starting Oracle Management Server...
Starting WebTier...
WebTier Successfully Started
Oracle Management Server Successfully Started
Oracle Management Server is Up
prodoem12c: TEST01>

14. Now perform the last remaining steps on OMS. login to your OMS.

Setup --> Manage Cloud Control --> Repository
01
Click on "OMS and Repository" --> Target Setup --> Monitoring Configuration
02
Repository Connect Descriptor --> This will have wrong values.
03
Correct the Connect Descriptor and continue, now the "Management Services and Repository" Target should show Green.
04

not included here:
added the new repository server and database on EM to monitor it.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s