Thursday, April 1, 2010

Oracle EBS Configuration Info

Here’s some useful SQL for anyone who needs at least a passing understanding of how an Oracle EBS instance is configured.

To find out when an instance was created (or last cloned over):

select NODE_NAME, CREATION_DATE from FND_NODES;

Which will return something like:

NODE_NAME CREATION_
------------------------------ ---------
INTEBS1 19-MAR-10
INTEBS2 20-MAR-10

To find url for active instance:

select profile_option_value from
profile_option_values where profile_option_value
like '%ebshostname%';

In the example above, the “ebshostname” would be the hostname of the EBS server, e.g. “intebs1”.

The output would include something like:

http://intebs1.example.com:8000/pls/intebs_portal30/portal30.home

Monday, October 5, 2009

Checking fnd_user_preferences

In Oracle’s Enterprise Business Suite (EBS), the fnd_user_preferences table contains some important parameters related to identity management. These are mostly set when you register an EBS instance with a 10g AS (Application Server) identity infrastructure (i.e. using the txkrun.pl script).

Some of the parameters you’ll see are OIDhost, OIDport, SSLOnly, appname.

This information can be helpful in validating that things are properly configured.

To display the values set, run the following SQL against the EBS database as the APPS user:

select USER_NAME,MODULE_NAME,
PREFERENCE_NAME,PREFERENCE_VALUE
from fnd_user_preferences
where USER_NAME = '#INTERNAL';

Tuesday, September 8, 2009

DBD::Oracle and cron

So, everyone knows that cron runs things with absolutely no user environment at all. Well, not exactly. On Linux, for example, It actually uses the “default” environment that probably includes “PATH=/usr/bin:/bin” and little else. As a result launching any kind of script using cron can be a problem.

I recently ran into this when trying to run my Oracle tablespace usage reporting script. On my box I didn’t have the Oracle client libraries used to compile DBD::Oracle included in the system /etc/ld.so.conf because I wanted to maintain the ability to run apps that used different versions of those libraries (e.g. from the full Oracle Client app so I could use its admin tools). As a result, I had the path to those libs defined as part of LD_LIBRARY_PATH in my .bash_profile.

But cron ignores your .bash_profile, so the LD_LIBRARY_PATH variable still needs to be defined for DBD::Oracle run under cron to find those libs.

No matter what I tried inside the script itself, nothing worked. This included using a BEGIN {} wrapped around a $ENV{'LD_LIBRARY_PATH'} = "/opt/oracle/instantclient_11_1" at the top of the script.

I finally got it to work by defining LD_LIBRARY_PATH in my crontab, like so:

0 3 *** LD_LIBRARY_PATH=/opt/oracle/client /usr/bin/perl
/home/myuser/bin/oracletbl.pl

Not entirely happy with this solution, but it works.

Another way is to write a shell script wrapper in which the variable is declared and then the perl script launched.

Finally, for a truly sledge hammer approach, you can simply define the variable at the top of the crontab itself, so it will be set for all scripts that execute out of it. Of course, being a sledge hammer kind of guy, this is the one I’m now using.

If anyone has a better idea, let me know.

Monday, August 31, 2009

What's the system time on that db?

Needed to check this today to make sure an apps db wasn’t out of sync with its corresponding infrastructure partners.

SQL> SELECT TO_CHAR(SYSDATE ,
2 'Dy DD-Mon-YYYY HH24:MI:SS') as
3 "Current Date/Time" FROM DUAL;

It’s little stuff like this that can make you crazy.

NTP was invented back around 1980 by Dave Mills at the University of Delaware. What excuse anyone has for not running it on all their servers and clients is… well, there is no excuse.

Of course we’ve still got the UT/GMT vs. Local Time thing to content with. Personally, if I had access to a time travel machine one of the things I’d do is go back and find some way stop that first implementation of local time on computers.

Then I’d move on to preventing anything but 7-bit ASCII from ever being displayed on terminals…

Tuesday, August 25, 2009

Reporting tablespace usage

Thanks to V.S. Babu for this neat little SQL script that gives a quick enumeration of tablespace usage perfect for harried Oracle Internet Directory admins. I found this code in one of V.S.’s posts entitled Tablespace Information. V.S. has a whole section on Oracle administration and development that is worth a look.

For OID admins I recommend connecting as the ODS user. The database you’ll connect to will be your metadata repository for the infrastructure tier, of course.

[me@testbox ~]$ sqlplus ODS/xxxxxx@infradb1
...
SQL> @tablespaces.sql

Heres the code:

select	a.TABLESPACE_NAME,
	a.BYTES bytes_used,
	b.BYTES bytes_free,
	b.largest,
	round(((a.BYTES-b.BYTES)/a.BYTES)*100,2) percent_used
from
	(
		select 	TABLESPACE_NAME,
			sum(BYTES) BYTES
		from 	dba_data_files
		group 	by TABLESPACE_NAME
	)
	a,
	(
		select 	TABLESPACE_NAME,
			sum(BYTES) BYTES ,
			max(BYTES) largest
		from 	dba_free_space
		group 	by TABLESPACE_NAME
	)
	b
where 	a.TABLESPACE_NAME=b.TABLESPACE_NAME
order 	by ((a.BYTES-b.BYTES)/a.BYTES) desc
/