Wednesday, August 26, 2009

How to put oracle database in Archive log mode


Archive log and No-Archive log
We have the option of running the database in archive log or no- archive log (default). The difference between archive log and no-archive log is that in no-archive log the online redo log group which are used in cyclic manner and not backup up. In archive log, the redo logs are archived and for each redo log an archive log file is created.
The advantage of archive log is that the backup of database along with archive logs provides the complete recovery of database. Also, hot/online backups are possible only if the database is in archive log mode. However
In no-archive log mode, the database can be recovered only till the last available backup. All the changes done after the backup was taken needs to be redone.
How to put the database in Archive log mode
Make the following optional changes in the init. ora. If these changes are not made then default format and destination will be used by oracle.
log_archive_dest_1='location=/u01/archivelog'
LOG_ARCHIVE_FORMAT = arch_%t_%s_%r.arc
#log_archive_start=TRUE

Please note that in oracle 10g we don't need to give "log_archive_start=TRUE". It is required only in oracle 9i. Also we can specify upto 10 locations using the parameter "log_archive_dest_n" where n can have following values--1,2,..9. Also instead of local location we can specify a standby database using "service" instead of "location" parameter.
Now shutdown the database and mount it. Now execute the following command->
alter database archivelog;
Now open the database using
alter database open;
Now you can check whether the database is in archive log or not using
archive log list;
Also you can query the following tables->
v$log,v$archived_log

Merge Patches using admrgpch

Admrgph utility is used to merge two or more patches in oracle apps. The advantage of merging patches is that it reduces downtime as the repetitive task of compiling invalid database objects,  generating forms and reports,jar files etc.
How to use Admrgpch to merge patches
Download the  patches in /patch directory. Now create 2 subdirectory in /patch say mergesource -which contains  the unzipped patches to be merged and mergedest -which contains the merged patch. Please note that both mergesource and mergedest should be created as immediate child of same parent directory say /patch. Now you can execute the following command to merge the patches.
admrgpch -s <source> -d <dest> -merge_name <mergename>
For example->
admrgpch -s </patch/mergesource> -d </patch/mergedest> -merge_name <amebrup2>
Please make sure the the merge path log file "admrgpch.log" does not contain any error. If the  above command to merge patches completes successfully then it displays the following->
Executing the merge of the patch drivers
-- Processing patch: /patch/mergesource/5708576
-- Done processing patch: /patch/mergesource/5708576
-- Processing patch: /patch/mergesource/4428060
-- Done processing patch: /patch/mergesource/4428060
Copying files...
5% complete. Copied 269 files of 5373...
10% complete. Copied 538 files of 5373...
15% complete. Copied 806 files of 5373...
20% complete. Copied 1075 files of 5373...
25% complete. Copied 1344 files of 5373...
30% complete. Copied 1612 files of 5373...
35% complete. Copied 1881 files of 5373...
40% complete. Copied 2150 files of 5373...
45% complete. Copied 2418 files of 5373...
50% complete. Copied 2687 files of 5373...
55% complete. Copied 2956 files of 5373...
60% complete. Copied 3224 files of 5373...
65% complete. Copied 3493 files of 5373...
70% complete. Copied 3762 files of 5373...
75% complete. Copied 4030 files of 5373...
80% complete. Copied 4299 files of 5373...
85% complete. Copied 4568 files of 5373...
90% complete. Copied 4836 files of 5373...
95% complete. Copied 5105 files of 5373...
100% complete. Copied 5373 files of 5373...
Character-set converting files...
  2 unified drivers merged.
Patch merge completed successfully
Please check the log file at ./admrgpch.log
Now go to the destination merge patch directory say "mergedest". You can see that the admrgpch already created a driver with name "u_<mergename>.drv" say u_amebrup2.drv. Now apply the merged patch as a single patch using  adpatch. So you have to give this driver name u_<mergename>.drv" when prompted.
Restrictions of admrgpch ->
It will not merge patches of different releases,platform,different parallel modes. Also do not use admrgpch to merge AD and Non-AD patches ad AD patches will change the patch utility itself.

Technorati Tags: ,,,,

Wednesday, July 1, 2009

How to find if server is single node or multi node

Oracle apps can be implemented on single node or multi node.
In single node-database,CM,Reports,forms,Apache are all on one single server only.
In multi-node we can have these components on different servers.
A typical 2-node server has the following->
1st node-database,CM,reports
2nd node-forms,Apache
A typical 3 node server has the following->
1st node-database
2nde node-CM,reports
3rd node-forms,Apache
Here's how to find out if the server is single node or multi node->
1-select * from fnd_nodes(It also contain column like "support_forms","support_web","support_web","support_db","support_admin" which identifies which tier it supports)
2-OAM-oracle applications manager
3- context file(Has variables s_isDB, s_isAdmin, s_isWeb, s_isForms,s _isConc which identifies which tier it supports)

How to change hostname in application tier in oracle apps

This summary is not available. Please click here to view the post.

How to change hostname on database tier in oracle apps

This summary is not available. Please click here to view the post.

Tuesday, June 30, 2009

Rebuild Index Online in oracle

In the following scenarios, one can think about rebuilding indexes->
1 If the ratio of deleted to actual leaf entries is more than 20% or
2 If the "blevel">3 (in table dba_indexes)
Here's how you can find it.You are supposed to do
analyze index validate structure
;
and then query the view INDEX_STATS
SELECT name,height,lf_rows,del_lf_rows,(del_lf_rows/lf_rows)*100 FROM INDEX_STATS;

Here's the command to rebuild indexes ->
alter index rebuild online;
You will require twice the space because during index rebuilding, the old index will still be there and will be dropped only when the new one has been created successfully.
References-> Oracle metalink document Id-182699.1 when and how to rebuild indexes. It provides the "bde_rebuild" script to automate rebuilding indexes .

The index creation can be made faster using the following->
alter index rebuild online  parallel 8 nologging;
Change index to normal logging and noparallel->
alter index parallel 1 logging;

Friday, April 24, 2009

Upgrade oracle database from 9i to 10g

Oracle apps version-11.5.10.2, database version-9.20.5, os-solaris 9 -64 bit, upgraded database version-10.2.0.4
Space requirement-->
RAM-atleast 1G, Swap space-1.5 times to .75 times the space of RAM, 400 MB of disk space in the /tmp directory, Between 1.5 GB and 3.5 GB of disk space for the Oracle software, depending on the installation type
/bin/isainfo -kv
If it displays -64-bit sparcv9 kernel modules then only you can install oracle 10g.
The following kernel parameters are also required->
Parameter Recommended Value
noexec_user_stack 1
semsys:seminfo_semmni 100
semsys:seminfo_semmns 1024
semsys:seminfo_semmsl 256
semsys:seminfo_semvmx 32767
shmsys:shminfo_shmmax 4294967295
shmsys:shminfo_shmmin 1
shmsys:shminfo_shmmni 100
shmsys:shminfo_shmseg 10
One can check these values in /etc/system.You can modify them by taking a backup of system file and the parameter
set semsys:seminfo_semmni=100
and then reboot the server using "reboot" command.
The database sid and listener port was kept same.
-Apply apps interoperability patch-10g Release 2 interoperability patch for 11.5.10 (4653225)
Install 10.2 oracle home in a different directory than 9i
login as "oracle" user
Set the following environment variables->>
TMP=/tmp
TMPDIR=/tmp
export TMP TMPDIR
ORACLE_HOSTNAME=xxx.yyy.com
export ORACLE_HOSTNAME
ORACLE_BASE=/u07/fatstdb
export ORACLE_BASE
ORACLE_HOME=/u07/fatstdb/10g
export ORACLE_HOME
unset TNS_ADMIN
Goto Advanced option->
image
Select Enterprise Edition->
image
Specify the path for 10g oracle home->
image
Verify that all the pre-req checks completed successfully->
image
Select "No" when it prompts you for "Do you want to upgrade the database now?"
image
Select "Install Database Software Install' only.
image
image
Run root.sh as root user when it prompts to do so.
image
The 10g software has been successfully installed.
Now install the 10g companion products-->
image
Specify the same ORACLE_HOME and path as specified while installing 10g software->
image
Select "Oracle 10g Products 10.2.0.1.0"
image
Verify that all the pre-req checks completed successfully->
image
image
image
Above shows that the oracle 10g products installation was successful.
Perform 10.2.0.4 patch set pre-installation tasks
SELECT version FROM v$timezone_file;
If this reports a version lower or higher then 4, see OracleMetalink document 553812.1 Actions for the DSTv4 update in the Release 10.2.0.4 patchset.
ORACLE_HOME=/u07/fatstdb/10g

export ORACLE_HOME


PERL5LIB=/u07/fatstdb/10g/perl/lib/5.8.3:/u07/fatstdb/10g/perl/lib/site_perl/5.8.3


export PERL5LIB


LD_LIBRARY_PATH=/u07/fatstdb/10g/lib:/usr/dt/lib:/usr/openwin/lib::/opt/sfw/lib


export LD_LIBRARY_PATH


PATH=/usr/ccs/bin:/usr/sbin/usr/bin:/usr/ucb:/usr/ccs/bin:/etc:/usr/local/bin:/u07/fatstdb/10g/bin:/u07/fatstdb/10g/perl/bin:/usr/bin


export PATH
Run runinstaller.sh
image
Specify the same ORACLE_HOME and path as specified while installing 10g software->
image
Verify that all the pre-req checks completed successfully->
image
image
image
Run root.sh from root user
image
The above shows that 10.2.0.4 patch set installation was successful.
Create nls/data/9idata directory-
Login to new 10g oracle home and execute ->
perl cr9idata.pl
Creating directory /u07/fatstdb/10g/nls/data/9idata ...
Copying files to /u07/fatstdb/10g/nls/data/9idata...
Copy finished.
Please reset environment variable ORA_NLS10 to /u07/fatstdb/10g/nls/data/9idata!
Now set
ORA_NLS10=/u07/fatstdb/10g/nls/data/9idata
export ORA_NLS10
Shut down Applications server processes
If event="38004 trace name context forever, level 1" is defined in either the init<SID>.ora initialization parameter file or the spfile<SID>.ora server parameter file, remove it.
Unset the TNS_ADMIN environment variable.
Run the Pre-Upgrade Information Tool
copy the "utlu102i.sql" file from 10g oracle_home/rdbms/admin to some directory outside 10g home. Then connect to 9i oracle.
cp utlu102i.sql /u07/10gpreupg
sqlplus "/ as sysdba"
SPOOL info.log
@utlu102i.sql
Then, check the spool file and examine the output of the upgrade information tool.
Issues-->
Deprecated CONNECT Role
SELECT grantee FROM dba_role_privs WHERE granted_role = 'CONNECT' and grantee NOT IN ( 'SYS', 'OUTLN', 'SYSTEM', 'CTXSYS', 'DBSNMP', 'LOGSTDBY_ADMINISTRATOR', 'ORDSYS', 'ORDPLUGINS', 'OEM_MONITOR', 'WKSYS', 'WKPROXY', 'WK_TEST', 'WKUSER', 'MDSYS', 'LBACSYS', 'DMSYS', 'WMSYS', 'OLAPDBA', 'OLAPSVR', 'OLAP_USER', 'OLAPSYS', 'EXFSYS', 'SYSMAN', 'MDDATA', 'SI_INFORMTN_SCHEMA', 'XDB', 'ODM');

If users or roles require privileges other than CREATE SESSION, then grant the specific required privileges prior to upgrading
Database Links With Passwords
During the upgrade to Oracle Database 10g, any passwords in database links will be encrypted. To downgrade back to the original release, all of the database links with encrypted passwords must be dropped prior to the downgrade. Consequently, the database links will not exist in the downgraded database. If you anticipate a requirement to be able to downgrade back to your original release, then save the information about affected database links from the SYS.LINK$ table, so that you can recreate the database links after the downgrade.
select 'create database link ' name ' connect to ' userid ' identified by ' password ' using '''''host ''''';' from sys.link$;
TIMESTAMP WITH TIMEZONE Datatype
The time zone files that are supplied with Oracle Database 10g have been updated from version 1 to version 2 to reflect changes in transition rules for some time zone regions. The changes may affect existing data of TIMESTAMP WITH TIME ZONE datatype. To preserve this TIMESTAMP data for updating according to the new time zone transition rules, you must run the utltzuv2.sql script on the database before upgrading. This script is located in the new 10.2 ORACLE_HOME/rdbms/admin directory. This script analyzes your database for TIMESTAMP WITH TIME ZONE
columns that are affected by the updated time zone transition rules
Optimizer Statistics
exec dbms_stats.gather_schema_stats('SYS',options=>'GATHER', estimate_percent =>DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade =>TRUE);
exec dbms_stats.gather_schema_stats('CTXSYS',options=>'GATHER', estimate_percent =>DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade =>TRUE);
exec dbms_stats.gather_schema_stats('ODM',options=>'GATHER', estimate_percent =>DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade =>TRUE);
exec dbms_stats.gather_schema_stats('OLAPSYS',options=>'GATHER', estimate_percent =>DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade =>TRUE);
exec dbms_stats.gather_schema_stats('ORDSYS',options=>'GATHER', estimate_percent =>DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade =>TRUE);
exec dbms_stats.gather_schema_stats('MDSYS',options=>'GATHER', estimate_percent =>DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => 'FOR ALL COLUMNS SIZE AUTO', cascade =>TRUE);
Make a list of invalid objects
select object_name,owner from dba_objects where status='INVALID';
Shutdown db listener and database
Run $10oracle_home/bin/netca to configure a version 10 listener
select listener configuration->
image
select Add->
image
select listener name->
image
select TCP protocol->
image
Specify the listener port->
image
Specify No.
image
Listener configuration is successful.
Now copy this init<sid>.ora to $10goracle_home/dbs
Add the following parameters------->
streams_pool_size = 50331648
large_pool_size =8388608
session_max_open_files = 20
Comment the following parameters---->
--> "optimizer_max_permutations"
--> "row_locking"
--> "undo_suppress_errors"
--> "max_enabled_roles"
--> "enqueue_resources"
--> "sql_trace"
Upgrade the database
image
Select the database you want to upgrade->
image
Click Yes
image
image
Specify location of sysaux tablespace
image
Select "recompile invalid objects at the end of upgrade"->
image
select the backup option you want->
image
Specify the Enterprise manager option->
image
Specify "Flash Recovery" option if you want->
image
Specify the passwords for dbsnmp and sysman->
image
Finally it shows the database upgrade summary-->
image
image
DBUA will show the progress->
image
Finally DBUA shows the 10g upgrade result->
image
image
Modify initialization parameters
Fix Korean lexers
sqlplus "/ as sysdba" @$ORACLE_HOME/ctx/sample/script/drkorean.sql
Run adgrants.sql -
if >=AD.I or 11.5.10
sqlplus "/ as sysdba" @adgrants.sql  APPLSYS
Grant create procedure privilege on CTXSYS
Copy $AD_TOP/patch/115/sql/adctxprv.sql from the administration server node to the database server node
sqlplus apps/<APPS password> @adctxprv.sql \
    <SYSTEM password> CTXSYS
Implement and run AutoConfig on db tier
Gather statistics for SYS schema
Copy $APPL_TOP/admin/adstats.sql from the administration server node to the database server node.
sqlplus "/ as sysdba"
SQL> shutdown normal;
SQL> startup restrict;
SQL> @adstats.sql
SQL> shutdown normal;
SQL> startup;
SQL> exit;

Re-create grants and synonyms
Apply Oracle Receivables patch
Apply Oracle Receivables patch 5753621.
Restart the application tier

Saturday, February 28, 2009

How to keep a Table in Buffer Pool

To cache an oracle table in memory, there is a special type of buffer pool called the KEEP buffer pool. Its significance is that we can keep the frequently accessed tables in memory so that oracle does not have to frequently read the data blocks for that table from disk to memory and hence saves the over-head involved and hence leads to improvement in performance

Consider the scenario where we have a table and it is accessed frequently. Now due to cyclic usage of buffer pool, when the buffer pool gets filled up the table gets removed from buffer pool to make room for another table.Now by keeping the table in KEEP buffer pool,the table remains longer in buffer pool thus avoiding the overhead of reading the blocks frequently from the disk to sga.

However the keep buffer pool is also used in cyclic fashion(FIFO) and hence if you cache lots of table then the earlier cached tables would be removed.

To cache a table in buffer pool->

alter table <owner>.<tablename>storage (buffer_pool keep);

Saturday, January 24, 2009

Upgrade J2SE Version 5.0 in Oracle Applications

J2SE 1.4 is no longer supported in Oracle Apps.The minimum supported version is JDK 1.5. Please note that The Java 2 SDK, Standard Edition (J2SE) was previously referred to as the Java Development Kit (JDK)

Pre-req

Oracle E-Business Suite 11.5.10 CU1 or higher

134MB Disk space for Solaris 9 OS 32 bit sparc

Downloading J2SE 1.5

Download Java SE Development Kit 5.0u17 for Solaris SPARC, Multi-language from the sun site
http://java.sun.com/j2se/1.5.0/download.jsp 

Java Development Kit 5.0 Update 17-->jdk-1_5_0_17-solaris-sparcv.tar.Z

Installing J2SE 1.5

Extract in a directory on the server (say /usr/patches). Execute the following steps using "root" user

-->zcat jdk-1_5_017-solaris-sparc.tar.Z | tar -xf -

Just make sure you do have any earlier 5.0 package installation of JDK.If it is there use pkgrm to remove the packages first.

Now we will install the packages->

-->pkgadd -d . SUNWj5rt SUNWj5dev SUNWj5cfg SUNWj5man SUNWj5dmo

It will give the following prompt-->

Processing package instance <SUNWj5rt> from </usr/patches>

JDK 5.0 Runtime Env. (1.5.0_17)
(sparc) 1.5.0,REV=2004.12.07.00.07
Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
Use is subject to license terms.
Using </usr> as the package base directory.
## Processing package information.
## Processing system information.
## Verifying package dependencies.
## Verifying disk space requirements.
## Checking for conflicts with packages already installed.
## Checking for setuid/setgid programs.

This package contains scripts which will be executed with super-user permission during the process of installing this package.

-->Do you want to continue with the installation of <SUNWj5rt> [y,n,?] y

Enter "y" above to continue

Verify the java version

By default jdk 1.5, referred as  $JDK50_TOP will be installed in "/usr/jdk/instances/jdk1.5.0"

cd $JDK50_TOP/bin

java -version

The following confirms that j2se 1.5 is installed correctly->
java version "1.5.0_17"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_17-b04)
Java HotSpot(TM) Server VM (build 1.5.0_17-b04, mixed mode)

Make J2SE 5.0 to be default on Solaris 9

In Solaris 9-->make JDK 5.0 the default Java platform by modifying the /usr/java symbolic link to point to /usr/jdk/instances/jdk1.5.0 by

-->ln -s /usr/jdk/instances/jdk1.5.0 java

Steps for Oracle Apps

Now following the Oracle metalink note 304099.1- "Using J2SE Version 5.0 with Oracle E-Business Suite 11i"

-->Step 1: Stop all Application Tier Server Processes

-->Step 2: Obtain and Install JInitiator 1.3.1

-Ignored as we already upgraded to JRE1.6.0_06

-->Step 3: Obtain TXK AutoConfig Template Rollup Patch 6372396

-Ignored as it we are already on 11.5.10.CU2

-->Step 4: Obtain J2SE 5.0 Consolidated Patch 4372996 and other EBS Interoperability Patch(es) --Apply patch 4372996

If you are using Oracle Field Service, apply Field Service (CSF) interoperability patch, Patch 5372210-skipped

If you are using Scheduler, please apply the following patch(es);

· 11.5.10CU2 users should also apply Patch 5680223-skipped

· 11.5.10CU1 users should also apply Patch 5281664 as a pre-req to Patch 5680223-skipped

-->Step 1: Execute the J2SE 5.0 Upgrade Script to Update Configuration Files

cd $FND_TOP/bin

txkrun.pl -script=SetJDKCfg -contextfile=$CONTEXT_FILE -runautoconfig=Yes -appspass=<APPS_schema_passwd> -jdktop=[JDK50_TOP]

This will update the configuration files and run autoconfig

-->Step 2: Regenerate the appsborg2.zip File & Product JAR Files

This step must be repeated for each [APPL_TOP]

$APPL_TOP/APPS<CONTEXT_NAME>.env

Run AD Administration, and choose "Generate Product JAR Files" and then "Generate Applications Files" menu to update appsborg2.zip to include the new JDBC Drivers for the J2SE 5.0 library (jdbc14.zip) and to generate the product JAR files.

-->Step 3: Restart all Application Tier Server Processes

cd $COMMON_TOP/admin/scripts/<CONTEXT_NAME>

adstrtal.sh <APPS username/APPS password>

Testing Applications

-->Section 4: Verify the Application Tier Node Configurations

-->Step 1: Verify Installations on all Web Server Nodes

Follow these steps to verify that J2SE 5.0 has been successfully installed on all the Web Server node(s):

Run the AOL/J test page from a web browser, using the URL:

http://[web server]:[port]/OA_HTML/jsp/fnd/aoljtest.jsp

Now, To create a simple J2SE test page (without logging in to the Oracle E-Business Suite database), proceed with the follows:

  1. Change to the OA_HTML directory on the Web server.
  2. Using a text editor, create a file called J2SEtest.jsp with the following lines:

The J2SE version is:<%= System.getProperty("java.version") %>
<p> </p>
The class path is:<%= System.getProperty("java.class.path") %>

  1. Access this JSP from a web browser, using the URL:

http://[web server]:[port]/OA_HTML/J2SEtest.jsp

The version should display "1.5.0_17". Also verify whether the necessary J2SE 5.0 libraries (i.e.[JDK50_TOP]/lib/dt.jar, [JDK50_TOP]/lib/tools.jar, [JDK50_TOP]/jre/lib/rt.jar, and [JDK50_TOP]/jre/lib/charsets.jar) are included in the CLASSPATH

-->Step 2: Verify Configurations on all Application Tier Nodes

Follow these steps to determine that J2SE 5.0 is running on all the application tier nodes:

1. Open the $APPL_TOP/admin/adovars.env file and ensure that the environment variables below are defined. Run the following commands to verify that the environment variables ADJVAPRG and AFJVAPRG point to the J2SE 5.0 executable. The CLASSPATH and AF_CLASSPATH environment variables must contain the necessary J2SE 5.0 libraries.

Note: If the AD utilities have not been upgraded to use J2SE 5.0, do not run $ADJVAPRG -version and echo $CLASSPATH

2. $ADJVAPRG -version

$AFJVAPRG -version

The above will display->
java version "1.5.0_17"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_17-b04)
Java HotSpot(TM) Server VM (build 1.5.0_17-b04, mixed mode)

echo $CLASSPATH
echo $AF_CLASSPATH

3. Log in to the Oracle Applications and select the "System Administrator" responsibility. Check the Concurrent/Manager/Administer form and make sure all managers have the corresponding numbers for their actual and target.Run the "Active Users" concurrent request.