Shell Script: Timeout and return error if Sqlplus hangs

Shell Script: Timeout and return error if Sqlplus hangs
Dear all,
This morning, our production database hung with lots of ORA-600 and 7445. The issue has been escalated to Oracle Tech support but my monitoring script which tries to make a connection every 5 mins to the database to see if its up, did not alert me. The reason is that, it connected to the database and hung, never came out to report an error and so I never got alerted until a user called me.
Can any one tell me how I can exit from the sqlplus block if I dont get a response in x seconds? This sqlplus block is being called with in a shell script.
Any help is highly apprciated.

I don't know of anything built into any shell scripting language that would do this, no. I'm not a Perl programmer, but I have a vague recollection that Perl may have something useful here.
From the "separate thread" part of my comment, though, you could certainly spawn a separate thread (thread 2), have thread 2 wait a period of time, then look for a message from thread 1 and throw an error if the message hadn't been sent. I don't know that I'd be for writing multi-threaded shell scripts, though. The heartbeat also gives you a layer of redundancy so that something is monitoring the monitor in case that process stops working.
Justin

Similar Messages

  • Please provide me unix shell script (export and import of database schema)

    please i am new in unix
    \please give me sample unix shell script (export and import of database schema)

    please i am new in unix
    \please give me sample unix shell script (export and import of database schema)Instead of providing you the readymade unix shell script for your requirement, I will give you the hints to prepare the same at your own.
    Create a file with .sh extension.
    # Specify and set all required Environment variables.
    ORACLE_HOME, PATH, NLS_LANG, etc.,
    # Use the export command with all clauses
    export scott/tiger@orcl file=scott.dmp log=scott_emp.log
    # Compress it.
    compress scott.dmp
    Refer any unix/linux documents for scripting basics.
    http://www.bijoos.com/ora7/oracle_unix.htm
    Regards,
    Sabdar Syed.

  • Database connection timeouts and datasource errors

    Connections in the pool randomly die overnight. Stack traces show that for some reason, the evermind driver is being used even though the MySql connection pool is specified.
    Also, the evermind connection pool is saying connections aren't being closed, and the stack trace shows they're being allocated by entity beans that are definitely not left hanging around.
    Sometimes we get non-serializable errors when trying to retrieve the datasource (this is only after the other errors start). Some connections returned from the pool are still good, so the application limps along.
    EJBs and DAOs both use jdbc/SQLServerDSCore.
    Has anyone seen this problem?
    <data-sources>
         <data-source
              class="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource"
              name="SQLServerDSCore"
              location="jdbc/SQLServerDSCore"
              xa-location="jdbc/xa/SQLServerXACore"
              ejb-location="jdbc/SQLServerDSCore"
              connection-driver="com.mysql.jdbc.Driver"
              min-connections="5"
              username="xxx"
              password="xxx"
              staleness-timeout="3600"
              alive-poll-query="SELECT 1 FROM medispan"
              url="jdbc:mysql://1.2.3.4:3306/dbo?autoReconnect=true&autoReconnectForPools=true&cachePrepStmts=true&is-connection-validation-required=true"
              inactivity-timeout="30"
         >
              <property name="autoReconnect" value="true"/>
              <property name="autoReconnectForPools" value="true"/>
              <property name="is-connection-validation-required" value="true"/>
              <property name="cachePrepStmts" value="true"/>
         </data-source>
    </data-sources>

    Rick,
    OC4J 9.0.4.0.0 - BTW, do you know of any patches?As far as I know, there are no patches for the 9.0.4
    production version of OC4J stand-alone.
    I'm using container managed persistence,It was not clear to me, from your previous post, that you
    are using CMP entity beans.
    I found staleness-timeout and alive-poll-query
    somewhere on a website when trying to track this
    down. Here's four sources:Those sources refer to OrionServer -- and an older version, too, it seems.
    Like all other Oracle products that start out as somebody
    else's -- including, for example, JBuilder (that became "JDeveloper"), Apache Web Server (that became "Oracle HTTP Server") and TopLink -- their development paths diverge, until, eventually, there is absolutely no similarity between them at all. Hence, the latest versions of OC4J and "OrionServer" are so different, that you cannot be sure that something that works for "OrionServer" will work for OC4J.
    I recall reading something, somewhere, sometime about configuring OC4J to use different databases (other than Oracle), but I really don't remember any details (since it was not relevant to me, because we only use Oracle database). In any case, it is possible to use a non-Oracle database with OC4J.
    Good Luck,
    Avi.

  • Shell script adapter and passwords

    Does anyone know how to get a password into a shell script resource adapter?
    I've set up the "password" attribute in my resource adapter's schema, expecting at least to see the encrypted password in in $WSUSER_password, but it's always empty. Other attributes I add to the resource scheme show up in the scripts as shell variables just fine.
    Side question - the Solaris resource adapter, which looks a lot like the shell script adapter, doesn't even have a password in its schema map, yet it seems to set passwords just fine. What's up with that?
    The ShellScriptResourceObjects55.xml example doesn't seem to deal with passwords at all.

    Hi,
    Have you been able to resolve this issue?
    I am currently working on configuring a Shell Script Resource on my IDM system.
    I am still in the "*Create User"* stage of things (I haven't even begun working with the other Actions : Get User, Get All Users, Delete User, Update User)
    After a month-long period of trial-and-error, and a lot of headaches, I finally succeeded in Creating a new user on my Unix Machine, without any errors
    Except for one thing : for some reason, the user I create is not being given a password!
    A first, I configured the "Attribute Mapping" page to include a "Password" attribute. This did not work.
    Then I removed the password from there (I figured that when I input the user's basic information on the IDENTITY tab in IDM, then the password gets automatically passed to the Unix machine).
    Still, this did not work.
    The funniest thing is : I am not getting any errors. The user is created on my Unix machine. And, also, in my My-SQL database.
    The problem is : when I try to log into that same Unix machine as the user, it does not work, because......of course.....*.there is NO PASSWORD*.
    What could be the problem?

  • Automator - Run Shell Script - Does not return when script launches firefox

    Automator does not work the same on my MacBooks as my Mac mini! Both are latest Snow Leopard. I'm trying to automatically setup my MacBook after it decides if I'm at work, or elsewhere.
    The Automator Action "Run Shell Script" (Shell: /usr/bin/perl) does NOT return control when attempting to launch Firefox:
    system("/Application/Firefix.app/Contents/MacOS/firefox-bin -private news.google.com &");
    Note: the ampersand should cause Firefox to start as a background process.
    It only returns control after I close Firefox. I have a "Show Growl Notification" as the second action, so I know that the first action has not completed. Odd thing is that this works on my Mac mini. I also noticed that another difference: on my MacBook status is displayed in the top toolbar when the Automator application is running.
    Any ideas?

    Thanks, it worked. I forgot about stderr and stdin.
    I'm using Perl as it is part of a bigger script. I can quickly and easily figure out if I am at work where my MacBook is plugged into a network:
    my $ethernet = qx(ifconfig en0) =~ m{status:.active}xms;
    if ($ethernet) {
    # setup stuff for work environment
    } else {
    # setup stuff for mobile environment
    }

  • Resource utilization alerts shell scripts, Memory and CPU

    Hi All,
    I am using the Oracle Enterprise Linux verison 4.6 x64 for Oracle 10g database. I want to implement some alerts for SWAP space thresholds, CPU comsumption and memory usage thresholds. For example I want an email alert is SWAP space is used 90%. Memory usage is more than 85%. CPU is 80% busy.
    I am sure that you Gurus must have implemented this kind of alerts through some tools or shell scripts so seeking your help to implement these.
    Thanks
    Naveed

    Hi Naveed,
    Firstly, I can tell you that Oracle has its own SNMP MIBs which can be used by SNMP to send trap (alerts) to various SNMP monitoring systems. If however, you are a bit like myself and perhaps don't have the cash or the need to use something so fancy, you can use Shell Scripting or in my case something like PERL.
    By using commands such as 'grep', 'awk' and 'less' (to name but a few) on can monitor simple things such as diskspace or memory.
    For example, if I were to look for diskspace usage on a partition known as u01 I could pipe in the output of 'df -h' to PERL, then run a regular expression on it looking for anything greater than 80%.
    Example of PERL code;
    # read in df -h command, looking for the partition /u01
    open(DISKUSAGE, "df -h | grep u01|");
    $diskUse = <DISKUSAGE>; #read its input
    chomp $diskUse; #remove last characterThis reads in the command into a 'buffer' in which you can search for things, i.e. to see if the disk usage is equal to, or greater than 80% from the variable $diskUse. As a starter I would look at splitting the string on empty spaces into an array for example, and reading the array index containing your disk usage. This can also be done with a Shell Script.
    Perl also has a very easy to use SMTP module which can be used for sending E-Mails. Do a search for Net::SMTP on google on how to use it. It really is very simple.
    I'm not expert on this stuff, and I'm sure there are many other and better ways of doing such things, but I hope this at least points you in the right direction.
    Best of luck,
    Conor

  • Shell script stop and start SAP

    Hello,
    Can you tell me the command to input username and password to login from shell script?
    I just know this -
    su - sidadm -c "stopsap"
    But this just logs in using Username - sidadm.
    how do modify this to add password also in command line?

    There are tools to do exactly that without a password - it's called "sudo".
    sudo is disabled by AIX team
    The "other user" must have execute right too.
    Since its just stopsap and startsap, they would be owned by sidadm only and executed by sidadm only through crontab
    I am guessing you do not know the syntax to use password in comman line on shell script

  • How to validate and return error message

    JDev 9.0.5.2 ADF UIX and Struts
    Scenario:
    I have a uix input page with 2 view objects (VO1-updates an entity object, VO2-sql viewobject, no entity).
    I have a Save button and its event where I want to handle the validation check and then commit the data. I need to manually check the VO2 fields in java and if none of them are populated, I need to stay on the same page and return a message. If one of the fields is populated, I need to save the data in VO1 and insert the values in VO2 into a table using java.
    I have been looking at the dataForwardAction class for the page but I am not sure if I should be overriding methods and which ones, as well as how to remain on the page if VO2 does not have at least 1 value populated with a message to the user.
    Any help is greatly appreciated.

    Hmm, I believe while, ActionError.GLOBAL_ERROR is a static string variable, it is used to hold the value that identifies the global error properties. I know I add multiple errors to global errors. Regardless, instead of ActionErrors.GLOBAL_ERROR you can use your own property, such as "test". Then on your jsp page you can use this tag: <html:errors property="test"/> and it should pull the relevant action error information. The value "context.errors.password.bad" by the way refers to a value in your ApplicationResources.properties file or whatever message resource file you have designated in your struts config as default.

  • Iphone 4S cannot be restored and returned error 3014

    I have tried to upgrade my Iphone 4S to the new iOS8.1. During the process itunes returned error 3014.
    I did all the steps in the article that I was referred to, but was unsuccessful.
    The mentioned article called to use the statement
    sudo nano /private/etc/hosts
    but this did not work, as it returned an empty file!
    On the internet I found another article that said to skip the /private/ part and that opened the hosts file.
    In that file there was no statement gs.apple.com that could be spiked out with a #.
    Now I have no idea how to fix this.
    Can anyone help?

    Did you check your security software settings on your computer? iTunes has to be able to contact Apple servers during the update process:
    iTunes for Windows: Troubleshooting security software issues
    If you are trying to update your phone over the air, try to use your computer  and iTunes instead.

  • Music files in my PC's iTunes directory have been moved around, now iTunes' index is not recognizing them and returns error messages. The files have previously been sync'd to my iPod, but when I tried to sync back from the iPod, iTunes on the PC error'd.

    I want iTunes to reconstruct its index of my music.
    We accidentally moved files around in my <<C:\Documents and Settings\Jordan\My Documents\My Music\iTunes>> directory. We tried to move them back, but anyway, the iTunes program now no longer can find/play the titles that the opened iTunes page/Library displays.
    I had previously copied/syncd all my iTunes music to my iPod. I tried syncing back to the PC from the iPod.  No improovement.
    At the moment, my dad is on my computer, logged in under his name (with administrative permissions). It seems that looking at my iTunes music under his login is still working OK.
    I do not have my music backed up to the "cloud".
    What are my options?

    The "missing file" error happens if the file is no longer where iTunes expects to find it. Possible causes are that you or some third party tool has moved, renamed or deleted the file, or that the drive it lives on has had a change of drive letter. It is also possible that iTunes has changed from expecting the files to be in the pre-iTunes 9 layout to post-iTunes 9 layout,or vice-versa, and so is looking in slightly the wrong place.
    Select a track with an exclamation mark, use Ctrl-I to get info, then cancel when asked to try to locate the track. Look on the summary tab for the location that iTunes thinks the file should be. Now take a look around your hard drive(s). Hopefully you can locate the track in question. If a section of your library has simply been moved, or a drive letter has changed, it should be possible to reverse the actions.
    If another application like Windows Media Player has moved/renamed the files then the chances are that subtle differences in naming strategies will make it hard to restore the media to the precise path that iTunes is expecting. In such cases, as long as the missing files can be found somewhere, you should be able to use my FindTracks script to reconnect them to iTunes. See this post for an explanation of how it works.
    If you have to resort to trying to pull back the library from your iPod see Recover your iTunes library from your iPod or iOS device.
    tt2

  • Java script app and syntex error with Firefox 17 ... can't fix it

    Ever since I downloaded Firefox 17 I get the above error.

    This issue can be caused by an extension that isn't working properly.
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance).
    *Do not click the Reset button on the Safe mode start window or otherwise make changes.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • Shell script, automator and file permissions

    We have an environment where, that when a user creates a folder on a network vol, it is owned by them and no one else has access to it. They then place a folder structure from there local HD into that folder they just created on the server. You would think a simple get info window with the user changing the permissions to include all would actually change all the file permissions in the enclosed folder, but it doesn't. I have a simple script written in automator using /bin/bash that is supposed to change the permissions in every folder and file to rw for all (user, group and everyone). It doesn't seem to be working correctly all the time for a few users.
    for f in "$@"
    do
    chmod -R 777 "$f"
    done
    I have tried this as well
    for f in "$@"
    do
    chmod -R a+rw "$f"
    done
    But that should be pretty much the same thing.
    Something i have noticed is the users with the most problem are running 10.4.11, while the script was written in 10.5. Also the users that are having the problem dont seem to have the same get info window as the rest of the 10.4.11 users, it very closely resembles 10.5, with some minor differences. It seems they are missing the groups or something. This might be more or less than an issue than I realize.
    http://picasaweb.google.com/tiemmothi/UserPermissions?feat=directlink
    the 10.4 window in question is "the offender" and
    "Mine" is 10.5

    *Access Control List* entries are in addition to the regular POSIX permissions. They are not required, but add finer levels of access control. Setting the regular permissions to read/write for everyone should work unless there are ACL entries which allow additional access - you can see ACL entries and extended attributes with/bin/ls -le@d /path/to/some/folder
    An inherited ACL entry to allow everyone read/write access would look something likechmod -R +a "everyone allow list,addfile,search,delete,add_subdirectory,delete_child,readattr,writeattr,chown,file_inherit,directoryinherit" /path/to/some/folderA users */Public/Drop Box* folder has similar entries.

  • IChat not working and returning error 8

    Hi All, I've joined the ranks of those struggling to get ichat working. I have just bought an iMAC 20, installed it set up our iChat details and started an AV iChat session with our son who is also using an iMac. Worked fine. Then tried again 1 week later and couldn't get it to work. When opening the buddy list both the camera and the mic icons are greyed out. In desperation I powered everything off unplugged cable modem (Comcast) and Wireless Router (Linksys). To my amazement when I brought everything back up it worked. That was yesterday, today it isn't working. I tried the power off/unplug trick but it doesn't work. I've seen a few postings with what seem like related problems and am wondering if either my modem (which is about 6 years old) or my wireless router are the problem. I'm currently on hold for Apple Support but its been 44 minutes now and they close in 30 minutes time!
    iMAC 20   Mac OS X (10.4.8)  

    I get the infamous error 8 on my Ichat video conference attempts.
    I am on a dual 2004 1.8 G5. My buddy is on a very recently purchased dual-core imac 17. We are both running 10.4.9.
    I spoke with Apple tech support. They conducted an AV test. We saw and heard each other. Same thing for the buddy.
    I am on verizon fios with a blazing 1.5mb/sec speed. Very nice. I have an ActionTec router.
    The buddy is on a wireless connection from HughesNet satellite ISP. Often very slow, but always over the minimimum 100Kbs threshold for IV chat.
    Both my and buddy's router, a Belkin pre-N, is set with minimum firewall security. Buddy is connecting to the router via apple wireless card. Could this be an issue? Again, connection speeds are always over the minimimum 100Kbs threshold for upload and download hovers in the 600Kb range.
    We are able to chat via typed messaging, but the audio and video never connect. We have both sent invites, which we both get, but the error -8 is the result always!!
    We set the ports per this topics many discussions. No good. We set a jabber connection through google talk today. Still no work.
    Our gear is current. We've made the settings. We've tried the recommendations. Are we missing something?
    Thanks for any help!
    G5 dual 1.8 Mac OS X (10.4.9)
    G5 dual 1.8 Mac OS X (10.4.9)
    G5 dual 1.8 Mac OS X (10.4.9) Connecting to an Imac dual-core running 10.4.9
    Mac OS X (10.4.9) G5 dual 1.8 trying to AV with Dual core Imac (new)
    G5 dual 1.8 Mac OS X (10.4.9)

  • Forum timeouts and server errors

    In the last two days I've been experiencing intermittent problems with the forum: when I click a link to a thread or post sometimes I can't get it to load. I have to wait about a minute and try again. The same issue occurs when I try to submit a post.
    I'm not maxing out my internet connection, other websites are working fine.
    Should I post this to the ML?

    Wait and see if anyone else is experiencing it. I get it from time to time, but suspect my conection is responsible more often than not.
    I also haven't noticed an uptick in frequency over the last week; nor does it happen when trying to submit a post, just when browsing*
    * Having said that, my browsing rate is probably similar to your posting one...

  • Shell Script Addapter and parsing Extended ascii/UTF8 characters

    Hellos.
    We are about to plunge into the world of ShellScripts. Our alphabet contains accented characters. The UNIX hosts running the scripts will be using locale ISO8859-1or ISO8859-15
    Simple question.
    When we parse the csv file .. who is parsing it? The IDM (utf8 based) system or the Unix (ascii) host?
    Should the csv always be iconv-ed to utf8 as a matter of course?
    Nothing about this in the Reference Manual.

    I know this thread is old, but it took me forever to find this out...
    Use:
    SELECT CHR (<ASCII Value> USING NCHAR_CS) FROM DUAL;
    E.g.
    SELECT CHR (206 USING NCHAR_CS) FROM DUAL;
    CHR (206 USING NCHAR_CS)
    ÎEdited by: martinByrne on 04-Aug-2010 08:37

Maybe you are looking for

  • HTTPS Without client authentication shows error of Certificate

    Hi Experts, I am trying to develop a SOAP to RFC scenario where in SOAP sender HTTP security level - HTTPS Without Client Authentication is selected. I have downloaded WSDL from Sender agreement and trying to test web service from SOAPUI.  Now as per

  • Using BO on Solman

    Hello, I'm looking for any information I can find about how SolMan interacts with BOBJ. Does SolMan support navigation to BOBJ for configuration and setup?  What works/doesn't? Does BOBJ work with the BI in SolMan? Thanks, Nikhil

  • HSBL Filter Optional Plug-in

    Hi - I'm trying to download a plug-in called HSBHSL from the Adobe website. It used to be available as part of an addition folder called "Goodies" This folder was available via the original installation disc or web based purchase. However, from versi

  • Problems in generating profile

    Hi experts, I have created a model view named Master Data with logical systems named DEV01 and DEV02 on client 100 and 200 respectively .The two clients are copies of 000. But when i am trying to create generate profile partners through the path Envi

  • Creating new small window

    I am try to figure out how to create a new smaller window when you click on a image link. Also how can I keep that window from having all the browser info on top. I want it to just have the page title at the top. Thanks