SQL script to check the status of the last command

Hi all

I need to make a SQL script and call it from Unix (bash) shell.


=========================
sqlplus vikas/vikas < < END
coil /oracle/vikas/output.txt
order 1
command 2
...
....
command N
spool off;
commit;
END
=========================


It works perfectly, but my problem is that if a command fails, the other controls in suite works. However, I need to keep a check when a broken command that you exit the script.

On unix, we have an option of echo $? to check the status of the previous command, but how to accomplish this SQL.

Pls help!
__________________
== > VIKAS < ==

=========================
sqlplus vikas/vikas<>
coil /oracle/vikas/output.txt
WHENEVER SQLERROR EXIT; -Add this
order 1
command 2
...
....
command N
spool off;
commit;
END
=========================

Tags: Database

Similar Questions

  • Using Script to check the version of Adobe Reader software

    Hello. I am now currently using LiveCycle Designer to create a form that allows users to attach attachments. We found that if a user uses Adobe Reader 7.0 or below, there is a problem on fixing attachments. Accordingly, we would like to add a script to check the version of the Adobe Reader client in a ready state of the form. If a user uses Adobe 7.0 or below, the message box opens and suggests the user to download a more recent version of the Adobe Reader software. I would like to know is possible to do so. Thank you very much

    Hello

    the script might look like:

    If (typeof (app.viewerVersion)! = "undefined")

    If (app.viewerVersion<>

    {

    xfa.host.messageBox ("your Version of Adobe Reader is old...");

    }

    }

    You can use it in the docReady:Event of your form to inform users.

  • Where the SQL Scripts running after the installation of the ODAC for Oracle Client?

    I just installed ODAC for Oracle Client on a windows server that runs a database of sql server, allowing developers to connect to a web application to an Oracle/Unix database. The installation States to run SQL scripts, located in the $ORACLE_HOME\ASP.NET\SQL directory after installation. I don't know where to run them? On the ORACLE DB on the Unix server? If someone could let me know, I'd appreciate it. Thank you.

    You must run on the Oracle database server, but they are necessary only if you use Oracle for ASP.NET providers.

    If you just install the software, so you can use OLEDB with SQL Server linked server, for example, you don't need them. What do you need to run although if this is the case is the oramtsadmin.sql script that creates the objects used by the Oracle MTS Recovery Service (if you do not have these objects created on the database) that SQL Server uses a distributed transaction for Oracle connections I think.

    It will be useful,
    Greg

  • Looking for a Script to check the current status of the VM tools based on resource pool (customer name)

    Hi all and

    LucD The champion!

    I'm looking for a power-cli script to verify the State of VM-tools of all the virtual machines in the cluster multi environment. Could you please help me on this. It would be really appreciated.

    Thank you. in advance.

    Concerning

    Nauman

    Try like this

    $report = @)

    {foreach ($cluster Get-cluster)

    foreach ($rp in Get-ResourcePool-location $cluster) {}

    foreach ($vm in (Get-VM-location the $rp)) {}

    $report += get-disk hard - VM $vm |

    Select @{N = "Cluster"; E = {$cluster. Name}},

    @{N = "ResourcePool"; E = {$rp. Name}},

    @{N = "VM"; E = {$vm. Name}},

    @{N = 'Tools status'; E = {$vm. ExtensionData.Guest.ToolsStatus}},

    @{N = 'HD'; E={$_. Name}},

    @{N = "Datastore"; E={($_. Filename.Split(']') [0]). TrimStart('[')}},

    @{N = 'Filename'; E={($_. Filename.Split('_') [1]). "Split('/') [0]}},"

    @{N = 'Path VMDK'; E={$_. File name}}.

    @{N = "Format"; E={$_. StorageFormat}},

    @{N = ' Type'; E={$_. DiskType}},

    @{N = "CapacityGB"; E={$_. CapacityGB}}

    }

    }

    }

    $report | Export Csv C:\temp\report.csv - NoTypeInformation - UseCulture

  • Apple script to check the part of iTunes XML library with other applications.

    Y at - there no apple for script

    Check "Sharing iTunes library XML with other applications." Of

    • iTunes
    • Preferences
    • Advanced tab...

    I want to read itunes Media Library .xml but lates itunes no xml is created by default,

    so I want this XML created by my application through the apple script.

    iTunes12.4

    https://discussions.apple.com/message/28513383#28513383 - new with the parameter preferably 12.2 iTunes to turn create .xml

    If you really want an AppleScript, I think you should ask on the iTunes for Mac forum, or maybe the OSX Technologies.

  • Script to check the DRS VM groups?

    Hello guys,.

    I want to know if you could give me an idea on how to check the DRS of VM groups on my cluster.

    DRS group are created with a shared identifier that is common on the VM too. For example: VMS DRS group R125 must include each VM name "R125" is included (such as VM-R125-001).

    First of all, I would like to work on a script that will be able to detect if certain VM are not in their groups of DRS corresponding VM (by listing for example) and later add an e-mail notification if possible.

    I would like to know if you could give me some advice on how to run this script, what cmdlet should I use, etc.

    Thank you very much

    Kind regards

    Benedict.

    EDIT: VM DRS group and not of DRS rules

    Try like this

    Import-Module DRSRule

    #

    # Specifications cluster

    $cluster1 = "ClusterName".

    $cluster = get-Cluster-name $cluster1

    #

    #for each customer ID.

    foreach ($Group in (Get-DrsVMGroup-Cluster $cluster))

    {

    # Get all the virtual machines that match the groupID

    $vms = get-VM-name 'vm-$($Group.Name)-01"- location $cluster | Select name

    # Compare 2 results

    $result = compare-Object - referenceobject $Group.VM - DifferenceObject $vms

    # Display the result

    Write-Output "missing DRS rule $([string]: join (($result |))). where {$_.} SideIndicator - eq "=>"} | Select ExpandProperty - InputObject,)' | ')) »

    Write-Output "be deleted from the rule DRS $([string]: join (($result |))). where {$_.} SideIndicator - eq '<='} |="" select="" -expandproperty="">

    }

  • Script to check the version of Cisco VEM on ESXi host

    Hallo,

    I need help, a script to check and report in a CSV file, the version of Cisco Nexus 1000v VEM on all ESXi hosts connected to a vCenter.

    Basically, "vem version - v" but for all the ESXi hosts connected to a vCenter.

    Thank you

    Joseph

    I suspect you could use PowerShell v1, in this version that the Export-Csv has not had the UseCulture parameter.

    Try to run the script without this parameter.

    But I would strongly suggest to upgrade your version of PowerShell (v3 is available)

  • PowerCLI script to check the setting of syslog on a whole cluster?

    Hey guys,.

    I'm looking for a way to check the setting configured for syslog remote on a large cluster of ESXi. Is it possible to easily check by cluster?

    Thanks in advance,

    The following PowerCLI script will give you the servers remote syslog for all hosts in a cluster:

    Get-Cluster "MyCluster" | Get-VMHost | ForEach-Object {
      $VMhost = $_
      $VMHost | Get-VMHostSysLogServer | ForEach-Object {
        $Report = "" | Select-Object -Property VMHost,SyslogServer,Port
        $Report.VMHost = $VMhost.Name
        $Report.SyslogServer = $_.Host
        $Report.Port = $_.Port
        $Report
      }
    }
    

    Best regards, Robert

  • Script to check the correct resource pools

    Hi guys

    Hoping someone can help with PowerCLI issue?

    I want to set up a script PowerCLI who together share CPU and memory allocated to all VMS in each Resource Pool, add them together and compare them with resource information in the list of resources and those who differ from a CSV output (including how on every property is different).

    The idea is that this script will quickly check through our vast domain for incorrectly configured in the resource pools (ie. those who have not been updated).

    Anyone able to help give advice on how I can get that data into PowerCLI from the pool of resources and the virtual computer?

    Thank you very much

    -


    a crazy penguin

    http://www.acrazypenguin.com

    I don't know if the values you provide are correct for what is planned.

    Especially the MaxCpuUsage won't say much because this will normally reflect the total amount of CPU resources on the host (provided that the customer has no defined limits).

    The following should give a better picture (I guess)

    $dcName = 
    $report = @()
    $dc = Get-View -ViewType Datacenter -Filter @{"Name"=$dcName}
    Get-View -ViewType ResourcePool -SearchRoot $dc.MoRef | where{$_.Name -ne "Resources"} | %{
         $rp = $_
         $rpMem = 0
         $rpCpu = 0
         Get-View -ViewType VirtualMachine -SearchRoot $rp.MoRef | %{
              $rpMem += $_.Summary.QuickStats.hostMemoryUsage
              $rpCpu += $_.Summary.QuickStats.overallCpuUsage
         }
         $report += New-Object PSObject -Property @{
              Name = $rp.Name
              "VmCpuTotal (MHz)" = $rpCpu
              "VmMemTotal (MB)" = $rpMem
              RpCpu = $rp.Runtime.Cpu.UnreservedForVm
              RpMem = $rp.Runtime.Memory.UnreservedForVm / 1MB
         }
    }
    $report | Export-Csv "C:\ResPool.csv" -NoTypeInformation -UseCulture
    

    Note that this does not overcommitment account. To have the script must use the unreservedForPool rather than the UnreservedForVm property property.

  • SQL script to change the database user

    Oracle 11g on Solaris 10.5 64-bit SPARC

    I work on generate a SQL script to change all default users to a new or custom password.
    Example: change the system of the user identified by new_password

    Problem:
    My problem is that I don't want the 'new_password' be in plain text, because the script will on the ground prior to deployment.
    Can anyone give me some suggestions?
    Is this doable or I can generate the already hashed password - as change User Manager idenfified < hash_characters >

    Example change manager users identified by 'HE5823WE4095432241252 ';

    You can use the hashed password if you say for example:

    change the system of the user identified by values 'hashed_password_string '.

  • SQL script to update the Peoplesoft database information

    Hi all

    I'm a new DBA for a charity running both PS financials & HR which often must create test, training and instances of dev of our production environments. Doing so currently requires a number of manual steps to update the different nodes and paths to those required for the new instance, and naturally I did not become a DBA to do manual work ;-)

    I'm looking for these steps, but the schema PS script being what it is, I'm not having much joy to find where relevant data could be. If someone had a script to do something similar, or could point me in the direction of the tables, I would be extremely grateful. The kind of things that we currently do through the interface are:

    PeopleTools > Integration Broker > Configuration of integration > nodes
    PeopleTools > Security > security objects > Single Sign-on
    PeopleTools > Public Services > Administration > URL
    PeopleTools > Integration Broker > Configuration > Quick Setup > Integration Broker areas
    PeopleTools > Portal > node definitions
    PeopleTools > the Ren Server Configuration > Ren Server Cluster

    We are currently running MS SQL Server, but all the PL SQL scripts would be great - I just need to know what are the tables contain the data.

    Thank you very much


    Andy

    Well, it is very dependent on version Peopletools.
    An easy way might be to open the corresponding page that you speak, and then display the definition of page and the associated record. At least that is what I use to do.
    Then, update you the table background and see if she takes your new values.

    To be brief, here is an excerpt of these tables (non-exhaustive list, PT.48):
    Node of single sign - we built: pstrustnodes
    Scheduler process definition: ps_serverdefn
    Run the command: psprcsruncntl
    Message channels: pschnldefn
    The e-mail table of contents: psapmsgpub *, psapmsgsub *, psapmsgarc *.
    Definition of message node: psmsgnodedefn
    URL: psurldefn
    Definition of employment: ps_prcsjobdefn
    OPRID (e-mail address): psoprdefn
    ...

    Then fill out your own list with the method that I gave above.

    Nicolas.

  • Apple script to check the part of iTunes library XML with another application.

    Y at - there no apple for script

    Set 'share the XML library with other applications iTunes'. under the name selected

    • iTunes
    • Preferences
    • Advanced tab...

    I want to read itunes Media Library .xml, but in the last version of iTunes without xml is created by default,

    so I want this XML created by my application through the apple script.

    iTunes12.4

    I don't think you can change that setting via AppleScript, however once you have enabled then the XML file will be generated and updated every time that the library is updated.

    TT2

  • Script to pull the last timestamp spend all hosts in a cluster?

    Hi all

    Lately I have seen an issue where my host 5.1 logging abruptly stops and the other remote access to every host I have no way of knowing what happened.

    Is it possible to account for the last, for example hostd.log timestamp for each host in a cluster?

    Thank you

    Tony

    Try something like this

    foreach($esx in Get-Cluster -Name MyCluster | Get-VMHost){  $log = Get-Log -Key hostd -VMHost $esx  $esx | Select Name,@{N="Last entry";E={[datetime]($log.entries[-1].Split(' ')[0])}}}
    

    But be aware that fetch a newspaper of the ESXi could take some time.

    The script needs get the full log, to be able to extract the last line

  • SQL * more to wrap the set command - doubt

    Hello

    I have a stupid question on the set "WRAP" command in SQL * more. I put A500 for column F2, linesize 100 and wrap is disabled.
    The result is clear, it truncates exactly the 100th character. When I put the envelope, for the header of column F2, I couldn't see
    the '-' character the hyphen for 500 times, but only for 100 characters. With the release, with few characters of column F2, how do I
    confirm that it printed 499 seats for 2 ranks and 495 white space for the last line.

    Please provide details on the envelope and TRIMOUT/TRIMSPOOL in this context.

    Also, when I increase the linesize 1000 and desc T1, it goes for a draw, it is documented in Oracle, but why is it?
    It is possbile to get the result without changing the linesize. Thank you.

    SQL > column f1
    F1 COLUMN WE
    FORMAT OF 999.99
    SQL > column f2
    COLUMN f2 WE
    FORMAT a500

    SQL > show linesize
    linesize 100

    SQL > set wrap off

    SQL > select f1, f2 from t1;

    F1 F2
    ------- --------------------------------------------------------------------------------------------
    1.00 IS
    2.00 Y
    3.00 three

    SQL > wrap value on

    SQL > show wrap
    Wrap: lines will be wrapped

    SQL > SELECT F1, F2 FROM TEST1;

    F1
    -------
    F2
    ----------------------------------------------------------------------------------------------------
    1.00
    THERE

    2.00
    THERE

    3.00
    Three

    Hello

    845956 wrote:
    Hello

    I have a stupid question on the set "WRAP" command in SQL * more. I put A500 for column F2, linesize 100 and wrap is disabled.
    The result is clear, it truncates exactly the 100th character. When I put the envelope, for the header of column F2, I couldn't see
    the '-' character the hyphen for 500 times, but only for 100 characters.

    Exactly. If LINESIZE is 100, the maximum display width of any column is 100, even if the column is actually longer, and/or you have an explicit order of the COLUMN in this way it will be longer. Nothing after that 100 characters will be encapsulated, if the package is enabled.

    With the release, with few characters of column F2, how do I
    confirm that it printed 499 seats for 2 ranks and 495 white space for the last line.

    Save the output in a HOLD file and change the file to see exactly what it contains. If TRIMSPOOL is activated, it does not contain the final spaces.
    >

    Please provide details on the envelope and TRIMOUT/TRIMSPOOL in this context.

    See the SQL * Plus Manual:
    http://docs.Oracle.com/CD/B28359_01/server.111/b31189/ch12040.htm#i2683480

    Also, when I increase the linesize 1000 and desc T1, it goes for a draw, it is documented in Oracle, but why is it?
    It is possbile to get the result without changing the linesize. Thank you.

    Describe automatically adjusts the width of each column to use all the space available with the LINESIZE current. I don't think there is a way to change this. If you cannot change LINESIZE, then write your own query on all_tab_columns and use it instead of sql * over order DESC.

    Published by: Frank Kulash, 5 March 2012 10:20

  • Check the last instance of a textfield is not null

    I have a repeating subform that includes a textfield for the user to enter his name. When the user clicks a button e-mail customized to send the form, I first want to check if the last instance of this field is filled (non-null). I don't care about previous instances only the last instance. Custom e-mail button is pushed down below each instance of the subform is always just below the last instance of the repeating subform. Is it possible to refer to the last instance of a field in the subform when I do not know how many instances are created?

    Thank you

    Hi DKinsley,

    I think that the code and the following steps will solve your problem.

    (1) in order to know the last instance, you must find the number of available instances. This can be achieved with the following code.

    var totalRowInstances = xfa.resolveNode ("form. Name.txtName").instanceManager.count;

    (2) to access the last value of the index,

    lastIndex var = totalRowInstances-1;

    [Since the index always starts with 0]

    var lastIndexNameCheck = xfa.resolveNode ("form. ("Name [" + lastIndex + '] '). txtName.rawValue;

    If (lastIndexNameCheck! = null)
    {
    do something
    }
    on the other
    {
    do something
    }

    Please Note: here, form - refers to the root node, name - refers to the subform, txtName - made reference in the name of a text field.

    Please let me know if this helped.

    Thank you
    VJ

Maybe you are looking for