How2 validate the chain of connection in unix shell script

I am writing a shell script unix which removes the instance user/passwd/user, form a connection string and pass it to sqlplus. Now, I want to validate if a valid/clean connection string was formed. Basically, I want to do something like below

sqlplus-s $CONN_STR

and disconnect if valid string and always disconnect and return to guest if it's not a string valid.

Is there a clean way, I can check if the return has been after a successful login and how disconnect it in script and check if a string is not valid.

Create a file name test.sql containing only the OUTPUT and use-L option to SQL * more (attempts to connect only once, instead of reprompting error.)

D:\>sqlplus -L hr/ko@XE @test.sql

SQL*Plus: Release 11.1.0.6.0 - Production on Wed Feb 17 08:48:37 2010

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

ERROR:
ORA-01017: invalid username/password; logon denied

SP2-0751: Unable to connect to Oracle.  Exiting SQL*Plus

D:\>echo %errorlevel%
1

D:\>sqlplus -L hr/hr@XE @test.sql

SQL*Plus: Release 11.1.0.6.0 - Production on Wed Feb 17 08:48:49 2010

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production

Disconnected from Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production

D:\>echo %errorlevel%
0

D:\>sqlplus -L hr/hr@KO @test.sql

SQL*Plus: Release 11.1.0.6.0 - Production on Wed Feb 17 08:52:22 2010

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified

SP2-0751: Unable to connect to Oracle.  Exiting SQL*Plus
D:\>echo %errorlevel%
1

Tags: Database

Similar Questions

  • How to validate SQL * MORE connection in Unix shell script

    I wrote the following function in unix shell script to validate SQL * MORE connection and throw a user-defined message.

    function check_db_conn

    {

    output | sqlplus-s-L $User/$Password@$SID >/dev/null

    If [[$?-no 0]]; then

    echo 'credentials incorrect DB.

    FI

    }

    However, I would like to change this feature so that the user has entered a good connection and that there is a problem with TNS listener must display the appropriate message.

    Hello

    Try adding:

    lsnrctl status $listener_name > /dev/null
    if [[ $? -ne 0 ]]; then
      echo "Issue with Listener"
    fi
    
  • Call the OBIEE Unix Shell Script

    Hi all

    Is it possible to make a call to a Unix Shell Script with the framework of the Action of OBIEE.

    Thanks in advance

    I don't think, but we can go for it instead side BI. Try to transfer the same features side shell script so that the script can identify your report using the tail of the log nqquery and execute the rest of your lines in shell script.

    This can done and works as expected. If you identify your report instead of this long logical query at all with my suggestion that you can go for a little keyword.

    Score pls help if

  • Re: Unix shell script to notify if an array has reached a number of lines

    Looking to write a script to send an alert notification when an Oracle database table object reaches a certain value of line number. If anyone has the logic "If this while" for a script shell unix would be great.

    With the logic of control and check on the table when it reaches the total line number can be added to the script and on-demand via cron.

    Thank you.

    Thus, you must periodically (how often?) a COUNT (*) on the target table?  Is this acceptable overhead?

    /Korn Bourne shell scripts can compare numbers and check if one is greater than another.  See "-gt" UNIX - Shell basic operators

    Hemant K Collette

  • Get the progress and result of a shell script

    Hello

    I would use a shell script to convert MP3 / audio FLAC files MP3 files with a bitrate of 192kbs and do other things in Automator or AppleScript script.

    So I installed lame and flac with brew, run an Automator process with a selected file and perform an action of AppleScrip:

    on run {input, parameters}
    
      if input is not {} then
    
      repeat with theFile in input
    
      set posix_file to POSIX path of theFile
    
      if input is not {} then
    
      tell application "Terminal"
    
      set thescript to "/usr/local/bin/lame -b 192 \"" & posix_file & "\" "
    
      do script thescript
    
      end tell
    
      end if
    
      end repeat
    
      end if
    
      return input
    
    end run
    

    The Terminal window is there because you tell the Terminal to run your script - try using shell script.

  • Get PLSQL stored procedure in unix shell script

    Hi Experts,

    I have a PLsql procedure with the specification below-

    PROCEDURE SEND_INV_VIA_EMAIL (p_pdf_file_name IN VARCHAR2, p_submitted_frm IN VARCHAR2);

    I can pass two parameters of SHELL script and it works fine-

    # By calling the PLSQL procedure

    sqlplus-s $APPS_USER < < EOSQL

    SET SERVEROUTPUT SIZE 1000000

    whenever sqlerror exit 1;

    run MOB_XMLPUB_ARCHIVE_ARINV_PCK.send_inv_via_email ("basename $DATA_FILE", "ARCHIVE");

    "exit";

    EOSQL

    But now I want to have an output in the plsql procedure parameter-

    PROCEDURE SEND_INV_VIA_EMAIL (p_pdf_file_name IN VARCHAR2, p_submitted_frm IN VARCHAR2, p_return_status IN OUT VARCHAR2);

    based on this I want to determine the concurrent request completion status since the shell script is called via the simultaneous program.

    How will pass parameter out of the shell and how do I use this parameter in the SHELL script to determine completion status?

    Thank you very much.

    Vikrant

    Something like this:

    # By calling the PLSQL procedure
    sqlplus-s $APPS_USER<>
    SET SERVEROUTPUT SIZE 1000000
    whenever sqlerror exit 1;
    declare
    rstatus varchar2 (100) - or however long, it must be
    Start
    MOB_XMLPUB_ARCHIVE_ARINV_PCK.send_inv_via_email ("basename $DATA_FILE", 'ARCHIVE', rstatus);
    dbms_output.put_line (' status = ' | rstatus);
    end;
    /
    "exit";
    EOSQL
    grep 'Return status =' somefile

  • Unable to verify the State of Null in a Shell Script

    Hello

    When I use to check the Null Condition to check for a running Java process his failure to check.

    I use the variable in a shell script

    DPID = $(ps-ef | grep-i java | grep-v grep)
    If ["$DPID '='" ']; then

    on the other


    FI

    If the DPID is null, then executed obtaining but if the DPID value her not to enter the other part of the loop

    Thanks and greetings

    You could try - c do grep returns a number of matches, and then check if this counter is zero or not.

    DPID=`ps -ef |grep - i java|grep -vc grep`
    
    if [[ $DBID -ne 0 ]]; then 
    
    else
    
    fi
    
  • TimesTen issue with the chain of connection on a 64 bit system

    Hello dear members,
    I need to write in vbscript code that creates a connection to the server Oracle timesten.
    The TimesTen database is located on a unix server, and the client application is on windows server.

    This is my code:

    Set mCnTT = CreateObject ("ADODB.connection")
    mCnTT.ConnectionString = "Provider = MSDASQL.1; DSN =" & TT_DSN & ';' & 'TTC_SERVER =' & TT_SERVER & ';' & 'TTC_SERVER_DSN =' & TT_SERVER_DSN & ';' & UID = "& TT_UID &";"&"PWD ="& TT_PWD & ';'.
    mCnTT.Open

    When he ran for 64-bit application will work fine. (I tried it on a stand alone vbscript)

    My problem is that I need this code runs on a Server 64-bit system, BUT from a 32-bit application (QTP)
    and I get the following error:
    "[Microsoft] [ODBC Driver Manager] driver name not found and no data Source specified default.

    no idea how to build a connection string that works? Maybe use a differnet provider?

    MSDAORA provider supports timesten?

    any suggestions will be most welcome!
    Thank you
    Rachel

    If you will be running a 32-bit application on 64-bit connection to TimesTen 64-bit Windows on a Unix server. is that correct? Assuming it is, you must:

    1 install TimesTen 32-bit Windows client rather than the Windows 64-bit TimesTen customer (a TT 32-bit client will work with a 64-server VT fine)

    2 use the 32-bit ODBC Administrator to configure the DSN rather than the 64-bit default cmdlet

    (2) is particularly important. DDNs ODBC 32-bit and 64-bit are held in completely different places in the Windows registry. 32-bit applications cannot see/use 64-bit DSN and vice versa.

    None of this is directly related to TimesTen; It comes to all the standard features of Windows 64-bit and questions.

    Chris

  • Shift registers loop when the chain is connected to the registers

    Hello everyone! I just need to know how these shifts of registers. For example a photo added, I have a stacked sequence structure. Some time ago in a loop with inside case structures. As you can see, there is registry to offset looping with initial string and on the right side of passage registry there is string "entry". So my question is when we run the VI, to check the error case it is going to start from initial case and then transmit the information to the case of entry into the structure of the case. So basically, I need to know how the shift registers can be used with the structures of the case and while loop.

    http://www.NI.com/Tutorial/9330/en/

    With this you can post a photo that is executable code.  For us looking at your code is not better than watching a photo with text in Notepad.

    That being said here is some information on shift registers.

    http://www.NI.com/getting-started/LabVIEW-Basics/shift-registers

    https://zone.NI.com/reference/en-XX/help/371361H-01/lvconcepts/shift_registers_concepts/

    To simplify your code, I highly recommend getting rid of the outer sequence structure.  Stacked sequence structures serve generally to cause new problems to users, and sequence variables compound which.  If you want the code to run before the main States are called, you can have a status of initializing in your state machine and do be more manageable.

  • DBMS_SCHEDULER - trying to create and run a UNIX shell script from Oracle

    How can I run Script Shell Unix from Oracle using DBMS_SCHEDULER?

    After reading many examples online, I finished the 3 steps below.
    Create program, create jobs, run task. On my 3rd stage, I get the following error.
    How can I make sure that the work was created?

    ORA-27475: "APPS. POSPAY_FILE_CHECK_JOB' must be work

    (1) create the program
    BEGIN
      dbms_scheduler.create_program(
         program_name => 'POSPAY_FILE_CHECK_PROG',
         program_type => 'EXECUTABLE',
         program_action => '/home/ldcgroup/ldccbc/POSPAY_USC2_CHECK.sh',
         number_of_arguments => 0,
         enabled => TRUE,
         comments => 'Test Program'
         );
    END;
    (2) create jobs
    BEGIN
    DBMS_SCHEDULER.CREATE_JOB (
       job_name          =>  'POSPAY_CHECK_FILE_JOB',
       program_name      =>  'POSPAY_CHECK_FILE_PROG',
       enabled           =>   TRUE);
    END;
    /
    (3) the job (not calendar, I'll run this a concurrent request of EBS)
    BEGIN
       DBMS_SCHEDULER.run_job (
         job_name => 'POSPAY_FILE_CHECK_JOB');
    END;
    /

    Of [documentation | http://download.oracle.com/docs/cd/E11882_01/server.112/e10595/scheduse002.htm#i1009668]

    The job is created disabled. You must enable it with DBMS_SCHEDULER.ENABLE before the Scheduler will automatically run it.
    
    Jobs are set to be automatically dropped by default after they complete. Setting the auto_drop attribute to FALSE causes the job to persist.
    
  • Unzip the file sys of operation or execute an Oracle stored procedure shell script

    Y at - it a package or something else I can use a procedure stored Oracle to decompress a file of the operating system or run a shell script? Have Oracle 11g 2, Linux Redhat. I am familiar with utl_file to look at properties, open, close, write files, etc., but am looking for a way to decompress a file or run a shell script.

    Without papers, and likely or very likely not supported

    http://technology.AMIS.nl/Blog/5307/Oracle-database-directory-listing-with-ls-function

    There are JVM/Java alternatives to it. Search asktom.oracle.com

    Published by: Marco Gralike on August 23, 2011 22:31

  • Unable to connect XP laptop to my wireless network. Diagnotics says 'error trying to validate the Winsock base providers' couldn't get cable or Internet.

    Unable to connect XP laptop to my wireless network. Diagnotics says 'error trying to validate the Winsock base providers' couldn't get cable or Internet.

    Hello

    Try the methods below to solve the problem.

    Method 1:

    How to reset the Protocol Internet (TCP/IP)
    http://support.Microsoft.com/kb/299357

    Method 2:

    How to determine and to recover from Winsock2 corruption in Windows Server 2003, Windows XP and Windows Vista

    http://support.Microsoft.com/kb/811259

    To do: Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems can occur if you modify the registry incorrectly. Therefore, make sure that you proceed with caution. For added protection, back up the registry before you edit it. Then you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click on the number below to view the article in the Microsoft Knowledge Base:

    How to back up and restore the registry in Windows

    http://support.Microsoft.com/kb/322756

  • Hello, I bought the download of Lr 5 6 Lr, and I want to validate the serienumber. But Adobe is still asking to connect to internet. Why, I'm connected. Please help ;-)

    Hello, I bought the download of Lr 5 6 Lr, and I want to validate the serienumber. But Adobe is still asking to connect to internet. Why, I'm connected. Please help ;-)

    Refer to this:

    Solutions to connection errors, activation and connection with creative Cloud applications and Creative Suite

    Mylenium

  • My Adobe Acrobat DC to validate the serial connection

    My product is installed, BUT it will not be validated it. I continue to support on validate and it says: connect to internet and I am. Any help?

    Check your hosts file.

    help for that and other adobe.com sure common connection problems read, http://helpx.adobe.com/x-productkb/policy-pricing/activation-network-issues.html

  • Validate the user connected to the database or not

    Hi all

    I am looking of the view or table to see if the user were connected to the database once the user has been created with all the privileges with on the activation of the audit.

    Thank you
    RAM.

    sb92075 wrote:

    Girish Sharma wrote:

    Another way is the logging listener to get the info if the user has been connected or not.

    Listener.log has NOT identify the USER. only hostname / IP #.

    Yes you're right Sb, I just got confused words 'Audit Trail' in the context of exploitation forest listener at the bottom of the link:
    http://docs.Oracle.com/CD/A57673_01/doc/net/doc/NWTR23/ch2log.htm#audit2

    Thanks for correcting me.

    Concerning
    Girish Sharma

Maybe you are looking for

  • MBP turns on and turns off when plugging in/out

    Hi all I had a problem with my MacBook Pro mid 2012 since I got it. I started with Mountain Lion and have recently upgraded to El Capitan. Same problem on all releases. I assumed it was a feature, but it really starts to get boring. When my MacBook i

  • Fax capability for Photosmart 7510 with Windows 7?

    Is it possible to put in place the capacity of other than efax fax?

  • Difference between the scale of gray and black and white adjustment

    Hello I just want to know the difference between black and white and grey adjustment of scale when printing text only, and which uses less ink. Thank you

  • Low internal memory

    I have a Moto G 2nd gen Android 6.0 running. I used a 32GB microSD card and set it to "expanded memory" that is the SD card is supposed to be an extension of the internal memory. I had no problems until recently, when I started to receive messages of

  • U2715H, black flashing, disable the CSM in the bios

    * What operating system? Windows 10 * Which video card? Gainward GTX 1060 6 GB* Video card driver version? Last Nvidia * Which ports are available for the video card? Several * Which video output from the video card port video on the port monitor do