Monday, November 29, 2010

Upgrade to Oracle Database 11g Release 11.2.0.2

For details Please explore Document 1189783.1
Starting with the first patch set for Oracle Database 11g Release 2 (11.2.0.2), Oracle Database patch sets are full installations of the Oracle Database software. In past releases, Oracle Database patch sets consisted of a set of files that replaced files in an existing Oracle home. Beginning with Oracle Database 11g Release 2, patch sets are full installations that replace existing installations.

Because Oracle Database 11g Release 2 and later patch sets are a full installation, Oracle patch sets are now released as several installation bundles, just as are the base releases:
• Oracle Database Server
• Oracle Grid Infrastructure
• Oracle Database Client
• Companion/examples
• Oracle Gateways

Simplified new installation: Because the release 11.2.0.2 patch set is a full installation package, if you are installing Oracle Database on a system without an existing Oracle Database installation, then you can simply install the release 11.2.0.2 patch set. You are no longer required to install the base release, and then apply the patch set.

Upgrade process: Beginning with the release 11.2.0.2 patch set, you have two ways to apply a patch set:
• Out-of-place upgrade – This is Oracle's recommended way to apply a patch set. You install the patch set into a new, separate Oracle home location. After you install the patch upgrade, you then migrate the Oracle Database from the older Oracle home. The patch set upgrade is now the same process to upgrade from one version to another. Oracle recommends that you perform an out-of-place patch set upgrade, because this patch set application option requires much less downtime, and is safer because it does not require patching an ORACLE_HOME that is already being used in production. However, you must ensure that you have sufficient free disk space to accommodate two Oracle home directories at the same time.
• In-place upgrade – You install the patch set into an existing Oracle home location. Oracle recommends that you select this option only if you do not have sufficient free disk space to perform an out-of-place upgrade, as the upgrade removes the existing Oracle installation. This patch option requires less disk space, but requires more time, and is riskier, because if you encounter an installation failure, then you must recover the entire existing Oracle home from a backup. If you choose this more risky option, then before you begin the patch installation, complete the following tasks:
o Make a complete backup of your existing Oracle home
o Read through the entire Upgrade Guide section dealing with in-place upgrades
Direct upgrade from previous releases: You can upgrade from a previous Oracle Database release directly to the latest patch set, without having to install the base release. For example, if you want to upgrade from Oracle Database 10g Release 2, or Oracle Database 11g Release 1, then you can upgrade directly to Oracle Database 11g Release 2, patch set 2 (11.2.0.2) using an out-of-place upgrade. Oracle now supports direct upgrades to the release 11.2.0.2 patch set from any release where direct upgrade to the base release (11.2.0.1) is supported, as well as direct upgrades from 11.2.0.1 to 11.2.0.2.

New Features Available in Patch Sets

In addition to the usual set of fixes, the release 11.2.0.2 patch set contains a small number of features that complete the Database 11g Release 2 feature set. The new features fall into the following five categories:
• General improvements
• Oracle Automatic Storage Management Cluster File System (ACFS) improvements
• Quality of Service Management
• Database Replay
• Management
How to Download
To download the software from My Oracle Support:

1.Log on to My Oracle Support.
2.Click Patches & Updates.
3.In the Patch Search section, click the Search tab.
4.Enter 10098816 in the patch number field.
5.Select a platform to download.
6.Click Search.
7.In the Patch Search Results page, under Patch Name, click the patch number to display the patch details.
8.Click Download.
9.From the File Download window, click each file name to download the selected software.
List of files:
Zip File                                                  Installation Type

p10098816_112020_platform_1of7.zip    Oracle Database (includes Oracle Database and Oracle RAC)
p10098816_112020_platform_2of7.zip    Note: you must download both zip files to install Oracle Database.
p10098816_112020_platform_3of7.zip    Oracle Grid Infrastructure (includes Oracle ASM, Oracle Clusterware, and Oracle Restart)
p10098816_112020_platform_4of7.zip   Oracle Database Client
p10098816_112020_platform_5of7.zip   Oracle Gateways
p10098816_112020_platform_6of7.zip   Oracle Examples
p10098816_112020_platform_7of7.zip   Deinstall

Saturday, November 27, 2010

Inastallation of Oracle Web Cashe as Load Balancer

Inastallation of Oracle Web Cashe as Load Balancer
We are going to install Oracle Web Cashe on Solaris SPARK system.

Step 1.
Create a user and give it DBA group.
Step 2.
Create folder and give read write permissions for this folder to the user.
Step 3.
Create entery in oraInst.loc in oraInventory.
Step 4.
Set the DISPLAY variable as to your ip address and export it.
Run the windowing service.
Login as the user the run the file runInstaller.
Give the PATH on which you want to install the webcashe.
At the end Installation will fail because on Solaris you need to add one patch which is a pre-requisite.Patch Number -4025481
Shutdown the services and start again.

Wednesday, November 24, 2010

Dropping and Recreating the Temporary Table Space

TABLESPACE usage details:

select TABLESPACE_NAME, BYTES_USED, BYTES_FREE from V$TEMP_SPACE_HEADER;

TABLESPACE_NAME                BYTES_USED BYTES_FREE
------------------------------ ---------- ----------
TEMP                             52428800   52428800

True free space within the used portion of the TEMPFILE

SELECT   A.tablespace_name tablespace, D.mb_total,
         SUM (A.used_blocks * D.block_size) / 1024 / 1024 mb_used,
         D.mb_total - SUM (A.used_blocks * D.block_size) / 1024 / 1024 mb_free
FROM     v$sort_segment A,
         (
         SELECT   B.name, C.block_size, SUM (C.bytes) / 1024 / 1024 mb_total
         FROM     v$tablespace B, v$tempfile C
         WHERE    B.ts#= C.ts#
         GROUP BY B.name, C.block_size
         ) D
WHERE    A.tablespace_name = D.name
GROUP by A.tablespace_name, D.mb_total;

 To find who is using the temporary segment

select s.username, u."USER", u.tablespace, u.contents, u.extents, u.blocks
from   sys.v_$session s, sys.v_$sort_usage u
where  s.saddr = u.session_addr
/

select s.osuser, s.process, s.username, s.serial#,
       sum(u.blocks)*vp.value/1024 sort_size
from   sys.v_$session s, sys.v_$sort_usage u, sys.v_$parameter vp
where  s.saddr = u.session_addr
  and  vp.name = 'db_block_size'
  and  s.osuser like '&1'
group  by s.osuser, s.process, s.username, s.serial#, vp.value
/

Create New Temporary Tablespace:
Create new temporary tablespace
CREATE TEMPORARY TABLESPACE TEMP2 TEMPFILE '/U01/ORADATA/ TEMP2.DBF' SIZE 200M;
Assign all users to new Tablespace:
Assign all users to this new tablespace.
ALTER DATABASE DEFAULT TEMPORARY TABLESPACE TEMP2;
Find Inactive Sessions:
Now you will find inactive sessions in V$SORT_USAGE table by running below command.
SELECT A2.TABLESPACE, A2.SEGFILE#, A2.SEGBLK#, A2.BLOCKS, A1.SID, A1.SERIAL#, A1.USERNAME, A1.OSUSER, A1.STATUS FROM V$SESSION A1,V$SORT_USAGE A2 WHERE A1.SADDR = A2.SESSION_ADDR;
Kill Inactive Sessions:
Kill the inactive sessions by using SID and SERIAL# from previous resultset.
ALTER SYSTEM KILL SESSION 'SID_NUMBER, SERIAL#';
Drop Previous Tablespace:
Finally drop the previous table space.

Monday, November 22, 2010

How to deal with Multiple Entries for the same host in Grid Control

How to deal with Multiple Entries for the same host in Oracle Enterprise Manager Grid Control 10g.
Steps:
Please find below the steps to remove the host entry. 
Delete targets discovered using the Agent. Targets-->Oracle Applications-->Remove. Wait around 20 min to let it complete.
To view the removal status, click on the global "Setup" link
--> Management Services and Repository
--> Overview page
--> General section
--> Deleted Targets
However,  you can change the host property of an agent through emcli utility . It will not create the duplicate entry.
How to setup emcli:
http://download.oracle.com/docs/cd/B16240_01/doc/em.102/b40004/cli.htm#sthref10
Emcli sample command:
emcli modify_target -name="" -type="" -properties="MachineName=hostname.domainname" -on_agent

oracle.apps.fnd.oam.em.sdk.targetData.discovery.AppsDiscoveryException: Fail to get EMDClient for Host hostname

Error:
Caused By: oracle.apps.fnd.oam.em.sdk.targetData.discovery.AppsDiscoveryException: Fail to get EMDClient for Host hostname
Caused By: java.sql.SQLException: ORA-01403: no data found
ORA-06512: at "SYSMAN.EM_JOB_UTIL", line 1087
ORA-06512: at "SYSMAN.MGMT_JOB_ENGINE", line 19035
ORA-06512: at line 1

Cause:
Hostname lacks domainname

Solution:
Step 1.  Bounce the Agent.
Step 2.  Create a backup copy of AGENT_HOME/sysman/emd/targets.xml.
Step3. Edit targets.xml and change the host property from hostname to hostname.domainname
Step4. Start , upload the agent and redo the discovery.

If this doesn’t work , you can restore the targets.xml.

However,  you can change the host property of an agent through emcli utility . It will not create the duplicate entry.
How to setup emcli:
http://download.oracle.com/docs/cd/B16240_01/doc/em.102/b40004/cli.htm#sthref10
Emcli sample command:
emcli modify_target -name="" -type="" -properties="MachineName=hostname.domainname" -on_agent

ORA-24005: must use DBMS_AQADM.DROP_QUEUE_TABLE to drop queue tables


ORA-24005: must use DBMS_AQADM.DROP_QUEUE_TABLE to drop queue tables
It appears that queue tables were not dropped cleanly in the past and may have some left over entries in the data dictionary.
Run following to get queue table name

select object_name, object_type, status from dba_objects where owner =’USERNAME’ and object_name like 'AQ%' order by object_name;

queue table name is on the middle AQ__X


For example: AQ$_RATINGCACHEQUEUE_I, queue table is RATINGCACHEQUEUE

You can first run following for each queue table

conn / as sys
exec DBMS_AQADM.DROP_QUEUE_TABLE(queue_table => '.', force => TRUE);

For example:

For AQ$_TICKETQUEUE_H table, queue table is TICKETQUEUE, then

exec DBMS_AQADM.DROP_QUEUE_TABLE(queue_table => 'USERNAME.TICKETQUEUE', force => TRUE);

and then carry rest of the manual cleaning steps from document Note 203225.1

Sunday, November 14, 2010

Installing Oracle Enterprise Manager Grid Control 11g on RHEL 5



In this article I will take you through step by step installation of Oracle Weblogic Server,Oracle Database 11g and Enterprise Manager Grid Control 11g.
Please make sure following rpm's are installed.
binutils
compat-libstdc++
elfutils-libelf
glibc-2.5-12
glibc-2.5-24
ksh
libaio
libgcc
libstdc++
make
elfutilslibelf-devel
elfutils-libelf-devel-static
kernel-headers
glibcheaders
glibc-devel
libstdc++-devel
libgomp
gcc
gcc-c++
libaiodevel
sysstat
unixODBC
unixODBC-devel
rng-utils
setarch
compatdb
pdksh
compat-libstdc++-33
compat-libstdc++-296
lsof
strace
wget
system-config-lvm


Installation Oracle WebLogic Server 11gR1 (10.3.2)
. Before installing,  create OS users and group.
groupadd dba
useradd -g dba -G oinstall oraoem
mkdir /u01/app/oraoem/Middleware
chown -R oraoem:dba /u01/app/oraoem/Middleware
./wls1032_linux32.bin








Install Database 11gR2
The following requirements are necessary:
/etc/sysctl.conf:
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
fs.aio-max-nr = 1048576
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 = 1048576
/etc/security/limits.conf:
ora11gr2 soft nproc 2047
ora11gr2 hard nproc 16384
ora11gr2 soft nofile 1024
ora11gr2 hard nofile 65536
oraoem soft nproc 2047
oraoem hard nproc 16384
oraoem soft nofile 1024
oraoem hard nofile 65536
/etc/profile:
if [ $USER = "ora11gr2" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -u 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
if [ $USER = "oraoem" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -u 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
useradd -g dba ora11gr2
mkdir -p /u01/app/ora11gr2
chown -R ora11gr2:dba /u01/app/ora11gr2
unzip linux_11gR2_database_1of2.zip
unzip linux_11gR2_database_2of2.zip
export ORACLE_BASE=/u01/app/ora11gr2
./runInstaller
At this point, we are installing Oracle Binaries only, without creating a database.











Installation of RDBMS patches:
I recommend to download and install these patches:
OPatch p6880880_112000_LINUX.zip
p6880880_112000_LINUX.zip
p9165206_112010_LINUX.zip
p9352237_112010_LINUX.zip
DBCA

















Network Configuration (Listener, TNS)










 

Database Preparations
Ensure that the UNDO tablespace and the TEMP tablespace are autoextensible in
the existing, certified Oracle Database. Moreover, resize UNDO tablespace to
>200M.
Documentation mentions that for RDBMS 11.2.0.1 as Grid Control Repository, patch for
bug# 9002336 and 9067282 should be installed. I prefer to install PSU 11.2.0.1.1, which
contains bugfix 9067282. Bug 9002336 can be addressed by underscore parameter
"_optimizer_distinct_agg_transform = false"
SQL> alter system set "_optimizer_distinct_agg_transform"=false
scope=spfile;
SQL> alter system set log_buffer=10485760 scope=spfile;
SQL> alter system set processes = 500 scope=spfile;
SQL> alter system set session_cached_cursors=200 scope=spfile;
SQL> alter database datafile
'/u01/app/ora11gr2/oradata/EMREP/undotbs01.dbf' resize 256M;
Check whether fine grained access control is installed:
select value from v$option where parameter = 'Fine-grained
access control';
At this point, deinstall DB Control:
./emca -deconfig dbcontrol db -repos drop
Note:
My Oracle Support Node 561429.1 mentions that 11.2.0.1 can only be used as repository,
if DNS is used. For my demo installation, I prefer usage of /etc/hosts. I have tested and
found no issues without DNS.


Upgrade Weblogic Server To WDJ7


cd /u01/app/oraoem/Middleware
cd utils/bsu
./bsu.sh









Click Tab "Get Patches", Select WDJ7 and click "Download Selected".



Instllation Enterprise Manager Grid Control 11g












Installation is now complete and Grid Control can be accessed via browser:
https://testsystem:7799/em/
Click on "Setup" Tab, then Agents, then testsystem:3872. Then you see that EMREP database
is not configured yet.
Unlock and set the password:
SQL> user dbsnmp identified by xxx account unlock;
Configure the respective password for dbsnmp and finish.
Enterprise Manager Grid Control 11g Patches
Environment-Files:
/home/oraoem/OMS.env:
export ORACLE_HOME=/u01/app/oraoem/Middleware/oms11g
export PATH=$ORACLE_HOME/bin:$PATH
/home/oraoem/AGENT.env:
export ORACLE_HOME=/u01/app/oraoem/Middleware/agent11g
export PATH=$ORACLE_HOME/bin:$PATH
Stoppen von OMS und Agent
as root: /etc/init.d/gcstartup stop
OMS Patch: (as oraoem)
. /home/oraoem/OMS.env
unzip p9659466_111010_Generic.zip
cd 9659466
/u01/app/oraoem/Middleware/oms11g/OPatch/opatch apply
/u01/app/oraoem/Middleware/oms11g/bin/rcuJDBCEngine
sys/xxx@ora-vm2.intra:1521:EMREP JDBC_SCRIPT
post_install_script.sql $PWD $ORACLE_HOME
Agent Patch: (as oraoem)
. /home/oraoem/AGENT.env
unzip p9738008_111010_LINUX.zip
cd 9738008
/u01/app/oraoem/Middleware/agent11g/OPatch/opatch apply
unzip p9676134_111010_Generic.zip
cd 9676134
/u01/app/oraoem/Middleware/agent11g/OPatch/opatch apply