Friday, December 5, 2014

Useful command for DBA

                                Command useful for MSSQL DBA :-
1) Ping :-
help in determining TCP/IP Networks IP address as well as determine issues with the network and assists in resolving them.
2) Telnet :-
The telnet commands allow you to communicate with a remote computer that is using the Telnet protocol. You can run telnet without parameters in order to enter the telnet context, indicated by the Telnet prompt (telnet>). From the Telnet prompt, use the following commands to manage a computer running Telnet Client.
         Example:- Telnet 192.168.10.24 1433  => check port is open in network

3)Tracert :-
     The TRACERT diagnostic utility determines the route taken to a destination by sending Internet Control Message Protocol (ICMP) echo packets with varying IP Time-To-Live (TTL) values to the destination. Each router along the path is required to decrement the TTL on a packet by at least 1 before forwarding it, so the TTL is effectively a hop count. When the TTL on a packet reaches 0, the router should send an ICMP Time Exceeded message back to the source computer. 
         Example :- Tracert  10.168.10.24 


 
4)Nltest:-
NLTest can test and reset the secure channel established by the NetLogon service. This secure channel is established between clients and the domain controller that logs them on. NLTest does not work for clients using Kerberos for authentication since this secure channel is not used with Kerberos.

To check mostly in Cluster environment.

C:\Windows\system32>nltest /sc_query:company.local
Flags: 30 HAS_IP  HAS_TIMESERV
Trusted DC Name \\DC01.domain.local
Trusted DC Connection Status Status = 0 0x0 NERR_Success
The command completed successfully

5)NET :-
You can start/stop SQL Server services using Services Console or SQL Server Configuration Manager. You can also perform these operation using command line in Windows. For this you must run command prompt with Administrative privileges.
To START SQL Server Service, use:
NET start MSSQLSERVER
To STOP SQL Server Service, use:
NET stop MSSQLSERVER
6) SC:-
To START SQL Server Service, use:
SC start MSSQLSERVER
To START SQL Server Service with parameters, use:
SC start MSSQLSERVER -m

7) Netstat :-
 Netstat command to quickly see all the used and listening ports on your computer. Note it is not a complete substitute for a port scanning tool. 
Example:- netstat -a | find "LISTENING"
You check port 1433 is listing which mark by red line.
8) IPconfig:-
Displays all current TCP/IP network configuration values and refreshes Dynamic Host Configuration Protocol (DHCP) and Domain Name System (DNS) settings. Used without parameters, ipconfig displays the IP address, subnet mask, and default gateway for all adapters.
9)Path :-
Displays or sets a search path for executable files.