How to get Listener Information using PL/SQL code

How to get Listener Information using PL/SQL code

user2075318 wrote:
How to get Listener Information using PL/SQL codeThis approach (somewhat of a hack) can be used - but it does not really provide meaningful data at application layer.
SQL> create or replace function TnsPing( ipAddress varchar2, port number default 1521 ) return varchar2 is
  2          type THexArray is table of varchar2(2);
  3          --// tnsping packet (should be 10g and 11g listener compatible)
  4          TNS_PING_PACKET constant THexArray := new THexArray(
  5                  '00', '57', '00', '00', '01', '00', '00', '00',
  6                  '01', '39', '01', '2C', '00', '00', '08', '00',
  7                  '7F', 'FF', '7F', '08', '00', '00', '01', '00',
  8                  '00', '1D', '00', '3A', '00', '00', '00', '00',
  9                  '00', '00', '00', '00', '00', '00', '00', '00',
10                  '00', '00', '00', '00', '00', '00', '00', '00',
11                  '00', '00', '00', '00', '00', '00', '00', '00',
12                  '00', '00', '28', '43', '4F', '4E', '4E', '45',
13                  '43', '54', '5F', '44', '41', '54', '41', '3D',
14                  '28', '43', '4F', '4D', '4D', '41', '4E', '44',
15                  '3D', '70', '69', '6E', '67', '29', '29'
16          );
17 
18          socket  UTL_TCP.connection;
19          txBytes number;
20          rxBytes number;
21          rawBuf  raw(1024);
22          resp    varchar2(1024);
23  begin
24          socket := UTL_TCP.open_connection(
25                          remote_host => ipAddress,
26                          remote_port => port,
27                          tx_timeout => 10
28                  );
29 
30          --// convert hex array into a raw buffer
31          for i in 1..TNS_PING_PACKET.Count loop
32                  rawBuf := rawBuf || HexToRaw( TNS_PING_PACKET(i) );
33          end loop;
34 
35          --// send packet
36          txBytes := UTL_TCP.write_raw( socket, rawBuf, TNS_PING_PACKET.Count  );
37 
38          --// read response
39          rxBytes := UTL_TCP.read_raw( socket, rawBuf, 1024 );
40 
41          UTL_TCP.close_connection( socket );
42 
43          --// convert response to varchar2
44          resp := UTL_RAW.Cast_To_Varchar2( rawBuf );
45 
46          --// strip the header from the response and return the text only
47          return( substr(resp,13) );
48  end;
49  /
Function created.
SQL>
SQL> select tnsping( '10.251.93.30' ) as TNSPING from dual;
TNSPING
(DESCRIPTION=(TMP=)(VSNNUM=169869568)(ERR=0)(ALIAS=LISTENER))
SQL> select tnsping( '10.251.95.69' ) as TNSPING from dual;
TNSPING
(DESCRIPTION=(TMP=)(VSNNUM=0)(ERR=0)(ALIAS=LISTENER))
SQL>

Similar Messages

  • How to get channel information using RDA

    I'm attempting to build my VIs in such a way that I have the user only supply the channel names while trying to get the device number using "Get Channel Information.vi". I found the "Virtual Channel Configurator.vi" on this site, which is fairly close to what I wanted.
    However there is one problem, I can't get Get Channel Information to work using RDA channels (error -10003). Is there a reason, or better, a solution for this?

    Dear Justin,
    I am having a similar problem as in this thread, I am sending a screen
    shot of the program I am using.  I am using  LabView 8, NI
    DAQmx 8, PXI-6259 Meries card. It is a real time remote system and not
    connected to my computer on which I am making the programs.
    I want the pulses to appear on the output terminal that I choose, but
    when I browse in the counter1(s), the global virtual channels that I
    made in the remote system  icon in Max do not appear?
    how can I make them appear so I can send the pulse signal to that output termainal?
    thanx.
    Attachments:
    mypic.jpg ‏2305 KB
    mypic1.jpg ‏2305 KB

  • How to get currency format using pl sql function

    Hi all,
    I am a newbee on the forum. currently i am facing an issue with the Format of Currency in an rdf report. This is a field of tax amount & i need to make some conditional formatting on this like if the tax amount is Zero then some static note is to be added before this field.
    I have tried a lot of functions on it like the one as below:
    IF :cp_org_id = 102
    AND :invoice_currency_code <> 'CAD'
    AND TO_CHAR (NVL (:cf_tax_amount, 0)) = 0
    THEN
    RETURN (TRUE);
    ELSE
    RETURN (FALSE);
    This is working fine in case of Zero tax amount But gets error out when there some Tax amount exists. It gives a VALUE ERROR in this format Trigger.
    Kindly suggest me how to solve this issue with right function. If possible then write the pseudo Code also.
    Thanks in advance
    D_Verma

    In addition to Satyaki:
    It might be a 'Reports Thing'.
    It works in SQL*Plus (although relying on implicit conversions is a bad idea, as mentioned):
    MHO%xe> begin
      2  IF 102 = 102
      3  AND 'DAC' != 'CAD'
      4  AND TO_CHAR (NVL (null, 0)) = 0
      5  THEN
      6  dbms_output.put_line('TRUE');
      7  ELSE
      8  dbms_output.put_line('FALSE');
      9  end if;
    10  end;
    11  /
    TRUE
    PL/SQL-procedure is geslaagd.
    MHO%xe> begin
      2  IF 102 = 102
      3  AND 'DAC' != 'CAD'
      4  AND TO_CHAR (NVL (0, 0)) = 0
      5  THEN
      6  dbms_output.put_line('TRUE');
      7  ELSE
      8  dbms_output.put_line('FALSE');
      9  end if;
    10  end;
    11  /
    TRUE
    PL/SQL-procedure is geslaagd.
    MHO%xe> begin
      2  IF 102 = 102
      3  AND 'DAC' != 'CAD'
      4  AND TO_CHAR (NVL ('0', '0')) = '0'
      5  THEN
      6  dbms_output.put_line('TRUE');
      7  ELSE
      8  dbms_output.put_line('FALSE');
      9  end if;
    10  end;
    11  /
    TRUE
    PL/SQL-procedure is geslaagd.

  • How to get customercontract informations using BAPI

    Hello,
    I am looking for a BAPI which could help me to get contract's informations for using the BAPI BAPI_CUSTOMERCONTRACT_CHANGE.
    I do not find BAPI_CUSTOMERCONTRACT_DISPLAY or BAPI_CUSTOMERCONTRACT_GETINFO
    Eg.:
    For a material, we use BAPI_MATERIAL_DISPLAY and then we use the data for the BAPI BAPI_MATERIAL_EDIT to change the material.
    Thanks for your help.

    Hi,
    Check out http://www.scribd.com/doc/15964168/bapilist
    you have to search for your BAPI.
    Thanks,
    Krishna

  • How to get display name using PL/SQL

    Hello i whish to know if any one know how get the url and the display name of a page group, i ask this because i what to make a dinamic menu usgin dinamic pages.
    If any one know please let me know
    Best Regards
    Jose.

    Jose -
    Use the view WWSBR_ALL_CONTENT_AREAS.
    The Content views are documented here: http://www.oracle.com/technology/products/ias/portal/html/plsqldoc/pldoc1012/wwsbr_api_view.html
    Regards,
    Candace

  • How to get better performance to this sql code?

    Guys I need your help.
    I have a master table, 80 columns, more than millions data in it.
    MasterTable
    PK_Column_1
    PK_Column_2
    Column_3
    Column_4
    Select column_3, column_4
    from MasterTable
    where PK_Column_1 = '1' and PK_Column_2 = '2';
    I don't know how to create index for this table. Thank u.

    I don't know how to create index for this table.If PK stands for Primary Key, there should already be an index on those columns.
    What trouble are you having? Have you looked at an explain plan?
    Also...
    PK_Column_1 = '1' Are your primary key columns varchar2 columns?

  • How to get multiple records using fn-bea:execute-sql()

    Hi,
    I created Proxy service(ALSB3.0) to get records from DB table. I have used Xquery function(fn-bea:execute-sql()). Using simple SQL query I got single record, but my table having multiple records. Please suggest how to get multiple records using fn-bea:execute-sql() and how to assign them in ALSB variable.
    Regards,
    Nagaraju
    Edited by: user10373980 on Sep 29, 2008 6:11 AM

    Hi,
    Am facing the same issue stated above that I couldnt get all the records in the table that am querying in the Proxyservice.
    For example:
    fn-bea:execute-sql('EsbDataSource', 'student', 'select Name from StudentList' ) is the query that am using to fetch the records from the table called StudentList which contains more than one records like
    Id Name
    01 XXX
    02 YYY
    03 ZZZ
    I tried to assign the result of the above query in a variable and while trying to log the variable, I can see the below
    <student>
    <Name>XXX</Name>
    </student>
    I want to have all the records from my table in xml format but it's not coming up. I get the value only from the first row of my table.
    Please suggest.
    regards,
    Venkat

  • How to get this output using sql query?

    Hi,
      How to get this output using sql query?
    Sno Name Age ADD Result
    1 Anil 23 delhi Pass
    2 Shruti 25 bangalor Pass
    3 Arun 21 delhi fail
    4 Sonu 23 pune Pass
    5 Roji 26 hydrabad fail
    6 Anil 28 delhi pass
    Output
    Sno Name Age ADD Result
    1 Anil 23 delhi pass
    28 delhi pass

    Hi Vamshi,
    Your query is not pretty clear.
    write the select query using Name = 'ANIL' in where condition and display the ouput using Control-break statements.
    Regards,
    Kannan

  • HT201328 My nephew give me the iphone and i'm not sure about the carrier. how i can get this information using the imei number?

    My nephew give me the iphone and i'm not sure about the carrier. how i can get this information using the imei number?

    If you have the iPhone in front of you, here's how you can learn the carrier:
    Go to Settings > General > About and look at the "Network" row near the top.  There's your carrier's name!

  • Getting the schema using Oracle SQL Developer 1.5.1

    I need to generate a report in CSV/XLS format using Oracle SQL Developer 1.5.1 to get the schema details
    in the below format.
    Table Name: XXXXXXXXX
    Table Space Name: XXXXXXXXXXXXXXX
    Structure :
    Field Name Data Type Size
    Xxxxxxxx xxxxxx xxxxx
    Xxxxxxxx xxxxxx xxxxx
    Xxxxxxxx xxxxxx xxxxx
    Xxxxxxxx xxxxxx xxxxx
    Field level constraint:
    Xxxxxxxxxxxxxxxxxx
    Table Level Constraint:
    Xxxxxxxxxxxxxxxxxx
    Indexes:
    Index Name Column Name(s) Table space name
    Xxxxxxxx xxxxxxxxx xxxxxxxxxxxx
    Xxxxxxxx xxxxxxxxx xxxxxxxxxxxx
    Xxxxxxxx xxxxxxxxx xxxxxxxxxxxx
    Sequence Number:
    Xxxxxxxxxxxxxxxx
    Triggers:
    Xxxxxxxxxxxxxxxxxx
    I am using a query to do that, but I cannot run more than one queries in the Create Report Dialog.
    I went to the Menu->View->Reports. In that, I chose User Defined Reports, created a new folder called Schema Detail and in that a report named Schema Detail. I right click on that report, choose Edit option, Create Report Dialog opens.
    In the Create Report Dialog, I chose the option Script for Value of Style.
    In the SQL column I enter a query "select * from table_names". But, if I enter another query after that, it does not run and reports an error "SQL Error: ORA-00933: SQL command not properly ended
    00933. 00000 - SQL command not properly ended" Cause:    Action: "
    I end the first query with a semi colon, but it does not work.
    The queries run fine in a SQL Worksheet. There, I can terminate the first query with a semi colon and enter the second query. Then, I run both of them together so that result-set of second query appears after the second.
    Am I doing something wrong? Can someone please advise on how to get the information I need?
    Thanks a lot.

    You can do it in SQL Worksheet because you are running a script. You could run the script in SQL*Plus, and even start it from a bat/cmd file.
    Or if you want this as a User Defined Report, you might make it a PL/SQL style report. Here, all output is done through DBMS_OUTPUT.PUT or DBMS_OUTPUT.PUT_LINE. You can output HTML tags or plain text. I have an example in my paper for ODTUG Kaleidoscope 2009.

  • How can one  read a Excel File and Upload into Table using Pl/SQL Code.

    How can one read a Excel File and Upload into Table using Pl/SQL Code.
    1. Excel File is on My PC.
    2. And I want to write a Stored Procedure or Package to do that.
    3. DataBase is on Other Server. Client-Server Environment.
    4. I am Using Toad or PlSql developer tool.

    If you would like to create a package/procedure in order to solve this problem consider using the UTL_FILE in built package, here are a few steps to get you going:
    1. Get your DBA to create directory object in oracle using the following command:
    create directory TEST_DIR as ‘directory_path’;
    Note: This directory is on the server.
    2. Grant read,write on directory directory_object_name to username;
    You can find out the directory_object_name value from dba_directories view if you are using the system user account.
    3. Logon as the user as mentioned above.
    Sample code read plain text file code, you can modify this code to suit your need (i.e. read a csv file)
    function getData(p_filename in varchar2,
    p_filepath in varchar2
    ) RETURN VARCHAR2 is
    input_file utl_file.file_type;
    --declare a buffer to read text data
    input_buffer varchar2(4000);
    begin
    --using the UTL_FILE in built package
    input_file := utl_file.fopen(p_filepath, p_filename, 'R');
    utl_file.get_line(input_file, input_buffer);
    --debug
    --dbms_output.put_line(input_buffer);
    utl_file.fclose(input_file);
    --return data
    return input_buffer;
    end;
    Hope this helps.

  • How to get the information of the log related to t.code generated by basis.

    In the log generated by the basis personnel we found the details of user and corresponding t.code used details.  How to get the information reg. which document he went into using this t.code? For example me29 t.code used by 'x' user.  The log is showing time date t.code and user.  By using me29n which document he attended is the requirement. How to get this information. Let me know it pl.
    TS

    Thanks all for the help.
    Here is my solution. A mix from Julian and Thomas.
    In future I will encapsulate the code in a function module.
    DATA: BEGIN OF usr_tabl OCCURS 10.
            INCLUDE STRUCTURE uinfo.
    DATA: END OF usr_tabl.
    DATA: th_opcode(1) TYPE x.
    DATA: LV_TID LIKE  SY-INDEX.
    CONSTANTS: opcode_list LIKE th_opcode VALUE 2.
    CALL 'ThUsrInfo' ID 'OPCODE' FIELD opcode_list
      ID 'TAB' FIELD usr_tabl-sys.
    CALL FUNCTION 'TH_USER_INFO'
      EXPORTING
        CLIENT = sy-mandt
        USER   = sy-uname
      IMPORTING
        TID    = LV_TID.
    read table usr_tabl with key tid = lv_tid.
    IF sy-subrc = 0.
      CASE usr_tabl-type.
        WHEN 2.
          write :/ usr_tabl-type, 'SYSTEM'." (system)
        WHEN 4.
          write :/ usr_tabl-type, 'GUI'." (Gui)
        WHEN 32.
          write :/ usr_tabl-type, 'RFC'."(RFC)
        WHEN 202.
          write :/ usr_tabl-type, 'PLUG-IN'." (Plug-in &).
      endcase.
    ENDIF.

  • How I get a Information about how many Scheduling agree

    Dear friend,
       Can any one tell me a process ,How I get a information about how many scheduling agreement or Schedule lines created with in given time.Any standard tcode available  ?
    Regards
    Abrar AHmed

    Dear Abrar
    - To see how many scheduling agreement is created for a given period, use VA05, click on [Further sel criteria] and tick the box against [Sales Document type]  Now input the scheduling agreement type and execute.  You will get list of all scheduling agreements created within the specified period.
    - You can see how many line items are created in a sale order for a given period via VA05.
    thanks
    G. Lakshmipathi

  • How to get this information for Conky

    Hi people,
    My question is how to get this information for show in Conky:
    - KDE version.
    - Last sync (pacman -Sy) and Last update (pacman -Su)
    For the first point could be use a script that execute $ kdesu --version and get information from there.
    I have no idea how get information from pacman (may be logs?).
    Any ideas?
    Thank you.

    I have had tremendous success with LUA in Conky on Arch. And all you need to to is put the text HI after the "TEXT" line. ^^;
    Examples of my LUA usage:
    http://fc02.deviantart.net/fs71/i/2010/ … usLink.png
    http://kittykatt.silverirc.com/screens/conky-HUD.png
    EDIT:  Also, I've had success with getting the KDE version by doing the following...
    kwin --version | awk '/^Qt/ {data="Qt v" $2};/^KDE/ {data=$2 " (" data ")"};END{print data}'
    This is the method I'm currently using in screenFetch. Tested it a couple of times myself, but besides that, I'm not sure if it will work or not.
    Last edited by kittykatt (2010-04-22 17:52:25)

  • I am new to Mac Pro but am purchasing one online.  can anyone tell me how to get the information from my Toshiba onto the Mac.  there are no stores in the state I live in.  Do I need to find a location and will they do a transfer from my I Tunes etc?

    I am new to Mac Pro and am purchasing one online  tonight.  Can anyone tell me how to get my information - Itunes, photos, and videos transferred onto the Mac from my Toshiba.  the state I live in doesn't have an Apple store but I could take it to Minneapolis when I go.  Any ideas where to begin?

    You might profit from a visit to a Minneapolis Apple store. With a brand new Mac, I think they will be most helpful - not just with transferring files, but with other advice as well. And I strongly recommend you invest in a back up drive. The Apple folk can help with that as well.

Maybe you are looking for