Wednesday 24 July 2013

Migrating an Enterprise Edition Oracle Database from 11.2.0.3.0 (11g R2) to 12.1.0.1.0 (12c) on Redhat Enterprise Linux Server 6.0 x86-64

Oracle Database 12c (12.1.0.1.0) is Oracle's first pluggable database that brings a completely new level of efficiency into the existing database platform and that makes database consolidation much more easier and optimal, while a melange of other new features address performance, availability and many more attributes of the product line.

In this tutorial, I will demonstrate to you how to migrate an existing Oracle database from version 11.2.0.3.0 (11g R2) to version 12.1.0.1.0 (12c) -

Time Duration: At least 3 to 4 hours ( at least 3.5 hours on an average!)

Prerequisites:
1. An existing 11.2.0.3.0 Oracle database.
2. Oracle Database 12c (12.1.0.1.0) setup files for Linux x86-64. They are available at - http://www.oracle.com/technetwork/database/enterprise-edition/downloads/database12c-linux-download-1959253.html
3. Starting up the listener of the existing database before the migration process using the LSNRCTL START [LISTENER-NAME] command.
4. Extracting the setup files in a directory using unzip utility of the Linux operating system. To be specific, use the command 'unzip filename.zip' for accomplishing this.


Migration Process:
Execute the runInstaller in the setup directory by using the command './runInstaller' as follows -

[oracle@oem12c database_121010]$ ./runInstaller
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 500 MB.   Actual 4994 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 6143 MB    Passed
Checking monitor: must be configured to display at least 256 colors.    Actual 16777216    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2013-07-21_10-20-47PM. Please wait ...

Note - You need to have more than 500 MB of temp space, 150 MB of swap space and a monitor with the capacity to display at least 256 colours in order to carry out the migration process.

You will encounter the following splash screen:
 1. The splash screen will disappear in a few seconds and an installation window will open -

 You will have the option to configure your email address to be used for alerts and will also have the option to configure My Oracle Support for the database.

If you don't enter/select any option, a warning message will be displayed, and it can be ignored safely by clicking 'yes'.

2. The next screen will give you the option to download latest patches for the database, so that they can be applied during database installation -

The process of downloading latest software updates can be skipped by selecting the option 'skip software updates' and by clicking 'next'.

3. The next screen will present the install options:

There are three install options available -
A. Create and configure a database - This option will not only allow the DBA to install the Oracle Database software, but it will also let him/her create and configure a database during the installation process itself.
B. Install database software only - This option will allow the DBA to only install the Oracle Database software, but it will NOT allow him/her to create and configure a database during the installation process itself.
C. Upgrade an existing database - This option will allow the DBA to upgrade an existing database to a new/later version.

As far as our purpose goes, we have to select the 'upgrade an existing database' option and click 'next'.

4. The next screen will present the languages in which you want the product to work -

By default, your default operating system language will get automatically selected. You may select an additional/another language if needed. Click 'next' once you select your language preferences.

5. The next screen will present the database editions available for installation -

There are three database editions available -
A. Enterprise Edition
B. Standard Edition
C. Standard Edition One

For information about each edition, go to the following website:
http://www.oracle.com/us/products/database/enterprise-edition/comparisons/index.html

By default, the 'Enterprise Edition' will get selected. Note that the space required by each edition of the database is mentioned beside the edition. Click 'next' once you select the desired edition to install.

6. The next screen will present two fields to you that you are supposed to enter -

These two fields are as follows -
A. Oracle base directory aka 'Oracle base:' - It stores all Oracle software and configuration-related files installed by this installation owner.
B. Oracle database home directory aka 'Software location:' - It stores the Oracle database software files separate from database configuration files in the Oracle base directory.

Both the fields are mandatory. Enter them and click 'next'.

7. The next screen will present the privileged operating system groups -

There are three new groups available in database 12c in addition to the OSDBA and OSOPER groups:
A. OSBACKUPDBA - This is the database backup and recovery group.
B. OSDGDBA - This is the data guard administrative group.
C. OSKMDBA - This is the encryption key management administrative group.

You may Google for more information about these groups if required.

Accept the default assignments and click 'next'.

8. The installation software will perform some prerequisite checks to ensure that the database software can be installed correctly on the system. If any check fails, it will be highlighted with an appropriate recommendation.

9. A final summary page will be displayed before the installation process can begin -

You can save the Response File if required at this step. Response files are useful for performing silent installations.

Click 'install' to begin the installation process.

10. The installation process will then begin as follows -

The process will gradually progress ...

The process will ask you to execute the root.sh script as the root user using a terminal -

Click 'OK' once you execute root.sh as the root user.

Once you click 'OK', the Oracle Net Configuration Assistant (NETCA) will start in order for you to configure the listener for the database -

Configure the listener correctly. It cannot use the existing port that is being used by the existing database. In my demonstration, my existing database is registered with a listener running on port 1521, so I have created a new listener running on port 1522 for the new 12c database.

The Oracle Database Upgrade Assistant (DBUA) will then start -

10.1 The first screen will present you with two operations:

These operations are as follows -
A. Upgrade Oracle Database - It allows you to upgrade an existing Oracle database.
B. Move Database from a Different Release 12.1 Oracle Home - It allows you to move the database from a different release 12.1 Oracle home.

Select the first operation (A) and click 'next'.

10.2 The second screen will present you with the option to select the source Oracle home and the source SID:

Make sure that your selection is accurate and click 'next'.

When you click 'next', the Database Upgrade Assistant will try to get the source database information, which may take a few minutes to get gathered.

10.3 The Database Upgrade Assistant will then perform some prerequisite checks in order to ascertain whether it is possible to continue with the upgrade process -

The DBUA will then present the validation results of these checks with appropriate actions that can be taken -

Apply the default recommended actions by clicking the 'Apply Action' button. The DBUA will then apply the actions it recommended, and we are finally ready to continue with the database upgrade process -


10.4 The next screen will present the upgrade options and custom SQL scripts that may be run before and after the upgrade process:

The available upgrade options are as follows -
A. Upgrade Parallelism - You can specify the number of parallel process to spawn in order to accelerate the upgrade process. The default value is 4.
B. Recompile Invalid Objects During Post Upgrade - This option is checked by default. It has an optional recompilation parallelism, which by default is set to 1.
C. Upgrade Timezone Data - This option by default is unchecked.
D. Gather Statistics Before Upgrade - This option by default is unchecked.
E. Set User Tablespaces Read Only During Upgrade - This option by default is also unchecked.
F. Diagnostic Destination - This option by default is set to the new <ORACLE_BASE>.
G. Audit File Destination - This option by default is set to the new <ORACLE_BASE>/admin/sid/adump

Click on the 'Custom SQL Scripts' tab -

In this tab, there are two fields that can be entered -
A. Before Upgrade - You can specify a custom SQL script to be executed before the upgrade process actually begins.
B. After Upgrade - You can specify a custom SQL script to be executed after the upgrade process finishes.

Let the default values be in both the above tabs and click 'next'.

10.5 The next screen will present you with the management options that you may specify for the database -

There are two management options available for the database -
A. Configure Enterprise Manager (EM) Database Express - This option is similar to the Enterprise Manager (EM) Database Control 11g.
B. Register with Enterprise Manager (EM) Cloud Control - This option allows you to register the database with an existing 12c Oracle Management Server (OMS) by specifying the OMS host, OMS port, EM admin username & password and the DBSNMP user's password (agent user's password).

You may select only one of the above two options and click 'next'.

10.6 The next screen will present you with the option of moving the existing database files and/or fast recovery area as part of the upgrade -

There are two storage options, namely, File System and Automatic Storage Management.

We will be selecting the File System option in our example, and we will be moving only the database files (control files, data files, and online redo log files) as part of the upgrade.

We can use a common location for storing all database files, or use a mapping file (text file) to specify the location of database files. If you select the former option, then you can optionally use Oracle Managed Files (OMF) and/or multiplex redo logs and control files. We will be using OMF in our example, but we will not be multiplexing the redo logs and control files.

If you prefer to move the fast recovery area, then you are forced to enter the new destination of the fast recovery area and its new size too.

Click 'next' to continue ...

10.7 In the next screen, you will be prompted to register the database with listener(s):

You can register the database with new, or existing listener(s). If the existing listener(s) is/are present in the source Oracle home, then it/they can be migrated and restarted in the target Oracle home. Since we have already created a new listener on port 1522, we will choose not to automatically migrate the existing listener. Instead, we will manually migrate it later.

Note: This screen also gives you the chance to create a new listener by entering the listener name, port and Oracle home in the last row ( the blank row).

Click 'next' to continue ...

10.8 The next screen will present you with the option to recover your database in case of any upgrade problem -

There are two options available here -
A. Use RMAN Backup - It allows you to either create a new offline RMAN backup in a specified path, or use an existing RMAN backup according to timestamp. You may optionally use flashback and guaranteed restore point either by creating a new guaranteed restore point, or by using an existing guaranteed restore point.
B. I have my own backup and restore strategy - This allows you to bypass the option (A) above.

Click 'next' to continue ...

10.9 The next screen presents the Database Upgrade Summary to you -

Please go through the entire summary (to spot mistakes!) and click 'finish' to start the database upgrade process.

10.10 The next screen will present the progress of the upgrade process -

It will take a lot of time to complete, so you may go and enjoy a cup of tea/coffee in the meanwhile!


My goodness ... what a bloody waste of time this process is !!!!!! Time to have some biscuits too ...


And finally the process completes ...


10.11 Click on 'Upgrade Results' to view the results of the upgrade process -

Finally, click 'close' to successfully end the database upgrade process.

11. You will be presented with a message that the upgrade of the Oracle database was successful -

Click 'close' to close the 12c database installer.


Now it's time to do some manual editing before you can make your database available to users!

Follow the steps mentioned below -

1. Edit .bash_profile in your local home directory (OS home) and update the ORACLE_BASE and ORACLE_HOME environment variables, saving your changes. Logout and login into the system again.

2. Backup listener.ora and tnsnames.ora in your new Oracle home.

Note: listener.ora and tnsnames.ora are present in <ORACLE_HOME>/network/admin

3. Copy (cp -p) listener.ora and tnsnames.ora from the old Oracle home to the new Oracle home in order to migrate the default listener to the new Oracle home, and optionally update the comments in these files with their respective new locations.

4. Edit initSID.ora, present in <ORACLE_HOME>/dbs, and hash out the LOCAL_LISTENER field. Also make sure that the control file location is correct, otherwise the database will not get mounted.

Note: The LOCAL_LISTENER parameter gets generated because we have created a non-default listener running on a port other than the default port 1521. The LOCAL_LISTENER parameter needs to be set in case if you use a non-default listener.

For more information regarding the LOCAL_LISTENER initialization parameter, kindly click the following link: http://edstevensdba.wordpress.com/2011/07/30/exploring-the-local_listener-parameter/

5. Start the listener by using the LSNRCTL START [LISTENER-NAME] command.

6. Start SQL*PLUS with SYSDBA privilege and create spfile from pfile.

7. Finally, perform a normal startup operation and you are done!


The Oracle database is available to users ... enjoy ... !

Hope you had a great time reading the post! :)

2 comments:

  1. Very detailed procedure... keep it up...

    ReplyDelete
    Replies
    1. Thanks for your valuable comments! I intend to post a new article every week. It is a good way to keep up with what one actually does.

      Delete