DBA scripts run by cron job

We've got a development database on which we're working every day. We intend to set up a cron job to run about once a week to help in the maintainance & performance of the database.... analyzing tables, stuff like that. Does anybody have any suggestions as to what scripts it's useful to run to help keep things running smoothly?
We're using 9.0.1
Cheers
RT

We've got a development database on which we're working every day. We intend to set up a cron job to run about once a week to help in the maintainance & performance of the database.... analyzing tables, stuff like that. Does anybody have any suggestions as to what scripts it's useful to run to help keep things running smoothly?
We're using 9.0.1
Cheers
RT i'd suggest you try out oracle enterprise manager and look at the list of events you can test for. You can use this list to implement in cron or let OEM do it for you. You'll find test like, is the listener up, is the db up, is the server up, what tablespaces will not be able to extend, if a disk is getting fulletc and stuff like that . Those items should help you frame your scripts for cron if you like.

Similar Messages

  • Solution Manager 7.1 - Monitor scripts which runs as cron job at OS level ?

    Hi All,
    We have Solution Manager 7.1 in our landscape and we have configured RCA, Monitoring.. Is it possible to Monitor the scripts running as Cron Job at the OS level?
    If in case, the script stops due to an issue, we need to get the alert in Solution Manager.
    Also can you please let us know whether it is possible to monitor jobs scheduled through external job scheduling tool.
    Thanks & Regards,
    Vaishali.K

    Hi,
    How to Schedule the background Job at the OS level:
    Invoke a sapevent using a OS script and then have a SAP background job set to run on a sapevent. I say this assuming Unix and a job in crontab. I would guess the same thing could be done on a Windows system.
    sapevt TRIGGER_NAME -t
    pf=d:usrsapDEVsysprofileDEV_DVEBMGS00_SVRNAME nr
    Kindly go through the links,hope this will help you out
    [Steps to configure RCA and Monitoring in SolMan;
    [http://help.sap.com/saphelp_45b/helpdata/en/c4/3a7ef8505211d189550000e829fbbd/content.htm]
    Thanks & Regards
    Ajitabh

  • Manually running a cron job in SunOS 5.8

    I was looking in the Solaris documentation and UNIX Man pages, however how do I manually run a cron job that is already set-up? I am troubleshooting an issue and the cron job runs just fine during the night, I would like to execute it manually for testing purposes. Thank you in advance.

    Run this command :
    crontab -l
    And, look for the command you want to run and then just execute it on command line. The first five columns (separated by spaces) are date/time/day (skip those), after that you will see full path of the script/program. Just copy and paste that full path on command line.

  • Run a cron job every minute

    Hi,
    I would like to run a cron job every minute.
    I can find cron.hourly, cron.daily, cron.weekly, cron.monthly in my /etc, but no cron.minutly.
    Can I get it? What should I do?
    Thanks!
    Nathan

    run
    crontab -e
    . this opens an editor. therein you type :
    #min hour day month weekday command
    */1 * * * * <your command>
    dw was faster
    Last edited by DonVla (2008-11-17 16:56:42)

  • Shell Script gives error when run through cron job.

    Hi,
    The following shell script runs without any problem when executed manulally.
    USED=$(df -h /arch | tail -1 | awk '{print $5}' | cut -d '%' -f 1)
    if [ ${USED} -gt 90 ]
    then
    find /arch/AUBUAT/ -type f -mtime +0 | xargs rm
    find /arch/AUBMIG/ -type f -mtime +0 | xargs rm
    fi
    But the same gives below error when called from a cron job:
    /backup/arch_test.sh: syntax error at line 1: `USED=$' unexpected
    We are running following version:
    bash-3.00$ uname -a
    SunOS uaeaubdbdr01.aub.af 5.10 Generic_141444-09 sun4u sparc SUNW,SPARC-Enterprise
    Kindly assist.
    Thanks
    Edited by: user13362786 on Apr 20, 2011 4:36 AM

    Hi,
    When I used #!/usr/bin/sh now even the manul execution of the script fails with the same err:
    bash-3.00$ ./arch_test.sh
    ./arch_test.sh: syntax error at line 2: `USED=$' unexpected
    And when I used #!/usr/bin/ksh the manual execution runs fine but again when the script is run from cronjob it now give dirrect err:
    /backup/arch_test.sh[2]: df: not found
    /backup/arch_test.sh[2]: tail: not found
    /backup/arch_test.sh[2]: cut: not found
    /backup/arch_test.sh[2]: awk: not found
    /backup/arch_test.sh[3]: test: argument expected

  • Help with newsletter PHP Mail script for mySQL / cron job

    I'm just trying to set up a PHP script to send emails as a cron job.
    It pretty much seems to work, but I can't get it to do two parts.
    The first part is to send the emails, and the second is to send a notification email to the site owner confirming that the emails have been sent.
    The script looks like:
    <?php
    include_once "connect_to_mysql.php";
    $sql = mysql_query("SELECT UserID, Firstname, Email, Newsletter_Received FROM Users WHERE Firstname='test' LIMIT 20");
    $numRows = mysql_num_rows($sql);
    $mail_body = '';
    while($row = mysql_fetch_array($sql)){
      $id = $row["UserID"];
      $email = $row["Email"];
      $name = $row["Firstname"];
      $mail_body = 'Test - please ignore';
        $subject = "Safari Awards Newsletter";
        $headers  = "From:[email protected]\r\n";
        $headers .= "Content-type: text/html\r\n";
        $to = "$email";
        $mail_result = mail($to, $subject, $mail_body, $headers);
      if ($mail_result) {
      mysql_query("UPDATE Users SET Newsletter_Received='1' WHERE Email='$email' LIMIT 20");
      } else {
    ?>
    <?php
    if ($numRows == 0) {
      $subj = "Newsletter Sent";
      $body = "The current newsletter has been sent to everyone.";
         $hdr  = "From:[email protected]\r\n";
         $hdr .= "Content-type: text/html\r\n";
         mail("[email protected]", $subj, $body, $hdr);
    ?>
    Basically with the line
    include_once "connect_to_mysql.php";
    included, it sends the emails as per the SELECT query, but does not send the 'Newsletter Sent' email.
    But if I take out that line, it obviously doesn't send the emails as per the SELECT query, but it does send the 'Newsletter Sent' email.
    Any suggestions on what might need changing in order for it to do both would be much appreciated!
    Thanks.

    Change this line -
    if ($numRows == 0) {
    to this -
    if ($mail_result) {

  • Bash script run via cron not executing MYSQL command

    I have a bash script which is run from a cron,
    It is executing as I have it write to a log file which it does correctly.
    I am wanting the bash script to restore a mysqldump file.
    When I run the bash script manually the dump file gets loaded fine. But when I run it through the cron the mysql command appears to be ignored.
    The mysqldump file is 54MB and I have checked to make sure that MYSQL is included in the global users path in /etc/profile
    Does anyone know why this maybe??
    Here is the bash file
    #!/bin/bash
    date >> /home/user/crons/crons.log
    echo "Started loadbackup" >> /home/user/crons/crons.log
    cd /home/user
    dbuser=root
    dbpass=password
    dbname=databasename
    filename=backup
    mysql -hlocalhost -u"$dbuser" -p"$dbpass" "$dbname" < " >> /home/user/crons/crons.log
    My crontab looks like
    02 17 * * * /home/user/crons/loadbackup.sh
    Many thanks
    Richard

    Hi Richard,
    Have you tried redirecting the script output in the cron to see if an error is being reported?
    I.e.
    02 17 * * * /home/user/crons/loadbackup.sh > /tmp/loadbackup.log 2>&1

  • Program that run a cron job in EP?

    Hi All,
    My requirement is :
    if a user upload a file to the specified folder in EP repository. (file will be .txt format), b'z they are the big customers to our client, so that they can just upload the order file.txt in a specified folder.
    after uploading a file to that folder or directory, i need to develop one program that will pick the file from a folder or directory for every 10 or 15 mins, need to place the orders in SAP R/3.
    Can anybody pl help me in this.
    Pl send me any source code or logic.
    Help appreciated with Reward Points.
    Thx
    Pradeep

    Hi Pradeep,
    for both things wizards exist in NWDS, just right-click on yur project, choose "Service, Filter and Scheduler Task Generation" and go on...
    See http://help.sap.com/saphelp_nw04/helpdata/en/3d/b5842eb8a911d5993900508b6b8b11/frameset.htm for the scheduler service and for some predefined scheduler tasks and click around the configuration within EP to understand the settings behind them.
    For implementation, see Did you know you can schedule jobs in portal using KM's Scheduler Task? and new Scheduler Task for example
    For RepServices, see http://help.sap.com/saphelp_ep60sp2/helpdata/en/69/d96b86a84611d5993600508b6b8b11/frameset.htm for the RepService description and for some predefined repository services and click around the configuration within EP to understand the settings behind them.
    For implementation see /thread/15093 [original link is broken] and the link given there.
    If questions stay, first look around the forum, many threads have been opened for these issues.
    Hope it helps
    Detlev

  • Are all Cron Jobs run by Root?

    OS : Sun OS 5.10
    I have scheduled an RMAN backup script which had only one line like
    rman target .............I logged in as os user oracle and ran this script without any issue. But when i scheduled this job to run, it didn't work.
    I got the error
    /u05/bkp_scripts/rman-level0_WM.sh: rman: not foundThe shell couldn't find rman binary in PATH. Everything worked when i explicitly set ORACLE_HOME, ORACLE_SID, PATH in the shell script.
    Does this mean a cron jobs scheduled by OS User oracle will still won't work unless you set set ORACLE_HOME, ORACLE_SID, PATH in the shell script?
    Are cron jobs handled by root user regardless of who scheduled it?

    ExpansiveMind wrote:
    OS : Sun OS 5.10
    I have scheduled an RMAN backup script which had only one line like
    rman target .............I logged in as os user oracle and ran this script without any issue. But when i scheduled this job to run, it didn't work.
    I got the error
    /u05/bkp_scripts/rman-level0_WM.sh: rman: not foundThe shell couldn't find rman binary in PATH. Everything worked when i explicitly set ORACLE_HOME, ORACLE_SID, PATH in the shell script.
    Does this mean a cron jobs scheduled by OS User oracle will still won't work unless you set set ORACLE_HOME, ORACLE_SID, PATH in the shell script?
    cron does not execute the user's .profile. You must guarantee your environment by setting it inside the script.
    Are cron jobs handled by root user regardless of who scheduled it?NO! root should NEVER be used for Oracle tasks. root should never be used for anything that can be done by another account.

  • How to take the cron job log in HP UX?

    Hi,
    How to take the cron job log in HP UX
    I need to run a backup and other stuff everyday. How do I check and start cron service under HP-UX UNIX operating system? How do I write cron jobs?
    A. Cron service is required to run jobs and tasks such as backup.
    You must login as the root to run following commands. Each user that is using the cron service must have a cron configuration file in the /var/spool/cron/crontab directory. Also users are permitted if their name appeared in /var/adm/cron/cron.allow file
    Task: Find out if cron is running under HP-UX
    Type the following command at a shell prompt
    # ps -ef | grep cron
    Open /etc/rc.config.d/cron file
    vi /etc/rc.config.d/cron
    Set control variable to 1 to enable cron: CRON=1
    Set control variable to 0 to disable: CRON=0
    Close and save the file. To start or stop cron you can type the following command:
    # /sbin/init.d/cron start <-- start cron
    # /sbin/init.d/cron stop <-- stop cron
    Task: HP-UX Start cron service
    If cron is not running, simply type:
    # cron
    Task: Edit / create cron jobs
    Type the following command to submit a cron job:
    # crontab -e
    List your cron file:
    # crontab -l
    Backup all your cron jobs:
    # crontab -l > ~/backup.cron.jobs
    Remove ALL cron job:
    # crontab -r
    Task: Crontab file format
    Cron file format is as follows:
    MIN HOUR DATE MONTH DAY /PATH/TO/COMMAND
    0-59 0-23 1-31 1-12 0-6 /root/scripts/backup2tape.shEasy to remember crontab file format:
    * * * * * command to be executed
    | | | | |
    | | | | ----- Day of week (0 - 7) (Sunday=0 or 7)
    | | | ------- Month (1 - 12)
    | | --------- Day of month (1 - 31)
    | ----------- Hour (0 - 23)
    ------------- Minute (0 - 59)To run /root/script/backup at 23:00, every day, enter:
    # crontab -e
    Append following
    0 23 * * * /root/script/backupRun foo job very weekday (MON-Fri) at 6am, enter:
    0 6 * * 1-5 /root/script/backupFor more information refer to cron and crontab man pages.
    Subscribe to our free e-mail newsletter or RSS feed to get all updates. You can Email this page to a friend.
    Related Other Helpful FAQs:
    What is Cron?
    Linux Start and stop the cron or crond service
    Run crontab Every 10 Minutes
    Linux / UNIX Setup and run php script as a cron job
    Stop Ubuntu / Debian Linux From Deleting /tmp Files on Boot
    Discussion on This FAQDavid Says:
    January 15th, 2008 at 12:21 am
    You might note that all files normally found in /etc/init.d, /etc/rc*.d, and others are all in /sbin in HP-UX 10.20 and up.
    Note too that your formatting is off in the description of the /etc/rc.config.d/cron file. Also, if you run /usr/bin/cron instead of /sbin/init.d/cron start, the /etc/rc.config.d/cron file is not used.
    Regards,
    Satya

    I guess it would :)
    btw, how did this piece miss from the contents pasted by the OP ?
    The doc has given all details of CRON and missed where to see the logfiles. :)
    ****Added****
    I tried man crontab in windows, i dont see it.i overlook most of the things, i would have done the same ;)
    Edited by: Bobcatalog on Oct 23, 2008 9:40 AM

  • Cron job error

    I get this message in my local mail:
    Subject: fcron <systab@morgana> /usr/sbin/run-cron /etc/cron.daily
    Date: Wed, 21 Dec 2011 00:02:47 +0200 (EET)
    From: [email protected] (fcron)
    Status: R
    col: Invalid or incomplete multibyte or wide character
    it's an error in one of cron.daily scripts. the only cron jobs were installed by packages:
    [root@morgana ~]# ls -l /etc/cron.daily/
    total 20
    -rwxr--r-- 1 root root 51 Sep 28 08:52 logrotate
    -rwxr--r-- 1 root root 807 Jun 4 2011 man-db
    -rwxr--r-- 1 root root 115 Sep 10 03:42 pkgfile
    -rwxr--r-- 1 root root 96 Dec 4 03:13 shadow
    -rwxr--r-- 1 root root 654 Apr 9 2011 updatedb
    I'm quite sure that man-db is having troubles. Also, I replaced default cron with fcron, same thing happens (I like fcron more anyway). Maybe it's locale related? I use en_US.UTF-8 in rc.conf and uk keymap.  locale.gen only has the defaults, en_US.UTF-8 UTF-8  & en_US ISO-8859-1.
    I have no idea what's wrong. Any ideas please? Thanks

    It appears one of your scripts is corrupt. Try running it through iconv to see if there is a bad byte sequence.
    $ iconv < /etc/cron.daily/man-db > /dev/null

  • Cron Job and PHP

    I am having problems running a cron job every one minute that calls a PHP script. Please see below:
    1 * * * * /usr/bin/php /Library/WebServer/Documents/secureohs/publichtml/reassignMSCcomptrack.php
    If I execute the command above, it runs just fine.
    Thank you in advance.

    I guess it would :)
    btw, how did this piece miss from the contents pasted by the OP ?
    The doc has given all details of CRON and missed where to see the logfiles. :)
    ****Added****
    I tried man crontab in windows, i dont see it.i overlook most of the things, i would have done the same ;)
    Edited by: Bobcatalog on Oct 23, 2008 9:40 AM

  • Pacman -Syu as a CRON job?

    OK, ... before the flames errupt ... I'm not managing any mission-critical systems.
    My interest in 'pacman -Syu' as a CRON job is for personal and friend's systems.  I'm wondering if you could post your cron scripts as an example for me to learn from.  How to you prefer to set your pacman.conf for this sort of thing?
    I'm mostly interested in the security benefits and new-features of using new/current packages by this automation.
    Thanx.

    I higly suggest you to do not run pacman as cronjob, but anyway there is nothing particular to do.
    At first ensure you have crond configured and running.
    Then just go into /etc/
    there are some directory with cron.[something]
    chose with which frequency youw ant to run the cron job
    then just create a file in the appropriate directory
    For pacman it shoul look like
    #!/bin/sh
    pacman -Syu
    I suggest you to use the
    IgnorePkg = <package> [package]
    in pacman config file in wich you specify wich package MUST NOT be update, for instance lilo.
    Consider that and indiscriminate automatic updating can potentially leed to an unsuable system.

  • Reg Cron Jobs

    hi,
    I need to run a cron job every alternate wednesdays...in a year
    Any suggestions????
    Thnx,
    Enz

    Method 1: Run a cron job every wednesday. Run your job if `date +%U` is even.
    problems: Some years will have 53 wednesdays, so eventually you'll run your job on consecutive weeks.
    Method 2: Run a cron job every wednesday. Set a file as a sentinel. If clear, set it and run your job. If set, clear it and dont' run the job.
    problems: If the cron job fails to run, your "alternate week" might get out of sync. Someone might screw up the sentinel file.
    Pick one based on your needs
    Darren

  • Cron job not running - script uses rsync, ssh (with id_rsa)

    Does anyone know how to get cron to run a rsync/ssh script which uses id_rsa for passwordless logins?
    I have a backup script I have slaved for months over that works wonderfully when running it from the command line.
    It uses rsync and connects with SSH (passwordless using ssh keys). I have setup id_rsa and id_rsa.pub for passwordless logins (this is my user account, and connects using root@ to the server)
    As stated all works find when run from the command line. But when I setup a cron job to run this file (exact same line I run from the command line) it does not execute. Actually, it does run, as I have an email notifiction which sends to me. It is just the rsync/ssh part that does not run.
    I have spent days and days trying to figure it out. No error messages occur, nothing.  Took me a while to find out cron is emailing the user account on Lion the messages (not to a proper email address).
    The error shows a permission denied, which I believe to be the cron user cannot use the id_rsa/ssh connection.
    Cron is running the script as my user, the same I use on the command line. I even tried copying the id_rsa to the root user .ssh folder in case cron is running as root but that does not work either.
    So does anyone know how to get cron to run this rsync/ssh script which used id_rsa for passwordless logins?
    Thanks a lot

    YES! Got it working, finally!
    So the issue is indeed cron/launchd not being able to access the ssh-agent which holds the key.
    So this is the solution...
    Download keychain for Mac:
    http://www.funtoo.org/wiki/Keychain
    Then once its installed and configured, the script to run needs this added to the top:
    eval `keychain --noask --eval id_rsa` || exit 1
    Note I am using id_rsa whereas keychains instructions refer to id_dsa so I just changed it and it works OK.
    When the script runs the first time it asks for the key password. Then it works from then on.
    What I do not know yet is will I need to re-enter the password when I logoff/logon again. That will cause an issue as I auto restart the Mac every day which means if I am off for a few days backup will stop (can you see the madness in this issue!).

Maybe you are looking for

  • FI-CAX

    Hello Guru, I have a question regarding FI-CAX. the issue is, we want to reverse a cash payment however reconciliation key is now closed. Please advise how to reversed. Reconciliation key status:     Reserved for Individ. Postings     Postings can no

  • Tag Handler Class classpath

              Hi.           I have some problems with Tag Handler Classes in custom tags. When tag handler           class store in package all is OK - I place it's class-file in /WEB-INF/classes/%package-path%/%class-name%.class           and in tld-fil

  • Antivirus for Nokia 808 Pureview White

    Please kindly suggest me the best free antivirus which i can install and which is compatible with my nokia 808 pureview white.... The installed antivirus F-Secure in my mobile is going to expire tomorrow.....  Solved! Go to Solution.

  • Security settings not taking effect?

    When I click the box to request a password on wake from sleep or screensaver, it doesn't take effect - I've tried rebooting and repairing permissions, but to no avail. I've also tried logging in as other users, still doesn't work. any ideas? edit wit

  • Symbian Anna - home screen error - no icons shown.

    Today while refreshing WLans suddenly phone give some error, which I couldn't read, cause was touching screen consistently. Then realized that suddenly all screens go back to their default values. It was changing between home screens and refreshing i