Unix Backup Script Question

Hello -
I want to compare file system dates (on AIX) for a backup script. For example, after the backup completes, I want to compare the timestamps on each backed up file with the the time the backup started. I should not see any timestamps prior to the start time of the backup.
Does anyone know how to do this in Unix?
Any help is greatly appreciated!
Thanks,
Mike

At the beginning of your backup use the touch command on a flag file of some kind. This will set the modified date to the current system time.
At the end of your backup compare the modified time of the flag file to the other files. Something like:
touch flag.file
< do your backup >
filelist=`ls filespec for files of interest`
for f in $filelist
do
   if [ $f -nt flag.test ]; then
      report it
   fi
done[pre]
HTH
John                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • Generate RMAN backup Script using unix shell script

    Hello,
    Could somebody give me a unix shell script that would generate RMAN script based on some user defined parameters in a config file.
    e.g.
    rman.conf
    CHANNELS=4
    USE_CATALOG=Y
    DEVICE='sbt_tabe'
    etc.,
    many thanks,
    kam

    You can actually encapsulate the RMAN commands inside the shell script.
    However if you really want to create a seperate RMAN script file, you can use the unix shell's "echo" command to write set variables to a file.
    Thus, for example,
    echo "rman target / catalog rman/rmanpassword@crcat" > RMAN_Script.rmn
    echo "backup database plus archivelog" >> RMAN_Script.rmn
    echo "backup archivelog all" >> RMAN_Script.rmn
    creates RMAN_Script.rmn with 3 commands.

  • Unix shell script to do a cold backup

    i want to do a coldback using a unix shell script.
    the db capacity is around 12 Tb
    wen the backup is done i need to zip it too.at this moment i dont want to copy to the disk.
    kindly help me regarding this
    thanks in advance
    NK

    i used something like this until recently:
    #!/bin/bash
    umask 0077
    export ORACLE_HOME="/u01/app/oracle/product/10.2.0/webdb1"
    export PATH="$ORACLE_HOME/bin:$PATH"
    export NLS_LANG="AMERICAN_AMERICA.WE8ISO8859P1"
    db="dbname"
    pipe="export.pipe"
    file="$db-`date "+%Y-%m-%d"`.dmp"
    if [ ! -p $pipe ]; then
    ## could exist but not be a pipe
    rm -f $pipe
    mknod $pipe p || (echo "could not create pipe $pipe"; exit 1)
    fi
    gzip -c > $file.gz < $pipe &
    exp system/****@$db FULL=Y CONSISTENT=Y FILE=$pipe DIRECT=Y GRANTS=Y
    you could of course also use zip|bzip2|pbzip2 or whatever.
    hth, rgds, armin walland

  • Need Help in creating Unix Shell Script for database

    Would be appreciable if some one can help in creating unix shell script for the Oracle DB 10,11g.
    Here is the condition which i want to implement.
    1. Create shell script to create the database with 10GB TB SPACE and 3 groups of redo log file(Each 300MB).
    2. Increase size of redolog file.
    3. Load sample schema.
    4. dump the schema.
    5. Create empty db (Script should check if db already exists and drop it in this case).
    6. Create backup using rman.
    7. restore backup which you have backed up.

    This isn't much of a "code-sharing" site but a "knowledge-sharing" site.  Code posted me may be from a questioner who has a problem / issue / error with his code.   But we don't generally see people writing entire scripts as responses to such questions as yours.  There may be other sites where you can get coding done "for free".
    What you could do is to write some of the code and test it and, if and when it fails / errors, post it for members to make suggestions.
    But the expectation here is for you to write your own code.
    Hemant K Chitale

  • Calling a report from unix shell script

    Hi,
    I had to call a report from unix shell script.
    May i know the procedure to accomplish this
    Thanks in Advance
    A.Gopal

    First you should not include the whole path to your report in the call ...
    Use like this:
    /ora/u01/oracle/v101/as2/bin/rwrun.sh report=an_stati destype=file desname=/ora/u01/oracle/v101/as2/test.pdf desformat=pdf
    In $ORACLE_HOME/bin/reports.sh:
    1) Verify that you have updated the REPORTS_PATH variable to include your folder where you have the report in question
    REPORTS_PATH=/ora/u20/app/qits/env1/run:$ORACLE_HOME/reports/templates:$ORACLE_HOME/reports/samples/demo: ....
    2) Verify that the REPORTS_TMP variable is pointing to a valid location and that the oracle user has access to write on it.
    After that, post the content of the tracefile located at $ORACLE_HOME/reports/logs/{in-process report server name folder}/rwserver.trc
    If no file is present then it means that you need to enable trace in your reports's conf file.... go to the $ORACLE_HOME/reports/conf folder and and locate the .conf file that correspond to your in-process reports server name (as specified in the rwservelet.properties file)... open/edit the file to enable trace logs ..
    i.e.
    Change the following line:
    <!--trace traceOpts="trace_all"/-->
    to <trace traceOpts="trace_all"/>
    Bounce the reports server and try to run the report again, this time the .trc file should be generated, post the content so that we can take a look.

  • Parallel Backup script written in python

    I'm writing a backup script in python, based on one I wrote in BASH earlier on. Both of these leverage rsync, but I decided to move to a python implementation because python is much more flexible than BASH. My goals with the new implementation are to back up the system, home folder, and my documents folder to a set of multiple primary, secondary, and tertiary disks, respectively. The method is as follows:
    1. check for the existence of disks and create folders which will contain mountpoints for each category of disk.
    2. decrypt and mount disks found under subfolders within those category folders, creating the mountpoints if they don't exist.
    3. syncronize the aforementioned data to the mounted disks using rsync, doing all three classes of disk in parallel.
    4. unmount and close disks
    This is really my first serious python program, and I realize that it's a bit complicated. My code is rather sloppy, as well, perhaps understandably so given my novice status. My only other programming experience is with BASH scripts, but I digress.
    Here is the code for the script (about 250 lines). It is written as a series of functions, and I'm uncertain as to whether functions or objects would work better. Additionally, I'm sure there's a python function provided by the os module analogous to the sync system call, but I've yet to find it in my python desk reference. The backup functions need work, and I'm still trying to figure out how to get them to loop through the mounted disks in each folder and copy to them. I require assistance in determining how to write the backup functions to do as outlined above, and how to run them in parallel. This is still a work in progress, mind.
    #!/usr/bin/python
    # Backup Script
    #### preferences ####
    # set your primary/secondary backup disks, encryption, and keyfile (if applicable) here.
    # backup disks
    # primary and secondary backups. As used here,
    # primary backups refer to backups of the entire system made to an external drive
    # secondary backups refer to backups made of individual folders, such as documents
    # primary backup disks by UUID:
    global PDISKS
    PDISKS = ("/dev/disk/by-uuid/16d64026-28bd-4e1f-a452-74e76bb4d47b","")
    # secondary backups by UUID.
    global SDISKS
    SDISKS = ()
    # tertiary disks by UUID:
    global TDISKS
    TDISKS = ("/dev/disk/by-uuid/39543e6e-cf50-4416-9669-e97a6abd2a37","")
    # backup paths
    # these are the paths of the folders you wish to back up to secondary
    # and tertiary disks, respectively. Primary disks are set to back up the
    # contents of the root filesystem (/*). NO TRAILING SLASHES.
    global SBACKUP
    SBACKUP = "/home/bryant"
    global TBACKUP
    TBACKUP = "/home/bryant/docs"
    # use encryption:
    use_encryption = True
    # keyfile
    # set the full path to your keyfile here
    # this assumes a single keyfile for all backup disks
    # set this to None if you don't have a single keyfile for all of your backups
    keyfile = "/usr/local/bin/backup.keyfile"
    # import modules
    import os, subprocess, sys
    ### preliminary functions ###
    # these do the setup and post-copy work
    def check_dirs():
    """checks that the folders which contain the mountpoints exist, creates them if they don't"""
    print("checking for mountpoints...")
    p = os.path.isdir("/mnt/pbackup")
    if p == True:
    print("primary mountpoint exists.")
    elif p == False:
    print("mountpoint /mnt/pbackup does not exist.\n\tcreating...")
    os.mkdir("/mnt/pbackup")
    s = os.path.isdir("/mnt/sbackup")
    if s == True:
    print("secondary mountpoint exists.")
    elif s == False:
    print("mountpoint /mnt/pbackup does not exist.\n\tcreating...")
    os.mkdir("/mnt/sbackup")
    t = os.path.isdir("/mnt/tbackup")
    if t == True:
    print("tertiary mountpoint exists.")
    elif t == False:
    print("mountpoint /mnt/tbackup does not exist.\n\tcreating...")
    os.mkdir("/mnt/tbackup")
    def mount_disks():
    """mounts available backup disks in their respective subdirectories"""
    pfolder = 1
    sfolder = 1
    tfolder = 1
    pmapper = "pbackup" + str(pfolder)
    smapper = "sbackup" + str(sfolder)
    tmapper = "tbackup" + str(tfolder)
    for pdisk in PDISKS:
    e = os.path.islink(pdisk)
    if e == True:
    subprocess.call("sync",shell=True)
    kf=os.path.isfile(keyfile)
    if kf == True:
    print("keyfile found. Using keyfile to decrypt...")
    subprocess.call("sudo cryptsetup luksOpen " + pdisk + " " + pmapper + " --key-file " + keyfile,shell=True)
    if kf == False:
    print("keyfile not found or keyfile not set. \t\nAsking for passphrase...")
    subprocess.call("sudo cryptsetup luksOpen " + pdisk + " " + pmapper,shell=True)
    f = os.path.isdir("/mnt/pbackup/pbak" + str(pfolder))
    if f == True:
    subprocess.call("mount " + "/dev/mapper/" + pmapper + " /mnt/pbak" + str(pfolder),shell=True)
    pfolder += 1
    elif f == False:
    os.mkdir("/mnt/pbackup/pbak" + str(pfolder))
    subprocess.call("mount " + "/dev/mapper/" + pmapper + " /mnt/pbak" + str(pfolder),shell=True)
    pfolder += 1
    for sdisk in SDISKS:
    e = os.path.islink(sdisk)
    if e == True:
    subprocess.call("sync",shell=True)
    kf=os.path.isfile(keyfile)
    if kf == True:
    print("keyfile found. Using keyfile to decrypt...")
    subprocess.call("sudo cryptsetup luksOpen " + sdisk + " " + smapper + " --key-file " + keyfile,shell=True)
    if kf == False:
    print("keyfile not found or keyfile not set. \t\nAsking for passphrase...")
    subprocess.call("sudo cryptsetup luksOpen " + sdisk + " " + smapper,shell=True)
    f = os.path.isdir("/mnt/sbackup/sbak" + str(sfolder))
    if f == True:
    subprocess.call("mount " + "/dev/mapper/" + smapper + " /mnt/sbackup/sbak" + str(sfolder),shell=True)
    sfolder += 1
    elif f == False:
    os.mkdir("/mnt/sbackup/sbak" + str(folder))
    subprocess.call("mount " + "/dev/mapper/" + smapper + " /mnt/sbackup/sbak" + str(sfolder),shell=True)
    sfolder += 1
    for tdisk in TDISKS:
    e = os.path.islink(tdisk)
    if e == True:
    subprocess.call("sync",shell=True)
    kf=os.path.isfile(keyfile)
    if kf == True:
    print("keyfile found. Using keyfile to decrypt...")
    subprocess.call("sudo cryptsetup luksOpen " + tdisk + " " + tmapper + " --key-file " + keyfile,shell=True)
    if kf == False:
    print("keyfile not found or keyfile not set. \t\nAsking for passphrase...")
    subprocess.call("sudo cryptsetup luksOpen " + tdisk + " " + tmapper,shell=True)
    f = os.path.isdir("/mnt/tbackup/tbak" + str(tfolder))
    if f == True:
    subprocess.call("mount " + "/dev/mapper/" + tmapper + " /mnt/pbak" + str(tfolder),shell=True)
    tfolder += 1
    elif f == False:
    os.mkdir("/mnt/tbackup/tbak" + str(tfolder))
    subprocess.call("mount " + "/dev/mapper/" + tmapper + " /mnt/tbak" + str(tfolder),shell=True)
    tfolder += 1
    def umount_disks():
    """unmounts and relocks disks"""
    subprocess.call("umount /mnt/pbackup*",shell=True)
    subprocess.call("umount /mnt/sbackup*",shell=True)
    subprocess.call("umount /mnt/tbackup*",shell=True)
    subprocess.call("cryptsetup luksClose /dev/mapper/pbackup*",shell=True)
    subprocess.call("cryptsetup luksClose /dev/mapper/sbackup*",shell=True)
    subprocess.call("cryptsetup luksClose /dev/mapper/tbackup*",shell=True)
    def check_disks():
    """checks to see how many disks exist, exits program if none are attached"""
    pdisknum = 0
    sdisknum = 0
    tdisknum = 0
    for pdisk in PDISKS:
    p = os.path.islink(pdisk)
    if p == True:
    pdisknum += 1
    elif p == False:
    print("disk " + pdisk + " not detected.")
    for sdisk in SDISKS:
    s = os.path.islink(sdisk)
    if s == True:
    sdisknum += 1
    elif s == False:
    print("disk " + sdisk + " not detected.")
    for tdisk in TDISKS:
    t = os.path.islink(tdisk)
    if t == True:
    tdisknum += 1
    elif t == False:
    print("disk " + tdisk + " not detected.")
    total = pdisknum + sdisknum + tdisknum
    if total == 0:
    print("ERROR: no disks detected.")
    sys.exit()
    elif total > 0:
    print("found " + str(total) + " attached backup disks")
    print(str(pdisknum) + " Primary")
    print(str(sdisknum) + " secondary")
    print(str(tdisknum) + " tertiary")
    return total, pdisknum, sdisknum, tdisknum
    ### backup functions ###
    # these need serious work. Need to get them to loop through available mounted
    # disks in their categories and then execute rsync
    def pbackup():
    """calls rsync to backup the entire system to all pdisks"""
    dirs = os.listdir("/mnt/pbackup")
    for dir in dirs:
    m = os.path.ismount(dir)
    if m == True:
    subprocess.call("sync",shell=True)
    print("syncing disks with rsync...")
    # subprocess.call("rsync --progress --human-readable --numeric-ids --inplace --verbose --archive --delete-after --hard-links --xattrs --delete --compress --skip-compress={*.jpg,*.bz2,*.gz,*.tar,*.tar.gz,*.ogg,*.mp3,*.tar.xz,*.avi} /* /mnt/pbackup/" + dir + "/ --exclude={/sys/*,/mnt/*,/proc/*,/dev/*,/lost+found,/media/*,/tmp/*,/home/*/.gvfs/*,/home/*/downloads/*,/opt/*,/run/*",shell=True)
    print("test1")
    subprocess.call("sync",shell=True)
    print("disk synced with disk " + pdisk + ".")
    print("sync with disk " + pdisk + " complete.")
    elif m == False:
    continue
    def sbackup():
    """calls rsync to backup everything under SBACKUP folder to all sdisks"""
    dirs = os.listdir("/mnt/sbackup")
    for dir in dirs:
    m = os.path.ismount(dir)
    if m == True:
    subprocess.call("sync",shell=True)
    # subprocess.call("rsync --progress --human-readable --numeric-ids --inplace --verbose --archive --delete-after --hard-links --xattrs --delete --compress --skip-compress={*.jpg,*.bz2,*.gz,*.tar,*.tar.gz,*.ogg,*.mp3,*.tar.xz,*.avi} SBACKUP/* /mnt/sbackup/" + dir + "/",shell=True)
    print("test2")
    subprocess.call("sync",shell=True)
    print("disk synced with disk " + pdisk + ".")
    print("sync with disk " + sdisk + " complete.")
    elif m == False:
    continue
    def tbackup():
    """calls rsync to backup everything under TBACKUP folder to all tdisks"""
    dirs = os.listdir("/mnt/tbackup")
    for dir in dirs:
    m = os.path.ismount(dir)
    if m == True:
    subprocess.call("sync",shell=True)
    # subprocess.call("rsync --progress --human-readable --numeric-ids --inplace --verbose --archive --delete-after --hard-links --xattrs --delete --compress --skip-compress={*.jpg,*.bz2,*.gz,*.tar,*.tar.gz,*.ogg,*.mp3,*.tar.xz,*.avi} TBACKUP/* /mnt/sbackup/" + dir + "/",shell=True)
    print("test3")
    subprocess.call("sync",shell=True)
    print("disk synced with disk " + pdisk + ".")
    print("sync with disk " + sdisk + " complete.")
    elif m == False:
    continue
    #### main ####
    # check for root access:
    r=os.getuid()
    if r != 0:
    print("ERROR: script not run as root.\n\tThis script MUST be run as root user.")
    sys.exit()
    elif r == 0:
    # program body
    check_dirs()
    check_disks()
    mount_disks()
    # pbackup()
    # sbackup()
    tbackup()
    umount_disks()
    print("backup process complete.")
    Last edited by ParanoidAndroid (2013-08-07 20:01:07)

    I've run into a problem on line 149. I'm asking the program to list the directories under the top-level backup directories under /mnt, check to see if each one is a mountpoint, and if it is unmount it. It does this, but it appears to recurse into the directories under the directories I'm asking it to check. The output is:
    checking for mountpoints...
    primary mountpoint exists.
    secondary mountpoint exists.
    tertiary mountpoint exists.
    disk /dev/disk/by-uuid/16d64026-28bd-4e1f-a452-74e76bb4d47b not detected.
    found 1 attached backup disks
    0 Primary
    0 secondary
    1 tertiary
    keyfile found. Using keyfile to decrypt...
    mounting tbackup1 at /mnt/tbak1
    test3
    not a mountpoint
    not a mountpoint
    not a mountpoint
    not a mountpoint
    not a mountpoint
    not a mountpoint
    not a mountpoint
    not a mountpoint
    not a mountpoint
    not a mountpoint
    not a mountpoint
    not a mountpoint
    not a mountpoint
    not a mountpoint
    Device /dev/mapper/pbackup* is not active.
    Device /dev/mapper/sbackup* is not active.
    backup process complete.
    here is the code for the entire script. It's been much modified from the previously posted version, so I included all of the code versus the section in question for reference. As I said, the section that seems to be causing the issue is on line 149.
    #!/usr/bin/python
    # Backup Script
    #### preferences ####
    # set your primary/secondary backup disks, encryption, and keyfile (if applicable) here.
    # backup disks
    # primary and secondary backups. As used here,
    # primary backups refer to backups of the entire system made to an external drive
    # secondary backups refer to backups made of individual folders, such as documents
    # primary backup disks by UUID:
    global PDISKS
    PDISKS = ["/dev/disk/by-uuid/16d64026-28bd-4e1f-a452-74e76bb4d47b"]
    # secondary backups by UUID.
    global SDISKS
    SDISKS = []
    # tertiary disks by UUID:
    global TDISKS
    TDISKS = ["/dev/disk/by-uuid/39543e6e-cf50-4416-9669-e97a6abd2a37"]
    # backup paths
    # these are the paths of the folders you wish to back up to secondary
    # and tertiary disks, respectively. Primary disks are set to back up the
    # contents of the root filesystem (/*). NO TRAILING SLASHES.
    global SBACKUP
    SBACKUP = "/home/bryant"
    global TBACKUP
    TBACKUP = "/home/bryant/docs"
    # use encryption:
    use_encryption = True
    # keyfile
    # set the full path to your keyfile here
    # this assumes a single keyfile for all backup disks
    # set this to None if you don't have a single keyfile for all of your backups
    keyfile = "/usr/local/bin/backup.keyfile"
    # import modules
    import os, subprocess, sys
    ### preliminary functions ###
    # these do the setup and post-copy work
    def check_dirs():
    """checks that the folders which contain the mountpoints exist, creates them if they don't"""
    print("checking for mountpoints...")
    if os.path.isdir("/mnt/pbackup"):
    print("primary mountpoint exists.")
    else:
    print("mountpoint /mnt/pbackup does not exist.\n\tcreating...")
    os.mkdir("/mnt/pbackup")
    if os.path.isdir("/mnt/sbackup"):
    print("secondary mountpoint exists.")
    else:
    print("mountpoint /mnt/pbackup does not exist.\n\tcreating...")
    os.mkdir("/mnt/sbackup")
    if os.path.isdir("/mnt/tbackup"):
    print("tertiary mountpoint exists.")
    else:
    print("mountpoint /mnt/tbackup does not exist.\n\tcreating...")
    os.mkdir("/mnt/tbackup")
    def mount_disks(wdisk):
    """mounts available backup disks in their respective subdirectories"""
    pfolder = 1
    sfolder = 1
    tfolder = 1
    pmapper = "pbackup"
    smapper = "sbackup"
    tmapper = "tbackup"
    if wdisk == "p":
    for pdisk in PDISKS:
    if os.path.islink(pdisk):
    subprocess.call("sync",shell=True)
    if os.path.isfile(keyfile):
    print("keyfile found. Using keyfile to decrypt...")
    subprocess.call("sudo cryptsetup luksOpen " + pdisk + " " + pmapper + str(pfolder) + " --key-file " + keyfile,shell=True)
    else:
    print("keyfile not found or keyfile not set. \t\nAsking for passphrase...")
    subprocess.call("sudo cryptsetup luksOpen " + pdisk + " " + pmapper + str(pfolder),shell=True)
    if os.path.isdir("/mnt/pbackup/pbak" + str(pfolder)):
    print("mounting " + pmapper + str(pfolder) + " at /mnt/pbak" + str(pfolder))
    subprocess.call("mount " + "/dev/mapper/" + pmapper + str(pfolder) + " /mnt/pbackup/pbak" + str(pfolder),shell=True)
    pfolder += 1
    else:
    os.mkdir("/mnt/pbackup/pbak" + str(pfolder))
    subprocess.call("mount " + "/dev/mapper/" + pmapper + str(pfolder) + " /mnt/pbackup/pbak" + str(pfolder),shell=True)
    pfolder += 1
    elif wdisk == "s":
    for sdisk in SDISKS:
    if os.path.islink(sdisk):
    subprocess.call("sync",shell=True)
    if os.path.isfile(keyfile):
    print("keyfile found. Using keyfile to decrypt...")
    subprocess.call("sudo cryptsetup luksOpen " + sdisk + " " + smapper + str(sfolder) + " --key-file " + keyfile,shell=True)
    else:
    print("keyfile not found or keyfile not set. \t\nAsking for passphrase...")
    subprocess.call("sudo cryptsetup luksOpen " + sdisk + " " + smapper + str(sfolder),shell=True)
    if os.path.isdir("/mnt/sbackup/sbak" + str(sfolder)):
    print("mounting " + smapper + str(sfolder) + " at /mnt/sbak" + str(sfolder))
    subprocess.call("mount " + "/dev/mapper/" + smapper + str(sfolder) + " /mnt/sbackup/sbak" + str(sfolder),shell=True)
    sfolder += 1
    else:
    os.mkdir("/mnt/sbackup/sbak" + str(folder))
    subprocess.call("mount " + "/dev/mapper/" + smapper + str(sfolder) + " /mnt/sbackup/sbak" + str(sfolder),shell=True)
    sfolder += 1
    elif wdisk == "t":
    for tdisk in TDISKS:
    if os.path.islink(tdisk):
    subprocess.call("sync",shell=True)
    if os.path.isfile(keyfile):
    print("keyfile found. Using keyfile to decrypt...")
    subprocess.call("sudo cryptsetup luksOpen " + tdisk + " " + tmapper + str(tfolder) + " --key-file " + keyfile,shell=True)
    else:
    print("keyfile not found or keyfile not set. \t\nAsking for passphrase...")
    subprocess.call("sudo cryptsetup luksOpen " + tdisk + " " + tmapper + str(tfolder),shell=True)
    if os.path.isdir("/mnt/tbackup/tbak" + str(tfolder)):
    print("mounting " + tmapper + str(tfolder) + " at /mnt/tbak" + str(tfolder))
    subprocess.call("mount " + "/dev/mapper/" + tmapper + str(tfolder) + " /mnt/tbackup/tbak" + str(tfolder),shell=True)
    if os.path.islink(tdisk):
    tfolder += 1
    else:
    os.mkdir("/mnt/tbackup/tbak" + str(tfolder))
    subprocess.call("mount " + "/dev/mapper/" + tmapper + " /mnt/tbackup/tbak" + str(tfolder),shell=True)
    tfolder += 1
    def umount_disks():
    """unmounts and relocks disks"""
    pdirs = os.listdir("/mnt/pbackup")
    sdirs = os.listdir("/mnt/sbackup")
    tdirs = os.listdir("/mnt/tbackup")
    for pdir in pdirs:
    if os.path.ismount("/mnt/pbackup/" + pdir):
    subprocess.call("umount /mnt/pbackup/" + pdir,shell=True)
    else:
    print("not a mountpoint")
    for sdir in sdirs:
    if os.path.ismount("/mnt/sbackup/" + sdir):
    subprocess.call("umount /mnt/sbackup/" + sdir,shell=True)
    else:
    print("not a mountpoint")
    for tdir in tdirs:
    if os.path.ismount("/mnt/tbackup/" + tdir):
    subprocess.call("umount /mnt/tbackup/" + tdir,shell=True)
    else:
    print("not a mountpoint")
    subprocess.call("cryptsetup luksClose /dev/mapper/pbackup*",shell=True)
    subprocess.call("cryptsetup luksClose /dev/mapper/sbackup*",shell=True)
    subprocess.call("cryptsetup luksClose /dev/mapper/tbackup*",shell=True)
    def check_disks():
    """checks to see how many disks exist, exits program if none are attached"""
    pdisknum = 0
    sdisknum = 0
    tdisknum = 0
    for pdisk in PDISKS:
    if os.path.islink(pdisk):
    pdisknum += 1
    else:
    print("\ndisk " + pdisk + " not detected.")
    for sdisk in SDISKS:
    if os.path.islink(sdisk):
    sdisknum += 1
    else:
    print("\ndisk " + sdisk + " not detected.")
    for tdisk in TDISKS:
    if os.path.islink(tdisk):
    tdisknum += 1
    else:
    print("\ndisk " + tdisk + " not detected.")
    total = pdisknum + sdisknum + tdisknum
    if total == 0:
    print("\nERROR: no disks detected.")
    sys.exit()
    elif total > 0:
    print("found " + str(total) + " attached backup disks")
    print(str(pdisknum) + " Primary")
    print(str(sdisknum) + " secondary")
    print(str(tdisknum) + " tertiary")
    return total, pdisknum, sdisknum, tdisknum
    ### backup functions ###
    # these need serious work. Need to get them to loop through available mounted
    # disks in their categories and then execute rsync
    def pbackup():
    """calls rsync to backup the entire system to all pdisks"""
    dirs = os.listdir("/mnt/pbackup")
    for dir in dirs:
    if os.path.ismount("/mnt/pbackup/" + dir) == True:
    subprocess.call("sync",shell=True)
    print("syncing disks with rsync...")
    subprocess.call("rsync --progress --human-readable --numeric-ids --inplace --verbose --archive --delete-after --hard-links --xattrs --delete --compress --skip-compress={*.jpg,*.bz2,*.gz,*.tar,*.tar.gz,*.ogg,*.mp3,*.tar.xz,*.avi} /* /mnt/pbackup/" + dir + "/ --exclude={/sys/*,/mnt/*,/proc/*,/dev/*,/lost+found,/media/*,/tmp/*,/home/*/.gvfs/*,/home/*/downloads/*,/opt/*,/run/*",shell=True)
    subprocess.call("sync",shell=True)
    else:
    continue
    def sbackup():
    """calls rsync to backup everything under SBACKUP folder to all sdisks"""
    dirs = os.listdir("/mnt/sbackup")
    for dir in dirs:
    if os.path.ismount("/mnt/sbackup/" + dir):
    subprocess.call("sync",shell=True)
    subprocess.call("rsync --progress --human-readable --numeric-ids --inplace --verbose --archive --delete-after --hard-links --xattrs --delete --compress --skip-compress={*.jpg,*.bz2,*.gz,*.tar,*.tar.gz,*.ogg,*.mp3,*.tar.xz,*.avi} " + SBACKUP + "/* /mnt/sbackup/" + dir + "/",shell=True)
    subprocess.call("sync",shell=True)
    else:
    continue
    def tbackup():
    """calls rsync to backup everything under TBACKUP folder to all tdisks"""
    dirs = os.listdir("/mnt/tbackup")
    for dir in dirs:
    if os.path.ismount("/mnt/tbackup/" + dir):
    subprocess.call("sync",shell=True)
    subprocess.call("rsync --progress --human-readable --numeric-ids --inplace --verbose --archive --delete-after --hard-links --xattrs --delete --compress --skip-compress={*.jpg,*.bz2,*.gz,*.tar,*.tar.gz,*.ogg,*.mp3,*.tar.xz,*.avi} " + TBACKUP + "/* /mnt/sbackup/" + dir + "/",shell=True)
    subprocess.call("sync",shell=True)
    else:
    continue
    #### main ####
    # check for root access:
    r=os.getuid()
    if r != 0:
    print("ERROR: script not run as root.\n\tThis script MUST be run as root user.")
    sys.exit()
    elif r == 0:
    # program body
    check_dirs()
    d=check_disks()
    if d[1] > 0:
    mount_disks("p")
    pbackup()
    elif d[2] > 0:
    mount_disks("s")
    sbackup()
    elif d[3] > 0:
    mount_disks("t")
    tbackup()
    umount_disks()
    print("backup process complete.")
    Last edited by ParanoidAndroid (2013-08-11 00:32:02)

  • Unix shell script should execute (run) webI report.

    Hi
    i am new to BO.
    I have webI reports developed, can any one tell me how  to execute a webI reprot using unix sheel script.

    Hello Vijaya,
    Thatu2019s an interesting question.  BusinessObjects does not supply any native UNIX shell interfaces or scripts for running/executing Webi Reports. Not knowing what it is you are exactly trying to accomplish Iu2019ll give a very general answer.
    I have had several customers who had requirements to have external systems execute, refresh and export reports in BusinessObjects Enterprise before.  These external systems could execute a shell script so what they have ended up doing is creating generic Java applications that use the BusinessObjects BOE Java SDK. Once they had the Java application created their external application could execute a java directory or they created shell wrappers that were called.  So what you could do is create some Java applications that wrap the functionally you need and then execute those from the command line.
    With that said there is a lot of functionally built into BusinessObjects Enterprise.  If I was to know exactly what you were trying to achieve I might be able to point you in the direction of an existing product feature.
    Cheers,
    David.

  • Exit status running java classpath in a unix shell script

    I'm new to putting java into unix scripts. I have a java classpath running inside of a unix shell script. During my testing it will error with java.io.FileNotFoundException error, which I know why that is, but when I set in my unix shell script this to see the right exit status of success/fail, it always shows a 0 for success when that isn't really the case. Below is the two lines I have set to capture the exit status and just display that exit status for now.
    notifycode=$?
    echo $notifycode
    I have these 2 lines above on a line right below my java command in my unix shell script. How can I get my unix shell script to show the right exit status if the java classpath command fails? Thanks for any help.

    That's Java code, it says "End this Java application and send return code 1 back to the shell". As for how the shell gets the return code from the application, that's a question about your shell and not about Java programming, no?

  • How to prepare for Converting UNIX shell scripts to PL/SQL

    Hi All
    I was said, that i may have to convert a lot of unix shell script to PL/SQL, what are the concepts i need to know to do it efficently,
    what are the options PL/SQL is having to best do that.
    I know the question is little unclear, but I too dont have much inputs about that i'm sorry for that, just its a question of how
    to prepare myself to do it the best way. What are the concepts i have to be familiar with.
    Many Thanks
    MJ

    Just how much work is involved, is hard to say. Many years ago I also wrote (more than once) a complete ETL system using a combination of shell scripts, SQL*Plus and PL/SQL.
    If the PL/SQL code is fairly clean, uses bind variables and not substitution variables, then it should be relatively easy to convert that PL/SQL code in the script to a formal stored procedure in the database.
    There is however bits and pieces that will be difficult to move into the PL/SQL layer as it requires new software - like for example FTP'ing a file from the production server to the ETL server. This can be done using external o/s calls from within PL/SQL. Or, you can install a FTP API library in PL/SQL and FTP that file directly into a CLOB and parse and process the CLOB.
    Think of Oracle as an o/s in its own right. In Oracle we have a mail client, a web browser, IPC methods like pipes and messages queues, cron, file systems, web servers and services, etc. And PL/SQL is the "shell scripting" (times a thousand) language of this Oracle o/s .
    In some cases you will find it fairly easy to map a Unix o/s feature or command to one in Oracle. For example, a Unix wget to fetch a HTML CSV file can easily be replaced in Oracle using a UTL_HTTP call.
    On the other hand, techniques used in Unix like creating a pipe to process data, grep for certain stuff and awk certain tokens for sed to process further... in Oracle this will look and work a lot different and use SQL.

  • Windows Server backup script won't do differential/incremental

    What follows is a script that doesn't seem to do backups on an incremental basis so it is creating full backups each time.
    ++++++++++
    param(
      [string]$volLetter,
      [string]$scriptStorageLocation
    function prepare-disk($checkDiskCriteria,$diskOrVolume){
        if($diskOrVolume -eq 'disk'){
        $disks = Get-WBDisk
        $selected = $disks|?{$_.DiskName -match $checkDiskCriteria}
        elseif($diskOrVolume -eq 'volume' ){
        $allVolumes = Get-WBVolume -AllVolumes
        $selected = $allVolumes|?{$_.MountPath -match $checkDiskCriteria}
    return $selected
    function add-volumeMountPoint($policyAdd,$mountPoint){
        $matchVolumes = Get-WBVolume -AllVolumes
        $correctVolume = $matchVolumes | ?{ $_.MountPoint -eq $mountPoint}
        Add-WBVolume -Policy $policyAdd -Volume $correctVolume;
        return $policyAdd
    function add-VMToWB($policyAdd,$vmName){
    $vmObject = Get-WBVirtualMachine |?{ $_.VMName -eq $vmName}
    $vmobject='PCLaw';'2012CORPEXCHANGE';'File Server';'DC1'
    Add-WBVirtualMachine $policyAdd -VirtualMachine $vmObject
    return $policyAdd
    function remove-policy(){
    $policy = get-wbpolicy -editable
    $policy|export-clixml 'backup.xml'
    remove-wbpolicy $policy -force
    function restore-policy($wbBackupTarget){
    $policyRestore = import-clixml 'backup.xml'
    $global:newPolicy = new-wbpolicy
    Set-WBSchedule -Policy $newPolicy -Schedule $policyRestore.Schedule
    $VolumeBackupLocation = New-WBBackupTarget -Volume $wbBackupTarget
    Add-WBBackupTarget -Policy $newPolicy -Target $VolumeBackupLocation
    if($([string]$policyRestore.VssBackupOptions) -match 'VssFullBackup' ){Set-WBVssBackupOptions $global:newPolicy -VssFullBackup;write-host 'foundFull'}
    else{Set-WBVssBackupOptions $global:newPolicy -VssFullBackup;write-host 'FoundCopy'}
    $newPolicyBound = $policyRestore.VolumesToBackup|%{add-volumeMountPoint $global:newPolicy $_.MountPoint;}
    $global:newPolicy = $newPolicyBound[-1]
    if($policyRestore.BMR){Add-WBBareMetalRecovery $global:newPolicy}
    if($policyRestore.SystemState){Add-WBSystemState $global:newPolicy}
    $newPolicyBound = $policyRestore.ComponentsToBackup | %{ add-VMToWB $global:newPolicy $_.VMName}
    $global:newPolicy = $newPolicyBound[-1]
    write-host -fore cyan 'Final Policy'
    $global:newPolicy
    Set-WBPolicy $global:newPolicy
    function rename-WIB($pathWIB,$dateOfBackup){
    if(test-path $pathWIB){
        $newName = "WIB_"+$dateOfBackup
        rename-item $pathWIB -newName $newName
    Add-WBBackupTarget -Policy $newPolicy
    Set-WBPolicy $newPolicy
    if(!($scriptStorageLocation)){
    $scriptStorageLocation = 'C:\Techbase\WindowsBackupRecreationScript';}
    $volCheck = $volLetter+":";
    $pathNew = $volLetter+":\WindowsImageBackup";
    $dateOfBackup = Get-Date -UFormat "%Y_%m_%d";
    $volName = $volLetter+":";
    if(!(test-path "$scriptStorageLocation\WBfile.txt")){
    $diskOrVolumeInput = Read-host 'Are you using a disk or a volume (type d or v)?'
    $diskOrVolumeInput = $diskOrVolumeInput.ToLower();
        if(($diskOrVolumeInput -eq 'v') -or ($diskOrVolumeInput -eq 'd')){
            New-Item "$scriptStorageLocation\WBfile.txt" -type file
            Add-content "$scriptStorageLocation\WBfile.txt" $diskOrVolumeInput        
                if($diskOrVolumeInput -eq 'd'){
                    disk
                    $diskNum= Read-host 'Please select the disk number ?'
                    Add-content "$scriptStorageLocation\WBfile.txt" $diskNum
                elseif($diskOrVolumeInput -eq 'v'){
                    $allVolumes = Get-WBVolume -AllVolumes;
                    $allVolumes|Select  *;
                    $diskVol= Read-host 'Please type in the letter of the Mountpath you would like to use (Only type in the letter)?'
                    $diskVol = $diskVol.ToUpper();
                    Add-content "$scriptStorageLocation\WBfile.txt" $diskVol
        else{
            Write-host -fore red 'Sorry the input was not an available option.'
    else{
    write-host 'Your configuration file was ready when this script is executed.';
    $info = gc "$scriptStorageLocation\WBfile.txt"
        if($info[0]='v'){
            write-host -fore cyan $info[1]
            $WB_Volume = prepare-disk $info[1] 'volume'
            $locationOfWIB = $info[1] +":\WindowsImageBackup";
            rename-WIB  $locationOfWIB $dateOfBackup
            remove-policy
            restore-policy $WB_Volume
        elseif($info[0]='d'){
            $WB_Disk = prepare-disk 'WD My Book 1230 USB Device' 'disk'
            $WB_Disk;
    +++++++++++
    Also what follows is the most recent backup policy.
    +++++++++++++++++++
    - <Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04">
    - <Obj RefId="0">
    - <TN RefId="0">
      <T>Microsoft.Windows.ServerBackup.Commands.WBPolicy</T>
      <T>System.Object</T>
      </TN>
      <ToString>Microsoft.Windows.ServerBackup.Commands.WBPolicy</ToString>
    - <Props>
    - <Obj N="Schedule" RefId="1">
    - <TN RefId="1">
      <T>System.Collections.Generic.List`1[[System.DateTime, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]</T>
      <T>System.Object</T>
      </TN>
    - <LST>
      <DT>2014-10-14T19:30:00</DT>
      </LST>
      </Obj>
    - <Obj N="BackupTargets" RefId="2">
    - <TN RefId="2">
      <T>System.Collections.Generic.List`1[[Microsoft.Windows.ServerBackup.Commands.WBBackupTarget, wsbcmdlet, Version=6.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]</T>
      <T>System.Object</T>
      </TN>
    - <LST>
    - <Obj RefId="3">
    - <TN RefId="3">
      <T>Microsoft.Windows.ServerBackup.Commands.WBBackupTarget</T>
      <T>System.Object</T>
      </TN>
      <ToString>F:</ToString>
    - <Props>
      <S N="Label">3TB USB</S>
      <Nil N="WBDisk" />
      <S N="WBVolume">3TB USB (F:)</S>
      <S N="Path">\\?\Volume{7f5bcfe6-a050-44be-80c9-b056f0121819}</S>
      <S N="TargetType">Volume</S>
      <B N="InheritAcl">true</B>
      <B N="PreserveExistingBackup">true</B>
      </Props>
      </Obj>
      </LST>
      </Obj>
    - <Obj N="VolumesToBackup" RefId="4">
    - <TN RefId="4">
      <T>System.Collections.Generic.List`1[[Microsoft.Windows.ServerBackup.Commands.WBVolume, wsbcmdlet, Version=6.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]</T>
      <T>System.Object</T>
      </TN>
      <LST />
      </Obj>
    - <Obj N="FilesSpecsToBackup" RefId="5">
    - <TN RefId="5">
      <T>System.Collections.Generic.List`1[[Microsoft.Windows.ServerBackup.Commands.WBFileSpec, wsbcmdlet, Version=6.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]</T>
      <T>System.Object</T>
      </TN>
      <LST />
      </Obj>
    - <Obj N="FilesSpecsToExclude" RefId="6">
      <TNRef RefId="5" />
      <LST />
      </Obj>
    - <Obj N="ComponentsToBackup" RefId="7">
    - <TN RefId="6">
      <T>System.Collections.Generic.List`1[[Microsoft.Windows.ServerBackup.Commands.WBApplicationComponent, wsbcmdlet, Version=6.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]</T>
      <T>System.Object</T>
      </TN>
    - <LST>
    - <Obj RefId="8">
    - <TN RefId="7">
      <T>Microsoft.Windows.ServerBackup.Commands.WBVirtualMachine</T>
      <T>Microsoft.Windows.ServerBackup.Commands.WBApplicationComponent</T>
      <T>System.Object</T>
      </TN>
      <ToString>0E91F216-553D-4C7C-8178-A09E5D081020\</ToString>
    - <Props>
      <S N="VMName">PCLaw 2008 R2</S>
      <S N="ComponentName">0E91F216-553D-4C7C-8178-A09E5D081020</S>
      <S N="LogicalPath" />
      <S N="Caption">Backup Using Saved State\PCLaw 2008 R2</S>
      <G N="WriterId">66841cd4-6ded-4f4b-8f17-fd23f8ddc3de</G>
      <G N="InstanceId">b0f4f239-bcc6-408f-9db6-b66d5de9458d</G>
      </Props>
      </Obj>
    - <Obj RefId="9">
      <TNRef RefId="7" />
      <ToString>12DCBB00-87D9-4660-82E1-E01245A5E011\</ToString>
    - <Props>
      <S N="VMName">2012CORPEXCHANGE</S>
      <S N="ComponentName">12DCBB00-87D9-4660-82E1-E01245A5E011</S>
      <S N="LogicalPath" />
      <S N="Caption">Backup Using Saved State\2012CORPEXCHANGE</S>
      <G N="WriterId">66841cd4-6ded-4f4b-8f17-fd23f8ddc3de</G>
      <G N="InstanceId">b0f4f239-bcc6-408f-9db6-b66d5de9458d</G>
      </Props>
      </Obj>
    - <Obj RefId="10">
      <TNRef RefId="7" />
      <ToString>8A769D3A-4B21-419A-8BA2-584EC3168C51\</ToString>
    - <Props>
      <S N="VMName">File Server</S>
      <S N="ComponentName">8A769D3A-4B21-419A-8BA2-584EC3168C51</S>
      <S N="LogicalPath" />
      <S N="Caption">Backup Using Saved State\File Server</S>
      <G N="WriterId">66841cd4-6ded-4f4b-8f17-fd23f8ddc3de</G>
      <G N="InstanceId">b0f4f239-bcc6-408f-9db6-b66d5de9458d</G>
      </Props>
      </Obj>
    - <Obj RefId="11">
      <TNRef RefId="7" />
      <ToString>A912807A-04FE-4AB6-981B-01D6489865D6\</ToString>
    - <Props>
      <S N="VMName">DC1</S>
      <S N="ComponentName">A912807A-04FE-4AB6-981B-01D6489865D6</S>
      <S N="LogicalPath" />
      <S N="Caption">Backup Using Saved State\DC1</S>
      <G N="WriterId">66841cd4-6ded-4f4b-8f17-fd23f8ddc3de</G>
      <G N="InstanceId">b0f4f239-bcc6-408f-9db6-b66d5de9458d</G>
      </Props>
      </Obj>
      </LST>
      </Obj>
      <B N="BMR">false</B>
      <B N="SystemState">false</B>
      <B N="OverwriteOldFormatVhd">false</B>
    - <Obj N="VssBackupOptions" RefId="12">
    - <TN RefId="8">
      <T>Microsoft.Windows.ServerBackup.Commands.VssBackupOptions</T>
      <T>System.Enum</T>
      <T>System.ValueType</T>
      <T>System.Object</T>
      </TN>
      <ToString>VssFullBackup</ToString>
      <I32>0</I32>
      </Obj>
      </Props>
      </Obj>
      </Objs>
    ++++++++
    +++++++++++++++++++++++++
    Script does everything perfect except for the backup not being incremental/differential - it just creates a different folder each iteration that it puts the backup into.
    I would appreciate if someone could go through and let me know what we might be doing wrong - why we are not able to get this job to be incremental/differential.
    Thanks in advance.

    Hre are all of the options for Windows Backup:
    http://technet.microsoft.com/en-us/library/ee706670.aspx
    If you can find an incremental backup naywhere in the options then I will admit I have missed something.
    The old Windows Backup, pre-2008, could do incremental backups.  The newer backup system is minimal and serves different purposes.
    The question about how to use a subsystem of Windows is NOT a scripting question.  It is a "how-to" for a Windows component.
    If you do not understand the scrip tyou posted then I recommend finding someone with sufficient understanding of Windows and the new backup Cmdlets to help you top understand how they work.
    Here is the Microsoft description of Windows Server Backup:
    Windows Server Backup consists of a Microsoft Management Console (MMC) snap-in, command-line tools, and Windows PowerShell cmdlets that provide a complete solution for your day-to-day backup and recovery needs. You can use Windows Server Backup to back
    up a full server (all volumes), selected volumes, the system state, or specific files or folders—and to create a backup that you can use for bare metal recovery. You can recover volumes, folders, files, certain applications, and the system state. And, in case
    of disasters like hard disk failures, you can perform a bare metal recovery. (To do this, you will need a backup of the full server or just the volumes that contain operating system files, and the Windows Recovery Environment—this will restore your complete
    system onto your old system or a new hard disk.)
    You can use Windows Server Backup to create and manage backups for the local computer or a remote computer. And, you can schedule backups to run automatically.
    Windows Server Backup is intended for use by everyone who needs a basic backup solution—from small business to large enterprises—but is even suited for smaller organizations or individuals who are not IT professionals.
    It specifically states that only a full server or selected file,device backup is possible.  There is no statement of incremental backup.  Windows Server backup is intended for server recovery.
    If you type "help Set-WBVssBackupOptions
    -full" you will see that there are only two options "full" and "copy".
    Please post your issues in the WS2008 or the WS2012 forum to get more information on how the Windows Server backup service works.
    ¯\_(ツ)_/¯

  • Execute stored procedure from Unix shell script

    My current method of executing stored procedures (wpl_1 and wpl_2) from a unix shell script is as follows:
    <<wpl.sh>>
    sqlplus user/password @/home/oracle/scripts/wpl.sql
    <<wpl.sql>>
    set serveroutput on size 1000000
    set timing on
    execute wpl_1('0000010676','~')
    execute wpl_2('0000010676','~')
    execute wpl_1('0000010236','FIX')
    execute wpl_2('0000010236','FIX')
    exit
    Question: Is it possible to combine the two scripts (unix and oracle) together?

    A little rusty on this, but this may work:
    My current method of executing stored procedures
    (wpl_1 and wpl_2) from a unix shell script is as
    follows:
    <<wpl.sh>>sqlplus user/password @/home/oracle/scripts/wpl.sql << EOF
    set serveroutput on size 1000000
    set timing on
    execute wpl_1('0000010676','~')
    execute wpl_2('0000010676','~')
    execute wpl_1('0000010236','FIX')
    execute wpl_2('0000010236','FIX')
    exit
    EOF
    >
    Question: Is it possible to combine the two scripts
    (unix and oracle) together?

  • Porting unix shell script to WEBUI having Struts framework

    Hi,
    I am working on an assignment where I have to migrate various unix shell scripts to web based application using struts framework(J2EE).
    Is there any way to call the existing unix shell script thru the web based application?? so that the rewritting complexity can be reduced.
    Any expert suggestion will be appreciated.
    Thanks
    Raj

    Thank you for reply ,
    And sorry by mistake question repeated twice,
    but when iam executing those batch files it is throwing some exceptions,
    in that file you did not mention to set the JRE path whether it is not necessary and also there msoc05 is the machine name of unix system that need to kept or need to be changed with window IP address .please reply.
    thanks in advance.

  • RMAN Cold backup script

    DB version :10.2.0.4
    Do you find anything wrong in the below mentioned RMAN cold backup script? Any enhancements, corrections required?
    shutdown immediate;
    startup mount;
    backup database including current controlfile tag='full_bkp';
    startup;
    crosscheck backup;
    delete noprompt obsolete device type disk;
    resync catalog;
    }

    Since you are doing a SHUTDOWN IMMEDIATE and STARTUP MOUNT before the BACKUP, there will be no ArchiveLogs generated while the backup is running --- as the database is not OPEN.
    However, the PLUS ARCHIVELOG can include ArchiveLogs that had been generated from the previous STARTUP or ALTER DATABASE OPEN.
    (In that case, I would suggest an SQL 'ALTER SYSTEM ARCHIVE LOG CURRENT' before the SHUTDOWN IMMEDIATE).
    Is your database running in ARCHIVELOG mode ? If not, then this discussion is moot.
    If yes, the next question is, obviously : Why not take a Hot Backup while the database is running (in which case you MUST backup archivelogs !)
    Hemant K Chitale

  • How can i call a Stored Procedure procedure from Unix shell script

    Hi All,
    I want to call a Strored PL-SQL Procedure through Unix shell script.
    Can any body help me with this.
    Regards,
    Saurabh

    I prefer a seperate script like the other poster mentioned. However, most shells can use a 'here' document as well ...
    sqlplus uid/pwd <<END
    exec myproc
    exit
    ENDRichard

  • Error while trying to execute a unix shell script from java program

    Hi
    I have written a program to execute a unix shell script in a remote machine. I am using J2ssh libraries to estabilish the session connection with the remote box.The program is successfully able to connect and authenticate with the box.
    The runtime .exec() is been implemented to execute the shell script.I have given below the code snippet.
    try {
         File file_location = new File("/usr/bin/");
         String file_location1 = "/opt/app/Hyperion/scripts/daily";
         String a_mib_name = "test.sh";
         String cmd[] = new String[] {"/usr/bin/bash", file_location1, a_mib_name};
         Runtime rtime = Runtime.getRuntime();
         Process p = rtime.exec(cmd, null, file_location);
    System.out.println( "Connected to the server1" );
    BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
    String line = br.readLine();
    while(line !=null)
    System.out.println(line);
    line = br.readLine();
    br.close();
    p.getErrorStream ().close ();
    p.getOutputStream().close();
    int retVal = p.waitFor();
    System.out.println("wait " + retVal);
    //session.executeCommand("ls");
    catch (IOException ex) {
    I get an error message
    Connected to the server
    java.io.IOException: Cannot run program "/usr/bin/bash" (in directory "\usr\bin"
    ): CreateProcess error=3, The system cannot find the path specified
    at java.lang.ProcessBuilder.start(Unknown Source)
    at java.lang.Runtime.exec(Unknown Source)
    at SftpConnect.main(SftpConnect.java:143)
    Caused by: java.io.IOException: CreateProcess error=3, The system cannot find th
    e path specified
    at java.lang.ProcessImpl.create(Native Method)
    at java.lang.ProcessImpl.<init>(Unknown Source)
    at java.lang.ProcessImpl.start(Unknown Source)
    I am sure of the file path where the bash.sh and test.sh are located.
    Am i missing something? Any help would be greatly appreciated.
    Thanks
    Senthil

    Hi, I am using a simple program to connect to a RMI server and execute shell script. I use the Runtime.exec aommand to do the same.
    The script is sh /tmp/pub/alka/test.sh /tmp/pub/alka/abc/xyz/ul ul
    The script when run from the server, gives no errors. But when ran using rthe above method in java, gives errors as follows,
    Mycode:
    String command = "/bin/sh /tmp/pub/alka/test.sh /tmp/pub/alka/abc/xyz/ul ul";
    Runtime rt = Runtime.getRuntime();
    Process proc = rt.exec(command);
    int exitVal = proc.exitValue();
    System.out.println("Process exitValue: " + exitVal);
    java.io.IOException: CreateProcess: /bin/sh /tmp/pub/alka/test.sh /tmp/pub/alka/abc/xyz/ul ul error=3
         at java.lang.ProcessImpl.create(Native Method)
         at java.lang.ProcessImpl.<init>(Unknown Source)
         at java.lang.ProcessImpl.start(Unknown Source)
         at java.lang.ProcessBuilder.start(Unknown Source)
         at java.lang.Runtime.exec(Unknown Source)
         at java.lang.Runtime.exec(Unknown Source)
         at java.lang.Runtime.exec(Unknown Source)
         at DecryptTest.main(DecryptTest.java:18)
    Can anyone please help

Maybe you are looking for

  • Tv shows on Touch

    Hi, I have a slight problem when i try to put a dvd of tv shows that i have taped of the television onto my touch. I have the handbrake software and when i try to encode the dvd it starts and finishs immediatly and there is no file to speak of. When

  • I downloaded iTunes 11 but want to keep format of iTunes 10

    This new format of iTunes annoys me i wish i could go back to the old one.....-_- if anyone know how to change it, it would make me happy.

  • How can I get ITunes to open when I plug in my Iphone and show my Iphone

    ITunes does not open when I plug in my IPhone and my IPhone does not show up

  • ATG 10.1.1 not load the productcatalog repository

    Hi, I have installed the atg101.1 with quency funds example, when i check the server start up log i am not seeing any product catalog repository load, and login to the BCC i am not seeing any catalog information is loaded in the BCC to (i am not seei

  • Sever address book issues

    For some reason, address book has duplicated groups by the dozens. Deleting is slow and laborious. Have tried it from my mbp, my imac and from icloud itself. Halfe the time the machine pinwheels out. I liked mobile me because if you wanted, you could