SQL Dba Interview Questions
SQL Dba Interview Questions
N SUBBA REDDY
Daily Activities
a) VERIFY ALL INSTANCES ARE UP
b) VERIFY DBSNMP IS RUNNING -DB simple n/w mail protocol
c) Check OS Event Logs, SQL Server Logs, and Security Logs for unusual events
d) VERIFY SUCCESS OF DATABASE BACKUP
e) VERIFY SUCCESS OF DATABASE ARCHIVING TO TAPE
f) Verify that all scheduled jobs and alerts have run successfully.
g) Periodically monitor performance using both System Monitor and Profiler.
h) Monitoring and identify blocking issues using Enterprise Manager/Management Studio
i) Monitoring Connectivity Issues and Memory Issues
j) Monitoring Log Shipping & Mirroring
k) Managing Logins, Users and Security
Can you explain the environments you have worked in related to the following items?
a. SQL Server versions: 2005 and 2008.
b. SQL Server technologies: Relational engine/Database Engine.
c. Number of SQL Servers :80 servers(5 Test Servers+10Development servers+Remaining
Production servers)
d. Number of instances: Avg 3 Instances for each server.
e. Number of databases :Avg 5 to 6 databases for each database’s
f. Range of size of databases: 30GB to 500GB.
g. Number of DBAs :6
h. Number of Developers :10
i. Hardware specs (CPU’s=For each server 4CPUs, memory=Intel Quad core processors(32GB
RAM), 64 bit, SANs=2TB)
Note: 1GB Backup will take 6secs with 32GB RAM
Project: Working on the software application called RS-Unify based on SQL Server.
It is an automation package, which is developed to automate the core business activities.
It is a multi-user package through which each and every HLL client can interact with main server to upload the
data needed for business transactions.
Client while interacting with server sends and receives the data, which is present in the database.
Citrix online server is used to connect client system remotely
The main purpose of the project was to Install & Implement RSUnify
system maintenance and Troubleshooting the Software and guidance
What is your experience with third party applications and why would you use them?
Experience Why
Backup tools Need to improve upon the functionality that SQL Server
offers natively
Performance tools Save time, save money, better information or notification.
Code or data synchronization
Disaster recovery\high availability
Third Party Tools to compress database:
Lite speed->Object level recovery----www.quest,.com BMC Remedy
TSM Tivoli www.redgate.com(Backupro)
Semantic Backup www.idera.com
System Requirements
* O/S : Windows 2000 server with sp4
: Windows 2003 server with sp2
: Windows 2008 sever
* RAM : >1GB
* CPU : >1GHz Processors:Pentium3 or higher
* HDD : 2684 MB
: 611 MB for database engine(493+118)
* SQL Native Client
* .Net Framework 3.5 with sp1
* Windows Services: WMI (Windows Management Instrumentation)
*DTC (Distributed Transaction Coordinator) * RPC (Remote Procedure Call)
* IE : 6 SP1 or a later version
I have 30GB Ram, How can we configure for production environment? Ans: Depends SLA
Questions are collected by K.V.N SUBBA REDDY
Upgrade Strategies: In-place upgrade: Using the SQL Server 2012 Setup program to directly upgrade an
instance of
SQL Server 2005, 2008, or 2008 R2. The older instance of SQL Server is replaced.
we don't have to worry about users and logins
sqlserver agent jobs will be upgraded during the upgrade process
The setup program takes the server offline by stopping the existing sqlserver services.
sqlserver 2005 enterprise,developer,standard,workgroup editions can be upgraded to diff. editions of
sqlserver 2008
sqlserver 2005 express editions can be upgraded to the express edition of sqlserver 2008
Side-by-side upgrade: Using steps to move all or some data from an instance of SQL Server 2005, 2008, or
2008 R2 to a separate instance of SQL Server 2012. There are two main variations of the side-by-side upgrade
strategy:
One server: The new instance exists on the same server as the target instance.
Two servers: The new instance exists on a different server than the target instance.
Advantages: Ability to run sqlserver side by side for testing and verification
rollback strategy as original server is still intact
best for large databases
Dis-advantages: Additional hardware may be required for instance upgrade or additional physical server.
does not preserver the sqlserver 2005 functionality
issue of instance name for connecting applications
Upgrade Advisor: To help you identify any possible problems before starting the upgrade process. SQL Server
2005 Upgrade Advisor scans the existing SQL Server 7 and SQL Server 2000 instances provided. The Advisor
checks for any potential compatibility issues, deprecated functionalities, and feature and behaviour changes, and
provides you with a recommended list of tasks that need to be done before and after the upgrade.
One of a user is unable to connect to SQL Server. What may be scenarios and how to troubleshoot it?
Possible Scenarios
1) Error: 26: SQL Browser Firewall No connectivity between client and server
2) Error: 28: Instance TCP/IP was disabled
3) Error: 40: Instance service is not running
4) Error: 18456 Login failed. (invalid login or pwd )
5) Expired Timeout: N/W issue, Server is busy, In server max sessions are open ,No available session
memory
6) Connection Forcibly Closed: Update the client computer to the server version of the Sql Server Native
Client.
7) In single user mode if any other service is connected with the db Engine, it doesn't allow connections.
My SQL Server service is not started. What may be the possible scenarios?
Possible Scenarios
1) Logon Failure: Problem with service account.
2) 3417: Files are not present in the respective path or there are no permissions on target folder where
the files are not present.
3) 17113: Master files are moved to different location, but not mentioned in startup parameters.
4) Service cannot be started in timely fashion: Insufficient resources, try to stop some other instances and
start again.
To find error: Using windows event log ( start --> run --> eventvwr->select System -> check for the errors
Using SQL Server ErrorLog file
Instance: It is a copy of sql-server which runs in a system either with same version or different version.
Questions are collected by K.V.N SUBBA REDDY
Default instance: it is a copy of sql-server which is created with the same name of the system name.A system
can contain only one default instance. The services of the default instance will be displayed as service name
(MSSQLSERVER)
NAMED INSTANCE: It is a copy of sql-server which is created by a user provided name.
A system can contain upto a maximum of 49/50 number of named instances.
The services of the named instance is displayed as service name(instance name)
We can have 49 named instances per machine.
Advantages of instances:
Allows to maintain multiple copies.
Allows to separate the environments(dev/testing/production).
Allows to differentiate the user permissions across the instances.
Directory structure:
For every instance installed a separate folder will be created.<drive>:\programm files \microsoft
sqlserver\mssql.n\mssql
Instance aware services: These services are installed once for each instance.
The following are the instance aware services.
i) Sqlserver service (database engine). (ii) Sqlserver reporting service. (iii) Sqlserver analysis service.
(iv) Sqlserver agent service. (v) Sqlserver full text search service.
The instance aware services are displayed with the format of service name (instance name).
Instance un-aware services: These services are installed only once for all the instances.
Some are sql-server services and some are windows services.
The instance un-aware services are displayed in the format of service name.
The following are the list of instance -unaware services.
(i) Sqlserver integration service. (ii) Sqlserver browser service.
(iii) Sqlserver vss writer (windows service). (iv) Sqlserver active directory helper (windows service).
RDBMS:
DBMS is a set of software that is used to manage and maintain Relational data effectively
RDBMS is more secure than DBMS
In RDBMS store and retrieve large amount of Data
RDBMS stores the data in tabular form. (Means table in rows & columns)
RDBMS supports client/server architecture.
RDBMS follows normalization. Allows simultaneous access of users to data tables.
RDBMS imposes integrity constraints. ACID properties of the database are defined in the integrity constraints.
It has additional condition for supporting tabular structure or data that enforces relationships among tables.
Different Types of RDBMS: 1.SQL Server 2.Oracle 3.DB2 4.Sybase 5.Informix
What is normalization?
In relational database design, the process of organizing data to minimize redundancy.
Different normalization forms:
1NF: Eliminate Repeating Groups
2NF: Eliminate Redundant Data
3NF: Eliminate Columns Not Dependent On Key
BCNF: Boyce-Codd Normal Form : If there are non-trivial dependencies between candidate key attributes,
separate them out into distinct tables.
4NF: Isolate Independent Multiple Relationships
5NF: Isolate Semantically Related Multiple Relationships
ONF: Optimal Normal Form: A model limited to only simple (elemental) facts, as expressed in Object Role Model
notation.
DKNF: Domain-Key Normal Form A model free from all modification anomalies.
COLLATION: Collation refers to a set of rules that determine how data is sorted and compared
CS -> CASE SENSITIVE AS -> ACCENT SENSTITIVE KS->Kana Sensitivity
CI -> CASE INSENSITIVE AI -> ACCENT INSENSITIVE WS-> Width sensitivity
When the procedure is modified, all clients automatically get the new version.
Stored procedures can be used to help ensure the integrity of the database.e.g. sp_helpdb,
sp_renamedb, sp_depends etc.
What is Trigger?
A trigger is a SQL procedure that initiates an action when an event (INSERT, DELETE or UPDATE)
occurs.
Triggers are stored in and managed by the DBMS.
Triggers are used to maintain the referential integrity of data by changing the data in a systematic
fashion.
A trigger cannot be called or executed; the DBMS automatically fires the trigger as a result of a data
modification to the associated table.
Triggers can be viewed as similar to stored procedures in that both consist of procedural logic that is
stored at the database level.
Stored procedures, however, are not event-drive and are not attached to a specific table as triggers
are.Stored procedures are explicitly executed by invoking a CALL to the procedure while triggers are
implicitly executed. In addition, triggers can also execute stored procedures.
Types of triggers: 1.DML Triggers (Instead of Trigger and After trigger) 2. DDL Triggers 3.Logon
Triggers
After Triggers:- After Triggers will fires after the data is inserted into the table. The typical use for an After
trigger is to log the action to an Audit or logging table
Before Triggers:- Before triggers will fire before the data is inserted into the table.
Note:- DML triggers fires before or after issue, DDL triggers fires after the issue
Nested Trigger: A trigger can also contain INSERT, UPDATE and DELETE logic within itself, so when the
trigger is fired because of data modification it can also cause another data modification, thereby firing another
trigger. A trigger that contains data modification logic within itself is called a nested trigger.
What is Index?
Questions are collected by K.V.N SUBBA REDDY
An index is a physical structure containing pointers to the data.
Indices are created in an existing table to locate rows more quickly and efficiently.
The users cannot see the indexes; they are just used to speed up queries.
Effective indexes are one of the best ways to improve performance in a database application.
Indexes need disk space, the more indexes you have, more disk space is used.
Indexes - where you cannot create them? Indexes cannot created in LOB (Large Object data), in the columns
with data types like: text, ntext, varchar (max), nvarchar (max), varbinary (max), xml, image.
What is Heap table? A table without a clustered index is called as heap table.
What is B-Tree? The database server uses a B-tree structure to organize index information. B-Tree generally
has following types of index pages or nodes:
• Root node: A root node contains node pointers to branch nodes which can be only one.
• Branch nodes: A branch node contains pointers to leaf nodes or other branch nodes which can be two
or more.
• Leaf nodes: A leaf node contains index items and horizontal pointers to other leaf nodes which can be
many.
What is the diff between re-building and re-organize? When your use.
Re-building Re-Organize
1. Complete index is dropped and recreated. Here 1. Just index pages are placed in order of index
you can specify FillFactor. key column volume. Here you can not specify Fill
Factor
2.Fragmentaion >30% or if scan density < 75% 2. .Fragmentaion >5% &<30% or if scan density
> 75% &<95%
3.Statistics are updated 3.Not Updated
4.Take Long time 4.Take less time
5.Table is block if the option “online processing of 5.Allows
DML…” is not enabled
Questions are collected by K.V.N SUBBA REDDY
Re-building Re-Organize
6.Use Tempdb space 6.Min.space
7.Alter index indexname/All on <tname> rebuild 7.Alter index indexname/All on <tname>
reorganize
8. It is offline operation 8. It is online operation
9.Option is available in all SQL Server 2005 edition 9.Option is available in SS 2005 EE and DE
What is cursor?
Cursor is a database object used by applications to manipulate data in a set on a row-by-row basis.
Types of cursors: 1. Static, 2. Dynamic, 3. Forward only, 4. Key set-driven.
In order to work with a cursor we need to perform some steps in the following order:
1. Declare cursor 2.Open cursor 3.Fetch row from the cursor 4.Process fetched row 5.Close cursor
6.Deallocate cursor
Disadvantages of cursors: Each time you fetch a row from the cursor, it results in a network round-trip, where
as a normal SELECT query makes only one round-trip, however large the result set is.
Cursors are also costly because they require more resources and temporary storage
Further, there are restrictions on the SELECT statements that can be used with some types of cursors.
What techniques are used to retrieve data from more than one table in a single SQL statement?
Joins, unions and nested selects are used to retrieve data.
What is the query used to display all tables names in SQL Server (Query analyzer)?
select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_TYPE = 'BASE TABLE'
To get the list of User Defined table names: Select * from sysobjects where type = 'u'
To get the list of system Defined table names: Select * from sysobjects where type =‘s’
What is the Syntax used for find the SQL Server version?
1) Select @@version
2) Click on Server > Summary Reports > Server Dashboard > configuration details > See product version.
OLAP: Online analytical processing performs analysis of business data and provides the ability to perform
complex calculations on usually low volumes of data. OLAP helps the user gain an insight on the data coming
from different sources (multi dimensional).
What is sub-query?
Sub-queries are often referred to as sub-selects
A subquery is a SELECT statement that is nested within another T-SQL statement.
A subquery SELECT statement can return any number of values.
It can be found in, the column list of a SELECT statement, a FROM, GROUP BY, HAVING, and/or
ORDER BY clauses of a T-SQL statement.
A Subquery can also be used as a parameter to a function call.
Properties of Sub‐Query
1 A sub‐query must be enclosed in the parenthesis.
2 A sub‐query must be put in the right hand of the comparison operator, and
3 A sub‐query cannot contain an ORDER‐BY clause.
4 A query can contain more than one sub‐query.
Types of Sub‐query
1 Single‐row sub‐query, where the sub‐query returns only one row.
2 Multiple‐row sub‐query, where the sub‐query returns multiple rows,. and
3 Multiple column sub‐query, where the sub‐query returns multiple columns
4
What are different Types of Join?
Joins are used in queries to explain how different tables are related. Joins also let you select data from a table
depending upon data from another table.
1.Inner Join:Contain matched rows only.
2.Outer Join:Contain Matched rows and Unmatched rows.These are 3 types.
Left Outer Join:Which contains all the rows from left table and matched rows from right table.
Right Outer Join:Which contains all the rows from Right table and matched rows from left table.
Full OuterJoin:Which contains all the rows from left table and all rows from right table.
3.Cross Join:A join with out any condition is called Cross Join,Every row in 1st table is joins with every row in
2nd table.
4.Self Join:A join joins with it self is called self join.
5.Equi Joins:Matchs rows from joined table & Display redundant values
6.Natural Joins:Display all matches rows & Restrict to Redundant values.
Constraint: Using Constraint, SQL Server enforces the integrity to the database.
It defines the rules that restrict unwanted data in the column.
Constraints can be table constraints or column constraints.
What is CHECK Constraint? A CHECK constraint is used to limit the values that can be placed in a column.
The check constraints are used to enforce domain integrity.
What is NOT NULL Constraint? A NOT NULL constraint enforces that the column will not accept null values.
The not null constraints are used to enforce domain integrity, as the check constraints.
Could you please describe some properties / Facts about NULL during comparisons.
NULL can not used with any comparing operator, NULL
• NULL will never be true or false
• NULL can not compared as =,<>,<,>, <=,<= etc.
• NILL is always equates will NULL only
What is Identity? Identity (or AutoNumber) is a column that automatically generates numeric values. A start and
increment value can be set, but most DBA leave these at 1.
Types of Transact-SQL
Data Definition Language (DDL): CREATE, ALTER, DROP
Data Control Language (DCL): GRANT, REVOKE, DENY
Data Manipulation Language (DML): SELECT, INSERT, UPDATE, DELETE
sql 2008
1. Can encrypt the entire database introduced in 2008.
2. Can compress tables and indexes
3. Date & time are seperately used for date and time datatype,geospatial & timestamp with internal
timezone is used.
4. Table datatype introduced.
5. SSIS avails in this version.
6. Central Management Server(CMS) is Introduced.
7. Policy based management(PBM) server is Introduced.
Storing backup file takes 5 minutes without compression in sqlserver 2005,but it takes only 3 minutes in
sql server 2008 for storing backup files with compression.
The nice thing is that it upgrading should be much easier from 2005 to 2008 than it was from 2000 to
2005.
when we write select * from --- it ask to for table name (2008) but 2005 does not ask.
Resource Governor , Transparent Data Encryption are there in 2008
Enhanced Auditing
Enhanced Database Mirroring
Automatic page repair. Enhanced supportability Log Stream Compression
What is Aggregate Functions? Aggregate functions perform a calculation on a set of values and return a
single value. Aggregate functions ignore NULL values except COUNT function. Aggregate functions are
AVG, MIN, CHECKSUM_AGG, SUM, COUNT, STDEV, COUNT_BIG, STDEVP, GROUPING, VAR, MAX,
VARP
How to reset SA password? Start the instance in single user mode and connect as a member of
Built-in\Administrators to reset the SA password
How to reset SA password? Start the instance in single user mode and connect as a member of
Built-in\Administrators to reset the SA password
Resource Governor: A technology that enables you to manage SQL Server workload and resources by
specifying limits on resource consumption. The RG Components are
Resource pools. Two resource pools (internal and default) are created when SQL Server 2008 is installed.
Workload groups. Two workload groups (internal and default) are created and mapped to their corresponding
resource pools when SQL Server 2008 is installed.
Classifier. There are internal rules that classify incoming requests and route them to a workload group.
Questions are collected by K.V.N SUBBA REDDY
Scenario There are two DBAs in one organization. One DBA A runs critical queries for business and another
DBA B is doing maintenance of the database. At any point in time the DBA A’s work should not be affected but
at the same time DBA B should be allowed to work as well. The ideal situation is that when DBA B starts working
he get some resources but he can’t get more than defined resources.
Codd's Rules: Any system which claims to be a relation database management system must be able to
manage databases entirely through its relational capabilities
Rule 0: Foundation rule
Rule 1: The information rule
Rule 2: The guaranteed access rule
Rule 3: Systematic treatment of null values
Rule 4: Active online catalog based on the relational model
Rule 5: The comprehensive data sublanguage rule
Rule 6: The view updating rule
Rule 7: High-level insert, update, and delete
Rule 8: Physical data independence
Rule 9: Logical data independence
Rule 10: Integrity independence
Rule 11: Distribution independence
Rule 12: The nonsubversion rule
Tools in sql-server:
(1) Configuration tools: (i) SS Configuration manager (ii) SS Surface area configuration (iii) Management
studio
(2) Monitoring tools: (i) Management studio (ii) activity monitor (iii) DMF’s & DMV's (iv) sqlserver profiler
(3) Command line utilities: SQLCMD, BCP, TABLEDIFF
(4) OTHER TOOLS: Database engine tuning advisor, Upgrade advisor, Third party tool (IDERA tools)
What is difference between Co-related sub query and nested sub query?
Correlated sub query runs once for each row selected by the outer query. It contains a reference to a value
from the row selected by the outer query. Nested sub query runs only once for the entire nesting (outer) query.
It does not contain any reference to the outer query row.
What are the difference between DDL, DML and DCL commands?
DML commands can't be rollback when a DDL command is executed immediately after a DML. DDL after DML means
"auto commit". The changes will return on disk not on the buffer. If the changes return on the buffer it is possible to
rollback not from the disk.
DDL is Data definition language statements which are used to develop a structure to the table. where as DML(data
manipulation language statements) are used to perform the
Questions are collected by K.V.N SUBBA REDDY
updations to the data.
What is the STUFF function and how does it differ from the REPLACE function?
STUFF function is used to overwrite existing characters.
REPLACE function to replace existing characters of all occurrences.
STUFF (string_expression, start, length, replacement_characters),
REPLACE (string_expression, search_string, replacement_string)
Which command using Query Analyzer will give you the version of SQL server and operating system?
SELECT SERVERPROPERTY ('productversion'), SERVERPROPERTY ('productlevel'), SERVERPROPERTY
('edition').
If Model and MSDB Database will crash what you will do? How to rebuild Master Database?
We can re-create Model and MSDB databases by rebuild the Master Database.
SQL Server 2000 (Rebuild MasterDB):- Start > Run > rebuildm.exe
SQL Server 2005 (Rebuild MasterDB):- Start > Run > setup.exe
How many ways you can move the data or databases between servers and databases?
SSIS, DTS, Attach & Detach, Backup/Restore, BCP, Replication, Log shipping, INSERT...SELECT,
SELECT...INTO
How to copy the tables, schema and views from one SQL Server to another?
There are multiple ways to do this.
1. “Detach Database” from one server and “Attach Database” to another server.
2. Manually script all the objects using SSMS and run the script on new server.
3. Use Wizard of SSMS.
Security Features:
Principles: Windows (Gropus, Domain Account, Local Account)
Questions are collected by K.V.N SUBBA REDDY
SQL Sever (SQL Account, Server Role)
Database (user, Database role, Application role, Group)
Permissions:
GRANT/REVOKE/DENY(Create,Alter,Drop,Control,Connect,Select,Execute,Update,Delete,Insert)
Securable: Server Scope (Logins, End points, Databases)
Database scope (Users, Assembles, Schemas)
Schema scope (Table, Procedures, Views)
Windows Authentication mode works: User connects to active directory server with domain credentials.
DC verifies the credentials and it sends unique no to client called TGT(Ticket Granting Ticket)
Client Machine produces TGT to Sql server and connects to sql server if there is mapping login
Syntax: Create login [domain/username] from windows [with default_database=<dbname>] For Windows
AM
Create login <loginname> with password=’....’ [default_database=’...’,
check_policy=on/off,check_expiration=on/off]
Create user <username> for login <loginname>
What is the difference between Windows Authentication and SQL Server authentication?
1) Windows authentication is highly secure than SQL Server authentication why because we need not provide
any login details. So the chance of tracing login details from code by the unauthorized persons will be less.
Windows authentication uses the default windows login credentials.
2) Windows authentication will uses the credentials of the currently logged user to login in to the SQL Server
database. Your application need not to supply the user name and password.
3) For SQL Server authentication we have to supply the SQL database user name and password. That will be
used to get the privileges and right of the user.
Orphan Login: The windows login for which there is no mapping user in active directory is called orphan
login.
To find Orphan login:sp_validatelogins
Role:Collectins of priveileges
server roles Fixed database roles
1. sysadmin 1. db_owner
2. serveradmin 2. db_accessadmin
3. setupadmin 3. db_securityadmin
4. dbcreater 4. db_ddladmin
5. processadmin 5. db_datareader
6. securityadmin 6. db_denydatareader
7. diskadmin 7. db_datawriter
8. bulkadmin 8. db_denydatawriter
9. db_bacupoperator
10. public
Permissions(Grant/Revoke/Deny)
1.Databaselevel:privileges like backup database,create table, show plan, alter table, select insert, update
Grant ……to <username>/<rolename>[WITH GRANT OPTION]
2.schema level:To group similar tables in database we can create schemas.
By default every table is stored in ‘dbo’ schema
Adv: to group similar tables,to grant permissions on more than one table at once.
No need to change the owner of table(s) if the user is deleted.
Syn: create schema <schemaname>
Create table <schemaname>.<tablename>(….)
To transfer dbo.emp into library schema ---> alter schema library transfer dbo.emp
To grant schema level permissions---->GRANT….on schema::[schemaname] to <username>/<rolename>
3.object level:GRANT….ON <objectname> to <username>/<rolename>
Where SQL server user names and passwords are stored in SQL server?
They get stored in System Catalog Views sys.server_principals and sys.sql_logins.
Where SQL server user names and passwords are stored in SQL server?
They get stored in System Catalog Views sys.server_principals and sys.sql_logins.
What are table qualifiers? When should table qualifiers be used? Syntax:[@table_qualifier =] qualifier
Is the name of the table or view qualifier. qualifier is sysname, with a default of NULL. Various DBMS products
support three-part naming for tables (qualifier.owner.name). In SQL Server, this column represents the database
name. In some products, it represents the server name of the table’s database environment.
Asymmetric keys are used for securing symmetric keys. They can also be used for limited data encryption and
to digitally sign database objects. An asymmetric key consists of a private key and a corresponding public key.
Symmetric Keys A symmetric key is one key that is used for both encryption and decryption. Encryption and
decryption by using a symmetric key is fast, and suitable for routine use with sensitive data in the
database.
Create symmetric key <keyname> with ALGORITHAM=DES/SHA1/MD5
encryption by certificate <certificatename>
Transparent data encryption (TDE) performs real-time I/O encryption and decryption of the data and log files.
The encryption uses a database encryption key (DEK).It can’t encrypt or decrypt individual pieces of data, it
can’t be used to restrict access to data. Steps: Create master key
Create or obtain a certificate a protected by master key.
Create a database key and protect it by the certificate
Set the database you want to protect to use encryption
What is SQL Server Agent? SQL Server agent plays an important role in the day-to-day tasks of a database
administrator (DBA). It is often overlooked as one of the main tools for SQL Server management. Its purpose is
to ease the implementation of tasks for the DBA, with its full-function scheduling engine, which allows you to
schedule your own jobs and scripts.
Whenever user wants to get sql sever agent what permissions you to give?
Three roles are there in MSDB database
1)sql agent user role 2)sql agent reader role 3)sql agent operator role
Path:Security->Login->Usermapping->select MSDB->select permissions
SQL Server Auditing: Auditing an instance of sql server or a sql server db involves tracking and logging events
that occurs on the system. Steps: 1.Server audit specifications (events to capture on the server instance
level).
Database audit specification(events to capture on specific database)
Target (wherewould be the events be logged)
To find: sys.dm_server_audit_status
sys_database_audit_specifications
What is Filestream?
Filestream allows you to store large objects in the file system and have these files integrated within the
database. It enables SQL Server based applications to store unstructured data such as documents, images,
audios, videos etc. in the file system. FILESTREAM basically integrates the SQL Server Database Engine with
Questions are collected by K.V.N SUBBA REDDY
New Technology File System (NTFS); it basically stores the data in varbinary (max) data type. Using this data
type, the unstructured data is stored in the NTFS file system and the SQL Server Using Transact SQL
statements users can insert, update, delete and select the data stored in FILESTREAM enabled tables.
What are “Unrepeatable reads”? Inconsistent Analysis (Nonrepeatable Read) occurs when a second
transaction accesses the same row several times and reads different data each time. Inconsistent analysis is
similar to uncommitted dependency in that another transaction is changing the data that a second transaction is
reading..
What is “Phantom rows”? Phantom reads occur when an insert or delete action is performed against a row
that belongs to a range of rows being read by a transaction. The transaction’s first read of the range of rows
shows a row that no longer exists in the second or succeeding read, as a result of a deletion by a different
transaction. Similarly, as the result of an insert by a different transaction, the transactions second or succeeding
read shows a row that did not exist in the original read.
What are the New Data types introduced in SQL Server 2005?
SQL Server 2005 has added some new data types to its existing data types.
XML Data type
1. VARCHAR (MAX)
2 .NVARCHAR (MAX)
3. VARBINARY (MAX)
What is CTE?
CTE is an abbreviation Common Table Expression. A Common Table Expression (CTE) is an expression that
can be thought of as a temporary result set which is defined within the execution of a single SQL statement . A
CTE is similar to a derived table in that it is not stored as an object and lasts only for the duration of the query.
What are the Advantages of using CTE?
• Using CTE improves the readability and makes maintenance of complex queries easy.
• The query can be divided into separate, simple, logical building blocks which can be then used to build
more complex CTEs until final result set is generated.
• CTE can be defined in functions, stored procedures, triggers or even views.
• After a CTE is defined, it can be used as a Table or a View and can SELECT, INSERT, UPDATE or
DELETE Data.
What are the Protocols used in Networking? What is the Default Port number of TCP/IP?
The protocols used in networking are TCP/IP, NAMED PIPPES, VIA, SHARED MEMORY. The default port no of
TCP/IP is 1433. Named pipes communicates across TCP port 445 UDP: 1434
VIA The Virtual Interface Adapter (VIA) can be used only by VIA hardware.
Shared Memory Shared Memory can only be used on the local computer and cannot be used as a network
protocol.
Database backup: It is the process of taking data, meta data and services present in the database into O/S file.
Backup can generate in two types of files. The files are .BAK and .TRN.We can provide more security for data.
We copy/move database from one server to another, We can implement standby solutions with log shipping. To
recover data up to point of failure .i.e. to avoid data loss.Sys admin, db_owner and db_backupoperator can take
backup.
What is Mean Cold backup (Offline Backup) and hot backup (Online Backup)
Cold backup: while taking the cold backup the database will not be accessible by other users (single user mode
or emergency mode (any administrator)), Hot backup: while taking the backup the database will be accessible
to all the users (online)
Non Logged operations: BCP, Bulk Insert, Select Into, Index, Text, Next data types
Check Point: It is a program executed by SS to take all committed transactions ftom T.Log into datafile.
It takes all committed transactions details (LSN<Pageid) from T.Log file and submits to Lazy writer.
Lazy writer is one of background process which takes the pages from data cahe and writes to data file
Check point truncates t.log file if the recovery model is SIMPLE
Questions are collected by K.V.N SUBBA REDDY
Check point occurs In the following scenarios
Periodically (Depends on recovery interval of SS) R.C on server->properties->Database settings-
>Recovery interval=1.
When the database backup is about to start And If server is started
If the T.log is 70% full and it is in log truncate mode.
When the data or log file is added or removed from a database.
When recovery model is changed.
CHECKPOINT ---> To Manually perform check point command (or) sp_configure 'recovery interval', 32767)
To verify Check point: Sp_who2 or DBCC log (‘dbname’, 3) Ex: dbcc log(test).
To start sql service without raising checkpoint SHUTDOWN WITH NOWAIT
What is RMAN? Recovery Manager (RMAN) is a utility that can manage your entire Oracle backup and
recovery activities.
Which Files must be backed up?
Database Files (with RMAN) Control Files (with RMAN) Offline Redolog Files (with RMAN)
INIT.ORA (manually) Password Files (manually)
Benefits: 1. Incremental backups that only copy data blocks that have changed since the last backup.
2. Tablespaces are not put in backup mode, thus there is no extra redo log generation during online backups.
3. Detection of corrupt blocks during backups.
4. Parallelization of I/O operations.
5. Automatic logging of all backup and recovery operations.
6. Built-in reporting and listing commands.
Can we change recovery model for System Database? YES, we can change recovery model
Database Default Can be changed or not
Name Recovery
Model
master Simple Not Applicable, technically, YES you can set to FULL or BULK logged but the database
continues to operate as simple recovery model only. you can not perform BACKUP
LOG even you change that to full / bulk logged
model FULL can be changed and set to FULL or BULK Logged
msdb SIMPLE can be changed and set to FULL or BULK Logged
tempdb SIMPLE Can not be changed
distribution SIMPLE YES, but distribution db just stores metadata and history data for replication, but a FULL
recovery model is recommended.
resource N/A recovery model is not relevant to resource database
Database Backup Requirements
Database Backup Requirements Full Backup Differential Transaction Log
Database Name
Critical Daily 6 Hourly 5 to 15 minutes
High Daily 6 Hourly Hourly
Medium Weekly Daily Hourly
Low* Weekly Daily N/A
*Database in simple recovery mode
System Database Database Full Backup Differential Transaction Log
master Daily N/A N/A
msdb Daily 6 Hourly N/A
model Weekly N/A N/A
distribution* Daily 6 Hourly Hourly
*if replication is enabled
SQL Server Database Restore
Single Database All Databases Full Failover
Database
Critical Databases Weekly Monthly Quarterly
High Databases Monthly Quarterly Yearly
Medium Databases Monthly Quarterly Yearly
Low Databases Monthly Quarterly Yearly
In which edition On-line restoration is possible? On-line restoration is possible only in Enterprise edition.
Does Recovery Model affects database transaction log ? YES,The full recovery model might consume all
available disk space, if appropriate database maintenance is not performed as log keep growing.
Does the recovery model effect the database size / disk ? YES,The full recovery model might consume all
available disk space, if appropriate database maintenance is not performed as log keep growing.
Questions are collected by K.V.N SUBBA REDDY
Is SQL Server recovery mode and Recovery model is same thing ? YES, is one of the same thing.
Restore Strategy?
First restore recent last full backup
Then restore last Diff. backup
Then restore all Transaction Log backups.
Data Transformation Services (DTS) is a set of tools available in SQL server that helps to extract (Import or
Export), transform and consolidate data.
Logshipping
What is Log shipping and purpose of Log shipping?
To achieve high availability and high protection, Log shipping copies transactions from a ‘primary server’ to one
or more ‘secondary servers’. In Log shipping, T.Log backups are sent to one or more secondary servers and
then restored to the destination servers individually. If the Primary database becomes unavailable, any of the
secondary database can brought into online manually. The Secondary server acts as a Backup server and
provides read-only query processing to reduce the load on the Primary server. (For query processing, secondary
servers should be configure in stand-by mode).
What are the Jobs running for Log shipping and explain them?
Log shipping having four operations which are handled by SQL Server Agent Job.
Backup Job: - Backup job is created on Primary Server instance and it performs backup operation. It logs history
on the local server and monitor severs and deletes old backup files and history information.
Copy Job: - Copy Job is created on Secondary server instance and it performs copies the backup files from
primary sever to secondary server. It logs history on the secondary server and monitor server.
Restore Job: - Restore Job is created on the Secondary server instance and it performs restore operation. It logs
history on the local server and monitor sever and deletes old files and history information.
Alert Job: - If a Monitor Server is used, the Alert Jobs is created on the Monitor server instance and it raises
Alerts if any operations have not completed successfully.
sp_refresh_log_shipping_monitor: Refreshes the monitor with the latest information for the specified log
shipping agent.
Transaction Log shipping Status report (Summary Reports):- This report shows the status of log shipping
configurations for which this server instance is a primary, secondary or monitor.
SQL Server Agent Job History
Checking the SQL Server Log
How Secondary Server will brought into Online, if the Primary Server becomes Unavailable?
If the Primary Server will become un-available, do the following steps.
1. Take the Tail of Log from Primary server with no recovery
2. Restore Tail of log into all Secondary Database with recovery
3. Remove Log-shipping configuration from Primary Server
4. Select any one of Secondary server and bring into online with Alter Database DBName set Online
5. Right click on Primary Database and Generate script for Users and Logins.
6. Then move the script to Secondary server to create Users and Logins
7. Re-configure log shipping from New Server (Secondary server)
.TUF File:Is transaction undo file.It is created when the configuare log shipping and if the secondary db is
STANDBY mode. This file is created in copy/restore folder in secondary server. It contains the information
regarding any modifications that were made as part of incomplete transactions at the time the backup was
performed.
Questions are collected by K.V.N SUBBA REDDY
What are errors occurred in Log shipping?
There are two errors are occurred during Log shipping
1) 14420:- This error occurs when the Backup job fails
2) 14421:- This error occurs when the Restoring job fails
Log Shipping Errors The following are the common log shipping errors and their solution I found. Hope this will
be helpful to everyone.
Error: 14262 :If SQL Server name is not the same as Windows Server name. You can check this by running
Select@@Version. The output of this query should be the name of your windows server name else you need to
perform the below steps, sp_dropserver ‘old server name’sp_addserver ‘new server name’, local
Error: 14420, The error indicates that the difference between the last T-log backed up file and current time on
the monitor server is greater than the time that is set for the Backup Alert threshold.
Error: 14421 indicates that the difference between the last T-log backed up file and last restored T-log file is
greater than the time selected for the Out of Sync Alert threshold.
Error 4323: The database is marked suspect. Transaction logs cannot be restored.
We had the same issue some time ago, this was related to a new file being created in a file group on the source.
Don't know if this applies to your case, but restoring a backup of this new file on the secondary server solved the
problem.
I've configured Log shipping successfully on standby mode, but in the restoration job I'm getting Error:
Could not apply log backup file 'C: \...trn' (Or) Error: Exclusive access could not be obtained because the
database is in use. RESTORE LOG is terminating abnormally
To restore transaction logs to the secondary db, SQL Server needs exclusive access on the database. When
you configure it in standby mode, users will be able to access the database and runs query against the
secondary db. Hence if the scheduled restore jobs runs at that time, the db will have a lock and it won't allow
SQL Server to restore the tlogs. To avoid this you need to check "Disconnect users in the database when
restoring backups" options in log shipping configuration wizard.
IS it possible to log ship database between SQL 2000 & SQL 2005?
No, that’s impossible, In SQL 2005 transaction log architecture is changed compared to SQL 2000 and hence
you won't be able to restore tlog backups from SQL 2000 to SQL 2005 or vice versa.
I'm getting the below error message in restoration job on secondary server, WHY? ( which is too late to
apply to the database) Was your sql server or agent restarted Y'day in either source or destination? Because
the error states there is a mismatch in LSN. A particular tran log was not applied in the destination server hence
the subsequent tran logs cannot be applied as a result !
Can I take full backup of the log shipped database in primary server??
In SQL Server 2000 you won't be able to take full backup of log shipped database, because this will break the
LSN chain and it directly affects the log shipping. In SQL Server 2005, yes its possible. You can take full backup
of log shipped database and this won't affect the log shipping.
Can I take full backup of the log shipped database in secondary server?
No chance, you won't be able to execute BACKUP command against a log shipped database in secondary
server.
Is it possible to log ship database from SQL server 2005 to SQL server 2008 and vice versa?
Questions are collected by K.V.N SUBBA REDDY
Yes you can log ship database from SQL server 2005 to SQL Server 2008 this will work. However log shipping
from SQL Server 2008 to SQL Server 2005 is not possible because you wont be able to restore SQL server
2008 backup to SQL Server 2005 (downgrading version).
What are the endpoints in log shipping?what r the port numbers for log shipping?
We don't need to create endpoints or assign port in log shipping, which is required for database mirroring
What are the log shipping frequent issues you have faced?
It depends. I have seen some issues like transaction log cannot restored on the secondary database which is
due to that the transaction log sequence is broken.
Out Of sync (14421): if there is no disk space in secondary server for restoring
If there is no respective path to create the file in SS.
If there is ad-hoc t.log backup was taken.(To solve restore ad-hoc log backup)
If the agent service or msdb is not working in SS.
If any t.log backups are missing/corrupted before restoring (To solve disable log shipping jobs, Take DIFF/FULL
backup and apply in SS, Enable Jobs)
Advantages
1. Using immediate restore option, we can setup almost an exact copy of the production system at the
Secondary Server.
2. Delayed Restore; using this option you setup a secondary Server with the transaction Logs shipped but are
not restored immediately, this option would be highly helpful, if incase of Data Corruption / Loss because of a
User accidentally deleting / dropping / modifying important Data. If acted immediately, you should be able to
recover the Data from the Database on the secondary Server.
3. Multiple Secondary Databases can be setup for a single Primary Database, providing the option to use one
copy for DR and another for a reporting kind of use (The Users need to be disconnected when the Logs are
restored and that can be done Automatically by SQL Server), so restoring Job can be scheduled for every 6
Hours so as not to interrupt reporting users frequently.
4,One of the biggest benefits of log shipping is that it is a much cheaper high availability solution than clustering.
This is because the hardware requirements that are necessary for clustering are not required for log shipping.
5. Does not require expensive H/W and S/W.
6. It is reliable, easy to maintain,implemenet log shipping is not technically difficult.
7. Stand by server can be used to reporting purpose.
Dis-advantages
1. Automatic Redirection / Failover of the application is not possible.
2. When compared to Database Mirroring or Transactional Replication there is a slight delay in synchronizing the
Database at the secondary server.
3. Can be implemented only with Databases having FULL/Bulk-Logged Recovery model.
4. Sometimes Entire Database is not required for the application when coming back immediately from a
Disaster. Let me explain, a Database has multiple years (let’s say 7) of transactional Data and you may not need
the entire 7 years of Data when disaster strikes, the most recent few years (may be 2 or 3) is good enough to
start immediately. OR a subset of the Database is required for a Marketing application; you cannot provide it
using Log Shipping.
5. There will be some data loss because you can't configure the backup job to run less than 2 minutes
Mirroring
What is Database Mirroring? What are the benefits of that?
“Database mirroring is a method of increasing database availability”, which supports automatic failover with no
loss of data.
Benefits:-Increases data protection
Increases availability of a database
Improves the availability of the production database during upgrades
What are the Operating Modes and explain them?(Performing fail over)
a. High Availability:- High-availability mode, runs synchronously. Requires a Witness Server instance.
It makes mirror db online automatically with in configured timeout. Incase of other operating modes,
we have to perform fail over manually. The Principal server sends the log buffer to the mirror server,
and then waits for a response from the mirror server.
b. High Protection:- High-protection mode, runs synchronously. Always commit changes at both the
Principal and Mirror. We have to run ALTER DATABASE <dbname> SET PARTNER OFF(To break
mirroring).Database comes into restoring state run the following cmd to take it online
RESTORE DATABASE <dbname> with recovery
c. High Performance: - High-performance mode, runs asynchronously and the transaction safety set to
off. The Principal server does not wait for a response from the mirror server after sending the log
buffer. The principal server running nice and fast, but could lose data on the mirror server. We have
to run ALTER DATABASE <dbname> SET PARTNER FORCE_SERVICE_ALLOW_DATA_LOSS in
mirror server. Transfer the logins. Make database available to the users and applications.
What is the default of Port numbers of Principal and Mirror servers? How to find the Port numbers?
The default port numbers of principal and mirror servers are 5022 and 5023.
To Find Port Number:- SELECT name, port FROM sys.tcp_endpoints
Which Trace flag is used in Mirroring?Trace flags are used to temporarily set specific server characteristics or
to switch off/on a particular behavior. 1400 Trace flag is used in mirroring.
To set trace flag for Database mirroring:- Configuration Manager > Right click on server instance > Properties >
Advanced tab > Startup parameters > -t1400 (add)
What is Role-switching? Inter changing of roles like principal and mirror are called role switching.
What is the Syntax to stop the Database Mirroring? Alter database <database name> set partner off
Questions are collected by K.V.N SUBBA REDDY
How to configure Mirroring?
Choose Principal Server, Mirror Server, and optional Witness server.
Configuring security and communication between instances
Configuring endpoint
Creating logins for other servers service accounts
Grant connect permission to this logins on endpoints
Create mirror database
Take full backup from principle server and restore it in mirror server with NORECOVERY.
Establish mirroring session using ALTER DATABASE command
To view total bytes send from principal and total bytes received at mirror we can use (run in witness
server)
select*from sys.dm_db_mirroring_connections
In SQL Server 2008, if you want to use a stored procedure to monitor the status of your database
mirroring session, which one would you use? sp_dbmmonitorresults
If mirror sever is failed then what is the effect on principle database t.log file?
Principal server transaction log file grows very fast. the transaction log cannot be truncated.
What are the major new features introduced in Mirroring 2008 version?
Auto Page Repair Select * from sys.dm_db_mirroring_auto_page_repair
Log Stream Compression Transactions are sending to Mirror by compressing.
Influences performance of Mirroring: Log generation rate & Transaction safety level.
N/W latency and bandwidth
No. of concurrent user connections & transaction size and volume.
Can I create multiple endpoints for configuring different databases for mirroring and point each
database to unique endpoint? No, that’s not possible. You can create only one endpoint in a server for
database mirroring you need to use this endpoint to configuring db mirroring for all the databases.
Can I configure a single database to be mirrored to more than one server. i.e) One source & many
destination like logshipping? No, thats not possible in Database mirroring, its one to one configuration.
What is Hardening?
As quickly as possible, the log buffer is written to the transaction log on disk, a process called hardening.
In SQL Server 2005 Database mirroring, which form is used to specify the network address of the
servers?
Tcp ://< server address> :< port>
Is it possible to setup database mirroring between standard and enterprise edition? No, it is not possible
. In which editions does automatic page repair work with Database Mirroring?
Automatic page repair is an Enterprise only feature. Database mirroring works in both standard and enterprise
editions.
Can you mirror a SQL Server 2008 database in compatibility mode 90?
Yes. Database Mirroring doesn't concern itself with checking if the compatibility mode. You can mirror a
database in any mode if you are on the SQL Server 2008 platform.
IHow can we setup mirroring for MSDB database? No, it is not possible to setup mirroring for system
databases (master, model, msdb, tempdb), it is possible only for user databases
Is it possible to rename Mirroring Database? No, not possible to rename when mirroring is enabled on it.
Can we enable mirroring and log shipping on same database? Yes, we can setup mirroring and log shipping
on primary database with one difference, incase of log shipping we can map one primary with multiple
secondary servers, it is not possible in mirroring. It is one to one.
Is it possible to query mirroring database ? Yes it is possible only using database snapshots, otherwise it is
not possible
Quorum
Quorum is a relationship that exists when two or more server instances in a database mirroring session are
connected to each other. Three types of quorum are possible:
A full quorum includes both partners and the witness.
A witness-to-partner quorum consists of the witness and either partner.
A partner-to-partner quorum consists of the two partners.
Is it possible to start service when quorum is gone? No quorum
Advantages
1. Supports immediate and automatic failover of applications using ADO.Net and SQL Native Client, using
Client-side Redirect.
2. Supports multiple modes of configuration namely, High Availability Mode, High Protection and High
Performance Mode. Each mode has its advantages, providing an option to choose accordingly based on
requirement in hand.
3. Protection against database failures.
4. Support of easy manual failover and no special H/W requirements.
5. Minimized chance of data loss and relatively easy of setup and configuration.
Questions are collected by K.V.N SUBBA REDDY
Dis-advantages
1. Database redundancy is not provided for Read-Only purpose, but a workaround way using Database
Snapshots on the Mirrored Database is suggested in BOL. It has to be remembered that Database Snapshots
are limited to Enterprise Edition of SQL Server 2005 (Not sure of Database Snapshots on the Mirrored Database
in SQL Server 2008)
2. Can be implemented only with Databases having FULL Recovery model, hence databases with other
recovery models cannot be used in Database Mirroring.
3. Database mirroring does not support FILESTREAM. A FILESTREAM filegroup cannot be created on the
principal server.
Support only full recovery model Supports full and bulk-logged recovery model
Mirror database is always in recovery mode. To You can use the stand-by option to read the
read it you have use database snapshot. database on standby server
Auto Page Recovery introduced with SQL Not supported
SERVER 2008 so it will recover the damaged
pages.
Replication
What is Replication? “Replication is the process of copying and distributing data between databases to
different servers throughout the enterprise”.
Replication is a set of technologies for copying and distributing data and database objects from one database to
another and then synchronizing between databases to maintain consistency.
Explain about Publisher, Subscriber and Distributer (or) What are the Server Roles Involved in
Replication?
Publisher:- The Publisher is a database that makes data available for replication. The Publisher can have one or
more publications.
Distributor:- The distributor is the intermediary between the publisher and subscriber. It receives published
transactions or snapshots and then stores and forwards these publications to the subscribers.
Subscribers:- Subscribers are database servers that store the replicated data and receive updates. A subscriber
can receive data from multiple publishers. Based on the replication type, the Subscriber can also pass data
changes back to the Publisher or republish the data to other Subscribers.
Note:MSDTC(MS distributed transactions coordinator) should be running in subscriber
Which recovery models are used for Replication? Full and Bulk-logged Recovery models
What are the Agents available for Replication and explain each?
SQL Server Agent hosts and schedules the agents used in replication and also controls and monitors operations
outside of replication.
Snapshot Agent (snapshot.exe):-The Snapshot Agent is typically used for all types of replication. It is
responsible for copying the schema and data from the publisher to the subscribers, stores the snapshot files,
and records information about synchronization in the distribution database. The Snapshot Agent runs at the
Distributor. The snapshot is created by using the following files
(i) .sch -> schema files which contains the articles structure. (ii).bcp -> contains the articles data.
(iii).idx -> contains the indexes infn (iv) .trg -> contains the triggers infn (v) .pre -> referential integrity
constraints.
Name pattern :< publisher>-<publicationdb>-<publication>-<int>
Log reader agent (logread.exe) The Log Reader Agent is used for transactional replication. It moves information
from the transaction log on the publisher to the distribution database.. Each database published using
transactional replication has its own Log Reader Agent that runs on the Distributor and connects to the Publisher
Distribution Agent :( distrib.exe): The Distribution Agent is used for snapshot replication and transactional
replication. It is responsible for moving the stored transactions from the distributor to the subscribers. The
Distribution Agent runs at either the Distributor for push subscriptions or at the Subscriber for pull subscriptions.
Name pattern(push):<publisher>-<publication>-<publication>-<subscriber>-<int>
Name pattern(pull):<publisher>-<publicationdb>-<publication>-<subscriber>-<subscriptiondb>-
<GUID>
Merge agent :( replmerg.exe):- The Merge Agent is used for merge replication. It is responsible for converging
records from multiple sites and then redistributing the converged records back to the subscribers. The Merge
Agent runs at either the Distributor for push subscriptions or the Subscriber for pull subscriptions.
Queue Reader Agent: (qrdrsvc.exe) - The Queue Reader Agent is used for transactional replication with the
queued updating option. It runs on the Distributor and is responsible for reading messages from the queue on
the subscribers and applying them to the appropriate publication. Unlike the Distribution Agent and the Merge
Agent, only one instance of the Queue Reader Agent exists to service all Publishers and publications for a given
distribution database.
What options are there to delete rows on the publisher and not on the subscriber?
• One option is to replicate stored procedure execution instead of the actual DELETE command. You can
create two different versions of the stored procedures one on the publisher that does the delete and the
other on the subscriber that does not do the delete.
• Another option is to not replicate DELETE commands.
Data is not being delivered to Subscribers, what can be the possible reasons?
There are a number of possible causes for data not being delivered to Subscribers:
o The table is filtered, and there are no changes to deliver to a given Subscriber.
o One or more agents are not running or are failing with an error.
o Data is deleted by a trigger, or a trigger includes a ROLLBACK statement.
o A transactional subscription was initialized without a snapshot, and changes have occurred on
the Publisher since the publication was created.
o Replication of stored procedure execution for a transactional publication produces different
results at the Subscriber.
o The INSERT stored procedure used by a transactional article includes a condition that is not
met.
o Data is deleted by a user, a replication script, or another application.
If I create a publication with one table as an article, and then change the schema of the published table
(for example, by adding a column to the table), will the new schema ever be applied at the Subscribers?
Yes. Schema changes to tables must be made by using Transact-SQL or SQL Server Management Objects
(SMO). When schema changes are made in SQL Server Management Studio, Management Studio attempts to
drop and re-create the table and since you cannot drop a published objects, the schema change will fail.
Can you tell me some of the common replication DMV’s and their use?
sys.dm_repl_articles - Contains information about each article being published. It returns data from the
database being published and returns a row for each object being published in each article.
sys.dm_repl_schemas – Contains information about each table and column being published. It returns data
from the database being published and returns one row for each column in each object being published
sys.dm_repl_traninfo - Contains information about each transaction in a transactional replication
To replicate permissions in the snapshot replication topology, select appropriate object, right mouse click and
choose Generate Script, then uncheck all formatting options and on the Options tab check 'Script object level
permissions'. Then select appropriate article and click Publication properties. On the Snapshot tab specify
'Additional script' ('Before applying the snapshot, execute this script' or 'After applying the snapshot execute this
script') and specify script which was created before (this script will contain the GRANT statements).
What is the major difference between Merge replication and Transactional replication?
In Merge replication the both publisher and subscriber can work independently
Peer-Peer Replication? Peer-Peer Replication decreases / nullifies the dependency on Distributor. In this
Replication topology each node is Publisher, Distributor and Subscriber. This increases availability of the
database system and Failure of any node does not impact the health of Replication process. This topology also
offers automatic conflict detection and correction. Hence, recommended in Realtime
Peer to Peer Replication configuration:
1. Take 2 or 3 instances.
2. Make both the instances as publisher as well as distributor.
3. Go to first instance create one transactional publication from required database.
4. Right click on publication take properties ->Select “Subscription Options” and Allow Peer to peer
subscriptions= True and click ok
5. Go to Node1 i.e. first server take full backup and restore backup in Node2
6. Right click on publication select configure peer to peer topology ->Click Next >Select publication
->click Next
7. Right on the surface and select Add New peer node
8. Select second instance Connect
9. Select Database and Peer Originator ID. OK
10. Right click on first node Select Connect to all displayed node->Click Next
11. Configure Log Reader Agent Security Next
12. Configure Distribution Agent security Next
13. Select first option “I created the peer database manually” Next ->Next Finish->Close.
Publication types: (i) snapshot publications (ii) transactional publications (iii) merge publications
(iv) Transactional publication with updatable subscriptions
Replication topologies
Central publisher/Central distributor. Remote distributor
Central subscriber/multiple publishers. Multiple publisher/multiple subscribers.
If u configures merge replication what column is newly added into that published table? Will it be
removed if u dropped from publication.
one column is added i.e. "rowguid" column and data type is uniqueidentifier.if u drop table form publication and
the column will so dropped. in case of transactional with updatabale one column is added into that table i.e
"repl_tran_version" column. It can't drop even if u drop table from publication and u need to do manually.
Questions are collected by K.V.N SUBBA REDDY
Failover in replication:
When the publisher or subscriber database fails, replication does not take place
Restore the database by using the available backup sets
On restore the database the replication continues.
Should I script my replication configuration? Yes. Scripting the replication configuration is a key part of any
disaster recovery plan for a replication topology
Can the same objects be published in different publications? Yes, but with some restrictions.
Replication issues
"There is insufficient system memory to run this query" - Log reader agent error for subscriber database
:
During working with replication this is one of the error which i encountered and get resolved it. This is coming
with log reader agent and it stopped working. It's due to the issue memory. i have flushed the unused memory
consumed by Adhoc queries and system cache.
To flush the memory use the below commands,
DBCC FREESESSIONCACHE
DBCC FREEPROCCACHE
DBCC FREESYSTEMCACHE('ALL')
"Could not find stored procedure 'sp_MSins_TableName' in replication in sql server" - Log reader agent
error:
It came after reinitialize all subscription for one publication and it stopped working with error,
"Could not find stored procedure 'sp_MSins_TableName' in replication in sql server"
This is due to replication object was not created for insert and named like 'sp_MSins_TableName'. The solution
for this issue, we need to create these missing replication objects using 'sp_scriptpublicationcustomprocs' which
generates scripts the custom INSERT, UPDATE, and DELETE procedures for all table articles in a publication.
Workaround for the solution is,
EXEC sp_scriptpublicationcustomprocs 'PublicationName'
After running generated scripts in subscriber database, log reader agent started to work.
"The row was not found at the Subscriber when applying the replicated command”:
It encountered it with log reader agent and it was stopped due to error as,
"Command attempted: if @@trancount > 0 rollback tran (Transaction sequence number:
0x000CAB2A00038CB6003B00000000, Command ID: 2) Error messages: The row was not found at the
Subscriber when applying the replicated command. (Source: MSSQLServer, Error number: 20598)"
Row conflict issue was occurred due to some of the tables which we can get the details with following query to
reach towards solution.
SELECT * FROM dbo.MSarticles m WHERE EXISTS ( SELECT mc.Article_id from MSrepl_commands mc
WHERE mc.xact_seqno = 0x000CAB2A00038CB6003B00000000
and mc.Article_id = m.article_id )
Does replication affect the size of the transaction log? Merge replication and snapshot replication do not
affect transaction log size, but transactional replication can
How to: Disable Publishing and Distribution (SQL Server Management Studio)
Disable publishing and distribution with the Disable Publishing and Distribution Wizard.
To disable publishing and distribution
1. Connect to the Publisher or Distributor you want to disable in Microsoft SQL Server Management Studio,
and then expand the server node.
2. Right-click the Replication folder, and then click Disable Publishing and Distribution.
3. Complete the steps in the Disable Publishing and Distribution Wizard.
Advantages
1. Provides redundancy of Database, giving a choice to use one system for reporting and another for DR or Hot
standby etc.
2. Can be used to build Scale-Out Implementation by using Peer-to-Peer Transactional Replication.
3. Can be used to setup a Reporting / Data Warehousing System which needs only some part of the Source
Database, this can be achieved using Horizontal and Vertical filtering of Data.
4. Oracle Database can be used as a Publisher.
5. Independent of the Recovery Model of the Database, hence any database can be published.
Dis-advantages
1. Automatic Failover of the application is not possible, the application has to be coded / changed to use the
standby system.
2. Many Table related properties, such as Index Partition Schemes, Check Constraints and Non Clustered
Indexes etc are not propagated to the subscribers by default; they need to be configured when publishing.
3. Data Conflict can occur when Merge Replication is configured and sometimes may turn out to be very
complex to solve the conflicts.
MANAGEMENT
What is Maintenance Plan?
A SQL Server maintenance plan allows the creation and scheduling of maintenance tasks through either a
wizard-driven interface or using the Maintenance Plan design surface. The purpose of wizard is to create and
schedule tasks covering the major administration items such as backups, DBCC checks, and index
maintenance.
Database Mail: Database Mail is an enterprise solution for sending e-mail messages from the Microsoft SQL
Server 2005 Database Engine. Using Database Mail, your database applications can send e-mail messages to
users. The messages can contain query results, and can also include files from any resource on your network.
Database Mail is designed for reliability, scalability, security, and supportability.
How can SQL Server Agent Mail send messages in SQL Server 2005?
SQL Mail through Extended MAPI or Database mail.
SQL Server Agent Mail can be configured to use Database Mail or Extended MAPI.
Operators: These are the alias to the people to whom we can send the electronic notifications using email,
pager, and net send.
1. Standard operators 2. Fail-safe operator: When the notifications to the operators failed, then the notification
will be sent to the fail-safe operator. We can have only one fail-safe operator and it cannot be deleted.
Alerts: These are the pre-defined indications which will be raised automatically by the alert engine.
When an alert is raised we can notify to an operator or we can run a job.
The alerts are 3 types:(i) sqlserver event alerts (ii) sqlserver performance condition alerts (iii) sqlserver WMI
alerts
Sqlserver performance condition alerts: These alerts are raised when the performance counters reaches a
threshold value.
These performance counters can be monitored by using system performace monitor.
Sqlserver event alerts: These alerts are raised when a database event is raised.
These alerts will be raised based on the error numbers or based on the error severity
Eg: create an event alert when a record is deleted from the customers table.
PERFORMANCE TUNING
Which Tools are used for Performance Tuning?
There are many tools are used for Performance tuning
a) Windows tools for monitoring applications :- Performance monitor, Performance Counters and Logs,
Task manager, Network manager
b) SQL Server tools for monitoring components :- SQL trace, SQL Profiler, DMVs, System Stored
procedures, Graphical show plan, Activity Monitor, DBCC, Built-in Functions, Trace flags
Once I run any SQL command, internal how SQL Server executes this command?
Once a query is submitted to SQL Server, It performs the following steps for first time.
1. Parsing (Compiling)
2. Resolving (Verifying table names, col names)
3. Optimizing (Generating execution plan)
4. Executing
Note: Execution plans are
* Case sensitive and
* Space sensitive
What are the steps to take to improve performance of a poor performing query?
Steps to take to improve performance of queries:
• Use indexes efficiently
• Create all primary and foreign keys and relationships among tables.
• Avoid using cursors
• Triggers are with Set NOCOUNT On
• Avoid using Select*, rather mention the needed columns and narrow the resultset as needed.
• Reduce the too much normalization
• Use partitioned views
• Use temporary tables and table variables
• Reduce joins and heavy clauses like GROUP BY if not needed
• Implement queries as stored procedures.
• Have a WHERE Clause in all SELECT queries.
• Use data types wisely
• Instead of NULLS use string values such as N/A
• Use locking and isolation level hints to minimize locking.
• Avoid expensive operators such as NOT LIKE.
• Fully qualify database objects.
• Add space to DB files or TempDB, if that are not having enough space
The key difference between SQL Server Profiler and System Monitor is that SQL Server Profiler monitors
Database Engine events, whereas System Monitor monitors resource usage associated with server processes.,
What is Deadlock?
A deadlock occurs when users try to place exclusive locks on each other’s objects.
Ex: - User1 places an exclusive lock on Table1 and then tries to place an exclusive lock on Table2. User2
already has an exclusive lock on table2, and User2 tries to put an exclusive lock on Table1. This condition
causes endless loop of waiting for the locks to be released.
The Database engine picks one of the victim (users) and kills their query and send a error message to users
“You are the victim of a deadlock and try again later”.
Deadlock Information Tools
Trace Flags: - DBCC TRACEON (1204) & DBCC TRACEON (1222). When these trace flags is enabling, the
deadlock information captured by the SQL Server error log. DBCC TRACEON (3605, 1204,-1).
Deadlock graph event in SQL Profiler: - SQL Server Profiler graphically representation of tasks and resources
involved in a deadlock. (Lock: Deadlock and Lock: Deadlock chain events in the Locks events)
System View: - We can find the blocking sessions by writing the following query
Select session_id, status, blocking_session_id from sys.dm_exec_requests where blocking_session_id > 0
Resolving Deadlock: - After find the session causing the problem we can use KILL command. > KILL
process_id
The following types of resources can cause blocking that could result in a deadlock.
Locks.
Worker threads. A queued task waiting for an available worker thread can cause deadlock.
Memory. When concurrent requests are waiting for memory grants that cannot be satisfied with the
available memory, a deadlock can occur.
Parallel query execution-related resources Coordinator, producer, or consumer threads associated
with an exchange port may block each other causing a deadlock
Multiple Active Result Sets (MARS) resources.
To help minimize deadlocks:
• Access objects in the same order.
• Avoid user interaction in transactions.
• Keep transactions short and in one batch.
• Use a lower isolation level.
• Use a row versioning-based isolation level.
o Set READ_COMMITTED_SNAPSHOT database option ON to enable read-committed
transactions to use row versioning.
o Use snapshot isolation.
• Use bound connections.
• In stored procedures or programming we have to handle deadlocks using TRY/ CATCH blocks. In Catch
block when error number 1205, write the logic to run the query again.
What is bound Connection? Bound connections allow two or more connections to share the same transaction
and locks. Bound connections can work on the same data without lock conflicts. Bound connections can be
created from multiple connections within the same application, or from multiple applications with separate
connections
Types of Bound Connections: Local bound connection (Single server)
Distributed bound connection (Multiple servers)
What is NOLOCK?
Using the NOLOCK query optimizer hint is generally considered good practice in order to improve concurrency
on a busy system. When the NOLOCK hint is included in a SELECT statement, no locks are taken when data is
read. The result is a Dirty Read, which means that another process could be updating the data at the exact time
you are reading it. There are no guarantees that your query will retrieve the most recent data. The advantage to
performance is that your reading of data will not block updates from taking place, and updates will not block your
reading of data. SELECT statements take Shared (Read) locks.
Can you say syntax of transaction? Begin Tran ……… Statements…… Commit Tran
Explicit transactions Each transaction is explicitly started with the BEGIN TRANSACTION statement and
explicitly ended with a COMMIT or ROLLBACK statement. Implicit transactions A new transaction is implicitly
started when the prior transaction completes, but each transaction is explicitly completed with a COMMIT or
ROLLBACK statement.
What is SQLCMD?
sqlcmd is enhanced version of the isql and osql and it provides way more functionality than other two options.
What is Activity Monitor and use of that? What are the permissions required to use Activity Monitor?
Activity Monitor is used to get information about users connections to the Database Engine and the locks that
they hold. Activity Monitor is used to troubleshooting database locking issues, and to terminate a deadlocked or
unresponsive process.
To use activity monitor:- VIEW SERVER STATE permission on Server and SELECT permission to the
sysprocesses & syslocks tables in the master database.
To Kill a Process:- sysadmin and processadmin database roles and permission are required to KILL a process.
What is Severity level in Event log? At what severity levels are written to the SQL Server log?
The Severity level tells how bad the error is. Above 19 Severity level errors are written to the SQL Server log.
When size of the log file is physically reduced? There are three events, which forces SQL Server
Database file to Shrink.
When a DBCC SHRINKDATABASE statement is executed.
When a DBCC SHRINKFILE statement referencing a log file is executed.
When an autoshrink operation occurs
If the server has completely failed, and how to all the backups restored onto a new server?
a) Build the Windows server and restore the domain logins to support Windows authentication.
b) Install SQL Server and any service-pack upgrades.
c) Put SQL Server in single-user mode and restore the master database.
d) Restore the msdb database.
e) If the model database was modified, restore it.
f) Restore the user databases.
Types of Clusters ?
In Windows we can configure two types of clusters
1. NLB (network load balancing) cluster for balancing load between servers. This cluster will not provide any
high availability. Usually preferable at edge servers like web or proxy.
2. Server Cluster: This provides High availability by configuring active-active or active-passive cluster. In 2 node
active-passive cluster one node will be active and one node will be stand by. When active server fails the
application will FAILOVER to stand by server automatically. When the original server backs we need to
FAILBACK the application
Quorum: A quorum is essentially a log file, similar in concept to database logs. Its purpose is to record any
change made on the active node, and should any change recorded here not get to the passive node
because the active node has failed and cannot send the change to the passive node over the network,
then the passive node, when it becomes the active node, can read the quorum file and find out what the
change was, and then make the change before it becomes the new active node.
Quorum drive: Is a logical drive on the shared array devoted to the function of storing the quorum.
Public and Private Networks: Each node of a cluster must have at least two network cards. One network card
will be connected to the public network, and the other to a private network. The public network is the
network that the SQL Server 2005 clients are attached, and this is how they communicate to a clustered
SQL Server 2005 instance. The private network is used solely for communications between the nodes of
the cluster. It is used mainly for heartbeat signal.
Heartbeat signal: In a cluster, the active node puts out a heartbeat signal, which tells the other nodes in the
cluster that it is working. Should the heartbeat signal stop then a passive node in the cluster becomes
aware that the active node has failed, and that it should at this time initiate a failover so that it can become
the active node and take control over the SQL Server 2005 instance.
The Virtual Server : When you create a cluster, one of the steps is to create a virtual cluster name and IP
address. This name and IP address is used by the active node to communicate with clients. Should a
failover occur, then the new active node uses this same virtual name and IP address to communicate with
clients.
Clustering Commands:
C:\>Cluster GroupTo listing status for all available resource group(Information of GROUP+NODE+STATUS)
C:\>cluster /cluster:node1 res -> To listing status for all available resources
C:\>cluster /cluster:node1 node -> To listing status for all available nodes
C:\>cluster /cluster:node1 group
Adding nodes in cluster:If u want add a node in 2005,we need to uninstall & rerun the setup,But from 2008,no
need to uninstall.,simple by click add node to sql server failover cluster in sql server installation center
ISCSI (Inter small computer system interface): Is a technology. It is used to show the drives in Node1 or
node2.
How to Failover the Cluster Group from Node1 to Node2 without any SQL Services Interruptions?
Sol 1 – Using CMD: Simply Issue the below command from your cmd prompt.
C:\>cluster group “cluster group” /move ->Moving resource group ‘cluster group’…
Questions are collected by K.V.N SUBBA REDDY
Sol2 – Using PS: Simply use Move-Cluster Group “Cluster Group”. You might get the below Error if you
are using Power shell for your Cluster for the First time.
PS C:\> Move-ClusterGroup “Cluster Group”.
Does SQL Server support Windows Server 2008 R2 Hyper-V Live migration? Yes.
What is a server "cluster"? A server cluster is a group of independent servers managed as a single system for
higher availability, easier manageability, and greater scalability.
When a cluster is recovering from a server failure, how does the surviving server get access to the failed
server's disk data? There are basically three techniques that clusters use to make disk data available to more
than one server:
Shared disks:
Mirrored disks
Shared nothing
What is "Wolfpack"? "Wolfpack" was the code name for Microsoft Cluster Server.
How is the quorum information located on the system disk of each node kept in synch?
The server cluster infrastructure ensures that all changes are replicated and updated on all members in a
cluster.
Can this method be used to replicate application data as well? No, that is not possible in this version of
clustering. Only Quorum information is replicated and maintained in a synchronized state by the clustering
infrastructure.
What is the difference between a geographically dispersed cluster and an MNS cluster?
A geographic cluster refers to a cluster that has nodes in multiple locations, while an MNS-based cluster refers
to the type of quorum resources in use. A geographic cluster can use either a shared disk or MNS quorum
resource, while an MNS-based cluster can be located in a single site, or span multiple sites.
What happens to a running Cluster if the quorum disk fails in Windows Server 2003 Cluster ?
1. Determine why the Quorum disk failed and repair.
2. Reprovision a new LUN, present it to the cluster, assign it a drive letter and format. Then start one node with
the /FQ switch and through cluadmin designate the new disk resource as the Quorum. Then stop and restart the
clussvc normally and then bring online the second node.
What happens to a running Cluster if the quorum disk fails in Windows Server 2008 Cluster ?
Cluster continue to work but failover will not happen in case of any other failure in the active node.
I know that a cluster node can contain several instances of SQL Server, but does a node represent a
single physical machine? Does a node can represent several virtual machines (deployed on a single
physical machine) ?YES
In a active/active/passive model, must all actives nodes have same installed databases ?
No, it is recommended that all versions will be same over all nodes
In a cluster, data are located on shared data. But what is the best thing to do in order to have backups of
the data?
I always copy backups another server for safety . But it node is failed over your backup jobs must running so
shared data should be there
Active vs. Passive Nodes: In a two-node SQL Server 2005 cluster, one of the physical server nodes is referred
to as the active node, and the other one is referred to as the passive node. When we refer to an active
node, we mean that this particular node is currently running an active instance of SQL Server 2005 and
that it is accessing the instance's databases, which are located on a shared data array. When we refer to
a passive node, we mean that this particular node is not currently in production and it is not accessing the
instance's databases. When the passive node is not in production, it is in a state of readiness, so that if
the active node fails, and a failover occurs, it can automatically go into production and begin accessing
the instance's databases located on the shared disk array. In this case, the passive mode then becomes
the active node, and the formerly active node now becomes the passive node
Shared Disk Array: Unlike non-clustered SQL Server 2005 instances, which usually store their databases on
locally attached disk storage, clustered SQL Server 2005 instances store data on a shared disk array. By
shared, we mean that both nodes of the cluster are physically connected to the disk array, but that only
the active node can access the instance's databases. There is never a case where both nodes of a
cluster are accessing an instance's databases at the same time. This is to ensure the integrity of the
databases.
This shared array must have at least two logical partitions. One partition is used for storing the clustered
instance's SQL Server databases, and the other is used for the quorumHow to take Offline/Online? Right Click
on Group--> Select Offline
What are the issues you faced? The node getting down
What are the minimum IP's required for Clustering? For Two Cluster environment we need 6 IP's
Is it possible to install Two Sql Server Instances in single Group? No, this feature is available in 2008
version
How many cluster nodes are support in SQLSERVER 2005 with windows 2003 server? 8 nodes
How many cluster nodes are support in SQLSERVER 2008 with windows 2008 server? 16 nodes
How many IP’s are required for 2 node cluster? 6 IP (2 external IP (public), 4 PrivateIP)
My SQL server instances are working fine on Node A but instances are not failover from Node B, what
could be the reason? Ans: Network down
Which cable is used for heart beat, Is it cross cable or plain cable? ANS: Cross cable
What are the different version on IIS that you have worked on ?
Windows Server 2008 - Windows Vista - Home Premium/ Ultimate - IIS 7.0
Windows Server 2003 - IIS 6.0
Windows XP Professional - IIS 5.1
“what is the difference between them ? ”
What are the permission settings are available for Virtual Directory ?
Below are the list of permission that can be set during virtual directory creation
1. Read 2. Run Scripts 3. Execute 4. Write 5. Browse
Which Tool is used for Remote IIS Debugging? Tool is: msvsmon.exe
This is located at: Install path\Microsoft Visual Studio 8\Common7\IDE\Remote Debugger\x86
What are the different authentication mode available for IIS Remote Debugging ?
For IIS Remote Debugging msvsmon supported two authentication mode
1. Windows Authentication 2. No-Authentication
How can we get the list of worker process running in IIS along with the Application pool name ?
By running iisapp.vbs script from command Prompt. Below are the steps:
1. Start > Run > Cmd
2. Go To Windows > System32
3. Run cscript iisapp.vbs
If there are multiple worker process running on IIS, then how can you attach a particular worker process
for application? Well, If there are multiple worker process running in IIS, it means I have to know the name of
my application pool. Then I can run cscript iisapi.vbs script to find out the process ID and Application Pool
name. Based on the process Id for particular application I have to attache the process from Visual studio IDE.
Why do we need to IIS Remote Debugging? There are following reasons where we can use remote
debugging
1. Your development server does not have IIS installed.
2. Development server and Build/Released/Hosting Server is different
3. Multiple users want to debug simultaneously.
Does IIS allows multiple user to Remote debug simultaneously? Yes. This is one of the great features of
msvsmon.exe . Each instance of the remote debugger has a unique server name. we can give an instance of the
remote debugger any server name. Now multiple user can able to access the server instance.
Can we have multiple web sites on IIS? Yes. IIS Can have multiple web sites and Each and every web sites
can have multiple virtual Directory. Note : Here web sites means the Root Node.
Where is the default location for IIS Log files? Its C:\WINDOWS\system32\LogFiles\W3SVC1
What is an ISAPI? ISAPI's are implemented using palin old DLLS used for compilation of IIS Pages,
Possible Uses for ISAPI Filters ISAPI filters can be registered with IIS to modify the behavior of a server.
For example, filters can perform the following tasks:
• Change request data (URLs or headers) sent by the client
• Control which physical file gets mapped to the URL
• Control the user name and password used with anonymous or basic authentication
• Modify or analyse a request after authentication is complete
• Modify a response going back to the client
• Run custom processing on "access denied" responses
• Run processing when a request is complete
• Run processing when a connection with the client is closed
• Perform special logging or traffic analysis.
• Perform custom authentication.
What are the different type of application pool available in IIS 7.0 ?
IIS 7.0 having two types of application pool. 1. DefaultAppPool (Integrated) 2. ClassicAppPool
What are the worker process for IIS 5.1 and IIS 6.0 ? For IIS 5.1 > aspnet_wp.exe For IIS 6.0 >
w3wp.exe
How can we set the default page for any web application ? We can set the default page for a web site from
the Virtual Directory Setting. How To : IIS Manager > Virtual Directory > Right Click > Properties > GoTo
Document Tab.
Is there any alternative way to host site on IIS rather than opening IIS Manager ?
Yes, We can directly host any site from the physical location of directory itself. Right Click on Physical Folder >
Properties > Web Sharing There you need to select > "Share This Folder" Option Button. Then it will ask for
alias name and other setting. Then Click on OK. To Validate : Run > Inetmgr > Check there should an virtual
directory with the same "Alias" name that you have given. If there are already one Virtual directory exist it will
showing you the error message while you providing the "Alias" name.
Questions are collected by K.V.N SUBBA REDDY
Can we create one Application Pool From Another Application Pool ?
Yes. We can. While creating Application Application Pool From IIS, there should have two option available first
one is for Default Setting and Another is for Existing Setting as template. We can select the second one and
from the drop down listed below we can select any on the Application Pool as Template,.
What are the main components of SVCHost.exe ? Main components for SVCHost.exe are WWW Publishing
Service (W3SVC) and Windows Activation Process (WAP) . W3SVC is the mediator of HTTP.SYS and Windows
Activation Process. Windows Activation Process maintain the worker processes.
What are the different way that we can hosted site on IIS ?
We can hosted site on IIS either creating Virtual Directory through IIS manager or Using Folder Web Sharing .
Apart from that Visual studio provide some inbuilt features to host the site on IIS like using Publishing the web
site , Using Copy web Tool or Creating Virtual directory during the creating the project by choosing Location as
HTTP
From where we can set the Session Time Out in IIS ? We can set the Session time out settings from the
Virtual Directory for that site. Right Click on Virtual Directory > Properties > Click on "Configuration" Button
Goto the "Option" Tab. There in Enable Session State Section you can configure the Session Timeout .
What are the different "Execution Permission" available for IIS for an virtual directory ?
There are three Execution Permission available.
1. None 2. Scripts Only 3. Scripts and Executable
From where you can change the ASP.NET Version in IIS ? This can be change from Virtual Directory
properties. First open Properties of Virtual Directory > GoTo ASP.NET Version Tab. There we can have change
the ASP.NET Version.
What is the latest version of IIS released with Windows 7? IIS 7.5
List of Error & Status codes in IIS 6.0? Status Code Type of Code
100 Series - Informational 400 Series - Client Error
200 Series - Success 500 Series - Server Error
300 Series - Redirection
What are the Different steps to be followed to get SSL(Secure Sockets Layer) for our Web Application ?
Intially we have to Generate a certificate request from our IIS
Now we have to request a certificate from the certificate authority(CA)
This CA is an entity which issues Digital Certificates.
Questions are collected by K.V.N SUBBA REDDY
After receiving the certificate we have to install that particular certificate on our Web Server using IIS
We have to use Secure Hyper Text Transfer Protocol(HTTPS) when accessing secure pages in our
application.
By this way we could make our web page as SSL protected. !!!
Which DLL is used to translate XML to SQL in Internet Information Services (IIS)? Sqlisapi.dll
What are the Different Authentication Methods(Using Windows Authentication) which are provided by IIS
?
Generally IIS provides four different kinds of Authentication Methods they are :
Anonymous Method If we select this authentication, IIS doesn't perform any authentication so that any one can
access the application.
Basic Metho If we select this method, the user who access the application should provide windows username
and password to access the application. Although this is sent through a network by transmitting direct text so it it
very insecure.
Digest Method This method is almost equal to Basic method but the difference is the password is hashed
before it is transmitted through out a network.
Windows Integrated Method In this the application uses the Kerberos protocol to validate(Authenticate) the
user. This uses a Secret key cryptography which provides strign authentication for Client/Server applications.
Client Certificate Mapping A certificate is a digitally signed statement that contains information about an entity
and the entity’s public key, thus binding these two pieces of information together. A trusted organization (or
entity) called a Certification Authority (CA) issues a certificate after the CA verifies that the entity is who it says it
is. Certificates can contain different types of data.
In which process does IIS runs? IIS runs in 2 modes (application isolation modes): 1. worker process isolation
mode is a new feature of IIS6.0. 2. IIS5.0 isolation mode – for compatibility with apps depending on IIS5.0
What is App Pool and App Domain? What is the difference between these two?
Application Pool is created the each and every website.
Application Domain is created to one domain Purpose.
What is the properties of App Pool in IIS? The properties are: 1.Recycling 2.Perfomance 3.Health
4.Identity
In which process does IIS runs (was asking about the EXE file)
Questions are collected by K.V.N SUBBA REDDY
inetinfo.exe is the Microsoft IIS server running, handling ASP.NET requests among other things. When an
ASP.NET request is received (usually a file with .aspx extension), the ISAPI filter aspnet_isapi.dll takes care of it
by passing the request to the actual worker process aspnet_wp.exe.
How to add multiple websites with same port no. and same ip address?
Using Host Headers In IIS Manager, right click on a Web Site
What is the settings that you need to do inorder an ASP code to run?
Enable Web Service Extensions from IIS Menu from the Left Panel of IIS Manager
If suppose every time I add a Web Site into my IIS Manager, the default port should take 8080? What will
you do?
The default port of 80, will be defined in IIS Metabase file located at C:\Windows\System32\inetsrv directory
then I will change the default port of 80 to 8080 in the metabase file
Any idea on NLB? Have you worked on it?
Yes, but just in a test environment, by enabling NBL through the LAN Properties
I will give you a scenario: If suppose we are having 50 Web sites running on a IIS Server, and suddenly
there is a load on CPU taking it to consume 90-100 % frequently. How will you troubleshoot to know
which application is taking this much CPU usage?Before answering what is the process which runs the
application in IIS?
w3wp.exe is the process which makes the applications runs in IIS.
First I will check in Task Manager(Run>Taskmgr) then i will see a number of w3wp.exe processes running.
I will check which one is taking the most CPU usage
I will make a note of the PID for that particular w3wp.exe
Then through command prompt, go to C:\Windows\System32>
in the prompt I will use the command IISApp.vbs , to find particular application name associated with that PID