Re: Agent restarts and .bash_profile

From: Niall Litchfield <>
Date: Mon, 14 May 2018 21:41:19 +0100
Message-ID: <>

Will is exactly correct. the profile files are intended for interactive sessions. Cron behaves in the same way for example.

I'm somewhat surprised that you are setting variables for the agent process? What is it that you achieve by this?

On Mon, May 14, 2018 at 8:27 PM, Will Beldman <> wrote:

> According to the bash manpage, there are very specific rules about when
> the
> .bash_profile/.bashrc/.profile files are picked up.
> .bash_profile is only read if the shell is interactive or if it isn't but
> you
> also supplied --login. Presumably, restarting the agent does not do either
> (it
> must be a non-interactive shell that doesn't supply --login).
> So assuming restarting the agent is classified as "non-interactive", from
> how
> I read the manpage, you could get away with setting BASH_ENV as
> "~oracle/.bash_profile" first, then restarting the agent.
> Alternatively, there could be other config files you supply for the agent
> that
> I'm not knowledgeable enough to comment on.
> On Monday May 14 2018 01:43:40 PM Dave Herring wrote:
> > Does anyone know WHY when restarting Oracle's management agent through
> OEM,
> > the appropriate ".*profile" is not sourced, corresponding to which
> account
> > you run the agent as? That's a rather confusing sentence so restating
> with
> > examples:
> >
> > If I restart the management agent in OEM and we run the agent under the
> OS
> > account "oracle", I'd expect at some point "~oracle/.bash_profile" to be
> > sourced within the agent's environment. Yet I know this doesn't happen
> > because we have a couple of important env variables set in
> > ~oracle/.bash_profile and when checking for these using something like
> "cat
> > /proc/<AGENT'S PID>/environ | xargs -n 1 -0" I don't see these variables.
> >
> > I've checked this under RHEL and Oracle 11g / 12c. I first noticed the
> > issue when applying the latest agent PSU to a group of agents via an OEM
> > plan, then validated the same situation happens if, under the agent's
> home
> > page, I restart it in OEM. Normally all management agent restarts are
> > performed in a standard script we have which runs through stop, start,
> > clearstate, upload, status for the given agent, among other things.

Niall Litchfield
Oracle DBA

Received on Mon May 14 2018 - 22:41:19 CEST

Original text of this message