Sie sind auf Seite 1von 5

1) What is LOCK escalation

It is the process of converting Low Level Locks to higer Level Locks.Example of


LLL(Low Level locks) is row locks and HLL(Higher Level Locks) is table lock.Ever
y lock take too much of memory so too many locks take lot of memory to get rid o
f this SQL escalates the many fine-grain locks to fewer coarse-grain locks.

2) What are the different index configurations a table can have


(1)No indexes
(2)A clustered index
(3)A clustered index and many nonclustered indexes
(4)A nonclustered index
(5)Many nonclustered indexes
3) What is Network Packet Size in SQL
NPS(Network Packet Size) is the size of the TDS (tabular data stream) packets us
ed to communicate between your applications and your relational database engine
and default packet size is 4 kilobytes and its manily depends on network packet
size configuration option.

4) How many objects SQL Server contains


Here is the list of some of the more important database objects
database,The transaction log,Assemblies,Tables,Reports,Filegroups,Full-text cata
logs,Diagrams,User-defined data types,Views,Roles,Stored procedures,Users,User D
efined Functions

5) Difference between Triggers and Storedprocedures


Triggers are basically used to implement business rules.Triggers is also similar
to stored procedures.The difference is that it can be activated when data is ad
ded or edited or deleted from a table in a database.Triggers are special kind of
stored procedures that get executed automatically when an INSERT,UPDATE or DELE
TE operation takes place on a table.

6) What is Store Procedure


A stored procedure is a set of structured query language statements that you ass
ign a name and store it in to the database in a compiled form so that it can sha
re between no of programs.
Some advantage of Store Procedure.
they allow faster execution
they can reduce network traffic
7) What is SQL injection
SQL injection is a security vulnerability that occurs in the database layer of a
n application. The vulnerability is present when user input is either incorrectl
y filtered for string literal escape characters embedded in SQL statements or us
er input is not strongly typed and thereby unexpectedly executed. It is in fact
an instance of a more general class of vulnerabilities that can occur whenever o
ne programming or scripting language is embedded inside another.

8) What about the SQL SERVER 2008


SQL SERVER 2008 have some beautifull features over its previous version some of
these are as follows:-
(1)Its take less resources and better performance.
(2)Its contains Extended Events which are low level and high performance eventin
g system in SQL SERVER.
(3)New Extended Events are based on ETW(Event Tracing for Windows) which helps i
n SQL tracing to trace oPerating System,IIS and other ETW enabled applications.
(4)Event that are fire i
n SQL 2008 are very fast and fire themselves synchronously and not take too many
memory.
(5)One of the good feature is system_health Extended Events Session which is alw
ays on and report on any bad data in it.
(6)Currently 254 events defined in SQL Server 2008.

9) Some Tips when Optimizing Sql Server 2005 Query.


Here are some important tips regarding Sql server 2005 query.
1. Turn on the execution plan, and statistics
2. Use Clustered Indexes
3. Use Indexed Views
4. Use Covering Indexes
5. Keep your clustered index small.
6. Avoid cursors
7. Archive old data
8. Partition your data correctly
9. Remove user-defined inline scalar functions
10. Use APPLY
11. Use computed columns
12. Use the correct transaction isolation level

10) What is SQL whats its uses and its component


The Structured Query Language (SQL) is foundation for all relational database sy
stems. Most of the large-scale databases use the SQL to define all user and admi
nistrator interactions. QL is Non-Procedural language . Its allow the user to co
ncentrate on specifying what data is required rather than concentrating on the h
ow to get it.
The DML component of SQL comprises four basic statements:
* SELECT to get rows from tables
* UPDATE to update
the rows of tables
* DELETE to remove rows from tables
* INSERT to add new rows to tables

11) What is heap table in SQL SERVER


A table that doesnot contains cluster and non cluster index is heap table becaus
e there is no indexing there on to the table.

12) How many types of local tables in SQL SERVER


There are 2 types of temporary tables, local and global. Local temporary tables
are created using a single pound (#) sign and are visible to a single connection
and automatically dropped when that connection ends. Global temporary tables ar
e created using a double pound (##) sign and are visible across multiple connect
ions and users and are automatically dropped when all SQL sessions stop referenc
ing the global temporary table.

13) What is the diffrence between SQL and Pl Sql


We can get modify, Retrieve by single command or statement in SQL but PL/SQL pro
cess all SQL statements one at a time. With PL/SQL, an entire block of statement
s process in a single command line.sql is structured query language ,various que
ries are used to handle the database in a simplified manner. while pl/sql is pro
cedural language contains various types of variable,functions and procedures and
other major diffrence is Sql as the name suggest it is just
structured query language wheareas PLSQL is a commbination of Programming langua
ge & SQL.

14) What is the difference between UNION ALL Statement and UNION
The main difference between UNION ALL statement and UNION is UNION All statement
is much faster than UNION,the reason behind this is that because UNION ALL stat
ement does not look for duplicate rows, but on the other hand UNION statement do
es look for duplicate rows, whether or not they exist.

15) Write some disadvantage of Cursor


Cursor plays there row quite nicely but although there are some disadvantage of
Cursor . Because we know cursor doing roundtrip it will make network line busy a
nd also make time consuming methods. First of all select query gernate output an
d after that cursor goes one by one so roundtrip happen.Another disadvange of cu
rsor are ther are too costly because they require lot of resources and temporary
storage so network is quite busy.

16) What is Log Shipping and its purpose


In Log Shipping the transactional log file from one server is automatically upda
ted in backup database on the other server and in the case when one server fails
the other server will have the same DB and we can use this as the DDR(disaster
recovery) plan.

17) SQL Server runs on which TCP IP port and From where can you change the defau
lt port
SQL Server runs on port 1433 but we can also change it for better security and F
rom the network Utility TCP/IP properties -->Port number.both on client and the
server.

17) What is the use of DBCC commands


DBCC stands for database consistency checker. We use these commands to check the
consistency of the databases, i.e., maintenance, validation task and status che
cks.DBCC CHECKDB - Ensures that tables in the db and the indexes are correctly l
inked.and DBCC CHECKALLOC To check that all pages in a db are correctly allocate
d. DBCC SQLPERF - It gives report on current usage of transaction log in percent
age. DBCC CHECKFILEGROUP - Checks all tables file group for

18) When do you use SQL Profiler


SQL Profiler utility allows us to basically track Connections to the SQL Server
and also determine activities such as which SQL Scripts are running, failed jobs
etc.

19) Can you explain the role of each service


SQL SERVER - is for running the databases SQL AGENT - is for automation such as
Jobs, DB Maintenance, Backups DTC - Is for linking and connecting to other SQL S
ervers.

20) Can you explain what View is in SQL


View is just a virtual table nothing else which is based or we can say devlop wi
th SQL SELECT query.So we can say that its a real database table (it has columns
and rows just like a regular table),but one difference is that real tables stor
e data,but views can?t. View data is generated dynamically when the view is refe
renced.And view can also references one or more existing database tables or othe
r views. We can say that it is filter of database

21) How to get which Process is Blocked in SQL SERVER


There are two ways to get this sp_who and sp_who2 . You cannot get any detail ab
out the sp_who2 but its provide more information then the sp_who . And other opt
ion from which we can find which process is blocked by other process is by using
Enterprise Manager or Management Studio, these two commands work much faster an
d more efficiently than these GUI-based front-ends.

22) Define basic functions for master and msdb and tempdb databases in Sql Serve
r

(1)master:-It contains system level information for a SQL Server system and als
o contains login accounts and all system configuration settings. master is the d
atabase that records the existence of all other databases, including the locatio
n of the database files.
(2) tempdb - This database holds all temporary tables and temporary stored proce
dures. It also fills any other temporary storage needs such as work tables gener
ated by SQ
L Server. tempdb is re-created every time SQL Server is started so the system st
arts with a clean copy of the database.
(3)model - The model database is used as the template for all databases created
on a system. When a CREATE DATABASE statement is issued, the first part of the d
atabase is created by copying in the contents of the model database, then the re
mainder of the new database is filled with empty pages. Because tempdb is create
d every time SQL Server is started, the model database must always exist on a SQ
L Server system.
(4)msdb - The msdb database is used by SQL Server Agent for scheduling alerts an
d jobs, and recording operators.

23) What is Cursor


Cursor is a database object used by applications to manipulate data in a set on
a row-by-row basis, instead of the typical SQL commands that operate on all the
rows in the set at one time. For example, you can use cursor to include a list o
f all user databases and make multiple operations against each database by passi
ng each database name as a variable

What is a constraint?
Constraints in Microsoft SQL Server 2000/2005 allow us to define the ways in whi
ch we can automatically enforce the integrity of a database. Constraints define
rules regarding permissible values allowed in columns and are the standard mecha
nism for enforcing integrity. Using constraints is preferred to using triggers,
stored procedures, rules, and defaults, as a method of implementing data integri
ty rules. The query optimizer also uses constraint definitions to build high-per
formance query execution plans.

What command would you use to create an index?


CREAT INDEX INDEXNAME ON TABLE(COLUMN NAME)

Das könnte Ihnen auch gefallen