5 Replies Latest reply on Aug 22, 2012 8:55 PM by Dude!

    Oracle Grid Control agent executes .bash_profile on startup/shutdown

      I recently installed the Oracle Grid Control agent on a number of servers (OEL 5.5). Since then, when the system is shutdown or starts up, it executes a script to start or stop the agent.

      The problem is the agent logs on as the oracle user. In the oracle users .bash_profile a prompt is displayed to input the SID. When the system is started or shutdown, it apparently executes the .bash_profile and prompts for the SID. This prompt is only displayed on the console and a reply must be made for the script to continue.

      I’m looking for a way that the startup and shutdown scripts do not prompt for the SID. This allows for rebooting from something other than the console and does not require a response.

      One thought is for the .bash_profile to check to see if it is being executed from an interactive session.

      I’m looking for suggestions on how to eliminate the prompt during reboots. If checking for an interactive session is the better way to go, then code examples would be greatly appreciated.

        • 1. Re: Oracle Grid Control agent executes .bash_profile on startup/shutdown
          There shouldn't be any need to involve your login profile or query for SID.

          What is your Database version?
          How is the shutdown of the EM agent triggered?
          Why do you have a prompt in the your startup profile?
          • 2. Re: Oracle Grid Control agent executes .bash_profile on startup/shutdown
            I should say that I assume that the .bash_profile is being exectuted.

            This happens on both database servers and WebLogic servers.

            The prompt for a SID (or WebLogic home) is done in the oracle users .bash_profile and not as part of the system startup.

            When the server hits certain run levels (reboot, shutdown, startup) a script is run to startup or stop (as appropriate) the grid agent. The agent runs as the user oracle, which has a .bash_profile that prompts for the SID.

            When a reboot, shutdown or power on is given, it goes through the process, but then executes the command . oraenv (somehow), which prompts for a SID. In these situations, the prompt is only displayed on the console. If these commands are given from a SSH session, you do not see the prompt.

            The process will hang until the . oraenv response is given.

            This began when the grid agent was installed on these servers.

            I don't know why it would be executing the .bash_profile for oracle, since this is not interactive (kinda like cron).
            • 3. Re: Oracle Grid Control agent executes .bash_profile on startup/shutdown
              You need to provide more details about your shutdown procedure for anyone to pin point the problem.

              Having .oraenv in the login script to prompt the user is silly. Instead export the variables or at least use:

              . oraenv -s

              I asked for the database version because it is not irrelevant. In fact the shutdown and startup and use of the dbshut and dbstart scripts 10g and 11g are different.

              You probably have an rc.init script to handle automatic shutdown and startup. I suggest to verify you properly defined the environment in the script and do not use a dash (-) with the su command, since this will reset the environment defined in the script and perform a login. You may have picked up a Init script example from the Internet that is incorrect.
              • 4. Re: Oracle Grid Control agent executes .bash_profile on startup/shutdown
                Database version is WLS: 10.3.4/10.3.5 FMW

                We have the .oraenv in the oracle user profile, because we have multiple databases and/or WebLogic homes on each server.

                I shut the database and listener down (shutdown immediate). Not using dbshut/dbstart. Also, all starting and stopping database and WebLogic processes are manual and not automatic. Basically same with the WebLogic server stopping all WebLogic processes. All using an SSH session.

                At that point from the shell prompt, issue “reboot”, “shutdown now”. The problem also occurs when the system is starting up.

                Again, all database, listener, WebLogic processes are started/stopped manually.

                In the rc#.d are scripts that the Oracle Agent installed to either start or stop the agent, as appropriate. This is what I believe is executing the .bash_profile.
                • 5. Re: Oracle Grid Control agent executes .bash_profile on startup/shutdown
                  I can't guess the content of your init script. If you suspect it's the problem please see my previous reply or post the content.