6 Replies Latest reply: Apr 2, 2013 6:21 AM by BluShadow RSS

    Spool listener status $lsnrctl status

    997121
      Hi guys,

      I'm trying to spool the listener status to a text file ($lsnrctl status).
      On the screen I'm getting the correct result but for some reason I can't spool it to a file.

      Isn't it possible to spool the result to a file?
        • 1. Re: Spool listener status $lsnrctl status
          sybrand_b
          First of all: is 'lsnrctl status' a SQL statement? I think you are in the wrong forum!
          Also, why do you want to do this? What is the useful application of this request. Listeners just work again, again and again, and they never fail.

          ----------
          Sybrand Bakker
          Senior Oracle DBA
          • 2. Re: Spool listener status $lsnrctl status
            997121
            Uhm... I posted the question under SQL and PL/SQL which I think would be the right place since it's a SQL command.

            I know if the listener is running it is working again and again and never fails.
            However, I'm writing an audit script and thus want to know the status of the listener - since it is possible to get the status it should be possible to export or spool the result.
            • 3. Re: Spool listener status $lsnrctl status
              BluShadow
              994118 wrote:
              Uhm... I posted the question under SQL and PL/SQL which I think would be the right place since it's a SQL command.
              lsnrctrl is not an SQL command, or even an SQL*Plus command...
              SQL> lsnrctl status
              SP2-0734: unknown command beginning "lsnrctl st..." - rest of line ignored.
              ... it's an operating system command as it's a utility in it's own right.
              I know if the listener is running it is working again and again and never fails.
              However, I'm writing an audit script and thus want to know the status of the listener - since it is possible to get the status it should be possible to export or spool the result.
              You should use your operating system's scripting language (which is dependent on your o/s) to output the results of any command line calls you make.
              • 4. Re: Spool listener status $lsnrctl status
                997121
                Thank you for the clarification about the lsnrctl status command :)

                So there is no generic way to export or spool the listener status if the database is running on Windows or Unix?
                • 5. Re: Spool listener status $lsnrctl status
                  sybrand_b
                  Writing an audit script is potentially a waste of time, as you can use database control to see whether the listener is running and since when it is running.
                  Yes, it periodically captures the result of lsnrctl status.
                  As most people here often don't do much investigation they always seem to be willing to reinvent the wheel.

                  --------
                  Sybrand Bakker
                  Senior Oracle DBA
                  • 6. Re: Spool listener status $lsnrctl status
                    BluShadow
                    994118 wrote:
                    Thank you for the clarification about the lsnrctl status command :)

                    So there is no generic way to export or spool the listener status if the database is running on Windows or Unix?
                    Well, most operatings systems use similar stream redirections e.g.
                    C:\> lsnrctl status > c:\temp\output.txt
                    so you can include that in your operating system script (batch file or shell script or whatever)