Software Development,SQL Tips, Information Technology Technical tutorials,SQL tips-Tricks for error resolution version 2014,2012,2008,2005,Procedural language,Stored Procedure, computer , excel macro programming,Film,Musical notations,Indian ,Western Music.

September 30, 2014

What is the Difference b/w SP_WHO n SP_WHO2 in SQL

1.SP_who2 shows one extra column that is RAM utilization than SP_WHO.

2.SP_who2 has these extra columns 
a. CPU Time
b. Disk IO
c. Last Batch
d. Program Name , apart from that SP_who is documented and Sp_who2 is not documented in BOL.

August 24, 2014

What is Covering Index in SQL

A covering index is a non-clustered index which includes all columns referenced in the query and therefore, the optimizer does not have to perform an additional look-up to the table in order to retrieve the data requested. As the data requested is all indexed by the covering index, it is a faster operation.

covering index is a non-clustered index which stores additional columns at leaf level to avoid bookmark lookup to heap/clustered index.this is typically created using INCLUDE clause.

Let say we have a table tab1 and we have columns starts from column 1 to 10. and we have clustered index on column1 and non clustered index on column 2 . for example you written a query select * from tab1 where column 2=200. this query first will go and look for the matching data in non clustered index and because of our query want to retrieve all the columns it will perform key look up , not helathy. this time i had one more non clustered index on column3 and column4 , this case our query select column3,column4 from tab1 where column3 =200 no need to check in clustered index and table it can retrieve the data from non clustered index(in this case covering) index.

August 20, 2014

Port in sql server

SQL server assign default port 1433 to default instance...for named instance it dynamically allots a port number, ideally it is five digit port number.

To see port of SQL Server you can check as below.

Go to configuration manager-->SQL Serve network Configuration-> Select instance-->right click TCP/IP properties-->IP Properties

August 12, 2014

Dedicated admin account in SQL

Dac means dedicared admin account, which is used to access sql server at .by default 1433 is sql server port , 1434 ia dac account.

Starting the server in single user mode will use DAC (Dedicated Administrative Connection) connection. DAC Connection will use

If the number of connections are limited for the instance and all are connected and if some one wants to connect and fails to troubleshoot if DBA want to connect he will also be restricted then he can use DAC connection to connect to the instance.

When ever the SQL Server standard connection not establish the connection then we go with DAC connection . only sys admin can use this DAC to connect the server and troubleshoot the problems.

August 11, 2014

Interview questions for sql DBA

1.What are Differences in Delete & Truncate .
2.What are Differences in UNIQUE and Primary key ?
3. What are the agents involved in replication
4.Which Types of clusters and how many ips are required to install failover cluster?
5.Configuration of logshipping and DB mirroring.
5.What are Types of backups and backup scenario?
6.What is deadlock and blocking?
7.Differences between clustered and non clustered indexes?
8.Why SQL Server Agent is used?
9.What are Types of System databases
10.What are the steps for restoring a database?

August 10, 2014

what is linked server in sql server?

Linked server means to retrieve the data from the other server to connect our own instance, before configure the linked server we must know the target server login and password then only we access the data from the other server.

Linked server means access the data from one server another server is called linked server. store procedure is sp_addlinkedserver.

When we have to run the distributed transactions we need to linkup the servers internally we use linked servers concept.Here distributed transactions means A query which has to executed on multiple servers at a time is called distributed transactions.

Checkpoint and lazywrite in SQL

Checkpoint : Write all the dirty pages into buffer cache. It is not clear from buffer cache is called checkpoint.check point is the internal process which will take dirty blocks from buffer pool to data file on interval based.
Lazywriter: Write all the dirty pages into buffer cache. It is clear from buffer cache is called lazywriter

Checkpoint and lazywrite do the same job of flushing out the (8k size) pages from the memory to disk the only difference is of when they do this task.

A lazy write does its task when there is resource contention and sql engine needs to process more pages and bring them in the memory. The lazy writer in this case gets all the pages which have been residing in the memory for the longest time and flushes them to the disk.

A checkpoint on the other hand does the task for the SQL engine to create a stable point from which SQL can recover in case there is a failure of service during some processing. A checkpoint is not issued due to lack of resources.

Please note that in both cases the pages flushed or written to the disk are still marked dirty. So in case sql service fails after a lazy write or a checkpoint, after starting again the SQL will know which flushed pages were marked dirty and those\ changes would be rolled back.

August 4, 2014

Grant Revoke privilege in SQL

Grant/Revoke are the keywords which uses to grant/revoke privileges on an object to/from a user/group.

Grant is a keyword you use when you want to authorize/authenticate. a principal and Revoke is the Keyword used when you want to take back the Authorization/authentication from the Principal.
Principal refers to Lo-gin at instance level.Database user at Database level.

Grant,revoke,deny,with grant are object level security.Grant means giving permission on a particular object to user.Command: grant privilege on object name to username.

Revoke means taking back the permission. Command: revoke privilege on object name from username.

Deny means restrict user not to do something command: deny privilege on object name to username.

With grant means by using grant user can give grant permission to other user command: grant privilege on object name to user with grant.

July 28, 2014

Clustered index and non clustered index in SQL

Clustered index which reordered the table and saved separately as index table(data pages stored as B-tree) there can be one clustered index per db & Non clustered index is typically a index(data pages stored as heap)

A table can have only one clustered index with many non clustered indexes.

The leaf nodes of the cluster index stores data pages and non clustered index stores key values(where as table includes clustered index) or rid's(table contains non cluster index only).

July 22, 2014

Advantage and disadvantage of Team Viewer , Ammy Admin and show my PC etc

Advantage of Team Viewer , Ammy Admin and show my PC etc

You can share your desktop to other user or pc to take live support help from your friend or colleague. You can also help to other friends also.

If you want to use limited hours in a month use of Team Viewer , Ammy Admin and show my PC then you can use trial version but if you want to use lot of time in a single month then you need to buy license. You can buy license online.

Disadvantage of Team Viewer , Ammy Admin and show my PC

Mostly these type of connections registers all clicks and keypress, that means they can know about all your logins and passwords and you PC could be hacked or misused(Its possibility but mostly they do not do it).