{"id":2026,"date":"2013-05-02T20:49:01","date_gmt":"2013-05-02T12:49:01","guid":{"rendered":"http:\/\/rmohan.com\/?p=2026"},"modified":"2013-05-02T20:54:33","modified_gmt":"2013-05-02T12:54:33","slug":"tcp-ip-port-in-sql-server-2012","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=2026","title":{"rendered":"TCP IP Port in SQL Server 2012 and Firewall"},"content":{"rendered":"<p>TCP IP Port in SQL Server 2012<\/p>\n<p>As an SQL Server Administrator you might need to find SQL Server TCP IP port configured for your SQL Server Instance. There are many <span class=\"GINGER_SOFATWARE_correct\">reason<\/span> to find it but most famous reasons is to give access to developer and set <span class=\"GINGER_SOFATWARE_correct\">firewall exception<\/span> if there is any. Generally 1433 is the default port but you may configure different ports if you have more than once SQL Server instance running or may be due\u00a0 to security reason you would like to change the default port of SQL Server.<\/p>\n<p>There are few different ways to find the SQL Server 2012 TCP\/IP port\u00a0 out of which I am going to mention <span class=\"GINGER_SOFATWARE_correct\">few<\/span> of the most used ways to reach TCP\/IP port of SQL Server 2012.<\/p>\n<p>1.)\u00a0 Read TCP IP Port of SQL Server 2012 from <span class=\"GINGER_SOFATWARE_correct\">Registry<\/span>:<\/p>\n<p>This is one of the most used ways. Either go to <span class=\"GINGER_SOFATWARE_correct\">registry<\/span> to find <span class=\"GINGER_SOFATWARE_correct\">TCP IP port<\/span> or execute extended stored procedure in SQL Server itself to read <span class=\"GINGER_SOFATWARE_correct\">registry<\/span>.<\/p>\n<p>&nbsp;<\/p>\n<p>DECLARE @tcp_port <span class=\"GINGER_SOFATWARE_noSuggestion GINGER_SOFATWARE_correct\">nvarchar<\/span><span class=\"GINGER_SOFATWARE_correct\">(<\/span>10)<br \/>EXEC XP_REGREAD<br \/>@rootkey = &#8216;HKEY_LOCAL_MACHINE&#8217;,<br \/>@key = &#8216;SOFTWARE\\MICROSOFT\\Microsoft SQL Server\\MSSQL11.SQL2K12DEV\\MSSQLServer\\SUPERSOCKETNETLIB\\TCP\\IPAll&#8217;,<br \/>@value_name = &#8216;TcpPort&#8217;,<br \/>@value = @tcp_port OUTPUT<br \/>SELECT @tcp_port AS TCPIP_Port<br \/>GO<\/p>\n<p>Read TCP IP Port From SQL Server 2012 Configuration Manager.<\/p>\n<p>Open \u201cSQL Server Configuration Manager\u201d from Start Menu-&gt; All Programs -&gt; Microsoft SQL Server 2012 -&gt; Configuration Tools -&gt; SQL Server Configuration Manager. Refer following screen shot for more details:<\/p>\n<p>\u00a0<a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2013\/05\/1SQLServerConfigurationManager.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2027\" alt=\"1SQLServerConfigurationManager\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2013\/05\/1SQLServerConfigurationManager.png\" width=\"403\" height=\"464\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2013\/05\/1SQLServerConfigurationManager.png 403w, https:\/\/mohan.sg\/wp-content\/uploads\/2013\/05\/1SQLServerConfigurationManager-260x300.png 260w, https:\/\/mohan.sg\/wp-content\/uploads\/2013\/05\/1SQLServerConfigurationManager-130x150.png 130w, https:\/\/mohan.sg\/wp-content\/uploads\/2013\/05\/1SQLServerConfigurationManager-400x460.png 400w\" sizes=\"(max-width: 403px) 100vw, 403px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Now move towards \u201cSQL Server Network Configuration\u201d-&gt; Protocol for \u201cSQLServerInstance\u201d-&gt;TCP\/IP property.<\/p>\n<p>\u00a0<a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2013\/05\/2SQLServerConfigurationManagerTCPIPProperty.png\"><br \/><\/a><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2013\/05\/2SQLServerConfigurationManagerTCPIPProperty1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2030\" alt=\"2SQLServerConfigurationManagerTCPIPProperty\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2013\/05\/2SQLServerConfigurationManagerTCPIPProperty1.png\" width=\"612\" height=\"296\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2013\/05\/2SQLServerConfigurationManagerTCPIPProperty1.png 612w, https:\/\/mohan.sg\/wp-content\/uploads\/2013\/05\/2SQLServerConfigurationManagerTCPIPProperty1-300x145.png 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2013\/05\/2SQLServerConfigurationManagerTCPIPProperty1-150x72.png 150w, https:\/\/mohan.sg\/wp-content\/uploads\/2013\/05\/2SQLServerConfigurationManagerTCPIPProperty1-400x193.png 400w\" sizes=\"(max-width: 612px) 100vw, 612px\" \/><\/a> <a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2013\/05\/3TCPIPPropertyPage.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2029\" alt=\"3TCPIPPropertyPage\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2013\/05\/3TCPIPPropertyPage.png\" width=\"416\" height=\"475\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2013\/05\/3TCPIPPropertyPage.png 416w, https:\/\/mohan.sg\/wp-content\/uploads\/2013\/05\/3TCPIPPropertyPage-262x300.png 262w, https:\/\/mohan.sg\/wp-content\/uploads\/2013\/05\/3TCPIPPropertyPage-131x150.png 131w, https:\/\/mohan.sg\/wp-content\/uploads\/2013\/05\/3TCPIPPropertyPage-400x456.png 400w\" sizes=\"(max-width: 416px) 100vw, 416px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<div><a title=\"Collapse\">Using SQL Server Configuration Manager<\/a><\/p>\n<div>\n<hr \/>\n<\/div>\n<\/div>\n<div><a id=\"sectionToggle1\"><\/a><\/p>\n<h3>To assign a TCP\/IP port number to the SQL Server Database Engine<\/h3>\n<div>\n<ol>\n<li>\n<p>In SQL Server Configuration Manager, in the console pane, expand\u00a0SQL Server Network Configuration, expand\u00a0Protocols for &lt;instance name&gt;, and then double-click\u00a0TCP\/IP.<\/p>\n<\/li>\n<li>\n<p>In the\u00a0TCP\/IP Properties\u00a0dialog box, on the\u00a0IP Addresses\u00a0tab, several IP addresses appear in the format\u00a0IP1,\u00a0IP2, up to\u00a0IPAll. One of these is for the IP address of the loopback adapter, 127.0.0.1. Additional IP addresses appear for each IP Address on the computer. Right-click each address, and then click\u00a0Properties\u00a0to identify the IP address that you want to configure.<\/p>\n<\/li>\n<li>\n<p>If the\u00a0TCP Dynamic Ports\u00a0dialog box contains\u00a00, indicating the Database Engine is listening on dynamic ports, delete the 0.<\/p>\n<\/li>\n<li>\n<p>In the\u00a0IP<em>n<\/em>\u00a0Properties\u00a0area box, in the\u00a0TCP Port\u00a0box, type the port number you want this IP address to listen on, and then click\u00a0OK.<\/p>\n<\/li>\n<li>\n<p>In the console pane, click\u00a0SQL Server Services.<\/p>\n<\/li>\n<li>\n<p>In the details pane, right-click\u00a0SQL Server (&lt;instance name&gt;)\u00a0and then click\u00a0Restart, to stop and restart SQL Server.<\/p>\n<\/li>\n<\/ol>\n<p>After you have configured SQL Server to listen on a specific port, there are three ways to connect to a specific port with a client application:<\/p>\n<ul>\n<li>\n<p>Run the SQL Server Browser service on the server to connect to the Database Engine instance by name.<\/p>\n<\/li>\n<li>\n<p>Create an alias on the client, specifying the port number.<\/p>\n<\/li>\n<li>\n<p>Program the client to connect using a custom connection string.<\/p>\n<\/li>\n<\/ul>\n<p><span style=\"font-size: x-large;\"><strong>Firewall<\/strong><\/span><\/p>\n<p>\u00a0To open a port in the Windows firewall for TCP access<\/p>\n<div>\n<ol>\n<li>\n<p>On the\u00a0<strong>Start<\/strong>\u00a0menu, click\u00a0Run, type\u00a0WF.msc, and then click\u00a0OK.<\/p>\n<\/li>\n<li>\n<p>In the\u00a0Windows Firewall with Advanced Security, in the left pane, right-click\u00a0Inbound Rules, and then click\u00a0New Rule\u00a0in the action pane.<\/p>\n<\/li>\n<li>\n<p>In the\u00a0Rule Type\u00a0dialog box, select\u00a0Port, and then click\u00a0Next.<\/p>\n<\/li>\n<li>\n<p>In the\u00a0Protocol and Ports\u00a0dialog box, select\u00a0TCP. Select\u00a0Specific local ports, and then type the port number of the instance of the Database Engine, such as\u00a01433\u00a0for the default instance. Click\u00a0Next.<\/p>\n<\/li>\n<li>\n<p>In the\u00a0Action\u00a0dialog box, select\u00a0Allow the connection, and then click\u00a0Next.<\/p>\n<\/li>\n<li>\n<p>In the\u00a0Profile\u00a0dialog box, select any profiles that describe the computer connection environment when you want to connect to the Database Engine, and then click\u00a0Next.<\/p>\n<\/li>\n<li>\n<p>In the\u00a0Name\u00a0dialog box, type a name and description for this rule, and then click\u00a0Finish.<\/p>\n<\/li>\n<\/ol>\n<\/div>\n<h3>To open access to SQL Server when using dynamic ports<\/h3>\n<div>\n<ol>\n<li>\n<p>On the\u00a0<strong>Start<\/strong>\u00a0menu, click\u00a0Run, type\u00a0WF.msc, and then click\u00a0OK.<\/p>\n<\/li>\n<li>\n<p>In the\u00a0Windows Firewall with Advanced Security, in the left pane, right-click\u00a0Inbound Rules, and then click\u00a0New Rule\u00a0in the action pane.<\/p>\n<\/li>\n<li>\n<p>In the\u00a0Rule Type\u00a0dialog box, select\u00a0Program, and then click\u00a0Next.<\/p>\n<\/li>\n<li>\n<p>In the\u00a0Program\u00a0dialog box, select\u00a0This program path. Click\u00a0Browse, and navigate to the instance of SQL Server that you want to access through the firewall, and then click\u00a0Open. By default,\u00a0SQL Server is at\u00a0C:\\Program Files\\Microsoft SQL Server\\MSSQL11.MSSQLSERVER\\MSSQL\\Binn\\Sqlservr.exe. Click\u00a0Next.<\/p>\n<\/li>\n<li>\n<p>In the\u00a0Action\u00a0dialog box, select\u00a0Allow the connection, and then click\u00a0Next.<\/p>\n<\/li>\n<li>\n<p>In the\u00a0Profile\u00a0dialog box, select any profiles that describe the computer connection environment when you want to connect to the Database Engine, and then click\u00a0Next.<\/p>\n<\/li>\n<li>\n<p>In the\u00a0Name\u00a0dialog box, type a name and description for this rule, and then click\u00a0Finish.<\/p>\n<\/li>\n<\/ol>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>TCP IP Port in SQL Server 2012<\/p>\n<p>As an SQL Server Administrator you might need to find SQL Server TCP IP port configured for your SQL Server Instance. There are many reason to find it but most famous reasons is to give access to developer and set firewall exception if there is any. Generally 1433 [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[44],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/2026"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2026"}],"version-history":[{"count":7,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/2026\/revisions"}],"predecessor-version":[{"id":2038,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/2026\/revisions\/2038"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2026"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2026"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2026"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}