<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: backup script and oracle problem in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/backup-script-and-oracle-problem/m-p/2874543#M99286</link>
    <description>&lt;BR /&gt;Without seeing your script I have constructed a demonstration, which I think, offers you a solution to your problem.&lt;BR /&gt;&lt;BR /&gt;First, amend Oracle's $HOME/.profile to read conditionally the database name variable only if the profile is associated with a terminal.  The amended code would look something like:&lt;BR /&gt;&lt;BR /&gt;if [ -t 0 ]&lt;BR /&gt;then&lt;BR /&gt;echo "&amp;gt;&amp;gt;&amp;gt; What Database? \c"&lt;BR /&gt;read   MYDB&lt;BR /&gt;export MYDB&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;To simulate your backup script, use this script and call it "whatdb.sh"&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;echo "I use the '${MYDB}' database'"&lt;BR /&gt;exit 0&lt;BR /&gt;#.end.&lt;BR /&gt;&lt;BR /&gt;To utilize 'whatdb.sh' and collect the $MYDB variable's value from the Oracle profile's interactive query do:&lt;BR /&gt;&lt;BR /&gt;# su - oracle -c 2&amp;gt; /dev/null './whatdb.sh'&lt;BR /&gt;&lt;BR /&gt;To utilize 'whatdb.sh' in a non-interactive environment (i.e. one in which stdin isn't associated with a terminal, do:&lt;BR /&gt;&lt;BR /&gt;# su - oracle -c &amp;lt; /dev/null 2&amp;gt; /dev/null 'export MYDB=USEME;./whatdb.sh'&lt;BR /&gt;&lt;BR /&gt;In the case above, stdin was associated with '/dev/null' and so Oracle's profile did not query for the MYDB variable via a read.  Instead, the value of the MYDB variable was exported to the environment for use with the 'whatdb.sh' script.&lt;BR /&gt;&lt;BR /&gt;In both cases, the annoying "not a typewriter" messages produced by sourcing the Oracle profile when 'su -' is executed, were suppressed by redirecting stderr to /dev/null.  In point of fact, the Oracle .profile could also use:&lt;BR /&gt;&lt;BR /&gt;If [ -t 0 ]&lt;BR /&gt;Then&lt;BR /&gt;??????&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;...to execute conditionally its 'stty' terminal sequences too.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Sat, 04 Jan 2003 21:39:03 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2003-01-04T21:39:03Z</dc:date>
    <item>
      <title>backup script and oracle problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/backup-script-and-oracle-problem/m-p/2874536#M99279</link>
      <description>Hi all, yes I have another script problem :)&lt;BR /&gt;We have a backup user that logs in, ID of 0, the .profile is scripted to automatically run from that point on. All they do is log in, walk away and look for any error messages. The backup user with an ID of 0 can then "su -" to all users such as oracle and shutdown databases before backups and then "su -" back in to start them up once backups complete. My problem is, our dba's added a prompt in oracle's .profile to ask which database they are going to want to work with. Well, when the backup user tries to su to oracle, it hangs waiting for a response that it will never get because it is all running automatically behind the scenes. Is there a way that either I can answer the prompt through the "su -" which I have tried several times and to no avail, or is the original ID retained so far that I could check the ID - if 0 bypass the prompt code? Anyone have any ideas? They would be greatly appreciated. I know this is limited information our backup scripts are quite complex but I tried to "put it in a nutshell". Thanks!!</description>
      <pubDate>Sat, 04 Jan 2003 14:52:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/backup-script-and-oracle-problem/m-p/2874536#M99279</guid>
      <dc:creator>Lisa  Mauer</dc:creator>
      <dc:date>2003-01-04T14:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: backup script and oracle problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/backup-script-and-oracle-problem/m-p/2874537#M99280</link>
      <description>Lisa,&lt;BR /&gt;ID 0 has user with name 'root' usually. Why do you want to run script under root? Not under dba account?&lt;BR /&gt;Eugeny</description>
      <pubDate>Sat, 04 Jan 2003 14:59:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/backup-script-and-oracle-problem/m-p/2874537#M99280</guid>
      <dc:creator>Eugeny Brychkov</dc:creator>
      <dc:date>2003-01-04T14:59:24Z</dc:date>
    </item>
    <item>
      <title>Re: backup script and oracle problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/backup-script-and-oracle-problem/m-p/2874538#M99281</link>
      <description>Maybe you can develop C program to 'ungetc' desired characters into buffer so they retrieved by dba's script prompt&lt;BR /&gt;Eugeny</description>
      <pubDate>Sat, 04 Jan 2003 15:07:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/backup-script-and-oracle-problem/m-p/2874538#M99281</guid>
      <dc:creator>Eugeny Brychkov</dc:creator>
      <dc:date>2003-01-04T15:07:05Z</dc:date>
    </item>
    <item>
      <title>Re: backup script and oracle problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/backup-script-and-oracle-problem/m-p/2874539#M99282</link>
      <description>Hi: Thanks for the response, we use the user id of 0 because we have many applications that need to be shut down a long with the databases. With a user id of 0 the script can run and become each user to shut down the necessary applications. We also check for looping processes, etc and kill those before the backups. It is a development environment and some code or processes from the programmers may be looping or hung etc....</description>
      <pubDate>Sat, 04 Jan 2003 16:46:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/backup-script-and-oracle-problem/m-p/2874539#M99282</guid>
      <dc:creator>Lisa  Mauer</dc:creator>
      <dc:date>2003-01-04T16:46:29Z</dc:date>
    </item>
    <item>
      <title>Re: backup script and oracle problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/backup-script-and-oracle-problem/m-p/2874540#M99283</link>
      <description>Hi,&lt;BR /&gt;you can use the ksh logname command for asking who originally logged in. However, if two users share the same ID, logname will show the one that appears first in /etc/passwd ("root", I assume in this case).&lt;BR /&gt;Assuming again that your backup user logs in directly, you could make a check based on this skeleton in oracle's .profile:&lt;BR /&gt;&lt;BR /&gt;ORIG_USER=`logname`&lt;BR /&gt;if [ $ORIG_USER != "root" ]&lt;BR /&gt;then&lt;BR /&gt;        # enter code for dba's prompt&lt;BR /&gt;else&lt;BR /&gt;        # enter code for&lt;BR /&gt;        # database selection&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;But you should keep in mind that the above logname test cannot distinguish between your backup user and the normal root user.&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sat, 04 Jan 2003 19:11:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/backup-script-and-oracle-problem/m-p/2874540#M99283</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2003-01-04T19:11:57Z</dc:date>
    </item>
    <item>
      <title>Re: backup script and oracle problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/backup-script-and-oracle-problem/m-p/2874541#M99284</link>
      <description>John - I think that is exactly what I needed. I have coded that into the .profile and will run in tonight to see how it works.&lt;BR /&gt;Thanks!!</description>
      <pubDate>Sat, 04 Jan 2003 19:36:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/backup-script-and-oracle-problem/m-p/2874541#M99284</guid>
      <dc:creator>Lisa  Mauer</dc:creator>
      <dc:date>2003-01-04T19:36:58Z</dc:date>
    </item>
    <item>
      <title>Re: backup script and oracle problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/backup-script-and-oracle-problem/m-p/2874542#M99285</link>
      <description>As I know system's behavior depends not on user name ('root', 'admin', 'superuser', 'lamer', 'gamer' etc) but depends on user ID. So however you will name user with user ID = 0 it will be superuser and system will behave the same way&lt;BR /&gt;Eugeny</description>
      <pubDate>Sat, 04 Jan 2003 19:58:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/backup-script-and-oracle-problem/m-p/2874542#M99285</guid>
      <dc:creator>Eugeny Brychkov</dc:creator>
      <dc:date>2003-01-04T19:58:26Z</dc:date>
    </item>
    <item>
      <title>Re: backup script and oracle problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/backup-script-and-oracle-problem/m-p/2874543#M99286</link>
      <description>&lt;BR /&gt;Without seeing your script I have constructed a demonstration, which I think, offers you a solution to your problem.&lt;BR /&gt;&lt;BR /&gt;First, amend Oracle's $HOME/.profile to read conditionally the database name variable only if the profile is associated with a terminal.  The amended code would look something like:&lt;BR /&gt;&lt;BR /&gt;if [ -t 0 ]&lt;BR /&gt;then&lt;BR /&gt;echo "&amp;gt;&amp;gt;&amp;gt; What Database? \c"&lt;BR /&gt;read   MYDB&lt;BR /&gt;export MYDB&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;To simulate your backup script, use this script and call it "whatdb.sh"&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;echo "I use the '${MYDB}' database'"&lt;BR /&gt;exit 0&lt;BR /&gt;#.end.&lt;BR /&gt;&lt;BR /&gt;To utilize 'whatdb.sh' and collect the $MYDB variable's value from the Oracle profile's interactive query do:&lt;BR /&gt;&lt;BR /&gt;# su - oracle -c 2&amp;gt; /dev/null './whatdb.sh'&lt;BR /&gt;&lt;BR /&gt;To utilize 'whatdb.sh' in a non-interactive environment (i.e. one in which stdin isn't associated with a terminal, do:&lt;BR /&gt;&lt;BR /&gt;# su - oracle -c &amp;lt; /dev/null 2&amp;gt; /dev/null 'export MYDB=USEME;./whatdb.sh'&lt;BR /&gt;&lt;BR /&gt;In the case above, stdin was associated with '/dev/null' and so Oracle's profile did not query for the MYDB variable via a read.  Instead, the value of the MYDB variable was exported to the environment for use with the 'whatdb.sh' script.&lt;BR /&gt;&lt;BR /&gt;In both cases, the annoying "not a typewriter" messages produced by sourcing the Oracle profile when 'su -' is executed, were suppressed by redirecting stderr to /dev/null.  In point of fact, the Oracle .profile could also use:&lt;BR /&gt;&lt;BR /&gt;If [ -t 0 ]&lt;BR /&gt;Then&lt;BR /&gt;??????&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;...to execute conditionally its 'stty' terminal sequences too.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Sat, 04 Jan 2003 21:39:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/backup-script-and-oracle-problem/m-p/2874543#M99286</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2003-01-04T21:39:03Z</dc:date>
    </item>
    <item>
      <title>Re: backup script and oracle problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/backup-script-and-oracle-problem/m-p/2874544#M99287</link>
      <description>Our backup approach is a little different.&lt;BR /&gt;&lt;BR /&gt;root cron starts the backup process.&lt;BR /&gt;&lt;BR /&gt;does a su -c oracle for database shutdown and backup.&lt;BR /&gt;&lt;BR /&gt;Any other apps that need to be shut down are shut down the same way.&lt;BR /&gt;&lt;BR /&gt;From a security standpoint this is much better.&lt;BR /&gt;&lt;BR /&gt;Also, there are no problems with password prompts and other issues with t his setup.&lt;BR /&gt;&lt;BR /&gt;I'd revise the approach though there are probably better ones.  The best part about my approach is I know cron's environment and I'm not dealing with a user environment per say.</description>
      <pubDate>Sat, 04 Jan 2003 23:54:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/backup-script-and-oracle-problem/m-p/2874544#M99287</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2003-01-04T23:54:47Z</dc:date>
    </item>
  </channel>
</rss>

