11g

Get Upgrading: Steps To Upgrade To 11gR2

As 11gR2 is out for Linux, I decided to upgrade one of my existing 10.2.0.3 database to 11.2.0.1 to get the look and feel of 11gR2. Direct upgrade to 11gR2 is supported from 9.2.0.8 or higher, 10.1.0.5 or higher, 10.2.0.2 or higher and 11.1.0.6 or higher. If you have a database 9.2.0.6 then first you need to upgrade to intermediate release i.e 9.2.0.8 then to 11.2.0.1.

9.2.0.6==>9.2.0.8==>11.2.0.1
8.1.7.0==>8.1.7.4==>10.2.0.4==>11.2.0.1

I will discuss how to upgrade an existing Single Instance 10.2.0.3 database with ASM, having same ORACLE_HOME, to 11gR2 with ASM. The upgrade needs to be performed in two phases:

1. Upgrade the ASM instance
2. Upgrade the database

Upgrade ASM Instance:
===============

There are three ways to upgrade already existing ASM instance:

- Using OUI of Grid Infrastructure
- Using ASM Configuration Assistant
- Manual upgrade

The recommended method to upgrade ASM instance is to use OUI of Grid Infrastructure, which I have used .

STEP 1:

Create OSASM group:
If you want, you can create a separate group for ASM instance here it is named as ASMADMIN.

# groupadd asmadmin
# usermod -a -G asmadmin oracle

STEP 2:

Before upgrading an ASM instance to 11gR2 it is mandatory to add a ‘user and password’ combination to the password file which is local to node’s ASM instance. Login to database instance “/ as sysdba”:

SQL> create user sood identified by oracle;
SQL> grant sysdba to sood;
SQL> select * from v$pwfile_users;

USERNAME            SYSDB SYSOP
------------------------------ -----       -----
SYS                        TRUE  TRUE
SOOD                     TRUE  FALSE

STEP 3:

From 11gR2 onwards ASM is part of Grid Infrastructure and we need to download Grid Infrastructure software first. To download the software for 11gR2 Grid Infrastructure click here

Start the RunInstaller:

./runInstaller

Click on the Image to Enlarge.

1. It will automatically defaults to the “Upgrade Mode”

Upgrade Mode

Select “Upgrade Grid Infrastructure” and click Next.

2. On clicking Next, It will detect the already existing ASM instance. Shutdown the Database and ASM instance at this point.

Click “Yes”.

3.  Select the Language

Click “Next”.

4.  Enter a Password for ASMSNMP user. The password can be anything you want, though Oracle will ask you to set a password which adhers to Oracle’s standards otherwise a “Red Cross” will be shown in the tab at left hand side. Do not worry about that cross 🙂

Click “Next”.

5. Provide the Group details

Click “Next”.

Click “Yes”.

6. Provide the Base and Home location for Grid Infrastructure Home

Click “Next”.

7.  It will perform the Prerequisite checks here, For more information on this click Installation Fixup script
I have select “Ignore All”

Click “Next”.

8.  Now you will see “Summary” page, make sure that the Installation Option is shown as “Upgrade Grid Infrastructure” and Migrate ASM as “True”.

Click “Finish”.

9. Now the setup for “Grid Infrastructure’ is started

Run the rootupgrade.sh

# ./rootupgrade.sh

[root@localhost ~]# cd /u01/11g/oracle/product/11.2.0/grid/

[root@localhost grid]# pwd
/u01/11g/oracle/product/11.2.0/grid
[root@localhost grid]# ./rootupgrade.sh
Running Oracle 11g root.sh script...

The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME=  /u01/11g/oracle/product/11.2.0/grid

Enter the full pathname of the local bin directory: [/usr/local/bin]:
The file "dbhome" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: y
Copying dbhome to /usr/local/bin ...
The file "oraenv" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: y
Copying oraenv to /usr/local/bin ...
The file "coraenv" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: y
Copying coraenv to /usr/local/bin ...

Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
2009-09-05 11:46:25: Checking for super user privileges
2009-09-05 11:46:25: User has super user privileges
2009-09-05 11:46:25: Parsing the host name
Using configuration parameter file: /u01/11g/oracle/product/11.2.0/grid/crs/install/crsconfig_params
Creating trace directory
LOCAL ADD MODE
Creating OCR keys for user 'oracle', privgrp 'oinstall'..
Operation successful.
CSS appears healthy
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
Shutdown has begun. The daemons should exit soon.
CRS-4664: Node localhost successfully pinned.
Adding daemon to inittab
CRS-4123: Oracle High Availability Services has been started.
ohasd is starting

localhost     2009/09/05 11:49:02     /u01/11g/oracle/product/11.2.0/grid/cdata/localhost/backup_20090905_114902.olr
Successfully configured Oracle Grid Infrastructure for a Standalone Server
Updating inventory properties for clusterware
Starting Oracle Universal Installer...

Checking swap space: must be greater than 500 MB.   Actual 885 MB    Passed
The inventory pointer is located at /etc/oraInst.loc
The inventory is located at /u01/10g/oraInventory
'UpdateNodeList' was successful.
[root@localhost grid]#

10. After the upgrade I have checked /etc/oratab file and found the entry of ASM pointing to new home i.e now ASM is a part of “Grid Infrastructure”
“+ASM:/u01/11g/oracle/product/11.2.0/grid:N”

Upgrade Database Instance:
===================

NOTE: DO NOT SHUTDOWN DATABASE BEFORE RUNNING DBUA.

STEP 1: Install The Software:

To download Oracle Database 11gR2 software click Here . Execute runInstaller to install “SOFTWARE ONLY” option, you can follow this link to install the software.  Make sure that you select “software only”  option as shown below rest of the steps are same as described in above link.

STEP 2: Run Pre-Upgrade Information tool

I have installed the software under “/u01/11g/oracle/product/11.2.0/dbhome_1” location. Once the software is installed, then go to location $ORACLE_HOME/rdbms/admin and copy  utlu112i.sql script to /tmp directory. Now login to 10g database “/ as sysdba” and startup the 10g database, then:

SQL> spool /tmp/upgrade.spl
SQL> @/tmp/utlu112i.sql
SQL> spool off</span>

Following is the output of this script from my database:

Oracle Database 11.2 Pre-Upgrade Information Tool    09-04-2009 01:54:32
.
**********************************************************************
Database:
**********************************************************************
--&gt; name:          ORCL10G
--&gt; version:       10.2.0.3.0
--&gt; compatible:    10.2.0.3.0
--&gt; blocksize:     8192
--&gt; platform:      Linux IA (32-bit)
--&gt; timezone file: V3
.
**********************************************************************
Tablespaces: [make adjustments in the current environment]
**********************************************************************
--&gt; SYSTEM tablespace is adequate for the upgrade.
.... minimum required size: 724 MB
.... AUTOEXTEND additional space required: 244 MB
--&gt; UNDOTBS1 tablespace is adequate for the upgrade.
.... minimum required size: 464 MB
.... AUTOEXTEND additional space required: 439 MB
--&gt; SYSAUX tablespace is adequate for the upgrade.
.... minimum required size: 447 MB
.... AUTOEXTEND additional space required: 207 MB
--&gt; TEMP tablespace is adequate for the upgrade.
.... minimum required size: 61 MB
.... AUTOEXTEND additional space required: 41 MB
.
**********************************************************************
Flashback: OFF
**********************************************************************
**********************************************************************
Update Parameters: [Update Oracle Database 11.2 init.ora or spfile]
**********************************************************************
WARNING: --&gt; "sga_target" needs to be increased to at least 336 MB
WARNING: --&gt; "java_pool_size" needs to be increased to at least 64 MB
WARNING: --&gt; "pga_aggregate_target" needs to be increased to at least 24 MB
.
**********************************************************************
Renamed Parameters: [Update Oracle Database 11.2 init.ora or spfile]
**********************************************************************
-- No renamed parameters found. No changes are required.
.
**********************************************************************
Obsolete/Deprecated Parameters: [Update Oracle Database 11.2 init.ora or spfile]
**********************************************************************
--&gt; background_dump_dest         11.1       DEPRECATED   replaced by
"diagnostic_dest"
--&gt; user_dump_dest               11.1       DEPRECATED   replaced by
"diagnostic_dest"
--&gt; core_dump_dest               11.1       DEPRECATED   replaced by
"diagnostic_dest"
.
**********************************************************************
Components: [The following database components will be upgraded or installed]
**********************************************************************
--&gt; Oracle Catalog Views         [upgrade]  VALID
--&gt; Oracle Packages and Types    [upgrade]  VALID
--&gt; JServer JAVA Virtual Machine [upgrade]  VALID
--&gt; Oracle XDK for Java          [upgrade]  VALID
--&gt; Oracle Workspace Manager     [upgrade]  VALID
--&gt; OLAP Analytic Workspace      [upgrade]  VALID
--&gt; OLAP Catalog                 [upgrade]  VALID
--&gt; EM Repository                [upgrade]  VALID
--&gt; Oracle Text                  [upgrade]  VALID
--&gt; Oracle XML Database          [upgrade]  VALID
--&gt; Oracle Java Packages         [upgrade]  VALID
--&gt; Oracle interMedia            [upgrade]  VALID
--&gt; Spatial                      [upgrade]  VALID
--&gt; Data Mining                  [upgrade]  VALID
--&gt; Expression Filter            [upgrade]  VALID
--&gt; Rule Manager                 [upgrade]  VALID
--&gt; Oracle OLAP API              [upgrade]  VALID
.
**********************************************************************
Miscellaneous Warnings
**********************************************************************
WARNING: --&gt; Database is using a timezone file older than version 11.
.... After the release migration, it is recommended that DBMS_DST package
.... be used to upgrade the 10.2.0.3.0 database timezone version
.... to the latest version which comes with the new release.
WARNING: --&gt; Database contains schemas with stale optimizer statistics.
.... Refer to the Upgrade Guide for instructions to update
.... schema statistics prior to upgrading the database.
.... Component Schemas with stale statistics:
....   SYS
....   XDB
WARNING: --&gt; Database contains schemas with objects dependent on network
packages.
.... Refer to the Upgrade Guide for instructions to configure Network ACLs.
WARNING: --&gt; EM Database Control Repository exists in the database.
.... Direct downgrade of EM Database Control is not supported. Refer to the
.... Upgrade Guide for instructions to save the EM data prior to upgrade.
WARNING:--&gt; recycle bin in use.
.... Your recycle bin turned on.
.... It is REQUIRED
.... that the recycle bin is empty prior to upgrading
.... your database.
.... The command:  PURGE DBA_RECYCLEBIN
.... must be executed immediately prior to executing your upgrade.
PL/SQL procedure successfully completed.
SQL&gt; spool off

Adjust the warnings shown by Pre-Upgrade Information tool.

STEP 3 : Upgrade using DBUA

Execute the DBUA from 11gR2 software home as

$ cd $ORACLE_HOME/bin
$./dbua

1.

Click “Next”

2.  Select the database that you want to upgrade

Click “Next”

3.  Here DBUA will show warnings that were not solved after running Pre-Upgrade Information tool

Click “Yes”

4. Turn OFF archiving while upgrading

Click “Next”

5. Check whether you want to move the datafiles while upgrade, though the “move datafile” check-box was not highlighted when I upgraded

Click “Next”.

6. Specify “FRA” and “Diagnostic Destination”

Click “Next”.

7. Check configuration for EM

Click “Next”.

8.  Check “Summary” page

Click “Finish”

Upgrade Process is started

Check the Results

12Congratulations!!!!!!!!!! Upgrade is Successful !!!!!!!!!!!!!!!

Now you are ready to use Most Powerful Database!! 🙂

11gR2 Database Installation with ASM on OEL5

I will be listing down steps for 11g Release 2 installation on Linux x86. There has been few changes incorporated in 11gR2 which must be given due consideration before starting installation. ASM instance now runs from new Oracle Home called Grid Infrastructure.

If you wish to use ASM for storing database files, then you should install first Oracle grid infrastructure for a standalone server. It is also required if you wish to use Oracle Restart feature (Provides for automatic restart of DB and other components after a hardware or software failure or whenever your database host computer restarts) for single instance.

Environment used for this setup
Operating System – Oracle Enterprise Linux Release 5(OEL5) on Vmware
Physical Ram – 1Gb

Asmlib for labeling ASM Disks.Refer to following OTN article for configuring asmlib and creating disks.

Software can be downloaded from OTN at following link

Oracle Database 11g Release 2 Grid Infrastructure (11.2.0.1.0) for Linux x86

Oracle Database 11g Release 2 (11.2.0.1.0) for Linux x86

All the pre-requisites for installation can be found here
http://download.oracle.com/docs/cd/E11882_01/install.112/e10840/pre_install.htm

I have tried to shorten it by keeping things which are relevant to our setup.

Check Packages

binutils-2.17.50.0.6
compat-libstdc++-33-3.2.3
elfutils-libelf-0.125
elfutils-libelf-devel-0.125
elfutils-libelf-devel-static-0.125
gcc-4.1.2
gcc-c++-4.1.2
glibc-2.5-24
glibc-common-2.5
glibc-devel-2.5
glibc-headers-2.5
kernel-headers-2.6.18
ksh-20060214
libaio-0.3.106
libaio-devel-0.3.106
libgcc-4.1.2
libgomp-4.1.2
libstdc++-4.1.2
libstdc++-devel-4.1.2
make-3.81
sysstat-7.0.2
unixODBC-2.2.11
unixODBC-devel-2.2.11

If you have yum installed on your machine, then it is very easy to install the packages. You can copy the list of packages in a text file and insert ‘yum install ‘ in beginning and execute it as root. This will install any missing packages. To know more about setting up yum, refer to my previous post

If Kernel parameters are not setup correctly, Oracle 11g OUI provides you  a fixup script and also ability to resume the installation process without need to re-run the earlier steps. Please refer to article here

Users,Roles and Groups for Installation

osdba group for ASM – Membership in the OSDBA group allows access to the files managed by Automatic Storage Management. It can be same as database osdba group. We will be using group dba in our setup.
OSASM group – Members of the OSASM group can use SQL to connect to an Automatic Storage Management instance as SYSASM using operating system authentication. The SYSASM privileges permit mounting and dismounting disk groups, and other storage administration tasks. SYSASM privileges provide no access privileges on an RDBMS instance. We will use asmadmin

OSOPER group – Similar to SYSOPER privilege in RDBMS, this is used for limited privileges like starting up and stopping the Oracle ASM instance. We will not be using separate group for it, will be selecting dba in our setup

oinstall – This is similar to previous releases, and used for Oracle Inventory group

I am using oracle user for installing Grid Infrastructure and Oracle Database Software. You can have a separate user say oragrid with oinstall membership and permission on oracle inventory directory.

Create Base directory where software will be installed. I used /u02/app/oracle

Add users and groups

/usr/sbin/groupadd -g 501 dba
/usr/sbin/groupadd -g 504 asmadmin
/usr/sbin/groupadd oinstall

/usr/sbin/useradd -u 502 -g oinstall -G dba,asmadmin oracle

Add following entries to /etc/security/limits.conf

oracle              soft    nproc   2047
oracle              hard    nproc   16384
oracle              soft    nofile  1024
oracle              hard    nofile  65536

Add or edit the following line in the /etc/pam.d/login file, if it does not already exist:

session    required     pam_limits.so

Add/replace following entries in /etc/sysctl.conf

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586

Execute following command as root to change the current kernel parameters:

/sbin/sysctl -p

Copy following in your login profile.

if [ $USER = "oracle" ]; then
        if [ $SHELL = "/bin/ksh" ]; then
              ulimit -p 16384
              ulimit -n 65536
        else
              ulimit -u 16384 -n 65536
        fi
umask 022
fi

We need to start with Grid Infrastructure installation. Unzip the contents and execute  runInstaller . This would require 2.8Gb of disk space.

$./runInstaller

Please click on image below for  displaying screenshots for 11gR2 Grid Infrastructure installation

Grid_infra_install

Execute root.sh from Grid ORACLE_HOME as root user

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u02/app/oracle/product/11.2.0/grid

Enter the full pathname of the local bin directory: [/usr/local/bin]:
The file "dbhome" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: y
   Copying dbhome to /usr/local/bin ...
The file "oraenv" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: y
   Copying oraenv to /usr/local/bin ...
The file "coraenv" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: y
   Copying coraenv to /usr/local/bin ...

Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
2009-09-02 05:07:26: Checking for super user privileges
2009-09-02 05:07:26: User has super user privileges
2009-09-02 05:07:26: Parsing the host name
Using configuration parameter file: /u02/app/oracle/product/11.2.0/grid/crs/install/crsconfig_params
Creating trace directory
LOCAL ADD MODE
Creating OCR keys for user 'oracle', privgrp 'oinstall'..
Operation successful.
CRS-4664: Node db11g successfully pinned.
Adding daemon to inittab
CRS-4123: Oracle High Availability Services has been started.
ohasd is starting

db11g     2009/09/02 05:09:24     /u02/app/oracle/product/11.2.0/grid/cdata/db11g/backup_20090902_050924.olr
Successfully configured Oracle Grid Infrastructure for a Standalone Server
Updating inventory properties for clusterware
Starting Oracle Universal Installer...

Checking swap space: must be greater than 500 MB.   Actual 2399 MB    Passed
The inventory pointer is located at /etc/oraInst.loc
The inventory is located at /u01/app/oraInventory
'UpdateNodeList' was successful.

To install Database software, Unzip the contents of both the zip files and execute runInstaller . Ensure you have 3.95Gb of free disk space

$./runInstaller

Please click on image for  displaying screenshots for 11gR2 Database installation .

11g_db_install

You are done 🙂

Component

Value /Commands to Check

Physical RAM >1 Gb

1Gb
grep MemTotal /proc/meminfo

Swap should be 1.5 times the RAM.

In our case it will be 1.5G
grep SwapTotal /proc/meminfo

/dev/shm to be configured to use MEMORY_TARGET

# df -h /dev/shm/

1Gb of /tmp space

df -h /tmp

Disk space Requirement for Grid Infrastructure Software (Enterprise edition)

2.95 Gb

Disk space Requirement for Database Software (Enterprise edition)

3.95 Gb

Packages for OEL5

binutils-2.17.50.0.6
compat-libstdc++-33-3.2.3
elfutils-libelf-0.125
elfutils-libelf-devel-0.125
elfutils-libelf-devel-static-0.125
gcc-4.1.2
gcc-c++-4.1.2
glibc-2.5-24
glibc-common-2.5
glibc-devel-2.5
glibc-headers-2.5
kernel-headers-2.6.18
ksh-20060214
libaio-0.3.106
libaio-devel-0.3.106
libgcc-4.1.2
libgomp-4.1.2
libstdc++-4.1.2
libstdc++-devel-4.1.2
make-3.81
sysstat-7.0.2
unixODBC-2.2.11
unixODBC-devel-2.2.11

Oracle 11gR2 on linux is out

Oracle 11gR2 has been released for linux x86 and x86-64 platform. Software can be downloaded at http://www.oracle.com/technology/software/products/database/index.html

Guys start downloading..:) ..

Note: – As of now documentation link  is not available on http://tahiti.oracle.com (13:30 G.M.T)

Update : – Thanks to H.Tonguç , documentation can be accesed at http://www.oracle.com/pls/db112/homepage?remark=tahiti

Cheers
Amit

GATHER_STATS_JOB – Is it enabled?

Few days back , Martin had posted a series of post on a issue where GATHER_STATS_JOB was failing silently for a large object. If you have missed it, you can check following links

Automated statistics gathering silently fails http://mwidlake.wordpress.com/2009/07/20/automated-statistics-gathering-silently-fails/
Automated Statistics Gathering Silently Fails #2 http://mwidlake.wordpress.com/2009/07/23/automated-statistics-gathering-silently-fails-2/
Automatic Statistics Gathering Fails #3   http://mwidlake.wordpress.com/2009/07/29/automatic-statistics-gathering-fails-3/

Automated statistics gathering silently fails

Automated Statistics Gathering Silently Fails #2

Automatic Statistics Gathering Fails #3

This post is based on some of the discussions on the thread. Please note that this is not intended to discuss bugs (if any) associated with the job

Gather_stats_job was introduced with Oracle 10g to gather statistics for database objects which has stale statistics (10% of data has changed, you can query dba_tab_modifications) or the tables for which the statistics has not been gathered (new tables created/truncated). This job runs during the maintenance window i.e every night from 10 P.M. to 6 A.M. and all day on weekends. This schedule can be though changed and process is documented in Metalink aka My Oracle Support Note 579007.1 –

This feature brought relief to lot of DBA’s as they did not have to write shell scripts to gather stats and could rely on this job to do the work. But slowly people realized that it does not fit in their environment and slowly recommendation turned from “Enabled ” to “Disabled “

Issues/Misconceptions

1) Should I schedule job run for every night?

As documented this job gathers stats on the tables which have got 10% of data changes since last run. So this will not touch the tables for which the data changes are less then 10%. Also due to rolling invalidation feature , sql cursors will not be immediately invalidated (Refer to oracle forums discussion and Fairlie Rego’s post)

If you are still not happy , you can change the maintenance window timings to suit the schedule (say on weekends)

In 11g, there is no GATHER_STATS_JOB. It has been now incorporated into DBMS_AUTO_TASK_ADMIN job along with Automatic segment advisor and Automatic tuning advisor. All these 3 run in all maintenance windows. New maintenance windows introduced with 11g are
You can check the name and state of this job using following query

SQL> SELECT client_name, status FROM dba_autotask_operation;

CLIENT_NAME							 STATUS
---------------------------------------------------------------- --------
auto optimizer stats collection 				 ENABLED
auto space advisor						 ENABLED
sql tuning advisor						 ENABLED

Window – Description

MONDAY_WINDOW – Starts at 10 p.m. on Monday and ends at 2 a.m.
TUESDAY_WINDOW – Starts at 10 p.m. on Tuesday and ends at 2 a.m.
WEDNESDAY_WINDOW -Starts at 10 p.m. on Wednesday and ends at 2 a.m.
THURSDAY_WINDOW – Starts at 10 p.m. on Thursday and ends at 2 a.m.
FRIDAY_WINDOW -Starts at 10 p.m. on Friday and ends at 2 a.m.
SATURDAY_WINDOW – Starts at 6 a.m. on Saturday and is 20 hours long.
SUNDAY_WINDOW -Starts at 6 a.m. on Sunday and is 20 hours long.

To enable the job (in case it is disabled)

BEGIN
  DBMS_AUTO_TASK_ADMIN.ENABLE(
    client_name => 'auto optimizer stats collection',
    operation => NULL,
    window_name => NULL);
END;
/

You can check history/run duration of these jobs by using following query

select client_name,JOB_NAME,JOB_STATUS,JOB_START_TIME,JOB_DURATION from DBA_AUTOTASK_JOB_HISTORY where JOB_START_TIME >systimestamp -7 and client_name='sql tuning advisor'

CLIENT_NAME		       JOB_NAME 		      JOB_STATUS      JOB_START_TIME					 JOB_DURATION
------------------------------ ------------------------------ --------------- -------------------------------------------------- --------------------
sql tuning advisor	       ORA$AT_SQ_SQL_SW_521	      SUCCEEDED       30-MAR-12 04.00.01.698038 PM AMERICA/LOS_ANGELES	 +000 00:22:13
sql tuning advisor	       ORA$AT_SQ_SQL_SW_493	      SUCCEEDED       01-APR-12 04.00.02.701398 PM AMERICA/LOS_ANGELES	 +000 00:42:26
sql tuning advisor	       ORA$AT_SQ_SQL_SW_522	      SUCCEEDED       31-MAR-12 04.00.07.642613 PM AMERICA/LOS_ANGELES	 +000 00:00:37

2) I do not want gather_stats_job to gather stats on some of my tables.

This requirement can arise due to following points

a)There are tables for which you have set the stats manually
b) There are queries for which you know your old stats will work fine
c) Tables are big and gather_stats_job is silently failing ( Again refer to Martin’s Post)
d) Tables for which histograms cannot not be gathered or vice versa
e) Tables for which you would like to estimate fixed percent of blocks

For all these situations. you can use DBMS_STATS.LOCK_TABLE_STATS and gather stats manually with force =>true to override locked statistics. For big partitioned tables you can use COPY_TABLE_STATS and APPROX_GLOBAL AND PARTITION feature. 

Oracle 11g also has enhancement to gathering stats on partitioned tables where in you can gather INCREMENTAL stats for partitions and oracle will automatically update global stats for table.This approach has advantage as we don’t scan table twice and reduces the time to gather stats drastically. You need to use DBMS_STATS.set_table_prefs procedure to set Incremental stats gathering to true. 

EXEC DBMS_STATS.SET_TABLE_PREFS('SCOTT','EMP_PART','INCREMENTAL','TRUE');

Note that first time, stats gathering will take more time as oracle will create object called synposes for each paritition. Subsequent runs of gather_stats_job will be faster. Refer to Optimizer group post for more info on copy_table_stats and 11g incremental stats feature. ( Due to bug copy_table_stats does not alter low/high value. Details can be found here )

To fix histogram issue, DBMS_STATS.SET_PARAM can be used to modify the default attributes e.g By default, GATHER_STATS_JOB will gather histograms, which can be confirmed by running below query

select dbms_stats.get_param('method_opt') method_opt from dual;

METHOD_OPT
--------------------------------------------------------------------
FOR ALL COLUMNS SIZE AUTO

To disable histogram capture, use

exec dbms_stats.set_param('method_opt', 'FOR ALL COLUMNS SIZE 1');

In case you wish to capture histograms for some of the tables, then you can use

exec dbms_stats.set_param('method_opt', 'FOR ALL COLUMNS SIZE REPEAT')

i.e Collects histograms only on the columns that already have histograms


Starting Oracle 11g database you can use DBMS_STATS.SET_*_PREFS to take care of point (d) and (e) i.e you can change the default gather options for particular table. Details can be found here

This is not exhaustive list and I hope that this will grow so that we can have Recommendation for GATHER_STATS_JOB status to be set to  “SCHEDULED” 🙂


Failed dependencies error: lib* needed by unixODBC-devel-2.2.11-7.1.i386

While trying to install 11gR1 on Oracle Enterprise Linux (OEL5), runInstaller failed for unixODBC* packages. To solve the issue , I started following OTN article

http://www.oracle.com/technology/pub/articles/smiley-11gr1-install.html

When trying to install RPM from CD3, faced following errors for unixODBC* rpm

#rpm -ivh compat-libstdc++-33* libaio-devel* sysstat* unixODBC*
warning: compat-libstdc++-33-3.2.3-61.i386.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
error: Failed dependencies:
libboundparam.so.1 is needed by unixODBC-devel-2.2.11-7.1.i386
libesoobS.so.1 is needed by unixODBC-devel-2.2.11-7.1.i386
libgtrtst.so.1 is needed by unixODBC-devel-2.2.11-7.1.i386
libmimerS.so.1 is needed by unixODBC-devel-2.2.11-7.1.i386
libnn.so.1 is needed by unixODBC-devel-2.2.11-7.1.i386
libodbccr.so.1 is needed by unixODBC-devel-2.2.11-7.1.i386
libodbcdrvcfg1S.so.1 is needed by unixODBC-devel-2.2.11-7.1.i386
libodbcdrvcfg2S.so.1 is needed by unixODBC-devel-2.2.11-7.1.i386
libodbcinst.so.1 is needed by unixODBC-devel-2.2.11-7.1.i386
libodbcminiS.so.1 is needed by unixODBC-devel-2.2.11-7.1.i386
libodbcnnS.so.1 is needed by unixODBC-devel-2.2.11-7.1.i386
libodbctxtS.so.1 is needed by unixODBC-devel-2.2.11-7.1.i386
liboplodbcS.so.1 is needed by unixODBC-devel-2.2.11-7.1.i386
liboraodbcS.so.1 is needed by unixODBC-devel-2.2.11-7.1.i386
libsapdbS.so.1 is needed by unixODBC-devel-2.2.11-7.1.i386
libtdsS.so.1 is needed by unixODBC-devel-2.2.11-7.1.i386
libtemplate.so.1 is needed by unixODBC-devel-2.2.11-7.1.i386
unixODBC = 2.2.11-7.1 is needed by unixODBC-devel-2.2.11-7.1.i386
libodbc.so.1 is needed by unixODBC-kde-2.2.11-7.1.i386
libodbcinst.so.1 is needed by unixODBC-kde-2.2.11-7.1.i386
unixODBC = 2.2.11-7.1 is needed by unixODBC-kde-2.2.11-7.1.i386

Issue is because of missing rpm unixODBC-2.2.11-7.1.i386.rpm which is present in CD2 . Install it first and then the other RPM i.e
unixODBC-devel-2.2.11-7.1.i386 and unixODBC-kde-2.2.11-7.1.i386
can be installed without errors

Mount CD2
#cd /media/E*/Server
#rpm -ivh unixODBC-2.2.11-7.1.i386.rpm

Once rpm is successfully installed, mount CD3 and install unixODBC* rpm

Mount CD3
#cd /media/E*/Server
#rpm -ivh unixODBC*

Update
=====

Frits Hoogland commented on the post and pointed me to Oracle yum (Yellowdog updater modified) for taking care of dependencies. I had heard of yum but I had never tried it earlier. But as I checked today, it is very easy to setup. Process is listed at http://public-yum.oracle.com/
I am documenting the steps for setting it up on OEL5

<span style="font-family: arial, helvetica, sans-serif;">#</span> cd /etc/yum.repos.d
# wget http://public-yum.oracle.com/public-yum-el5.repo

Edit the copied file based on your OEL5 release and set enabled=1. e.g

cat /etc/enterprise-release
Enterprise Linux Enterprise Linux Server release 5.3 (Carthage)

[el5_u3_base]
name=Enterprise Linux $releasever U3 - $basearch - base
baseurl=http://public-yum.oracle.com/repo/EnterpriseLinux/EL5/3/base/$basearch/
gpgkey=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
gpgcheck=1
enabled=1

To check

[rroot@db11g ~]# yum list ocfs2
Loaded plugins: security
Error: No matching Packages to list

ocfs2 packages are not available. Let’s install it now

[root@db11g ~]# yum install ocfs2
Loaded plugins: security
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package ocfs2-2.6.18-128.el5.i686 0:1.2.9-1.el5 set to be updated
--> Processing Dependency: ocfs2-tools >= 1.2.6 for package: ocfs2-2.6.18-128.el5
--> Running transaction check
---> Package ocfs2-tools.i386 0:1.2.7-1.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                   Arch      Version             Repository        Size
================================================================================
Installing:
 ocfs2-2.6.18-128.el5      i686      1.2.9-1.el5         el5_u3_base      272 k
Installing for dependencies:
 ocfs2-tools               i386      1.2.7-1.el5         el5_u3_base      1.1 M

Transaction Summary
================================================================================
Install      2 Package(s)
Update       0 Package(s)
Remove       0 Package(s)         

Total download size: 1.4 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): ocfs2-2.6.18-128.el5-1.2.9-1.el5.i686.rpm         | 272 kB     00:03
(2/2): ocfs2-tools-1.2.7-1.el5.i386.rpm                  | 1.1 MB     00:08
--------------------------------------------------------------------------------
Total                                           102 kB/s | 1.4 MB     00:13
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : ocfs2-tools                                       [1/2]
  Installing     : ocfs2-2.6.18-128.el5                              [2/2] 

Installed: ocfs2-2.6.18-128.el5.i686 0:1.2.9-1.el5
Dependency Installed: ocfs2-tools.i386 0:1.2.7-1.el5
Complete!

It’s cool..:)
There is one more method using which all the validated oracle packages can be installed during OEL5 installation.This also creates the oracle user/groups, sets up sysctl.conf, limits.conf, etc. Check out the article
here

Installing 10.2.0.5 EM using software-only on 10.2.0.4/11g DB (GUI)

In this article , I will discuss how to install 10.2.0.5 EM Grid using 10.2.0.4 database. This method can also be used with 11g database.When you carry out 10.2.0.1 EM Grid control installation, it creates a 10.1.0.4 Database by default which is no longer supported and  requires one to upgrade to supported release i.e 10.2. In case you choose EM grid installation with existing database, then DB version need’s to be <=10.2.0.3 which you would again like to upgrade to so as to easily receive bug fixes and be on latest supported release. So if you want to use 10.2.0.4 DB or 11.1 database, you will not be able to install using existing database directly but would have to follow a upgrade path. To overcome such situation, starting 10.2.0.4 EM Grid Control we now have Software-Only install method .Using the ‘Installing Software-Only and Configuring Later’ installation method, you can install only the software of the base release and then configure it later by applying the latest patch set.

Note that 10.2.0.4 /10.2.0.5 are patchset’s and need a 10.2.0.1 base installation to work.

In case you wish to carry out the installation in silent mode, you can find OTN article at below mentioned link

http://www.oracle.com/technology/pub/articles/revitt-oem.html

There is also metalink Note 763347.1 – How to Install Enterprise Manager Grid Control 10.2.0.5.0 Using an Existing Database with the Software Only Method

One of the issue while using silent install mode is that due to Bug 7137054 (Refer Note 602750.1 ConfigureGC.pl Reports – Invalid Username/Password ), you will be required to change sys password and run the ConfigureGC.pl script multiple times. Also you would be required to enter the password’s in the response file, which you might not be comfortable with. (Yeah in some environments, people can be very particular 🙂 )

While using GUI mode, I did not face any issues arising out of bug 7137054. Below steps are tried on a 10.2.0.4 database (11g database can also be used) and Platform is AIX 5L. Installation steps would remain same for other platforms too (In windows you will have to check the steps where in you are supposed to run scripts. GUI part should remain same)

Steps To Perform 10.2.0.5 EM Grid Installation using Software-only Install Method – GUI

1. Ensure that  database parameters are set to following values. This is important as OUI checks for these values and if it is not set , then installation fails

job_queue_processes 10
db_block_size 8192
timed_statistics TRUE
open_cursors 300
session_cached_cursors 200
aq_tm_processes 1
compatible <currently installed Oracle Database release> (default)
undo_management AUTO
undo_retention 10800
undo_tablespace <any acceptable name>
processes 150
log_buffer 1048576
statistics_level TYPICAL (Note that this value is specific only to Enterprise Manager 10g Repository Database release and later.)
TEMP space (Tablespace)Foot 1 50 MB (extending to 100 MB)
_b_tree_bitmap_plans false (hidden parameter)

2. Ensure that dbconsole repository is not present in the database. If it is, then remove it. You need to stop the dbconsole before starting the process.

 $ORACLE_HOME/bin/emctl stop dbconsole

Remove the following directories from your filesystem:

rm -rf $ORACLE_HOME/(hostname_sid)
rm -rf $ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole_(hostname)_(sid)

Removing DB Repository

ALTER system ENABLE RESTRICTED SESSION ;
EXEC sysman.emd_maintenance.remove_em_dbms_jobs;
EXEC sysman.setEMUserContext('',5);
REVOKE dba FROM sysman;
DECLARE CURSOR c1 IS SELECT owner, synonym_name name FROM dba_synonyms WHERE table_owner = 'SYSMAN';
 BEGIN
FOR r1 IN c1
 LOOP
IF r1.owner = 'PUBLIC'
THEN
 EXECUTE IMMEDIATE 'DROP PUBLIC SYNONYM '||r1.name; ELSE EXECUTE IMMEDIATE 'DROP SYNONYM '||r1.owner||'.'||r1.name;
END IF;
 END LOOP;
 END;
/
DROP USER mgmt_view CASCADE;
 DROP ROLE mgmt_user;
DROP USER sysman CASCADE;
 ALTER SYSTEM DISABLE RESTRICTED SESSION;

3.Log in to the database as SYSDBA and run the following command to install DBMS_SHARED_POOL package:

@?/rdbms/admin/dbmspool.sql

commit;

4. Install the 10.2.0.1 database using -noconfig option i.e to skip the configuration part. This will be carried out in the end by running ConfigureGC.pl script

./runInstaller -noconfig

Choose Installation with Existing Database

Specify the ORACLE_BASE Location under which you would like to install the EM Grid

You will be now prompted to enter the database details for the Repository database. Ensure that listener is UP.

a)In the Configure Email Notification section, specify an appropriate e-mail address, and the corresponding SMTP server name. You will receive important information on the condition of the monitored targets, including critical alerts at this e-mail address.

b)Specify the My Oracle Support (formerly Metalink) credentials.

c)Specify the Proxy Information if Grid Control is using a proxy server for external access


Refer to following documentation link for more information

http://download.oracle.com/docs/cd/B16240_01/doc/install.102/e10953/installing_em.htm#CHDJJBCJ

a)Specify the password for Securing agent
b)Specify password for SYSMAN user. Please note that default ias_admin password is the same as the password assigned to the SYSMAN account. This is required to access the Oracle application server console



OUI will install OMS under $BASE_DIR/oms10g

OUI will install Management Agent under $BASE_DIR/agent10g

Once the installation finishes , you will be prompted to run allroot.sh script (as shown below). Before executing it, stop all the OPMN processes by running the following command from the Oracle home directory of the OMS (for example, oms10g):

Open a different shell and execute following commands using Oracle Software owner

Processes in Instance: EnterpriseManager0.db11g
-------------------+--------------------+---------+---------
ias-component      | process-type       |     pid | status
-------------------+--------------------+---------+---------
DSA                | DSA                |     N/A | Down
HTTP_Server        | HTTP_Server        |     N/A | Down
LogLoader          | logloaderd         |     N/A | Down
dcm-daemon         | dcm-daemon         |     N/A | Down
OC4J               | home               |     N/A | Down
WebCache           | WebCache           |     N/A | Down
WebCache           | WebCacheAdmin      |     N/A | Down

$./opmnctl stopall
opmnctl: stopping opmn and all managed processes...

$./opmnctl status
Unable to connect to opmn.
Opmn may not be up.

Now run the script allroot.sh as Root.


You will get a message that configuration assistants were skipped. You can ignore it as we used -noconfig method



Installation for 10.2.0.1 Base release is complete now. We now need to proceed towards 10.2.0.5 Patchset installation


5. Run following command from 10.2.0.5 patchset directory.

<span style="font-size: small;"> </span>cd $patch_dir/3731593/Disk1
./runInstaller -noconfig b_softwareonly=true

Choose OMS home to patch and proceed


You will be prompted for Sys password


Enter ias_admin Password. This will be same as SYSMAN password


Application server console will be now shutdown. You will get a message confirming same. Click Ok.

After Installation completes , you will be prompted to run root.sh (as shown below) as root from OMS_HOME


6. Next apply 10.2.0.5 patchset to AGENT_HOME by issuing following command.

<span style="font-size: small;">.</span>/runInstaller -noconfig

Select AGENT_HOME for patching i.e agent10g


After Installation completes , you will be prompted to Run root.sh (as shown below) from Oracle Home for Management Agent ($BASE_DIR/agent10g)


7.Now the installation part is over. Next we need to run ConfigureGC.pl script which will actually configure 10.2.0.5 Grid Control.

Before making changes to the environment variable PERL5LIB, take a backup of the variable:

 setenv PERL5LIB_BACKUP $PERL5LIB

Set PERL5LIB to $OMS_ORACLE_HOME/perl/lib/5.6.1

export PERL5LIB=/db40/temp2/oms10g/perl/lib/5.6.1

Configure Grid Control by running the ConfigureGC.pl script from the Oracle home directory of the OMS

/db40/temp2/oms10g/perl/bin/perl /db40/temp2/oms10g/sysman/install/ConfigureGC.pl /db40/temp2

This script will take long time (took 2 hrs on my setup). You can monitor $OMS_ORACLE_HOME/cfgtoollogs/cfgfw/ CfmLogger*log file to check for any errors

The plug-in Starting Oracle Management Server has successfully been performed
------------------------------------------------------
------------------------------------------------------
The plug-in EMCLI Configuration is running

Operation EMCLI Setup is in progress.

The plug-in EMCLI Configuration has successfully been performed
------------------------------------------------------
The action patchsetConfiguration has successfully completed
###################################################

Once you get message that the configuration is complete, then check the status for OMS and AGENT

$OMS_ORACLE_HOME/bin/emctl status oms
$AGENT_ORACLE_HOME/bin/emctl status agent

You can now proceed with Agent installation on the targets to be monitored