Need a bat script to check Server status remotly.

Hi,
I need bat script to check server status remotly (Ping) for multiple servers. It should generate a txt file for result.
Thanks.

Hi Ravi,
To ping multiple computers and generate report cia cmd, please refer to the script below, the "fnm" is computer name list and the "lnm" is the result, and you can save the script below as .bat file:
@echo off
set fnm=d:\test1\computers.txt
set lnm=d:\test1\ping.txt
if exist %fnm% goto Label1
echo.
echo Cannot find %fnm%
echo.
Pause
goto :eof
:Label1
echo PingTest STARTED on %date% at %time% > %lnm%
echo ================================================= >> %lnm%
echo.
for /f %%i in (%fnm%) do call :Sub %%i
echo.
echo ================================================= >> %lnm%
echo PingTest ENDED on %date% at %time% >> %lnm%
echo ... now exiting
goto :eof
:Sub
echo Testing %1
set state=alive
ping -n 1 %1
if errorlevel 1 set state=dead
echo %1 is %state% >> %lnm%
Refer to:
Explain the Batch script to ping multiple computers
If there is anything else regarding this issue, please feel free to post back.
Best Regards,
Anna Wang
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

Similar Messages

  • Need a windows script to check all unix db boxes are pinging ?

    Hi ,
    I need a windows script to check all unix remote db boxes are pinging ?
    I need to show the output in an html file.
    Can anyone suggest ideas ?

    I have a script that "kind of" works. The only problem I've seen is that it gets confused when filenames contain characters that are fine in Macland but not good in Unixland. Forward slashes are a good example of this.
    In this case I have a folder in my home named "copytest" Inside copytest are two folders:
    Source (containing the images to be added)
    Dest (My existing library of images)
    It also assumes that the folder of images to be added contains no sub-folders. Hope this helps.
    tell application "Finder"
    set theSource to folder "source" of folder "copytest" of home
    set imagesToBeCopied to name of every file of theSource
    end tell
    repeat with theFile in imagesToBeCopied
    try
    if (do shell script "find -r ~/copytest/dest -name " & quoted form of (theFile as string)) is not equal to "" then
    --The file exists. Don't copy it
    else
    --the file doesn't already exist. Copy it.
    end if
    on error
    return "Failed while trying to check for existence of a file"
    end try
    end repeat

  • Script to check aur status

    I'm trying to write a script to check the status of a package on aur; ie, to see if its been updated since I've installed it.
    Here's what I have so far:
    #!/bin/sh
    PACK=$1 #package name
    PACKID=$2 #package ID on AUR
    #grab last updated of package on AUR
    LUPD=`elinks -source http://aur.archlinux.org/packages.php?ID=$PACKID | grep "Last Updated" | awk -F : '{print $2}'`
    LAST=`grep -c $PACK /var/log/pacman.log` #number of instances of package
    INST=`grep $PACK /var/log/pacman.log | sed -n ${LAST}p` #get last instance
    echo -e "Package: $PACK \n $INST \n Last Update: $LUPD"
    This basically works fine for manually inputting a package name and AUR ID (though it needs to be prettied up):
    [mike@esme abs]$ aurcheck rxvt-unicode-256color 13060
    Package: rxvt-unicode-256color
    [2008-04-18 20:01] installed rxvt-unicode-256color (9.02-1)
    Last Update: Sun, 04 May 2008 14
    but what I envision is having a two column file with the first column the package name and the second the ID but I can't figure out how to make this loop around for each line of such a file.  If anyone can provide some help/pointers I'd greatly appreciate it.
    PS Perhaps yaourt can do this for you, but I don't use yaourt and would like to learn how to do this even just to improve my scripting abilities
    Thanks!

    Daenyth wrote:Oh wow, I had no idea such a thing existed... Very cool!
    Expanding on my suggestion, here's the bash/js-script I use to find packages in AUR:
    wget="/usr/bin/wget -q -O-"
    aurrepo="http://aur.archlinux.org/rpc.php?type=search&arg="
    js="/usr/bin/js"
    aur() {
    local iam="${FUNCNAME[0]}:"
    local cmd="${1}"
    local what="${2}"
    local aurresult=""
    [[ -z "${cmd}" ]] && {
    echo "${iam}: use ${iam} (cmd) searchstring"
    return 1
    aurresult="$(${wget} ${aurrepo}${what})"
    ${js} -e "
    var out = ${aurresult};
    var res = out.results;
    var i, j, len;
    var tabs = ' ';
    var tabstop1 = 13;
    var oneline1 = {
    'ID':true, 'CategoryID':true, 'NumVotes':true,
    'OutOfDate':true, 'License':true
    var oneline2 = {'Name':true, 'Version':true};
    var line1='', line2='';
    var others = {};
    function tabto(string) {
    return tabs.substring(1, tabstop1 - string.length);
    if (out.type === 'error') {
    print(res);
    quit(1);
    for (i in res) {
    others = {};
    line1 = '';
    line2 = '';
    for (j in res[i]) {
    if ((typeof oneline1[j] !== 'undefined')
    && (typeof res[i][j] === 'string')) {
    if (line1.length > 0) line1 = line1 + '; ';
    line1 = line1 + j + ': ' + res[i][j];
    } else if ((typeof oneline2[j] !== 'undefined')
    && (typeof res[i][j] === 'string')) {
    if (line2.length > 0) line2 = line2 + '; ';
    line2 = line2 + j + ': ' + res[i][j];
    } else {
    others[j] = res[i][j];
    print(line2);
    print(line1);
    for (k in others) {
    print(k + ':' + tabto(others[k]) + others[k]);
    print('---');
    quit(0);
    return $?
    Note that js(1), which has no man-page or other documentation, is part of "spidermonkey", which in turn is part of "firefox".  It makes sense to assume that people have this browser installed.  If at all possible, the javascript shell should have the file-methods compiled in to be able to use it like many other scripting languages, especially with JSON code.  The scriptlet above works with an unmodified standard install.

  • Bash script for checking link status

    So I'm doing some SEO work I've been tasked with checking a couple hundred thousand back links for quality.  I found myself spending a lot of time navigating to sites that no longer existed.  I figured I would make a bash script that checks if the links are active first.  The problem is my script is slower than evolution.  I'm no bash guru or anything so I figured maybe I would see if there are some optimizations you folks can think of.  Here is what I am working with:
    #!/bin/bash
    while read line
    do
    #pull page source and grep for domain
    curl -s "$line" | grep "example.com"
    if [[ $? -eq 0 ]]
    then
    echo \"$line\",\"link active\" >> csv.csv else
    echo \"$line\",\"REMOVED\" >> csv.csv
    fi
    done < <(cat links.txt)
    Can you guys think of another way of doing this that might be quicker?  I realize the bottleneck is curl (as well as the speed of the remote server/dns servers) and that there isn't really a way around that.  Is there another tool or technique I could use within my script to speed up this process?
    I will still have to go through the active links one by one and analyze by hand but I don't think there is a good way of doing this programmatically that wouldn't consume more time than doing it by hand (if it's even possible).
    Thanks

    I know it's been awhile but I've found myself in need of this yet again.  I've modified Xyne's script a little to work a little more consistently with my data.  The problem I'm running into now is that urllib doesn't accept IRIs.  No surprise there I suppose as it's urllib and not irilib.  Does anyone know of any libraries that will convert an IRI to a URI?  Here is the code I am working with:
    #!/usr/bin/env python3
    from threading import Thread
    from queue import Queue
    from urllib.request import Request, urlopen
    from urllib.error import URLError
    import csv
    import sys
    import argparse
    parser = argparse.ArgumentParser(description='Check list of URLs for existence of link in html')
    parser.add_argument('-d','--domain', help='The domain you would like to search for a link to', required=True)
    parser.add_argument('-i','--input', help='Text file with list of URLs to check', required=True)
    parser.add_argument('-o','--output', help='Named of csv to output results to', required=True)
    parser.add_argument('-v','--verbose', help='Display URLs and statuses in the terminal', required=False, action='store_true')
    ARGS = vars(parser.parse_args())
    INFILE = ARGS['input']
    OUTFILE = ARGS['output']
    DOMAIN = ARGS['domain']
    REMOVED = 'REMOVED'
    EXISTS = 'EXISTS'
    NUMBER_OF_WORKERS = 50
    #Workers
    def worker(input_queue, output_queue):
    while True:
    url = input_queue.get()
    if url is None:
    input_queue.task_done()
    input_queue.put(None)
    break
    request = Request(url)
    try:
    response = urlopen(request)
    html = str(response.read())
    if DOMAIN in html:
    status = EXISTS
    else:
    status = REMOVED
    except URLError:
    status = REMOVED
    output_queue.put((url, status))
    input_queue.task_done()
    #Queues
    input_queue = Queue()
    output_queue = Queue()
    #Create threads
    for i in range(NUMBER_OF_WORKERS):
    t = Thread(target=worker, args=(input_queue, output_queue))
    t.daemon = True
    t.start()
    #Populate input queue
    number_of_urls = 0
    with open(INFILE, 'r') as f:
    for line in f:
    input_queue.put(line.strip())
    number_of_urls += 1
    input_queue.put(None)
    #Write URL and Status to csv file
    with open(OUTFILE, 'a') as f:
    c = csv.writer(f, delimiter=',', quotechar='"')
    for i in range(number_of_urls):
    url, status = output_queue.get()
    if ARGS['verbose']:
    print('{}\n {}'.format(url, status))
    c.writerow((url, status))
    output_queue.task_done()
    input_queue.get()
    input_queue.task_done()
    input_queue.join()
    output_queue.join()
    The problem seems to be when I use urlopen
    response = urlopen(request)
    with a URL like http://www.rafo.co.il/בר-פאלי-p1
    urlopen fails with an error like this:
    Exception in thread Thread-19:
    Traceback (most recent call last):
    File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/threading.py", line 639, in _bootstrap_inner
    self.run()
    File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/threading.py", line 596, in run
    self._target(*self._args, **self._kwargs)
    File "./linkcheck.py", line 35, in worker
    response = urlopen(request)
    File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/urllib/request.py", line 160, in urlopen
    return opener.open(url, data, timeout)
    File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/urllib/request.py", line 473, in open
    response = self._open(req, data)
    File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/urllib/request.py", line 491, in _open
    '_open', req)
    File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/urllib/request.py", line 451, in _call_chain
    result = func(*args)
    File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/urllib/request.py", line 1272, in http_open
    return self.do_open(http.client.HTTPConnection, req)
    File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/urllib/request.py", line 1252, in do_open
    h.request(req.get_method(), req.selector, req.data, headers)
    File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/http/client.py", line 1049, in request
    self._send_request(method, url, body, headers)
    File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/http/client.py", line 1077, in _send_request
    self.putrequest(method, url, **skips)
    File "/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/lib/python3.3/http/client.py", line 941, in putrequest
    self._output(request.encode('ascii'))
    UnicodeEncodeError: 'ascii' codec can't encode characters in position 5-8: ordinal not in range(128)
    I'm not too familiar with how character encoding works so I'm not sure where to start.  What would be a quick and dirty way (if one exists) to get URLs like this to play nicely with python's urlopen?

  • Cannot launch vivado simulator 2015.1: behav/compile.bat' script "Please check that the file has the correct 'read/write/execute' permissions"

    Hi,
    I'm trying to run a verilog simulation using the vivado simulator 2015.1 on Windows 7.
    I get the following error when I attempt to launch simulation:    
    ERROR: [USF-XSim-62] 'compile' step failed with error(s) while executing 'D:/projects/axi/axi_test_system/axi_test_system.sim/sim_1/behav/compile.bat' script. Please check that the file has the correct 'read/write/execute' permissions and the Tcl console output for any other possible errors or warnings.
    The tcl console repeats the same message, "Please check that the file has the correct 'read/write/execute' permissions"
    I cannot find any problem with the permissions.  I believe that windows will always execute a .bat file.   Within the same project, I can run elaboration, synthesis and implementation without problems. 
    Any idea why the simulation compile script won't run?
    Thanks,
    Ed

    Hi,
    Thanks very much for your detailed reply. These were the right questions based upon what I told you.   
    However, I took the code home last night and ran it on my webpack 2014.2 release.   It still failed, but I got completely different error messages.   These messages correctly pointed me to an undeclared signal in my testbench. Once fixed, the compile worked and the simulator launched. 
    This morning, I fixed the signal name in my 2015.1 setup, and it also compiled and launched correctly. 
    So, the problem wasn't actually related to file permissions.  It seems like the 2015.1 error message may be broken compared to 2014.2.  
    I was running the Vivado GUI, clicking on "Simulate > Run Behavioral Simulation"
    Thanks again for your help. 
    Regards,
    Ed  
      

  • Weblogic.admin script to alert server status

    Hi,
    Can anybody share a weblogic.admin utility script for alerting the server status in unix ?

    Below is the solaris shell script integrated with weblogic.admin utility....
    If the server status is other than running it will sends a alert mail to you.
    Sometime your server may be in shutdown mode and if you execute the below script, it says destination not reachable on specified port and then also it sends a alert mail.
    Change it according to ur env and execute...
    set -x
    export CLASSPATH=”/wl_home/server/lib/weblogic.jar”
    declare -a Port=( 8003 7072 8201 )
    declare -a ServerState[]
    declare -a ServerName[]
    declare -a ObjectName[]
    i=”0″
    IP=Weblogic host address
    while [ $i -lt 5 ]
    do
    ServerState[$i]=`java weblogic.Admin -url $IP:${Port[$i]} -username weblogic -password weblogic GET -pretty -type ServerRuntime -property State |grep -i State |awk ‘{print $2}’`
    ObjectName[$i]=`java weblogic.Admin -url $IP:${Port[$i]} -username weblogic -password password GET -pretty -type JVMRuntime -property ObjectName |grep -i ObjectName |awk ‘{print $2}’`
    if [ "${ServerState[$i]}” != “RUNNING” ] ;
    then
    mailx -s ” Weblogic Server Staus- $IP ” [email protected]<<EOF
    Weblogic Managed server ${Port[$i]} is in SHUTDOWN state
    EOF
    fi
    i=`expr $i + 1`
    done
    Thanks,
    Kartheek
    Troubleshooting in weblogic gives thrilling experience .......

  • Need Windows bat script help

    Apparently I've been in Unix land a little too long, because I'm trying to do something in a windows .bat scirpt that i know is possible in a Kornshell. I just don't know for sure if it is possible on windows.
    I am trying to assign a variable the value of a command. More specifically, I'm trying to assign the variable as the contents of a file.
    So in a Kornshell I would do something like this...
    DBS_NAME=$(cat DBS_NAME.txt)
    echo $DBS_NAME
    So I have gotten this far in the .bat script...
    set DBS_NAME=type DBS_NAME.txt
    echo %DBS_NAME%
    but everything I've tried to resolve the "type" command (to display the contents of the file) is not working, I keep ending up with the text of what is after "set DBS_NAME=" on the output.
    Does anybody know if this is possible in windows?
    TIA,
    Robert

    The echo is there to display the value of DBS_NAME for testing.
    I'm actually trying to read this in so I can pass it to a maxl command line, and instead of the variable passing the App.DBname (contents of the file), it is passing 'type C:\DBS_NAME.txt' to my maxl script, and so it is failing.
    Here is the test bat script...
    set DB=type C:\DBS_NAME.txt
    essmsh C:\Test.mxl %DB%
    and its maxl output below...
    (I overwrote the user, password and server below)
    Notice that it is failing on the word 'type'. This should be the App.DB being passed (the contents of the file), but instead it is still only passing the text of the command.
    MAXL> login <user> <password> on <server>;
    OK/INFO - 1051034 - Logging in user [000694098].
    OK/INFO - 1051035 - Last login on Friday, November 05, 2010 2:08:03 PM.
    OK/INFO - 1241001 - Logged in to Essbase.
    MAXL> display variable on database type;
    ERROR - 1242021 - (1) Syntax error near ['type'].
    MaxL Shell completed

  • Script Logic - Check Work Status

    Hi,
    I am using the standard process chain "/CPMB/DEFAULT_FORMULAS_LOGIC" to trigger Script logic file.
    I have created some logic to clear and copy data to a targer category. I want to check the workstatus of the target category and if it is locked i want to clear/copy to fail.
    I am not sure how to go about this? I was thinking of adding the following but that is just a guess!
    TASK(/CPMB/CLEAR_SOURCE_CUBE,CHECKLCK,1)
    any advice would be helpful.
    Thanks,

    Hi,
    Ideally did want an option for the user to select option to check whether the copy should happen if the data had been locked. Have done this via the standard COPY package.
    Can this be done with the script logic e.g. using paramters in the package?
    Or if you create a script logic file does it always check the workstatus?
    thanks

  • Need help setting up Mac OSX Server for remote/off-site access

    Hello, I want to be able to access our g5 tower running Mac OSX Server 10.5.8 remotely when not in the office. We have a static IP.
    Are there easy step-by-step directions someone could provide or point me to? Thanks a bunch.

    Hi
    its really easy
    You need to have Apple remote desktop
    there are bunch of software s like chichen vnc and etc.
    01. open your router from your web browser
    02. go to nat settings
    03. screch the option calld port forwading
    04. enter the server ip address to that
    05. save and restart the router
    ** What you did so far
    if some one want to connect from your static ip address now it will forwerd to your server. *******
    Go to system preferences (on server)
    go to sharing
    enable remote management
    select opetions which you want
    your done
    2nd part Adding Computer to ARD
    Select All Computer ----> click plus button and select add by address
    put the Address : ip address
    user name : server User name
    password : server password
    eureka
    now you done

  • Script to check RDP connection status

    Hi all,
    Could anyone provide me a script to check whether multiple remote servers are able to RDP or not. I just want to check the connectivity status. I have checked with past threads available in form, but none has worked for me. Powershell or Batch or VBS scripts
    ... anything would be good....
    I am not that much good at writing scripts.. So please help me.
    Thanks in Advance..
    Vinay..

    Run this script on one of the servers:
    Get-Wmiobject -Class Win32_Terminal -Property *
    It should return a number of information including, fEnableTerminal. For servers that have RDP enabled, fEnableTerminal should be 1, for the servers with RDP not enabled, fEnableTerminal should be 0.
    Once you can confirm that this is the case, I will provide the full script to run this on multiple servers with input from AD query of text file
    That still won't tell you if the TS is accessible.  PortQry or Net Tcp are the fastest and easiest ways to do this.
    Your code also only orks on WS2008R2 and later but, s posted, ill not work on any system.  Have you actually tried it?
    The other bigger issue is that the Win32_Terminal class will always return enabled on any server even if the terminal server is inaccessible and even if it is in Admin mode.  All Servers since 2003 have Terminal Server running by default but not in
    Terminal Server mode.
    PortQry to 3389 will tell us that the TS is alive and available.  Win32_Terminal will report enabled even if the service is stopped.
    Win32_Terminal is only useful to admins and PortQry can be used by anyone.
    The above PowerShell code can be run on any system instead of installing PortQry or other software.
    The original question was "Check RDP connection".  RDP is available on all systems since XP.  The Win32_Terminal class is only available on Server class machines and it does not check to see if the RDP connection is available.
    ¯\_(ツ)_/¯

  • Unix script for checking the user account status

    Hi All,
    i have created one unix script to check the status of the user in diff databases.
    #!/bin/ksh
    useracctreport.txt if [ ! -f hh ];
    then
    echo "Database file does not exist"
    fi
    echo "Enter Username"
    read USER
    echo "Enter the password"
    stty -echo
    read PASS
    stty echo
    for j in `cat users`
    do
    j="`echo $j| tr '[a-z]' '[A-Z]'`"
    for i in `cat hh`
    do
    sqlplus -s $USER/$PASS\@$i <<EOF >> useracctreport.txt
    column USERNAME format a8
    column ACCOUNT_STATUS format a5
    !echo "*****User $j Status in $i DB*****"
    select USERNAME,ACCOUNT_STATUS from dba_users where username=('$j');
    select OBJECT_TYPE,count(*) from dba_objects where owner='$j' group by object_type;
    EOF
    done
    done
    In log file ,i get the below error when its unable to connect to the DB.
    SP2-0306: Invalid option.
    Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}] | [INTERNAL]
    where <logon> ::= <username>[<password>][@<connect_string>] | /
    SP2-0306: Invalid option.
    Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}] | [INTERNAL]
    where <logon> ::= <username>[<password>][@<connect_string>] | /
    SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
    ERROR:
    ORA-01017: invalid username/password; logon denied
    Is there any way i can supress this error?
    and is there any other way i can make this script faster.Thanks a lot for your help

    Hi,
    The failing line is
    sqlplus -s $USER/$PASS\@$i <<EOF >> useracctreport.txtYou should test the connect statement you provide to sqlplus. For example:
    CONSTRING=$USER/$PASS\@$i
    echo Connect string used: $CONSTRING
    sqlplus -s $CONSTRING <<EOF >> useracctreport.txtCheck the echoed value. It's malformed. Correct it appropriately.
    Yoann.

  • Script for Checking the Server Status

    Hi All,
         I just need the script for monitoring the server status through the WLST.My scenario:I have 2 server in Running State.If any one of the server get failed or in not RUNNING state then i use the script for starting that server automatically.I tried some of the script but it is not working properly .If any one have the sample script please share with me.
    Regards,
    Ove.

    Hi Syed,
    Replication state is very easy to see in 4.x and earlier. The last changenumber in the supplier changelog is visible (on the root DSE IIRC), and each consumer suffix has an operational attribute "copiedfrom" that tells you the name of the supplier, the database generation id, and the last change replayed from the supplier.
    So a script that compares the results of
    ldapsearch -h <supplier> -s base -b "" "objectclass=*" lastchangenumber
    and
    ldapsearch -h <consumer> -s base -b <base_suffix> "objectclass=*" copiedFrom
    will show you if a replica has fallen out of sync. It won't tell you more than how many changes behind the replica is, though, because pre-5.x changenumbers are sequential integers, not timestamps.
    However, the change that corresponds to the changenumber is clearly visible under the "cn=changelog" suffix. So if you look at the change itself you can see the timestamp on it.
    For more info on the status of replication, you should be able to query the agreements on the supplier. Those live under the "Netscape Machine Data Suffix", which you can also find on the supplier's root DSE:
    ldapsearch -h <supplier> -s base -b "" "objectclass=*" netscapemdsuffix
    And of course the error logs will usually tell you if replication is failing outright.
    I may be off on some of the attribute names, but if you do some investigating along these lines, you should be able to figure it out.

  • I need a shell script to move latest archivelogs from one server to another server..

    Hi,
         I need a shell script to move latest archivelogs from one server to another server..
    Thanks&Regards,
    Vel

    ea816fb9-f9ea-45ac-906f-36a8315970d0 wrote:
    Thanks it's really helpfull..
    Now i have pasted a shell script which generates archivelog and shows latest archivelog time..
    just check let me know the answer, that how i need to execute it..
    # Force a logswitch to get the last archivelog to the standby host
    ORACLE_SID=ORCL
    ORAENV_ASK=NO
    . oraenv >/dev/null 2>&1
    SwitchLogfile()
      # Do logswitch 
      RESULT=`echo "Alter system switch logfile;" | sqlplus -S / as sysdba | grep 'System altered'`
      if [ "$RESULT" = "System altered." ]
      then
      export RETURN=1
      else
      export RETURN=0
      fi
      # Do we need to do something with this return value?
      export RETURN
    GetArchiveTime()
      CURYEAR=`date +%Y`
      echo "set heading off;" > temp.sql
      echo "set termout off;" >> temp.sql
      echo "select to_char(first_time,'YYYY-MM-DD HH24:MI:SS') from v\$archived_log where sequence#=(select sequence# - 1 from v\$log where status='CURRENT');" >> temp.sql
      sqlplus -S / as sysdba <
    spool tempres.txt
    @temp.sql
    quit
    EOF
    cat tempres.txt | grep ${CURYEAR} | grep -v grep | awk '{print $1" "$2}'
    #rm -f temp.sql  tempres.sql
    SwitchLogfile
    GetArchiveTime
    You seem to have ignored Dude's VERY good advice and continue to press down this ill-advised path.  If you continue this approach, you WILL have problems at the very time you do not need any additional problems.  Trying to recover your production database at 2:00 in the morning is not the time to be getting errors from rman because it can't find what it needs - because you decided to move them around yourself.
    Please reconsider.

  • Need a Script to check Database backup chain for revovery

    Dear All,
    any having a handy script to check database backup chain ,
    Database A --> Full backup  -- Diff -- log1 --Log 2 ...... and scan through the files to validate if we can recover the database using the avaiable backups.
    Regards
    Sufian
    Mohd Sufian www.sqlship.wordpress.com Please mark the post as Answered if it helped.

    You can use below TSQL
    set nocount on
    go
    if exists ( select name from tempdb..sysobjects where name like '#DatabasesBackupsStatus%')
    drop table #DatabasesBackupsStatus
    GO
    create table #DatabasesBackupsStatus
    ServerName varchar(100) null,
    DBName varchar(100) null,
    RecoveryModel varchar(100) null,
    LastFullbackup datetime null,
    days_since_Lastfullbackup int null,
    days_since_Lastdiffbackup int null,
    HOURS_since_LastLogbackup int,
    DBStatus varchar (100) null,
    FullBackupLocation varchar(1000) null,
    MEDIASET INT,
    JobOwner varchar(100) null
    Go
    insert into #DatabasesBackupsStatus(ServerName,DBName)
    select convert(varchar,serverproperty('ServerName')),a.name
    from master.dbo.sysdatabases a
    where a.name <> 'tempdb'
    update #DatabasesBackupsStatus
    set LastFullbackup=b.backup_start_date,
    days_since_Lastfullbackup=datediff(dd,b.backup_start_date,getdate()),
    MEDIASET=b.media_set_id
    from #DatabasesBackupsStatus a,(select database_name,MAX(media_set_id)media_set_id,max(backup_start_date) backup_start_date
    from msdb..backupset where type='D' group by database_name)b
    where a.DBName=b.database_name
    update #DatabasesBackupsStatus
    set RecoveryModel=convert(sysname,DatabasePropertyEx(DBName,'Recovery'))
    update #DatabasesBackupsStatus
    set DBStatus=convert(sysname,DatabasePropertyEx(DBName,'Status'))
    update d
    set d.FullBackupLocation=b.physical_device_name
    from #DatabasesBackupsStatus d , msdb..backupmediafamily b
    where d.MEDIASET =b.media_set_id
    update d
    set d.days_since_Lastdiffbackup=datediff(dd,b.backup_finish_date,getdate())
    from #DatabasesBackupsStatus d , (select database_name,max(backup_finish_date) backup_finish_date
    from msdb..backupset where type ='I' group by database_name) b
    where d.DBName = b.database_name
    update d
    set d.JobOwner=b.[user_name]
    from #DatabasesBackupsStatus d , msdb..backupset b
    where d.MEDIASET = b.media_set_id
    update d
    set d.HOURS_since_LastLogbackup=datediff(hh,b.backup_finish_date,getdate())
    from #DatabasesBackupsStatus d , (select database_name,max(backup_finish_date) backup_finish_date
    from msdb..backupset where type ='L' group by database_name) b
    where d.DBName = b.database_name
    AND d.RecoveryModel != 'SIMPLE'
    Go
    select * from #DatabasesBackupsStatus
    Go
    drop table #DatabasesBackupsStatus
    Please Mark This As Answer if it solved your issue 
    Please Mark This As Helpful if it helps to solve your issue
    Thanks,
    Shashikant

  • How to check Server availability status in jsf?

    how to check Server availability status in jsf ?

    Do "something" that would cause the server to respond; fetch a webpage, call a webservice, whatever. If it doesn't work the server isn't there, or is in a broken state.

Maybe you are looking for