SQL QUERY TO CHECK FIREWALL PORTS

Hi All,
These is Nani..I am looking for a sql script to show inbound sql ports opened under windows firewall.
Thank You in Advance for your help.
Thanks,
Nani.
NB

Hi Nani55,
Please refer to the following query:
select distinct local_net_address, local_tcp_port from sys.dm_exec_connections
where local_net_address is not null
The query will return the local IP as well as the listening Port number. For more information, please see:
sys.dm_exec_connections (Transact-SQL):
http://msdn.microsoft.com/en-us/library/ms181509.aspx
Elvis Long
TechNet Community Support

Similar Messages

  • SQL Query to check window firewalls ports

    Hi All,
    I am looking for a sql query like below to check inbound sql ports opened in window firewall.
    Below query display all firewall ports but my requirement is to display ports opened related to sql server.
    EXECUTE [master].[dbo].[xp_cmdshell] 'netsh advfirewall firewall show rule name=any |find "sql"'
    Thanks,
    Nani.
    NB

    To find the answer, you would first find which ports that are "SQL ports", and this you can find by looking in the errorlog or the registry for each instance if you want to do it programmatically.
    To check Windows firewall programmatically, I have no idea, and it is definitely not a question for an SQL Server forum. Find the suitable Windows forum.
    And, no, there is no SQL query you can write to do this. But Powershell may work.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • I want SQL query to check if any of our important concurrent programs

    I want a sql query to check if any of our important concurrent programs are currently scheduled or not

    SinghP wrote:
    I want a sql query to check if any of our important concurrent programs are currently scheduled or notThat's nice,
    What scheduling tool are you using? are you referring to dbms_job?
    what version of Oracle are you using? are you using some custom job management system that involves writing to user created tables in your database?

  • Apple TV not responding, check firewall port 3689

    Hi,
    I have this problem: "Apple TV not responding" with my PC wired to the router (Thomson Speedtouch 780i WL). I have read all the topics on this issue and tried everything: no success! With my XP laptop I can make a wireless connection and everything works fine. But not with the PC where I have all my music and photo archives on.
    Now I have a clean installed Vista and the problem remains the same. How is this possible?
    - the firewall port 3689 is open
    - i have rebooted everyting
    - i have made a new connection with the apple tv
    - apple tv software is updated
    I want to get this thing working. Could you please help me?
    Thanks, Sliek.

    The problem is not with the router nor the firewall. And with you having the issue on a PC and I having it on a Mac, this rules out the OS. That leaves a networking problem in either iTunes or the AppleTV. Or most likely a dropped packet of information between the two.
    Using NetBarrier I have watched the interaction between my Mac and the AppleTV. The sync occurs in three separate phases. The first phase initiates communications via port 3689 and a few high order ports (49xxx - 6xxxx). After this is finished about a dozen ports are opened by the AppleTV (all high order) for a couple of minutes. When these ports close and after a substantial wait, the AppleTV opens a whole s**t-load of ports (well over 200) and the actual sync occurs. It is this third phase that fails when I fail the sync. Or iTunes gets stuck waiting for a response from the AppleTV. I think that the AppleTV is dropping the ball and failing to respond properly.

  • Need the SQL Query to check SQL time zone and change the time zone

    Hi All,
    I am using SQL Server 2008 SP2. My Ex SQL Admin said that the data which we query from our database gives the output in London time.
    But the SQL server is located in USA and is having US time.
    I would like to know how to find what time zone is the SQL application running on and how to change it ?
    Is there any query which i can use to determine and change the time zone ?
    Gautam.75801

    Refer the below two links
    http://blog.sqlauthority.com/2014/02/15/sql-server-get-current-timezone-name-in-sql-server/
    Check this link
    http://dba.stackexchange.com/questions/39421/how-to-handle-timezone-properly-in-sql-server
    SELECT [DateTimeUtil].[UDF_ConvertLocalToLocalByTimezoneIdentifier] (
    'GMT Standard Time', -- the original timezone in which your datetime is stored
    'Middle East Standard Time', -- the target timezone for your user
    '2014-03-30 01:55:00' -- the original datetime you want to convert
    --Prashanth

  • SQL Query to check which datafiles have AutoExtend on?

    I want to turn autoextend off on almost all my datafiles(obviously not on system). Using the Java Enterprise Manager you can visually see which datafiles have autoextend on. I'd prefer to find out using sqlplus which files have autoextend on so I can script turning it off. I don't see it in the v$tablespace or v$datafile views.. Where can i find this??
    Paul

    Hi,
      1* select substr(file_name,1,50), AUTOEXTENSIBLE from dba_data_files
    SQL> /
    SUBSTR(FILE_NAME,1,50)                             AUT
    /data/ora/H89UCBAC/u05/system/system01.dbf         YES
    /data/ora/H89UCBAC/u05/rbs/psundots01.dbf          YES
    /data/ora/H89UCBAC/u01/psdefault/psdefault.dbf     NO
    /data/ora/H89UCBAC/u01/aaapp/aaapp.dbf             NO
    /data/ora/H89UCBAC/u01/aalarge/aalarge.dbf         NO
    /data/ora/H89UCBAC/u01/adapp/adapp.dbf             NO
    /data/ora/H89UCBAC/u01/amapp/amapp.dbf             NO
    /data/ora/H89UCBAC/u01/avapp/avapp.dbf             NO
    /data/ora/H89UCBAC/u01/bdapp/bdapp.dbf             NO
    /data/ora/H89UCBAC/u01/bnapp/bnapp.dbf             NO
    /data/ora/H89UCBAC/u01/bnlarge/bnlarge.dbf         NO
    ...Nicolas.

  • SQL query to check continious records

    With T1 As ( SELECT ‘E1’ as E ,1100 as T , 15.0787 as SM1 , 16.1345 as EM1 from dual union all
    SELECT ‘E1’ ,1100 , 16.084 , 18.045 from dual union all
    SELECT ‘E2’ ,1100 , 15.0787 , 16.1345 from dual union all
    SELECT ‘E2’ ,1100 , 15.0327 , 18.045 from dual union all
    SELECT ‘E3’ ,1100 , 15.0197 , 16.1445 from dual union all
    SELECT ‘E3’ ,1100 , 16.1445 , 18.045 from dual union all
    SELECT ‘E4’ ,1100 , 13.0787 , 14.0743 from dual union all
    SELECT ‘E4’ ,1100 , 14.0743 , 34.0843 from dual union all
    SELECT ‘E4’ ,1100 , 34.0843 , 54.0743 from
    SELECT ‘E4’ ,1110 , 13.0787 , 14.0743 from dual union all
    SELECT ‘E4’ ,1110 , 14.0743 , 34.0843 from dual union all
    SELECT ‘E4’ ,1110 , 34.0843 , 54.0743 from union all
    SELECT ‘E1’ ,1100 , 19.084 , 20.045 from )
    Main Output should be come as
    E1      1100     15.0787 18.045
    E2 1100 15.0787 16.1345
    E2 1100 15.0327 18.045
    E3 1100 15.0197 18.045
    E4 1100 13.0787 54.0743
    E4 1110 13.0787 54.0743
    E1 1100 19.084 20.045
    could you help me with an sql to get the first output ?
    Logic to derive the above output:
    For a particular set of E and T as long as the EM1 of previous record <=SM1 of next record and SM1 of previous record < = SM2 of next record then consider it as a continious record. So record will become for this set
    ‘E1’ 1100 15.0787 16.1345
    ‘E1’ ,1100 , 16.084 , 18.045
    temporary Output wll be : E1 1100 15.0787 18.045

    Hi,
    user5698021 wrote:
    With T1 As ( SELECT ‘E1’ as E ,1100 as T , 15.0787 as SM1 , 16.1345 as EM1 from dual union all
    SELECT ‘E1’ ,1100 , 16.084 , 18.045 from dual union all
    SELECT ‘E2’ ,1100 , 15.0787 , 16.1345 from dual union all
    SELECT ‘E2’ ,1100 , 15.0327 , 18.045 from dual union all
    SELECT ‘E3’ ,1100 , 15.0197 , 16.1445 from dual union all
    SELECT ‘E3’ ,1100 , 16.1445 , 18.045 from dual union all
    SELECT ‘E4’ ,1100 , 13.0787 , 14.0743 from dual union all
    SELECT ‘E4’ ,1100 , 14.0743 , 34.0843 from dual union all
    SELECT ‘E4’ ,1100 , 34.0843 , 54.0743 from
    SELECT ‘E4’ ,1110 , 13.0787 , 14.0743 from dual union all
    SELECT ‘E4’ ,1110 , 14.0743 , 34.0843 from dual union all
    SELECT ‘E4’ ,1110 , 34.0843 , 54.0743 from union all
    SELECT ‘E1’ ,1100 , 19.084 , 20.045 from )Thanks for posting this. Please test (and, if necessary, correct) your code before you post it. The code above has syntax errors.
    Use only straight single-quotes (CHR (39)) around string literals. That is, don't say:
    SELECT  ‘E1’ , ...instead, say:
    SELECT  'E1' , ...
    Main Output should be come as
    E1      1100     15.0787 18.045
    E2 1100 15.0787 16.1345
    E2 1100 15.0327 18.045
    E3 1100 15.0197 18.045
    E4 1100 13.0787 54.0743
    E4 1110 13.0787 54.0743
    E1 1100 19.084 20.045
    could you help me with an sql to get the first output ?
    Logic to derive the above output:
    For a particular set of E and T as long as the EM1 of previous record <=SM1 of next record and SM1 of previous record < = SM2 of next record What is sm2?
    then consider it as a continious record. So record will become for this setWhat does "previous" mean in this case? If you look at 2 rows, how can you tell which comes first? Remember, there is no built-in order to rows in a relational database. Are there other significant columns in the table that you haven't shown?
    ‘E1’ 1100 15.0787 16.1345
    ‘E1’ ,1100 , 16.084 , 18.045
    temporary Output wll be : E1 1100 15.0787 18.045You can use LEAD or LAG to see when a new group starts, creating a new column with 0 or 1. Use the analytic SUM function on that column to see how many groups have already begun, and then GROUP BY that number; something like this:
    WITH     got_grp_start     AS
         SELECT     e, t, sm1, em1
         ,     order_col
         ,     CASE
                  WHEN  e  = LAG (e)           OVER (ORDER BY order_col)
                  AND       t  = LAG (t)        OVER (ORDER BY order_col)
                  AND   sm1  BETWEEN LAG (sm1) OVER (ORDER BY order_col)
                              AND     LAG (em1) OVER (ORDER BY order_col)
                  THEN  0
                  ELSE  1
              END     AS grp_start
         FROM    t1
    ,     got_grp          AS
         SELECT     e, t, sm1, em1
         ,     SUM (grp_start) OVER (ORDER BY order_col)     AS grp
         FROM     got_grp_start
    SELECT       e
    ,       t
    ,       MIN (sm1)     AS start_sm1
    ,       MAX (em1)     AS end_em1
    FROM       got_grp
    GROUP BY  grp, e, t
    ORDER BY  grp
    ;I couldn't test this, of course.
    I assume there's another column, order_col, in the table, that determines what "previous" means.
    Edited by: Frank Kulash on Dec 7, 2012 6:15 AM

  • Need Suitable Pure SQL Query

    Hi
    I have Pure SQL DataBase name of Table as per given Coloumn Name.
    User Name StartDate EndDate
    Mr.Jack 01/04/2010 05/04/2010
    Mr.Perlin 07/04/2010 10/04/2010
    Mr.Tinklin 01/05/2010 05/05/2010
    Mr.Kerlin 12/04/2010 15/04/2010
    Now I am using asp.net Form Using C#...
    Name --> TextBox
    StartDate -> TextBox
    EndDate --> TextBox
    Now User enter the Dates after Click Save Button....
    Here SQL Query Check Whether the User Dates Clause into Data Base Date's.
    For Examble..
    User Enter Start Date = 04/04/2010, EndDate =08/04/2010
    Now Query it check SQL DataBase, Already 01/04/2010 to 10/04/2010 Available so Dont allow Save.... only allow various dates...
    ---------------- This is task Condition -------
    i am using SQL Query
    DECLARE @StartDate DATETIME
    DECLARE @EndDate DATETIME
    SET @StartDate ='02/04/2010' --// This is User Start Date coming from Text Box
    SET @EndDate = '10/04/2010' --// This is User End Date coming from Text Box
    IF NOT EXISTS (SELECT PollID FROM Polls WHERE (StartDate<= CAST (CONVERT(VARCHAR,@StartDate,101) AS DATETIME) OR EndDate <= CAST (CONVERT (VARCHAR,@EndDate,101) AS DateTime)) AND STATUS<>'D')
    SELECT 'OK ALLLOW'
    ELSE
    SELECT 'NOT ALLOW'
    But it is not working Correctly....
    Pls give some correctful query for solve task Condition
    By
    Riyaz
    Edited by: 798225 on Sep 28, 2010 10:37 PM
    Edited by: 798225 on Sep 28, 2010 10:52 PM

    Now I am developing Polls Application in asp.net
    I am using Polls Concept,
    DateBase Name : Polls
    Fields : PollID          PollName                           StartDate                                     EndDate                     UserID
    In Asp.Form Having
    User Name :  TextBox
    PollName: TextBox
    StartDate: TextBox
    EndDate: TextBox
    Submit - Button
    Task Details
    Whenever User Click after fillup all data's... then SQL Query Check
    if StartDate or EndDate is exists in Between DataBase Date's.....
    Condition true means dont allow save.. else Save.....
    Examble:
    PollID PollName StartDate EndDate UserName
    01 Sample 23/09/2010 26/09/2010 Klit
    02 Sample 2 29/09/2010 30/09/2010 Jack
    Now User given follwing details and click Submit,
    User Name : James
    PollName: Test
    StartDate: 22/09/2010
    EndDate: 27/09/2010
    Submit - Button
    Here User StartDate: 22/09/2010 , EndDate: 27/09/2010
    SQL Query Check ,
    Condtion 1 : Those dates are avilable in Datebase???
    Result: Yes
    Because, Sample Poll date is 23/09/2010 to 26/09/2010, here Start Date is Not Exists, But End Date Exists.
    So dnt allow Save Operation....
    Now User Again given follwing details and click Submit,
    User Name : James
    PollName: Test
    StartDate: 27/09/2010
    EndDate: 28/09/2010
    Submit - Button
    Here User StartDate: 27/09/2010 , EndDate: 28/09/2010
    SQL Query Again Check ,
    Condtion 1 : Those dates are avilable in Datebase???
    Result: No
    Because, Sample Poll date is 23/09/2010 to 26/09/2010,
    Sample1 Poll Date is 29/09/2010 to 30/09/2010
    here Start Date is Not Exists, But End Date Not Exists.
    So Allow Save Operation....
    This a My Task....
    Could You give SQL Query for help to Check given condition??
    regd
    Riayz
    Edited by: Riyaz on Sep 30, 2010 1:08 AM

  • Looking for an SQL query to retreive callvariables + ECC from a RUN SCRIPT RESULT (Translation to VRU)

    Hi Team,
    I am looking for an SQL query to check the data (ECC + CallVariable) received following a RUN SCRIPT RESULT when requesting an external VRU with a Translation Route to VRU with a "Run External Script".
    I believe the data are parsed between the Termination Call Detail + Termination Call Variable .
    If you already have such an SQL query I would very much appreciate to have it.
    Thank you and Regards
    Nick

    Omar,
    with all due respect, shortening a one day's interval might not be an option for a historical report ;-)
    I would recommend to take a look the following SQL query:
    DECLARE @dateFrom DATETIME, @dateTo DATETIME
    SET @dateFrom = '2014-01-24 00:00:00'
    SET @dateTo   = '2014-01-25 00:00:00'
    SELECT
    tcv.DateTime,
    tcd.RecoveryKey,
    tcd.RouterCallKeyDay,
    tcd.RouterCallKey,
    ecv.EnterpriseName AS [ECVEnterpriseName],
    tcv.ArrayIndex,
    tcv.ECCValue
    FROM Termination_Call_Variable tcv
    JOIN
    (SELECT RouterCallKeyDay,RouterCallKey,RecoveryKey FROM Termination_Call_Detail WHERE DateTime > @dateFrom AND DateTime < @dateTo) tcd
    ON tcv.TCDRecoveryKey = tcd.RecoveryKey
    LEFT OUTER JOIN Expanded_Call_Variable ecv ON tcv.ExpandedCallVariableID = ecv.ExpandedCallVariableID
    WHERE tcv.DateTime > @dateFrom AND tcv.DateTime < @dateTo
    With variables, you can parametrize your code (for instance, you could write SET @dateFrom = ? and let the calling application fill in the datetime value in for you).
    Plus joining two large tables with all rows like you did (TCD-TCV) is never a good option.
    Another aspect to consider: all ECC's are actually arrays (always), so it's not good to leave out the index value (tcv.ArrayIndex).
    G.

  • Query to check cross segment postings

    Hi,
    I have a database with a segmented chart of accounts. It has only 1 segment for the company. The client would like to have the ability to post across segments however I need to ensure that the journal is always balanced overall, but aswell as with a specific segment.
    I would like to create a SQL query to check all my journal entries to determine weather the journal is balanced on all segments...
    Any ideas?
    Grant
    Edited by: Darius Heydarian on Mar 27, 2008 2:06 PM

    Hi Suda,
    I have a journal as follows:
    Account Code--Debit--
    Credit
    720002-002--2000--
    720002-003--1000--
    720001-001----
    3000
    201201-001--3000--
    201201-002----
    2000
    201201-003----
    1000
    In the above example you will notice that the journal is balanced, and the debits and credits between each segment is also balanced. This transaction is therefore acceptable.
    If the journal is balanced, but the debits and credits for a specific segment are not in balance then the transaction is not acceptable.
    I need a way to either block these type of journals or alternatively to provide a report to highlight the "incorrect" journals...
    Hope hope this makes my requirement a little clearer...
    Regards
    Grant
    Edited by: Grant Boshard on Mar 13, 2008 1:55 PM

  • [SQL QUERY] Select TCP Port Monitors and their related Watcher Node

    Hi everybody,
    I'm working on a SSRS report and SQL Query, I have no problem to find all my TCP Port Monitor (SCOM 2012 R2) based on the DisplayName, but I can't figure out how to get their related watcher nodes (in my case only 1 computer is a watcher node).
    I can't find which table, which field, contains this information..?
    Here is the query i started to write (i select * since i still searching for the right column):
    SELECT
    FROM StateView s
    INNER JOIN BaseManagedEntity me on me.BaseManagedEntityId=s.BaseManagedEntityId
    INNER JOIN MonitorView mv on mv.Id=s.MonitorId
    INNER JOIN ManagedTypeView mtv on mtv.Id=s.TargetManagedEntityType
    --where mv.DisplayName like 'Ping Target Status Check%'
    AND me.IsDeleted = '0'
    where mv.DisplayName like '%tcpmon%'
    and mv.LanguageCode = 'ENU'
    --and s.HealthState in (@state)
    ORDER BY s.Lastmodified DESC
    It would be great if someone can help me !
    Thanks,
    Julien

    Hi,
    After creating a TCP port monitor, we can find a table for this monitor under operationsmanager database :
    SELECT *
    FROM [OperationsManager].[dbo].[MT_TCPPortCheck_******WatcherComputersGroup]
    You will find the warcher computer group.
    Regards,
    Yan Li
    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 Subscriber Support, contact [email protected]

  • Check the hints used in SQL Query (Parallel, First_Rows)

    Hi,
    I have used above hints in my sql query and found no difference in execution time.
    I just want to know whether the hints are used in my sql are not.
    Could you please let me know where to check for it.
    Thanks in advance

    Can you post the SQL which uses these hints and the execution plan with and without those hints here? Then only community can help you find out if the hints are really used or not.
    Please use code tags to preserve the format of execution plan.
    Edited by: Satish Kandi on Jun 23, 2009 5:37 PM

  • How to check the sql:query is return null value

    I have use :
    <sql:query var="sql1" dataSource="${db}">
    select col_name from table_name
    where a=<c:out value="${row.test1}"/>
    and b='<c:out value="${row.test2}"/>'
    </sql:query>
    So, how can I check this statement return null value which is no record within this table?

    The Result should never be null but can be empty. You can check if the Result is empty using an if tag and checking the rowCount property:
        <sql:query var="books"
          sql="select * from PUBLIC.books where id = ?" >
          <sql:param value="${bookId}" />
        </sql:query>
         <c:if test="${books.rowCount > 0}">
         </c:if>http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSTL7.html#wp84217
    Look for query Tag Result Interface

  • Checking correct data format using sql query

    1) I got column date of joining which accepts date in below format
    DD-MON-YYYY
    DD-MON-YY
    MON-DD-YYYY
    MON-DD-YY
    Month DD,YYYY
    Question:- how do i check whether all dates in Date of joining column are in above format or not using sql query?
    2) I got one more date column which accepts date in below format
    MMDDYYYY
    YYYYMMDD
    MM/DD/YYYY
    MM/DD/YY
    YYYY/DD/MM
    Question:- how do i check whether all dates in date column are in above format or not using sql query?
    sorry if it is a very simple question since I am new to sql and trying to learn ......Thanks for the answers from the group............

    In short, NO, it's not possible.  If you store dates correctly in the database as DATE datatype then you don't have this problem.  If you store them as VARCHAR2 you have a problem.
    So, you get a date of 20092012
    Is that 20th September 2012?  or is it 20th December 2009?
    What about...
    11-Jan-12
    Is that 11th January 2012 or 12th January 2011?
    Dates should never be stored on the database as strings.  That is why Oracle gives you a DATE datatype so you can store them properly.
    Also, when dates are passed from an application to the database, the application should be passing them as DATE datatype, and the application interface should be designed to accept dates from the user in a format specific to their country/locality and it would then know what that format is and automatically convert it to a DATE datatype before it gets anywhere near the database or any SQL.

  • Check dynamic SQL Query

    Hi,
    i often use the feature SQL Query (PL/SQL Function Returning SQL Query).
    Sometimes there is an error in the query and zero rows are returned. It would be nice to see which SQL-Statement was used.
    I tried to copy the sql statment to an item on the page, but that doesn´t work.
    Example:
    DECLARE
    s VARCHAR2(32000);
    BEGIN
    s:='select * from emp where 1=1 ';
    IF :P15_1 <>'%null%' THEN
    s:=s||q'( AND ...' )';
    END IF;
    IF :P15_2 IS NOT NULL THEN
    s:=s||q'( AND ...' )';
    END IF;
    insert into msta_log (datum,aktion) values (sysdate,s);
    commit; -- This worked
    :MY_DEBUG:=s; -- Error Item not Found in Application 4000
    RETURN s;
    END;
    Are there other tricks available?
    Thanks
    marco

    Yes yor are right. I deleted <> before '%null%' sorry
    the javascript example did not work. i had to change a litlle bit, but it was a good idea, thanks a lot
    This worked for me:
    htp.p('<script type=text/javascript>alert("'||replace(s,chr(10),'')||'");</script>');
    Thanks
    marco

Maybe you are looking for