• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/501

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

501 Cards in this Set

  • Front
  • Back
Permissions prior to SQL Server 2005
All permissions are granted directly to objects within a DB.
Permission in SQL 2005 and later
Define multiscope to which you can assign permissions. Because you grant permissions on a securable you can assign permissions to a securable at any scope.
Cmd that allows users to view metadata in a DB
GRANT VIEW DEFINITION to <user>
Ownership Chains
Each object within a DB as an owner associated to it. You can also build objects that reference other objects within a DB. The owner of each object that is referenced in a calling stack forms an ownership chain as code transits from on object to the next within the calling stack. So long as the owner of the object and any other objects that it references have the same owner you have an intact ownership chain.
First Sql server specific virus
slammer Trojan
Biggest potential threat to an instance
Through the use of features that expose an external interface or ad hoc execution capability. The two features with the greatest risk are:

OPENROWSET/OPENDATASOURCE

OLE Automation procedure
Features that should have been disabled unless specifically needed
Ad Hoc Distributed Queries

CLR Enabled

Cross Database Ownership Chaining CDOC

Database Mail

External Key Management

Filestream Access Level

OLE Automation Procedures

Remote Admin Connections

SQL Mail extended stored procedures
Use of OLE Automation procedure
Exist within SQL Server to provide some basic interoperability with previous versions.
CLR uses
With the inclusion of CLR in SQL server 2005 any application that need the services of Object Linking and Embedding automation should be re-written as Visual Basin .Net or C#.Net assemblies.
OLE
Object linking and embedding.
OPENROWSET and OPENDATASURCE
Expose you to attack by allowing applications to embed security credentials into code that spawns a connection to another instance.
CDOC
Cross Database Ownership

Allows you to transfer execution authority across DBs. When enabled the owner of the database contain the object being called effectively cedes control to another db owner.
SQL Server and Surface

"Configuration Manager"
Exists only in 2005. The functionality of it is provided by SQL Server Config Manager.
How do you configure an instance so only local connections are allowed
The TCP/IP provider enables connections to be created to the instance remotely. By disabling the TCP/IP provide, you can create only local connections to the instance.
What do you use to enable or disable feature for an instance
The sp_confgure system stored procedure is used to enable or disable feature.
Which logins cannot be used to authenticate to an instance
You cannot use logins that are mapped to a cert or asymmetric key to authenticate to an instance.
What db principal was create as a replacement for an application role
Loginless users are the replacement for an application role.
Impersonations
You can impersonate another principal to execute commands in a specific user context. You must have the IMPERSONATE permission granted to your account on the principal that you want to impersonate.
cmd to accomplish impersonation
{ EXEC / EXECUTE } AS <context_specification>

[;]

<context_specification>::=

{ LOGIN / USER } = 'name'
[ WITH { NO REVERT / COOKIE INTO @varbinary_variable } ]
/ CALLER
master key
Provides the basis for the encryption hierarchy within SQL and are required before you can creates a certificate or asymmetric key.
How many SMK?

How many DMK?
How many DMK?

SMK - single service master key for the entire instance

DMK - database master key within each DB
Service master key
Generated auto first time the instance is started.

Symmetric generated from the local machine key and encrypted using SQL Server Service account.
Database master key must be generated explicitly using what cmd
CREATE MASTER KEY ENCRYPTION BY PASSWORD = <Pass>
DMK usage
To protect ant certificates, symmetric keys, or asymmetric key stored in a DB.

Encrypted using Triple DES
Certificates
Based on X.509 standard used to authenticate the credentials of the entity supplying the cert. You can create either public or private certs.
Public Certs
Essentially a file that is supplied by a certificate authority that validates the entity using the cert.
Priv Certs
Generated by and used to protect data within an organization.
Signatures
Allow you to elevate a users permission but to provide a restriction such that the elevation occurs only when the user is executing a specified piece of code.
The process of signing code digitally
1) Create a DB master key

2) Create a certificate in the database

3) Create a user mapped to the certificate

4) Assign permission on an object or objects to the user

5) Execute ADD SIGNATURE on a module by the certificates
You are deploying a new server within Wide World Importers that will be running a SQ: server 2008 instance in support of a new application. Because of the feature support that is needed you will be installing SQL Server 2008 Enterprise. Which operating system will support your installation? (Choose all that apply)

a)Win 200 Server Enterprise SP4 or up

b)Win 2003 Server Enterprise

c)Win 2003 Server Enterprise SP2

d)Win Serve 2008 Enterprise
Correct C and D

A) SQL Server 2008 is not supported on Win 2000

B) SQL Server 2008 is supported on Win 2003 Enterprise but SP2
You are deploying SQL Server 2008 Express in support of a new Web-based application system does NOT support your installation?

A)Win XP home edition sp2

B)Window Server 2008 Server Core

C)Windows Server 2003 Enterprise SP2

D)Windows XP tablet edition SP2
B - correct

A) SQL Server 2008 is not supported on Win 2000

C) SQL Server 2008 is supported on Windows Server 2003 Enterprise SP2

D) SQL Server 2008 Express is supported on Win XP Tablet Edition SP2, but it is not the optimal operating system to use
Which edition support the entire feature set available within the SQL Server data Platform? Of these editions which editions are not licensed for production use?
Enterprise, Developer, and Evaluation editions have the entire set of features available within the SQ: Server 2008 data platform. Developer and Evaluation edition are not licensed for use in a production environment.
Which edition of SQL Server are designed as storage engines for embedded applications with limited hardware and feature support?
Express and Compact edition are designed as storage engines for embedded application and support only a single CPU, up to 1 GB of RAM and a maximum database size of 4 GB.
Margie's Travel is opening a new division to offer online travel bookings to their customers. Managers expect the traffic volume to increase rapidly, to the point where hundreds of users will be browsing offerings and booking travel at any given time. Management would also like to synchronize multiple copies of the database of travel booking to support both online and face-2-face operations. Which editions of SQL Server 2008 would be appropriate for Margie's Travel to deploy for their new online presence?

A) Express

B) Standard

C) Enterprise

D) Compact
Correct - B,C

A) Although Express could probably handle the user load it is not capable of acting as a publisher to synchronize multiple copies of a travel bookings database

D) Compact is not designed to be used as the storage engine for Web-base application
Margie's travel decided to minimize the cost and deploy SQL Server 2008 Standard to support the new online division. After a successful launch, managers are having a hard time managing business operations and need to deploy advanced analytics. Which edition of SQL Serve needs to be installed on the new server to support the necessary data analytics?

A) SQL Server 2008 Standard

B) SQL Server 2008 Express with Advanced Service

C) SQL Server 2008 Work group

D) SQL Server 2008 Enterprise
Correct - D

A,B,C) Only SQL Server 2008 Enterprise supports all the advanced analytics needed, such as OLAP and Data Mining
Which edition of SQL Server supports installing more than one instance of SQL Server on a machine?
Only SQL Server enterprise supports multiple instances of the same machine.
What are the authentication modes that SQL Server can be configured with?
You can configure SQL Server to operate under either Windows only or Windows and SQL Server authentication mode.
Wide world importers will be using the new FILESTREAM data type to store scanned images of shipping manifests. Which command must be executed against SQL Server instance before FILESTREAM data ca be stored?

A) ALTER DATABASE

B) DBCC

C) sp_configure

D) sp_filestream_configure
Correct - d

sp_filestream_configure is used to enable the filestream access level as well as configure the Windows share to be used
Contoso has implemented a new policy that requires the passwords on all service accounts to be changed every 30 day. Which tool should the Contoso database administrators use to change the service account passwords so that SQL Server service comply with the new policy?

A) Windows Service Control applet

B) SQL Server Management Studio

C)SQL Server Configuration Manager

D)SQL Server Surface Area Configuration Manager
Correct C

Only the SQL Server configuration Manager has the code to decrypt and re-encrypt the service master key used by SQL Server services correctly when the service account or password is changed
As part of the implementation of the new Web based booking system at Margie's Travel, customer should receive notices when a travel booking has been successfully saved. What technologies or feature can the developers at Margie's Travel use to implement notifications?(Select 2)

A) Notification Services

B) Database Mail

C) Microsoft Visual Studio. NET code libraries

C) Activity Monitor
Correct - B, A

B) Database Mail can be used to send messages to customers

C) Visual Studio .Net application can be created to use the mail libraries available within the .Net framework
The developers at Margie's Travel have decided to utilize Database Mail to send messages to their customers. The ability to send mail messages through a given profile needs to be restricted, but it must not require an approved user to specify a mail profile when sending messages. What settings need to be configured to meet these requirements?(Select 2)
Correct C,D: You need to configure mail profile to be private along with granting access to the mail profile for approved users

D) Designating a mail profiles as the default allows approved users to send mail using the profile without the need to specify the profile explicitly
What are the types of files that you create for databases and what are the commonly used file extensions?
You can create data and log files for a database. Data files commonly have either an .mdf or .ndf extension, whereas log files have an .ldf. extensions.
What is the purpose of the transaction log?
The transaction log records every change that occurs within a database to persist all transactions to a disk.
You have a reference database name OrderHistory, which should not allow any data to be modified. How can you ensure, with the least amount of effort, that users can only read data from the database?

A) Add all database users to the db_datareader role

B) Create views for all the tables and grant select permissions only on the views to database users

C)Set the database to READ_ONLY

D) Grant select permission on the database to all users and revoke insert, update and delete permission from all users on the database
C) Set the database to READ_ONLY
How do you restrict database access to members of the db_owner role and terminate all active transactions and connections at the same time?
You would execute the following cmd:

ALTER DATABASE <database name> SET RESTRICTED_USER WITH ROLLBACK IMMEDIATE
What backups can be executed for a database in each of the recovery models?
You can create full, differential, and file/filegroup backups in the Simple recovery model. The Bulk-logged recovery model allows you to execute types of backups, but you cannot restore a database to a point in time during an internal when a minimally logged transaction is executing. All types of backups can be executed in the Full recovery mode.
You are the database administrator at Blue Yonder Airline and are primarily responsible for the Reservations database, which runs on a server running SQL Server 2008. In addition to customers booking flights through the company's Web site, flights can be booked with server partners. Once an hour, the Reservations database receives multiple files from partners, which are then loaded into the database using the Bulk Copy Program (BCP) utility. You need to ensure that you can recover the database to any point in time while also maximizing the performance of import routines. How would you configure the database to meet business requirements?

A) Enable AUTO_SHRINK

B) Set PARAMETERIZATION FORCED on the database

C) Configure the database in the Bulk-logged recover model

D) Configure the database in the Full recovery model
D) Correct

The full recovery model ensures that you can always recover the database to any point in time.
Which option should be enabled for all production databases?
You should set the PAGE_VERIFY CHECKSUM option for all production databases.
What checks does DBCC CHECKDB perform?
DBCC CHECKDB checks the logical and physical integrity of every table, index, and indexed view within the database, along with the contents of every indexed view, page allocations, Service broker data, and database catalog.
Which cmd are executed when you run the DBCC CHECKDB command?

A) DBCC CHECKTABLE

B) DBCC CHECKIDENT

C) DBCC CHECKCATALOG

D) DBCC FREEPROCCACHE
A and C

DBCC CHECKDB executes DBCC CHECKTABLE

DBCC CHECKALLOC

DBCC CHECKCATALOG
What are the three new options that you can configure for columns, rows, or pages within a table?
You can designate columns as SPARSE to optimize the storage of NULLs. You can apply the FILESTREAM property to a VARBINARY(MAX) column to enable the storage of documents in a directory on the operating system that exceed 2 GB. Rows can be compressed to fit more rows on a page. Pages can be compressed to reduce the amount of storage space required for the table, index, or indexed view.
Which options are not compatible with row or page compression? (2)

A) A column with a VARCHAR(MAX) data type

B) A sparse column

C) A table with a column set

D) A VARBINARY(MAX) column with he FILESTREAM property
A and C

ROWGUIDCOL

IDENTITY

FILESTREAM

Are not allowed to be used with SPARSE columns. Because the NOT FOR REPLICATION option is applied to an identity column, you cannot have a column that is SPARSE, which also has the NOT FOR REPLICATION option, In addition, a column must allow NULLs to be designated as a sparse column.
What is the difference between a primary key and a unique constraint?
A primary key does not allow NULLs.
What restrictions does the parent table have when creating a foreign key?
The parent table must have a primary key that us used to define the relationship between the parent and child tables. In addition, if the parents primary key is defined on multiple columns, all the columns must exist in the child table for the foreign key to be created
Columns with which properties cannot be sparse columns?(2)

A) FILESTREAM

B) NULL

C) NOT FOR REPLICATION

D) NULL
A and C

ROWGUIDCOL, IDENTITY, and FILESTREAM are not allowed to be used with SPARSE columns. Because the NOT FOR REPLICATION option is applied to an identity column, you cannot have a column that is SPARSE, which also has the NOT FOR REPLICATION option. In addition, a column must allow NULLs to be designated as a sparse column
What type of structure does SQL use to construct an index?
SQL Server uses a B-tree structure for indexes.
What are the three type of pages within an index?
And index can contain

root
intermediate
leaf pages

An index has a single root page defined at the top of the index structure. An index can have one or more levels of intermediate pages, but it is optional. The leaf pages are the lowest-level page within an index.
Fabrikam store product info in the following table:

CREATE TABLE Products.Product

(
ProductID INT INDENTITY(1,1,),
ProductName VARCHAR(30) NOT NULL,
SKU CHAR(8) NOT NULL,
Cost MONEY NOT NULL,
ListPrice MONEY NOT NULL,
ShortDescription VARCHAR(200) NOT NULL,
LongDescription VARCHAR(MAX) NULL,
CONSTRAINT pk_product PRIMARY KEY CLUSTERED (ProductID)
)


The table is queried either by ProductID, ProductName, or SKU. The application displays ProductName, SKU, ListPrices, and ShortDescription. The ProductID is also returned to facilitate any subsequent operations. Several thousand new products were recently added and now you have performance degradation. Which index should you implement to provide the greater improvement in query performance?

A) CREATE NONCLUSTERED INDEX idx_product ON Products.Products (ProductID, ProductName, SKU)

B) CREATE NONCLUSTERED INDEX idx_product ON Products.Products (ProductName)

C) CREATE NONCLUSTERED INDEX idx_product ON Products.Products (ProductName) INCLUDE (SKY, ListPrice, ShortDescription, ProductID)

D)A)CREATE NONCLUSTERED INDEX idx_product ON Products.Products (ProductName, SKU, ProductID, ListPrice, ShortDescription)
Correct answer C

C) This index allows SQL Server to search on ProductName and return the entire result set for the query from the index instead of the table. In addition, the index is kept small by having only the ProductName column define the B-tree and upper levels of the index

A) Because the optimizer considers only the first column in an index when determining the query plan, unless the query returned only ProductID, ProductName and SKU, it is very unlikely that SQL Server would use this index over the primary key on the table

B) Although this index allows SQL Server to locate queries that searched in ProductName, SQL Server must access the table to return the remainder of the data for the result set

D) Although SQL Server could use this index to satisfy queries entirely from the index every level of the index would be built on a 250 KB key causing a much larger set of pages to be read
What if two indexes have at least one column in common?
SQL Server can join the two indexes to satisfy a query.
What is the difference between a clustered and a nonclustered index?
2A clustered index imposes a sort order on the data pages in the table. A nonclustered index does not impose sort order
How does the FILLFACTOR option affects the way an index is built?
The FILLFACTOR option reserves space on the intermediate and leaf levels of the index.
A DB at a retail company that supplies blanks and kits to pen turners. You are designing a database to store characteristics of the products offered. Each product has a variety of characteristics, but not all products have the same set of characteristics. You are planning the index strategy for the database. The most common query will be the following

SELECT a.ProductName, b.ProductType, b.WoodSpecies, b.Color

FROM Product a INNER JOIN ProductAttributes b ON a.ProductID = b.ProductID WHERE b.Color = "X"

Not all products have a Color attribute. Which index strategy would be the most efficient



A) A nonclustered index on Color

B) A nonclustered index on Color that include the ProductType and WoodSpecies columns

C) A filtered, nonclustered index on Color

D) A filtered, nonclustered index on Color that includes the ProductType and WoodSpecies column
Correct D) Because the Color column is nullable, the most efficient index for this query includes only the values that were not nullable. In addition, by including the ProductType and WoodSpecies columns, the query could be satisfied entirely by the index
What is the difference between the REBUILD and REORGANIZE options of ALTER INDEX?
REBUILD de-fragments all levels of an index

REORGANIZE de-fragments only the leaf level of an index
What happens when an index is disabled?
An index that is disabled is no longer used by the optimizer. In addition, as data changes in the table any disabled index is not maintained.
You are in charge of building the process that loads approximately 150gb of data into the enterprise data warehouse every month. Every table in you data warehouse has at least eight indexes to support data analysis routines. You want to load the data directly into the tables as quickly as possible. Which operation provides the best performance improvement with the least amount of administrative effort?

A) USE a BULK INSERT cmd

B) Drop and re-create the indexes

C) Disable and enable indexes

D) Use integration services to import the data
Correct C) By disabling the indexes prior to the load, you avoid all the overhead required to maintain indexes. By using the disable/enable method, you do not have to maintain scripts to recreate the indexes following the data load

A) Although a BULK INSERT statement can load data quickly, if the indexes exist on the table during the data load operation, you incur a very large overhead for the writes to indexes

B) Loading data to a table without any indexes and the creating the indexes after the load is more efficient than loading whit the indexes in place. However, dropping and recreating the indexes takes more effort than disabling and re-enabling

D) It is more efficient to load data into tables that do not have indexes. Integration Services cannot overcome the overhead of index maintenance during a load operation
Before you can create a full text index, which structure do you need to create?
Full text indexes are contained within full text catalogs. Therefore, you must create a full text catalog prior to creating a full text index.
What do you need to specify to create a full text index on documents stored within a FILESTREAM?
SQL Server stores the documents within a VARBINARY(MAX) column with the FILESTREAM property enabled. In order to create a full text index, you need to also specify a type column that designates what type of document is stored in the VARBINARY(MAX) column to load the appropriate filter for the word breaker in use.
Your are the database administrator at your company. You need to enable the sales support team to perform fuzzy searches on product descriptions. Which actions do you need to perform to satisfy user needs with the least amount of effort?

A) Create a full text catalog specifying the filegroup for backup purposes and the root path to store the contents of the catalog on the file system

B) Create a full text catalog and specify the filegroup to store the contents of the catalog

C) Create a full text index on the table of product descriptions for the description column and specify NO POPULATION

D) Create a full text on the table of product description for the description column and specify CHANGE_TRACKING AUTO
correct B and D

B) Full text catalogs contain full text indexes and the contents of the indexes are stored within the database in SQL Server 2008.

D) CHANGE_TRACKING AUTO option enables SQL Server to populate the full text index upon initial creating and migrate changes automatically to underlying data into the index.
You want to configure your full text indexes such that SQL server migrate changes into the index as quickly as possible with the minimum amount of administrator effort. Which command should you execute?

A) ALTER FULLTEXT INDEX ON <table_name> START FULL POPULATION

B) ALTER FULLTEXT INDEX ON <table_name> START INCREMENTAL POPULATION

C) ALTER FULLTEXT INDEX ON <table_name> SET CHANGE_TRACKING AUTO

D) ALTER FULLTEXT INDEX ON <table_name> START UPDATE POPULATION
Correct C

When the CHANGE_TRACKING argument is set to AUTO, SQL Server automatically updates the full text index as changes to underlying data occur. In AUTO mode, no administration intervention is required either manually or via a scheduled job
Which predicate performs fuzzy searching by default?
FREETEXT and FREETEXTTABLE predicates perform wildcard searches by default
Which predicate is used to perform proximity and synonym searches?
CONTAINS and CONTAINSTABLE are used for proximity, thesaurus, and inflectional searches
You want to search for two terms based on proximity within a row. Which full text predicates can be used to perform proximity searches?(2)

A) CONTAINS

B) FREETEXT

C) CONTAINSTABLE

D) FREETEXT
A and C
You want to perform a proximity search based on a weighting value for the search argument. Which options for the CONTAINSTABLE predicate should you use?

A) FORMSOF with the THESAURUS keyword

B) FORMSOF with the INFLECTIONAL keyword

C) ISABOUT

D) ISABOUT with the WEIGHT keyword
D
What data types cannot be used with partition functions?
text
ntext
image
xml
varbinary(max)
varchar(max)
CLR data types
Transact-SQL data type
What is the max number of partitions allowed for a table?
1000
What is the max number of boundary points allowed per table?
999
How many groups can you specify if you use the ALL keyword when defining a partition scheme?
You can specify exactly one filegroup when using the ALL keyword.
Can you create a new filegroup at the same time that you are creating a partition scheme?
No. Any filegroups that you specify in CREATE PARTITION SCHEME statement must already exist in the DB.
What property must be set to use a computed column as a partitioning key?
A computed column must be PERSISTED.
Which clause of the CREATE TABLE or CREATE INDEX statements is used to partition the object?
The ON clause is used to specify the storage structure, filegroup, or partition scheme, for the table or index.
Which operators are used to add or remove boundary point from a partition function?
SPLIT add new boundary points

MERGE removes boundary point
Which operator is used to remove a boundary point?
The SWITCH operator is used to move partitions between tables
What are the data formats that BCP supports and the cmd line switches for each format?
BCP can work with data in either a character or native format. The -c switch designates character mode while the -n switch is used for native mode.
Which parameter do you specify to export data using a query?
The queryout parameter is used to export the result set of a query.
The Import and Export Wizard is based on which feature of SQL Server?
The Import and Export Wizard uses a subset of the SSIS feature.
Which sources and destinations is the Import and Export Wizard capable of using?
You can define any source or destination for which you have an OLE DB provider.
You want to import data into the Orders table. The table has triggers and check constrains that you want to be checked to guarantee integrity. You choose to use the BCP utility and specify the -h "CHECK_CONSTRAINTS, FIRE_TRIGGERS" hint to accomplish your task. Which permission must be in place?(2)

A) SELECT permission on the Orders table

B) ALTER TABLE on the Orders table

C) INSERT permission on the Orders table

D) A member of the bulkadmin role
A,C

If you are importing data, you need SELECT, INSERT, and ALTER TABLE permissions on the destination. However if you do not disable triggers and check constraints you don't need ALTER TABLE permissions.
You are performing a migration on the Order database at Contoso from Oracle to SQL Server. The Order database contains several hundred tables. The CustomerAddress table has an XML column named AddressBook. What is the most efficient, least intrusive way to move the data to the new SQL Server database?

A) Move the Order database from Oracle to SQL Server using replication

B) Unload the data using Oracle utilities and load the data into SQL Server using BCP

C) Move the Order database using the import and export wizard

D) Move the data form Oracle to SQL Server using the OPENROWSET function
C

The import and export wizard allows you to connect to Oracle, select multiple tables, and move the data to SQL server in a single operation.
You work as the network administrator at CertKiller.com. CertKiller.com has acquired an enterprise application that runs SQL Server 2008. The stored procedures that the application uses make use of the EXECUTE AS clause that makes use of the Microsoft Windows accounts.
A new CertKiller.com security policy requires that all enterprise applications must run under the context of a service account. It is imperative that this account complies with the company policy that states all accounts must have the least amount of privileges whilst allowing duties to be carried out. Consequently this service account must have as little privileges as possible. You have received instructions to configure the SQL Server service to be used in a suitable context for the installation of the new enterprise application.

What should you do?

A. You should consider running the SQL Server service under the domain user account.

B. You should consider running the SQL Server service under the local system account.

C. You should consider running the SQL Server service under the local Administrator account.

D. You should consider running the SQL Server service under the local service account
Answer: A
You work as a database administrator at CertKiller.com. CertKiller.com is using a SQL Server 2008 instance. The SQL Server 2008 instance contains a database named CK_DB. CK_DB has its data file and the transaction log file on drive D. You have received instructions to move both the data file and the transaction log file to drive G.

What should you do?


A. You should consider adding the following Transact-SQL statement:

ALTER DATABASE CK_DB SET RESTRICTED_USER WITH ROLLBACK_IMMEDIATE;

B. You should consider moving the data file and use the following Transact-SQL statement:

ALTER DATABASE CK_DB MODIFY FILE(NAME = CK_DB_Data, FILENAME = mdf');
ALTER DATABASE CK_DB SET MULTI_USER;

C. You should consider adding the following Transact-SQL statement:

ALTER DATABASE CK_DB SET OFFLINE WITH ROLLBACK_IMMEDIATE;
ALTER DATABASE CK_DB mdf';
ALTER DATABASE CK_DB SET ONLINE;

D. You should consider moving the data file and then start the SQL Server service with the following Transact-SQL statement:

IEXEC sp_attach_single_file_db @dbname = N' CK_DB ',@physname = N'v:\SQLServer\
CK_DB_Data.mdf';

E. You should consider moving the data file and transaction log file and then start the SQL Server service with the following Transact-SQL statement:

EXEC sp_attach_db @dbname = N' CK_DB ',@filename1 = N'G:\SQLServer\
CK_DB_Data.mdf',@filename2 = ldf';

F. You should consider moving the data file and transaction log file and then start the SQL Server service with the following Transact-SQL statement:

EXEC sp_attach_db @dbname = N' CK_DB ',@filename1 = N'G:\SQLServer\
CK_DB_Data.mdf',@filename2 = N 'g:\SQLServer \CK_DB_log.ldf';\
Answer: F
How do you detect and log corrupt pages?
Execute

ALTER DATABASE <dbname> SET PAGE_VERIFY CHECKSUM
Orders DB is critical to company operations and is set to the full recovery model. Daily backups are ran at 1am, differential backups every four hours beginning at 5am and transaction log backups every fie min. If the Orders DB is to become damaged and go off-line, what is the first step in the restore process?

A) Restore the most recent full backup with the NORECOVERY option

B) Restore the most recent differential backup with the NORECOVERY option

C) Back up the transaction log with the NO_TRUNCATE option

D) Back up the transaction log with the TRUNCATE_ONLY option
Answer C

The first step of every restore operation is to backup the tail of the log. However the BACKUP LOG cmd write an entry into to the transaction log as well as the master data file. If the db is offline, you can backup the transaction log but not wrote to the master data file. The NO_TRUNCATE option allows you to back up the transaction log without writing to the master data file.

A) If you start with a restore of the most recent full backup you lose any transactions that have not yet been backed up.

B) You cannot start a restore sequence with a differential backup.

D) The TRUNCATE_ONLY option of the BACKUP LOG cmd no longer exists in SQL Server 2008.
Which two features are not compatible with DB snapshots?
FILESTREAM

full text indexes
Prior to reverting a db using a DB snapshot, what must be done?
You must drop all DB snapshots except the DB snapshot being used as the source for the RESTORE cmd.
What are the two parts of an endpoint?
An endpoint has a transport defined as either TCP or HTTP and has a payload defined as TSQL, SERVICE_BROKER, DATABASE_MIRRORING or SOAP
What are the 3 states of an endpoint, and what is the difference between each state?
STARTED - listens for and allows connections

STOPPED - listens for connections and returns error messages

DISABLED - does not respond to any request
What authority must be granted before an endpoint allows a connection request?
To allow a connection request, the log in that is being used must have been granted the CONNECT permission on the endpoint.
What types of authentication are available for Service Broker and Database Mirroring endpoints?
NTML

Kerberos

NEGOTIATE
What are the two universal arguments for TCP endpoints?
You are required to specify a port for the endpoint to listen on.
msde

cdoc
Microsoft database engine

cross database ownership changing
OPENROWSET and OPENDATASOURCE
Expose you to attack by allowing applications to embed security credentials into code that spawns a connection to another instance.
SQL Server and Surface

"Configuration Manager
Exist only in 2005. The functionality of it is provided by SQL Server Config Manager.
cmd to accomplish impersonation
{ EXEC / EXECUTE } AS <context_specification>

[;]

<context_specification>::=

{ LOGIN / USER } = 'name'
[ WITH { NO REVERT / COOKIE INTO @varbinary_variable } ]
/ CALLER
How many SMK?

How many DMK?
SMK - single service master key for the entire instance

DMK - database master key within each DB
Certificates
Based on X.509 standard used to authenticate the credentials of the entity supplying the cert. You can create either public or private certs.
What are the minimum hardware requirements for SQL Server 2008 32 bit?
Processor: P3 or higher
Processor Speed: 1 GHz or more
Memory: 512 MB
What are the minimum hardware requirements for SQL Server 2008 64 bit?
Processor: Itanium, Opteron, Athlon or Xeon/Pentium with EM64t support
Processor Speed: 1.6 GHz or more
Memory: 512 MB
The operating systems supported for all editions of SQL Server are?
Windows Server 2008 Standard or higher
Windows Server 2003 SP2 or higher
The operating systems supported for SQL Developer, Evaluation and Express are?
Windows XP Professional SP2 or higher
Windows Vista Home Basic or higher
SQL Server Express is supported on?
Windows XP Home Edition SP2 or higher
Windows XP Home Reduced Media Edition
Windows XP Tablet Edition SP2 or higher
Windows XP Media Center 2002 SP2 or higher
Windows XP Professional Reduced Media Edition
Windows XP Professional Embedded Edition Feature Pack 2007 SP2
Windows XP Professional Embedded Edition for Point of Service SP2
Windows Server 2003 Small Business Server Standard Edition R2 or higher
What version of Server 2008 is SQL 2008 not supported on and why?
SQL Server 2008 is not supported on Windows Server 2008 Server Core. Windows Server.

2008 Server Core is not supported because the .NET Framework is not supported on Server.

Core. SQL Server 2008 relies on .NET Framework capabilities to support FILESTREAM.

SPATIAL, and DATE data types, along with several additional features.
What editions is SQL Server 2008 available in?
Enterprise
Standard
Workgroup
Express
Compact
Developer
Evaluation
How do the developer and evaluation editions differ from the enterprise edition?
They contain the same functionality, but cannot be run in a production environment.
Which editions of SQL Server are designed as storage engines for embedded applications with limited hardware and feature support?
Express and Compact editions are designed as storage engines for embedded applications and support only a single CPU, up to 1 GB of RAM, and a maximum database size of 4 GB.
How many CPUs are supported by the Standard, Workgroup, Express and Compact editions?
Standard: 4
Workgroup: 4
Express: 1
Compact: 1
What database size is supported by the Standard, Workgroup, Express and Compact editions?
Standard: Unlimited
Workgroup: Unlimited
Express: 4 GB
Compact: 4 GB
What RAM size is supported by the Standard, Workgroup, Express and Compact editions?
Standard: Unlimited
Workgroup: Unlimited
Express: 1 GB
Compact: 1 GB
Which versions among Standard, Workgroup, Express and Compact allow the use of SQL Server Management Studio?
Standard: Yes
Workgroup: Yes
Express: Separate Download
Compact: No
Which versions among Standard, Workgroup, Express and Compact allow for full text search?
Standard: Yes
Workgroup: Yes
Express: Advanced services only
Compact: No
Which versions among Standard, Workgroup, Express and Compact allow for partitioning?
Standard: No
Workgroup: No
Express: No
Compact: No
Which versions among Standard, Workgroup, Express and Compact allow for parallel operations?
Standard: No
Workgroup: No
Express: No
Compact: No
Which versions among Standard, Workgroup, Express and Compact allow for multiple instances?
Standard: No
Workgroup: No
Express: No
Compact: No
Which versions among Standard, Workgroup, Express and Compact allow for database snapshots?
Standard: No
Workgroup: No
Express: No
Compact: No
Which versions among Standard, Workgroup, Express and Compact allow for scalable shared databases?
Standard: No
Workgroup: No
Express: No
Compact: No
Which versions among Standard, Workgroup, Express and Compact allow for index views?
Standard: No
Workgroup: No
Express: No
Compact: No
Which versions among Standard, Workgroup, Express and Compact allow for log compression?
Standard: No
Workgroup: No
Express: No
Compact: No
Which versions among Standard, Workgroup, Express and Compact allow for clustering?
Standard: 2 nodes
Workgroup: No
Express: No
Compact: No
Which versions among Standard, Workgroup, Express and Compact allow for database mirroring?
Standard: single-thread
Workgroup: No
Express: No
Compact: No
Which versions among Standard, Workgroup, Express and Compact allow for online operations?
Standard: No
Workgroup: No
Express: No
Compact: No
Which versions among Standard, Workgroup, Express and Compact allow for resource governor?
Standard: No
Workgroup: No
Express: No
Compact: No
Which versions among Standard, Workgroup, Express and Compact allow for backup compression?
Standard: No
Workgroup: No
Express: No
Compact: No
Which versions among Standard, Workgroup, Express and Compact allow for hot add memory/CPU?
Standard: No
Workgroup: No
Express: No
Compact: No
Which versions among Standard, Workgroup, Express and Compact allow for Data Encryption?
Standard: Limited
Workgroup: Limited
Express: Limited
Compact: Password-based only
Which versions among Standard, Workgroup, Express and Compact allow for Change Data Capture?
Standard: No
Workgroup: No
Express: No
Compact: No
Which versions among Standard, Workgroup, Express and Compact allow for Data Compression?
Standard: No
Workgroup: No
Express: No
Compact: No
Which versions among Standard, Workgroup, Express and Compact allow for Policy-based management?
Standard: Yes
Workgroup: No
Express: No
Compact: No
Which versions among Standard, Workgroup, Express and Compact allow for Performance Data Collection?
Standard: Yes
Workgroup: No
Express: No
Compact: No
Which versions among Standard, Workgroup, Express and Compact allow for CLR?
Standard: Yes
Which versions among Standard, Workgroup, Express and Compact allow for XML?
Standard: Native
Workgroup: Native
Express: Native
Compact: Stored as text
Which versions among Standard, Workgroup, Express and Compact allow for Spatial Data?
Standard: Yes
Which versions among Standard, Workgroup, Express and Compact allow for Stored procedures, triggers and views?
Standard: Yes
Workgroup: Yes
Express: Yes
Compact: No
Which versions among Standard, Workgroup, Express and Compact allow for Merge Replication?
Standard: Yes
Workgroup: Yes
Express: Subscriber only
Compact: Subscriber only
Which versions among Standard, Workgroup, Express and Compact allow for Transactional Replication?
Standard: Yes
Workgroup: Subscriber only
Express: Subscriber only
Compact: No
Regarding SSIS ,which versions among Standard, Workgroup, Express and Compact have an Import/Export Wizard?
Standard: Yes
Workgroup: Yes
Express: NA
Compact: NA
Regarding SSIS ,which versions among Standard, Workgroup, Express and Compact have a Package Designer?
Standard: Yes
Workgroup: Yes
Express: NA
Compact: NA
Regarding SSIS ,which versions among Standard, Workgroup, Express and Compact support Data Mining?
Standard: No
Workgroup: No
Express: NA
Compact: NA
Regarding SSIS ,which versions among Standard, Workgroup, Express and Compact support Fuzzy grouping/lookup?
Standard: No
Workgroup: No
Express: NA
Compact: NA
Regarding SSIS ,which versions among Standard, Workgroup, Express and Compact support term extraction/lookup?
Standard: No
Workgroup: No
Express: NA
Compact: NA
Regarding SSIS ,which versions among Standard, Workgroup, Express and Compact support OLAP processing?
Standard: No
Workgroup: No
Express: NA
Compact: NA
Regarding SSRS ,which versions among Standard, Workgroup, Express and Compact support Microsoft Office Integration?
Standard: Yes
Workgroup: Yes
Express: Advanced Services Only
Compact: NA
Regarding SSRS ,which versions among Standard, Workgroup, Express and Compact support report builder?
Standard: Yes
Workgroup: Yes
Express: Advanced Services Only
Compact: NA
Regarding SSRS ,which versions among Standard, Workgroup, Express and Compact support Scale-out reporting?
Standard: No
Workgroup: No
Express: No
Compact: NA
Regarding SSRS ,which versions among Standard, Workgroup, Express and Compact support Data-driven subscriptions?
Standard: No
Workgroup: No
Express: No
Compact: NA
Regarding SSAS-OLAP support ,which versions among Standard, Workgroup, Express and Compact have support Linked measures/dimensions?
Standard: No
Workgroup: No
Express: NA
Compact: NA
Regarding SSAS-OLAP support ,which versions among Standard, Workgroup, Express and Compact have support Perspectives?
Standard: No
Workgroup: No
Express: NA
Compact: NA
Regarding SSAS-OLAP support, which versions among Standard, Workgroup, Express and Compact have support for Partitioned cubes?
Standard: No
Workgroup: No
Express: NA
Compact: NA
Regarding SSAS-Data Mining support, which versions among Standard, Workgroup, Express and Compact have support for Time series?
Standard: No
Workgroup: No
Express: NA
Compact: NA
Regarding SSAS-Data Mining support, which versions among Standard, Workgroup, Express and Compact have support for Parallel processing and prediction?
Standard: No
Workgroup: No
Express: NA
Compact: NA
Regarding SSAS-Data Mining support, which versions among Standard, Workgroup, Express and Compact have support for Advanced mining algorithms?
Standard: No
Workgroup: No
Express: NA
Compact: NA
In addition to the core database engine technologies, SQL Server 2008 Enterprise supports Service Broker for asynchronous processing.
summary
Which core components of SQL, which run as services, require dedicated service accounts?
Database Engine and SQL Server Agent.
What is a collation sequence?
A collation sequence defines the character set that is supported, including case sensitivity, accent sensitivity, and kana sensitivity.
What are the two authentication modes that you can set for SQL Server authentication?
Windows Only (integrated security) or Windows and SQL Server (mixed mode).
Why can you not use the Windows Service Control Applet to change service accounts or service account passwords?
SQL Server Configuration Manager needs to be used, because it includes the code to regenerate the service master key that is critical to the operation of SQL Server services.
What is an enumeration request and when would you disable responses?
By disabling enumeration responses by setting the Hide Instance to Yes, you prevent someone from using discovery techniques to locate servers running SQL Server for a possible attack.
What is database mail?
Database mail enables a computer running SQL to send outbound mail messages. It uses SMTP rather than MAPI.
What are the two types of profiles that you can configure within Database Mail?
Either a public or private profile. A public profile can be accessed by any user with the ability to send mail. A private profile can be accessed only by those users who have been granted access to the mail profile explicitly.
How is the SQL Server Agent related to Database Mail?
Database Mail utilizes the services of SQL Server Agent to send messages as a background process. If SQL Server Agent is not running, messages will accumulate in a queue within the Msdb database.
What are the two file types that SQL uses?
Data and Transaction log files. Data files are responsible for the long-term storage of all the data within a database. Transaction log files are responsible for storing all the transactions that are executed against a database.
When you create a database, it should have three files and two filegroups; what are they?
You should have a file with an .mdf extension within a filegroup named PRIMARY, a file with an .ndf extension in a filegroup with any name that you choose, and the transaction log with an .ldf extension.
After you create a database, why should you mark the second database as the default filegroup?
By changing the default filegroup, you ensure that any objects you create are not accidentally placed on the primary filegroup and that only the system objects for the database reside on the primary filegroup--reduces the possibility of introducing corruption.
What is the command to change the default filegroup?
ALTER DATABASE <database name> MODIFY FILEGROUP <filegroup name> DEFAULT
What determines the maximum transaction throughput for any database?
The amount of data per second that SQL Server can write to the transaction log.
What is the FILESTREAM feature?
FILESTREAM feature allows you to associate files with a database. The files are stored in a folder on the operating system, but are linked directly into a database where the files can be backed up, restored, full-text-indexed, and combined with other structured data.
What is the filestream.hdr file?
It is a system file that is created to manage the files subsequently written to the filestream folder.
What is unique about the FILENAME property defined for a FILESTREAM filegroup?
The initial part of the folder path definition must exist; however, the last folder in the path defined cannot exist and is created automatically.
In addition to temporary objects, what does SQL Server use the tempdb for?
Worktables used in grouping/sorting operations, worktables to support cursors, the version store supporting snapshot isolation level, and overflow for table variables. You can also cause index build operations to use space in tempdb.
Every database in SQL server has a recovery model property; which recovery models are available?
Full

Bulk-logged

Simple
In the full recovery model, what changes are logged to the transaction logs and how long are the changes retained in the transaction logs?
All changes made, using both data manipulation language (DML) and data definition language (DDL), are logged to the transaction log. Changes are retained in the transaction log indefinitely and are removed only by executing a transaction log backup.
What are the operations that are performed in a minimally logged manner with the database set in the Bulk-logged recovery model?
BCP

BULK INSERT

SELECT. . .INTO

CREATE INDEX

ALTER INDEX. . .REBUILD
How does the simple recovery model differ from the full recovery model?
A database in the Simple recovery model logs operations to the transaction log exactly as the Full recovery model does. However, each time the database checkpoint process executes, the committed portion of the transaction log is discarded. A database in the Simple recovery model cannot be recovered to a point in time because it is not possible to issue a transaction log backup for a database in the simple recovery model.
What is the command to set the recovery model of a database?
ALTER DATABASE database_name SET RECOVERY {FULL / BULK_LOGGED / SIMPLE }
What types of backup (Full, Differential, Trans log) are available for a database in the Full recovery model?
Full: Yes
Differential: Yes
Transaction Log: Yes
What types of backup (Full, Differential, Trans log) are available for a database in the Bulk Logged model?
Full: Yes
Differential: Yes
Transaction Log: Yes/No minimally logged
What types of backup (Full, Differential, Trans log) are available for a database in the Simple recovery model?
Full: Yes
Differential: Yes
Transaction Log: No
What is the PAGE_VERIFY CHECKSUM?
Allows you to discover and log damaged page files (default configuration of SQL does not check for damaged pages).
What happens when a damaged page is encountered?
If PAGE_VERIFY CHECKSUM is not enabled, database could go offline. If enabled, an 824 error is returned to the calling application and logged to the SQL Server error log and Windows Application Event log and the ID of the damaged page is logged to the suspect_pages table in the msdb database.
What happens if AUTO_CLOSE is enabled?
When the last connection to a database is closed, SQL Server shuts down the database and releases all resources related to the database. When a new connection is made to the database, SQL Server starts up the database and begins allocating resources.
What happens if AUTO_SHRINK is enabled?
SQL Server periodically checks the space utilization of data and transaction log files. If the space checking algorithm finds a data file that has more that 25 percent free space, the file automatically shrinks to reclaim disk space.
What happens if AUTO_CREATE_STATISTICS is enabled?
SQL Server automatically creates statistics that are missing during the optimization phase of query processing.
What happens if AUTO_UPDATE_STATISTICS is enabled?
Updates out-of-date statistics during query optimization.
What happens if AUTO_UPDATE_STATISTICS_ASYNCH is enabled?
Controls whether statistics are updated during query optimization or if query optimization continues while the statistics are updated asynchronously.
What is the CHANGE_TRACKING database option that SQL Server 2008 introduced? How do you specify how long to keep tracking information?
Change tracking is a lightweight mechanism that associates a version with each row in a table that has been enabled for change tracking. Each time the row is changed, the version number is incremented. The CHANGE_RETENTION option and the AUTO_CLEANUP option control how long to keep tracking information.
What are the three states that a database can be set to in order to control access?
ONLINE
OFFLINE
EMERGENCY
What access is granted to a database in an EMERGENCY state?
Can only be accessed by members of the db_owner role and the only command allowed to be executed is SELECT.
How can you control the ability to modify data for an online database? What impact does this have on transaction log files?
By setting the database to READ_ONLY or READ_RIGHT. A database in READ_ONLY cannot be written to and SQL removes any transaction log file that is specified for the database. If changed to READ_WRITE, SQL recreates the transaction log file.
What three option settings control user access to a database?
SINGLE_USER
RESTRICTED_USER
MULTI_USER
A database set to RESTRICTED_USER only allows access to: ?
Members of the db_owner, dbcreator and sysadmin roles.
What happens if multiple users are using the database when you change the mode to SINGLE_USER or users conflict with the allowed set for RESTRICTED_USER? What option can you add to control this?
The ALTER DATABASE command is blocked until all the non-allowed users disconnect. ROLLBACK IMMEDIATE forcibly rolls back any open transactions along with disconnecting any nonallowed users. Using ROLLBACK AFTER <number of seconds> waits for the specified number of seconds before rolling back transactions and disconnecting users.
What is the benefit of a parameterized query?
It can reuse cached query plans more frequently and avoid the time required to build a query plan.
How can you force SQL Server to read every page from disk and check the integrity?
Use the DBCC CHECKDB command.
When DBCC CHECKDB is executed, what actions are performed?
Checks page allocation within the database.

Checks the structural integrity of all tables and indexed views.

Calculates a checksum for every data and index page to compare against the stored checksum.

Validates the contents of every indexed view.

Checks the database catalog.

Validates Service Broker data within the database.
What commands does DBCC CHECKDB execute?
DBCC CHECKALLOC, to check the page allocation of the database.

DBCC CHECKCATALOG, to check the database catalog.

DBCC CHECKTABLE, for each table and view in the database to check the structural integrity.
If a database is participating in a database mirroring session and a corrupt page is found using PAGE_VERIFY CHECKSUM, what happens?
SQL Server automatically retrieves a copy of the page from the mirror, replaces the page on the principal, and logs an entry in the sys.dm_db_mirroring_auto_page_repair view.
If your application accesses multiple databases or you are creating an application with multiple databases that do not need to be stored on separate instances for increased capacity, what should you do?
You should combine the objects into a single database and use schemas to separate groups of objects.
What are the nine numeric data types in SQL Server 2008?
TINYINT
SMALLINT
INT
BIGINT
DECIMAL(P,S) and NUMERIC(P,S)
SMALLMONEY
MONEY
REAL
FLOAT(N)
What is the range of values and how much storage space is required for the data type TINYINT?
Values: 0 to 255
Space: 1 byte
What is the range of values and how much storage space is required for the data type SMALLINT?
Values: -32,768 to 32,767
Space: 2 bytes
What is the range of values and how much storage space is required for the data type INT?
Values: -2^31 to 2^31-1
Space: 4 bytes
What is the range of values and how much storage space is required for the data type BIGINT?
Values: -2^63 to 2^63-1
Space: 8 bytes
What is the range of values and how much storage space is required for the data type DECIMAL(P,S) and NUMERIC(P,S)?
Value: - 10^38 +1 through 10^38 - 1
Space: Precision Storage bytes
1 - 9 5
10-19 9
20-28 13
29-38 17
What is the range of values and how much storage space is required for the data type SMALLMONEY?
Value: - 214,748.3648 to 214,748.3647
Space: 4 bytes
What is the range of values and how much storage space is required for the data type MONEY?
Value: -922,337,203,685,477.5808 to 922,337,203,685,477.5807
Space: 8 bytes
What is the range of values and how much storage space is required for the data type REAL?
Value: - 3.40E + 38 to -1.18E - 38, 0 and 1.18E - 38 to 3.40E + 38
Space: 4 bytes
What is the range of values and how much storage space is required for the data type FLOAT(N)?
Value: - 1.79E+308 to -2.23E-308, 0 and 2.23E-308 to 1.79E+308
Space: Depends on the value of n; if n's value is between 1-24, is has a precision of 7 digits and requires 4 bytes; if n is between 25-53, the precision is 15 digits and requires 8 bytes.
What are the two parameters of decimal data types?
Precision and scale. The precision indicates the total number of digits that can be stored both to the left and to the right of the decimal. The scale indicates the maximum number of digits to the right of the decimal point.
What are the four character data types in SQL Server 2008? How much storage space is associated with each one?
CHAR(n) - 1 byte per character defined by n, up to a maximum of 8,000 bytes.

VARCHAR(n) - 1 byte per character stored up to a maximum of 8,000 bytes.

NCHAR(n) - 2 bytes per character defined by n, up to a maximum of 4,000 bytes.

NVARCHAR(n) - 2 bytes per character stored up to a maximum of 4,000 bytes.
What are the 6 time and date data types in SQL Server 2008?
SMALLDATETIME

DATETIME

DATETIME2

DATETIMEOFFSET

DATE

TIME
What are the range of values, the accuracy and storage space associated with SMALLDATETIME?
Range: 01/01/1900 to 06/06/2079
Accuracy: 1 minute
Storage: 4 bytes
What are the range of values, the accuracy and storage space associated with DATETIME?
Range: 01/01/1753 to 12/31/9999
Accuracy: 0.00333 seconds
Storage: 8 bytes
What are the range of values, the accuracy and storage space associated with DATETIME2?
Range: 01/01/0001 to 12/31/9999
Accuracy: 100 nanoseconds
Storage: 6 to 8 bytes
What are the range of values, the accuracy and storage space associated with DATETIMEOFFSET?
Range: 01/01/0001 to 12/31/9999
Accuracy: 100 nanoseconds
Storage: 8 to 10 bytes
DATETIMEOFFSET allows you to store a time zone.
What are the range of values, the accuracy and storage space associated with DATE?
Range: 01/01/0001 to 12/31/9999
Accuracy: 1 day
Storage: 3 bytes
What are the range of values, the accuracy and storage space associated with TIME?
Range: 00:00:00.0000000 to 23:59:59.9999999
Accuracy: 100 nanoseconds
Storage: 3 to 5 bytes
What are the three binary data types in SQL Server 2008?
BIT

BINARY

VARBINARY
What are the range of values and storage space associated with BIT?
Range: Null, 0, 1
Storage: 1 bit
What are the range of values and storage space associated with BINARY?
Range: Fixed-length binary data
Storage: Up to 8,000 bytes
What are the range of values and storage space associated with VARBINARY?
Range: Variable-length binary data
Storage: Up to 8,000 bytes
What is the XML data type?
It allows you to store and manipulate Extensible Markup Language (XML) documents natively. You are limited to 2 GB per document as well as 128 levels within a document.
What is an XML Schema Collection used for?
When an XML Schema Collection is applied to an XML column, the only documents allowed to be stored within the XML column must first validate to the associated XML schema collection.
What are the two spatial data types that SQL Server 2008 supports?
GEOMETRY - based on Euclidian geometry and is used to store points, lines, curves, and polygons

GEOGRAPHY - based on an ellipsoid and is used to store data such as latitudes and longitudes.
What are the 7 different geometric objects that a GEOMETRY column can contain?
1. Point - Has x and y coordinates, with optional elevation and measure values.

2. LineString - A series of points that defines the start, end, and any bends in the line, with optional elevation and measure values.

3. Polygon - A surface defined as a sequence of points that defines an exterior boundary, along with zero or more interior rings. A polygon has at least three distinct points.

4. GeometryCollection - Contains one or more instances of other geometry shapes, such as a Point and a LineString.

5. MultiPolygon - Contains the coordinates for multiple Polygons.

6. MultiLineString - Contains the coordinates of multiple LineStrings.

7. MultiPoint - Contains the coordinates of multiple Points.
What is the HIERARCHYID data type?
The HIERARCHYID data type is used to organize hierarchical data, such as organization charts, bills of materials, and flowcharts. The HIERARCHYID stores a position within a tree hierarchy.
What are the 7 properties that you can apply to a column?
1. nullability

2. COLLATE

3. IDENTITY

4. ROWGUIDCOL

5. FILESTREAM

6. NOT FOR REPLICATION

7. SPARSE
What database property sets the nullability property?
ANSI_NULL_DEFAULT
How can you insert a value into an identity column explicitly?
By using the SET IDENTITY_INSERT <table name> ON command.
How do you change the next value generated for an identity column by modifying the seed?
Use the DBCC CHECKIDENT command.
What is the ROWGUIDCOL property used for?
Used mainly by merge replication to designate a column that is used to identify rows uniquely across databases. The ROWGUIDCOL property is used to ensure that only a single column of this type exists and that the column has a UNIQUEIDENTIFIER data type.
What data type do columns that have the FILESTREAM property applied have?
VARBINARY(MAX). The column maintains a 16 byte identifier for the file.
Can you implement database mirroring against a database containing data stored with FILESTREAM?
NO
How is a FILEGROUP designated for FILESTREAM storage treated in a database snapshot?
It is off-line and inaccessible.
What is the SPARSE option used for?
When a NULL is stored in a column designated as SPARSE, no storage space is consumed. However, non-NULL values require 4 bytes of storage space in addition to the normal space consumed by the data type. The column must allow nulls.
What can you not apply the SPARSE property to?
- Columns with the ROWGUIDCOL or IDENTITY property
- TEXT, NTEXT, IMAGE, TIMESTAMP, GEOMETRY, GEOGRAPHY, or user-defined data types
- A VARBINARY(MAX) with the FILESTREAM property
- A computed column of a column with a rule or default bound to it
- Columns that are part of either a clustered index or a primary key
- A column within an ALTER TABLE statement
What is the maximum size a row can be before you cannot issue an ALTER statement to either change a column to SPARSE or add an additional SPARSE column? Why?
4,009 bytes. During the ALTER, each row is recomputed by writing a second copy of the row on the same data page. Because two copies of a row that exceed 4,009 bytes would exceed the 8,018 bytes allowed per page, the ALTER TABLE statement fails.
How can you make a column SPARSE if the row size is more than 4,009 bytes?
- Reduce the data within a row so that the maximum row size is greater than 4,009 bytes
- Create a new table, copy all the data to the new table, drop the old table, and then rename the newly created table
- Export the data, truncate the existing table, make the changes, and import the data back into the table
If you do not want to incur the overhead of making the calculation of a Computed Column at runtime, what can you specify?
The PERSISTED property. If a computed column is PERSISTED, SQL Server stores the result of the calculation in the row and updates the value anytime data that the calculation relies upon is changed.
What is row-level compression? What is the limitation?
Allows you to compress individual rows to fit more rows on a page, which reduces the storage space for the table because you don't need to store as many pages on a disk. Because you can uncompress the data at any time, in order for it to succeed, you cannot use compression to store more than 8,060 bytes in a single row.
What commands do you use to have SQL Server compress new data added to a heap?
BULK INSERT or INSERT INTO...WITH (TABLOCK) statement
Do compression settings for a table pass to any nonclustered indexes or indexed views created against a table?
NO
Why can you not compress VARCHAR(MAX), NVARCHAR(MAX) and VARBINARY(MAX) data?
They store data in specialized structures outside the row; any data stored outside the row cannot be compressed.
How many columns can a standard table in SQL 2008 have?
1,024 columns
What are wide tables?
Tables that exceed 1,024 columns (up to a max of 30,000columns) by using a column set definition; data stored in any row still cannot exceed 8,019 bytes unless you have a VARCHAR(MAX), NVARCHAR(MAX) or VARBINARY(MAX) column defined for the table.
Where are temporary tables stored?
The tempdb database.
What are the two types of temporary tables and how are they designated?
Local or global. Local is designated by a name beginning with # and is visible only within the connection that created it. A global is designated by a name beginning with ## and is visible across all connections to the instance.
What is a table variable?
A table variable is a memory resident structure that is visible only within the connection that declared the variable and is deallocated after the code which declared the variable completes.
What is a clustered primary key?
A clustered primary key, the default SQL Server behavior, causes SQL Server to store the table in sorted order according to the primary key.
When a clustered primary key is created on a table that is compressed, when is compression applied to the primary key?
When the table is rebuilt.
How is a unique constraint similar to a primary key?
Neither allows duplicates, though a unique constraint allows NULLs. A unique constraint treats NULLs as it does any other data value; if a unique constraint is defined on a single column, then a single row within the table is allowed to have a NULL within the column.
What is a default constraint?
A default constraint allows you to specify a value that is written to the column if the application does not supply a value. SQL SERVER WRITES THE DEFAULT VALUE TO A COLUMN ONLY IF THE APPLICATION DOES NOT SPECIFY THE COLUMN IN THE INSERT STATEMENT.
What is a check constraint?
A check constraint limits the range of values within a column.
How do check constraints at a column level differ from check constraints at a table level?
Column-level check constraints cannot reference any other column in the table; table-level check constraints can reference any column within a table, but not other tables.
What structure does SQL Server use to build and maintain indexes?
A balanced tree (B-tree). A B-tree is constructed of a root node that contains a single page of data, one or more optional intermediate level pages, and one or more optional leaf level pages.
How many bytes of data are in a SQL Server data page? How many can be used for actual data?
A data page is 8,192 bytes, 8,060 bytes can be used to store data.
If you are creating an index on a sparse column, what type of index should you use?
You should use a filtered index.
What is the maximum number of columns that can be used to define an index?
16
What is a clustering key?
The column(s) defined for a clustered index.
What is special about a clustered index?
It causes SQL to arrange the data in the table according to the clustering key.
How many clustered indexes can you have for a table?
Only one, since a table can only be sorted one way.
What is a heap?
A table without a clustered index.
What does the leaf node of a clustered index correspond to; how does this compare to the leaf node of a heap?
In a clustered index, the leaf node is the actual data; in a heap, it is a forward pointer to the location of the row in the table's data pages.
When is the FILESTREAM_ON clause used?
When clustered indexes are crated on a table containing FILESTREAM data.
If you specify a different filegroup in the FILESTREAM_ON clause than where the FILESTREAM data is currently located, what happens?
All the FILESTREAM data will be moved to the newly specified filegroup during the creation of the clustered index.
What restrictions doe nonclustered indexes have?
Max size of 900 bytes in the index key, a maximum of 16 columns and a table is limited to 1,000 nonclustered indexes.
Where does the pointer at the leaf level of a nonclustered index point if a clustered index exists on the table; if one does not?
If a clustered index exists on the table, the leaf level of the nonclustered index points to the clustering key; if a clustered index does not exist, it points to the row of data in the table.
What is a covering index?
An index that is constructed such that SQL Server can completely satisfy queries by reading only the index.
What is the benefit of using the INCLUDE clause with indexes?
Included columns become part of the index only at the leaf level; values do not appear in root or intermediate levels and do not count against the 900 byte or 16 column restrictions.
What does the query optimizer do?
It is a component that decides whether or not to use an index to satisfy a query based on the distribution statistics that are stored for the index.
What is meant by the selectivity of an index?
The degree to which values in a column allow you to locate small sets of data; as the number of unique values within a column increases, so does the selectivity of an index. The query optimizer chooses the most selective indexes to satisfy queries.
What is a filtered index?
An index with a WHERE clause. Only the index keys matching the WHERE clause are added to the index, allowing you to build indexes that focus on the highly selective portions of the table.
What restrictions do filtered indexes have?
The must be a nonclustered index.

They cannot be created on computed columns.

Columns cannot undergo implicit or explicit data type conversion.
What is FILLFACTOR used for?
It is used to control the rate at which page splits occur; it specifies the percentage of free space that should be left on the leaf level of an index during creation or rebuild.
What is the PAD_INDEX option used for?
It causes the FILLFACTOR to be applied to the intermediate-level page(s) and the root page of an index.
What is the SORT_IN_TEMPDB option used for?
Normally, during index creation, the work tables SQL uses for sorting the values prior to building the B-tree are created in the same database as the index. The use of this option causes them to be created in the tempdb database.
What is the IGNORE_DUP_KEY option used for?
In indexes designated as unique, multi-row inserts with a duplicate in one row would cause the entire transaction to roll back; this option rejects only the row with a duplicate.
Index can be created either online or offline, how is this done and what does it mean?
It is done using WITH ONLINE = ON / OFF. When off, SQL locks the entire table, preventing any changes until the index is created. When on, SQL allows changes to the table during creation of the index by using the version store within the tempdb database.
How to clustered and nonclustered index builds differ when done off-line.
When you build a clustered index offline, the table is locked and does not allow select statements or data modifications. If you build a nonclustered index offline, a shared table lock is acquired, which allows select statements but not data modification.
What versions of SQL Server 2008 support online index creation, rebuild or online restore?
Only SQL server 2008 enterprise.
What is a primary XML index?
A primary XML index is built against all the nodes within the XML column. The primary XML index is also tied to the table by maintaining a link to the corresponding row in the clustered index. Therefore, a clustered index is required before you can create a primary XML index.
What is a secondary XML index?
Secondary indexes can be created on PATH, VALUE, or PROPERTY. A primary XML index is first required, because secondary XML indexes are built against the data contained within the primary XML index.
What is a spatial index?
It is an index created against a spatial column that it types as either geometry or geography.
What is the decomposition process by which spatial data is converted from a 2D system to a linear structure?
Tessellation.
What is the BOUNDING_BOX parameter?
The BOUNDING_BOX parameter defines the maximum and minimum x, y coordinates that are considered when constructing the grid hierarchy and tessellating the rows of geometry data.
What are the three types of XML indexes that you can create?
PATH, VALUE and PROPERTY.
How do you defragment an index?
You use the ALTER INDEX statement.
What are the two options you can use when you defragment an index?
You can either REBUILD or REORGANIZE.
What does the REBUILD option in an ALTER INDEX statement do?
The REBUILD option rebuilds all levels of the index and leaves all pages filled according to the FILLFACTOR setting of an index. If you rebuild the clustered index, only the clustered index is rebuilt. However, rebuilding the clustered index with the ALL keyword also rebuilds all nonclustered indexes on the table. The rebuild of an index effectively re-creates the entire B-tree structure, so unless you specify the ONLINE option, a shared table lock is acquired, preventing any changes until the rebuild operation completes.
What does the REORGANIZE option in an ALTER INDEX statement do?
The REORGANIZE option removes fragmentation only at the leaf level. Intermediate-level pages and the root page are not defragmented during a reorganize. REORGANIZE is always an online operation that does not incur any long-term blocking.
How do you disable an index?
ALTER INDEX { index_name / ALL }
ON <object>
DISABLE [ ; ]
What happens when an index is disabled?
When an index is disabled, the definition remains in the system catalog but is no longer used. SQL Server does not maintain the index as data in the table changes, and the index cannot be used to satisfy queries. If a clustered index is disabled, the entire table becomes inaccessible.
How do you re-enable an index that was disabled?
It must be rebuilt using the REBUILD option:

ALTER INDEX { index_name / ALL }
ON <object>
REBUILD [ ; ]
In SQL Server 2008, where are the contents of a full text catalog stored?
In the database, unlike previous versions, where it was stored in a directory on the operating system.
What does the ACCENT_SENSITIVITY option provide?
It allows you to configure whether the full text engine considers accent marks when building or querying a full text index.
What do you need to do if you change the ACCENT_SENSITIVITY option on a full text catalog?
You need to rebuild the full text indexes with the catalog.
What columns can be used to create a full text index?
CHAR

VARCHAR

XML

VARBINARY
What are word breakers?
Assemblies that locate breaks between words within the data being indexed for a full text index.
What are stemmers?
Stemmers conjugate verbs so that your queries can locate information even across multiple verb tenses.
What are stop words?
In the creation of a full text index, stop words are common words that you would not normally search upon (e.g. the, a, an).
How many full text indexes can a table or index view have?
Only one, though it can be created on multiple columns.
What is the CHANGE_TRACKING option for a full text index used for?
It determines how SQL maintains the index when underlying data changes are made. The options are AUTO, OFF or MANUAL.
Before you can create a full text index, what structure do you need to specify?
A full text catalog.
What columns can you create a full text index on?
CHAR/VARCHAR, XML, and VARBINARY.
What are the four commands that SQL Server uses to query full text?
CONTAINS

FREETEXT

CONTAINSTABLE

FREETEXTTABLE
What is the difference between CONTAINS and FREETEXT and CONTAINSTABLE and FREETEXTTABLE?
CONTAINS and FREETEXT return a True/False value used to restrict a result set, and CONTAINSTABLE and FREETEXTTABLE return a result set that can be used to extend query functionality.
Are all search terms used with full text Unicode strings or non-Unicode strings?
Unicode?
What happens if you pass a non-Unicode string to a full-text query?
If you pass in a non-Unicode string, the query still works, but it is much less efficient because the optimizer cannot use parameter sniffing to evaluate distribution statistics on the full text index.
What features does the CONTAINS query allow you to search on?
Search word forms

Search for word proximity

Provide relative weighting to terms
How do CONTAINS AND FREETEXT differ in fuzzy searching?
It is the default in FREETEXT, while you have to specify that you want it in CONTAINS.
What are the two options you can use with FORMSOF?
INFLECTIONAL, which causes the full text search engine to consider word stems (e.g. searching for driven also searches for drove, drive, driving).

THESAURUS which produces synonyms for the search terms.
What type of file are Thesaurus files and where are they located?
XML; the FTDATA directory underneath your default SQL Server installation path.
What does ISABOUT perform?
ISABOUT performs proximity searches and it also applies weighting if the WEIGHT keyword and weighting value are supplied.
When is the thesaurus file used?
After it is defined, FREETEXT and FREETEXTTABLE use it automatically; CONTAINS and CONTAINTSTABLE use it if specified with the FORMSOF THESAURUS option.
What are the two set types that a thesaurus file contain?
A thesaurus can contain expansion sets or replacement sets. A replacement set defines a term or terms that are replaced within the search argument prior to the word breaker tokenizing the argument list. An expansion set defines a set of terms that are used to expand upon a search argument. When an expansion set is used, a match on any term within the expansion set causes SQL Server to retrieve the row.
What setting specifies whether the thesaurus is accent sensitive?
The diacritics setting.
Where are Stop lists contained in SQL 2008, how does this differ from SQL 2005?
In 2008, they are stored in the database. In 2005, they were stored in the FTDATA directory.
What are the options for populating a Full text index?
- FULL Reprocesses every row from the underlying data to rebuild the full text index completely.

- INCREMENTAL Processes only the rows that have changed since the last population; requires a timestamp column on the table.

- UPDATE Processes any changes since the last time the index was updated; requires that the CHANGE_TRACKING option is enabled for the index and set to MANUAL.
How do you reload the English thesaurus file?
EXEC sys.sp_fulltext_load_thesaurus_file 1033
How do you manage thesaurus files?
You edit the language specific file that is contained in the FTDATA directory for the instance.
What commands do you use to build a list of stop words for a full text index?
CREATE FULLTEXT STOPLIST and ALTER FULLTEXT STOPLIST
What is the process for partitioning a table, index or indexed view?
1. Create a partition function.

2. Create a partition scheme mapped to a partition function.

3. Create the table, index or indexed view on the partition scheme.
What data types cannot be used with partition functions?
You cannot use text, ntext, image, xml, varbinary(max), varchar(max), or any CLR data types.
What is the maximum number of partitions allowed for a table?
The maximum number of partitions for a table is 1,000.
What is the maximum number of boundary points allowed for a partition function?
The maximum number of boundary points for a partition function is 999.
What is the AS clause used for in a partition function?
The AS clause allows you to specify whether the partition function you are creating is RANGE LEFT or RANGE RIGHT.
What is the FOR VALUES clause used for in a partition function?
It is used to specify the boundary points for the partition function. If the partition function is created as RANGE LEFT, then the boundary point is included in the left partition. If the partition function is created as RANGE RIGHT, then the boundary point is included in the right partition.
Where are NULL values stored in a partition?
They are always stored in the leftmost partition until you explicitly specify null as a boundary point and use the RANGE RIGHT syntax, in which case nulls are stored in the rightmost partition.
How do you partition an existing object after it has been populated with data?
To partition an existing table, you need to drop the clustered index and re-create the clustered index on the partition scheme. To partition an existing index or indexed view, drop the index and re-create the index on a partition scheme. You will want to be very careful when partitioning existing objects that already contain data, because implementing the partition will cause a significant amount of disk input/output (I/O).
What happens if more filegroups are included in the partition scheme than there are partitions?
Any excess filegroups will not be used to store data unless explicitly specified by using the ALTER PARTITION SCHEME command.
If you specify the ALL keyword when creating a partition scheme, what is the maximum number of filegroups you can specify?
1
Can you create a new filegroup at the same time that you are creating a partition scheme?
No. Any filegroups that you specify in the CREATE PARTITION SCHEME statement must already exist in the database.
How do you create a partitioned table or indexed view?
Instead of using the ON clause to specify a filegroup, you specify a partition scheme.
What property must be set to use a computed column as a partitioning key?
The computed column must be persisted.
Which operators are used to add or remove boundary points from a partition function?
The SPLIT operator is used to introduce a new boundary point. The MERGE operator is used to remove a boundary point.
Which operator is used to move partitions between tables?
The SWITCH operator is used to move partitions between tables.
What are the two purposes of the NEXT USED clause?
1. It adds a new filegroup to the partition scheme, if the specified filegroup is not already part of the partition scheme.

2. It marks the NEXT USED property for a filegroup (The filegroup that is marked with the NEXT USED flag is the filegroup that contains the next partition that is created when a SPLIT operation is executed.).
What is aligned storage?
When a table and all its indexes use the same partition function and the same partition scheme. This ensures that if a single partition is backed up or restored, the data and corresponding indexes are kept together in a single unit.
What requirements does the SWITCH operator have?
-- The data and index for the source and target tables must be aligned.

-- Source and target tables must have the same structure.

-- Data cannot be moved from one filegroup to another.

-- Two partitions with data cannot be exchanged.

-- The target partition must be empty.

-- The source or target table cannot participate in replication.

-- The source or target tables cannot have full text indexes or a FILESTREAM data type defined.
If you are exporting data using BCP, the account that BCP is running under needs what permissions?
Only SELECT
If you are importing data using BCP, the account that BCP is running under needs what permissions?
SELECT, INSERT and ALTER TABLE
In BCP, what does the first argument specify?
The table or query that BCP operates upon.
In BCP, what does the second argument specify?
Can be set to in, out or queryout. When in, BCP imports the contents of the file specified. When out, BCP exports the entire contents of the table into the file specified.
In BCP, what does the third argument specify?
The file that is the source or target of the BCP command.
How do you use queryout with BCP?
You replace the name of the table with a query delimited by double quotes.
What do the -n and -c switches specify in BCP?
They are mutually exclusive. -n specifies that the data in the files is in the native format of SQL Server. The-c switch specifies that the data is a character format.
In BCP, what does the -S switch specify?
The instance name to connect to.
In BCP, what does the -T switch specify?
Designates a trusted connection and BCP uses the windows credentials of the account that is executing the BCP command to connect.
In BCP, what does the -U switch specify?
login name
In BCP, what does the -P switch specify?
password
In BCP, what does the -h switch specify?
Enforces check constraints and fire triggers during the import.
How does the BULK INSERT command differ from BCP?
BULK INSERT cannot export data and is a T-SQL command, thus does not require the instance name or login credentials.
The Import and Export wizard is based on which feature of SQL?
SSIS
What three data types can the Import and Export Wizard not work with?
Hierarchy, geography and geometry.
What permission is required by BCP to use the -h option other than SELECT and INSERT?
ALTER TABLE
Where are all the objects for Policy Based Management stored?
Within the msdb database.
How can you get a list of the facets available?
By querying the dbo.syspolicy_management_facets table.
What are the five objects that are used within Policy Based Management?
Facets, conditions, policies, policy targets, and policy categories.
What are the allowed execution modes for a policy?
The policy execution modes are On demand, On schedule, On change, Log only, and On change, prevent.
Which object has a property that allows you to mandate checking for all databases on an instance?
Policy categories allow you to mandate checking of all databases within an instance.
How many facets can be checked within a single condition?
A condition can be defined on only one facet.
How many conditions can be checked within a single policy?
A policy can check only a single condition.
What is a facet?
Facets define the type of object or option to be checked, such as database, Surface Area and login.
If you define a condition using the advanced editor, can a policy that incorporates the condition be scheduled?
No, it must be executed manually.
What are the four execution modes that a policy can be set for?
-- On demand Evaluates the policy when directly executed by a user.

-- On change, prevent Creates data definition language (DDL) triggers to prevent a change that violates the policy.

-- On change, log only Checks the policy automatically when a change is made using the event notification infrastructure.

-- On schedule Creates a SQL Server Agent job to check the policy on a defined schedule.
What effect does the policy category mandate property have when applied to a database?
When a policy category is set to Mandate and a sysadmin subscribes the instance to a policy category, all databases that meet the target set are controlled by the policies within the policy category. A policy subscription to a policy category set to Mandate cannot be overridden by a database owner.
What is the mandate property setting for the default category?
Mandate enabled.
What security context do all backup execute under?
Under the SQL Server service account.
What databases can a sysadmin backup?
All the databases in an instance.
What databases can a db_owner backup?
Only their databases.
What database role can you add a user to in order to allow them to back up a database while preventing any other access to the database?
db_backupoperator
What are the four types of backups you can perform in SQL Server 2008?
Full
Differential
Transaction Log
Filegroup
What does a Full Backup contain?
All pages within a database that contain data; pages that do no contain data are no included in the backup.
What is the limiting factor for the speed of a backup?
The performance of the device where the backup is being written.
What are the backup procedure steps that SQL Server performs?
1. Locks the database, blocking all transactions

2. Places a mark in the transaction log

3. Releases the database lock

4. Extracts all pages in the data files and writes them to the backup device

5. Locks the database, blocking all transactions

6. Places a mark in the transaction log

7. Releases the database lock

8. Extracts the portion of the log between the marks and appends it to the backup
What are the only operations not allowed during a backup?
Adding or removing a database file and shrinking a database.
What are the only two parameters required for a backup?
The name of the database and the backup device.
What happens when you specify more than one backup device? What is the max number you can have?
SQL Server stripes the backup across each of the devices specified. The max is 64.
What effect does the MIRROR TO clause have on a backup?
When you include the MIRROR TO clause, SQL Server retrieves the page once from the database and writes a copy of the page to each backup mirror.
What requirements do mirrored backups have?
-- All backup devices must be of the same media type.

-- Each mirror must have the same number of backup devices.

-- WITH FORMAT must be specified in the backup command.
Why is a compressed backup always worth the processing overhead?
The amount of time saved far exceeds the overhead associated with the compression operation.
What do the INIT/NOINIT options of a BACKUP command control?
Whether an existing backup file is overwritten or appended to.

NOINIT = append

INIT = overwrite
What does the CHECKSUM option of a BACKUP command control?
When CHECKSUM is specified, SQL Server verifies the page checksum, it if exists, before writing the page to the backup. Also, a checksum is calculated for the entire backup that can be used to determine if the backup has been corrupted.
What is the default behavior for errors encountered during a backup?
STOP_ON_ERROR - if an invalid page checksum is encountered during backup, the backup terminates with an error.
How do you continue to backup past an invalid checksum?
Use the CONTINUE_PAST_ERROR option.
What is Log Sequence Number (LSN)?
A unique number assigned to each row of a transaction log. It begins with one and increments to infinity, never repeating.
What does the active portion of the transaction log contain? The inactive?
The active portion contains all changes that have not yet been committed. The inactive portion contains all the changes that have been committed to the database.
What happens if an LSN gap is introduced into the transaction log backup?
You must create a full backup before you can start backing up the transaction log.
What does a differential backup capture?
All extents that have changed since the last full backup.
How are the changes since the last full backup tracked?
By using a special page in the header of a database called the Differential Change Map (DCM). A full backup zeroes out the contents of the DCM.
When an extent is changed, how does the change appear in the DCM?
The bit corresponding to the extent is set to 1.
What does the COPY_ONLY option in a backup allow?
It allows you to create a backup but does not affect the database state or set of backups in production. e.g. a full backup with COPY_ONLY set does not zero out the DCM and a transaction log backup with COPY_ONLY does not remove transactions from the transaction log.
What is a Filegroup backup?
It allows you to target a portion of the database to be backed up (reducing time and the footprint of the backup).
What is a partial backup?
Partial backups back up the primary filegroup, all read/write filegroups and any explicitly specified read-only filegroups. In this way, you eliminate backing up read-only filegroups, which would not change.
How do you perform a partial backup?
By specifying the READ_WRITE_FILEGROUPS option:

BACKUP DATABASE database_name READ_WRITE_FILEGROUPS [,<file_filegroup_list>] TO <backup_device>
What command to you execute to have SQL Server detect and quarantine corrupted pages?
ALTER DATABASE <dbname> SET PAGE_VERIFY CHECKSUM
Is there a limit to the number of corrupt pages in a database?
Yes, SQL puts a limit of 1000 corrupt pages on a database. Once you reach the limit, the database is taken offline and places it in a suspect state to protect it from further damage.
What are maintenance plans and what tasks are supported?
They provide a mechanism to graphically create job workflows that support common administrative functions. The tasks supported are:

-- Backing up of databases and transaction logs
-- Shrinking databases
-- Re-indexing
-- Updating of statistics
-- Performing consistency checks
What are maintenance plans based on?
SSIS
What is a service master key?
A service master key is created automatically the first time than an instance is started. It is regenerated each time that you change the SQL Server service account or password.
How do you backup the service master key?
BACKUP SERVICE MASTER KEY TO FILE = 'path_to_file'

ENCRYPTION BY PASSWORD = 'password'
What are database master keys (DMKs)?
DMKs are created prior to the creation of a certificate, symmetric key or asymmetric key. A DMK is the root of the encryption hierarchy in a database.
How do you backup a DMK?
BACKUP MASTER KEY TO FILE = 'path_to_file'

ENCRYPTION BY PASSWORD = 'password'
What must you do before you backup the DMK?
The DMK must be open:

USE <database name>;

OPEN MASTER KEY DECRYPTION BY PASSWORD = '<SpecifyStrongPasswordHere>';
By default, what is the DMK encrypted with?
The service master key.
How do you backup just the public key of a certificate?
BACKUP CERTIFICATE certname TO FILE = 'path_to_file'
How do you backup a certificate (both the private and public keys)?
BACKUP CERTIFICATE certname TO FILE = 'path_to_file'

[ WITH PRIVATE KEY

(FILE = 'path_to_private_key_file' ,
ENCRYPTION BY PASSWORD = 'encryption_password'
[ , DECRYPTION BY PASSWORD = 'decryption_password' ] ) ]
How do you validate a backup?
RESTORE VERIFYONLY FROM <backup device>
What checks does SQL perform when a backup is validated?
-- Calculates a checksum for the backup and compares to the checksum stored in the backup file.

-- Verifies that the header of the backup is correctly written and valid.

-- Transits the page chain to ensure that all pages are contained in the database and can be located.
What does the NO_TRUNCATE option allow?
It allows you to backup the transaction log without writing to the master data file.
Where is the LSN of the last modification stored at the database level, the data file level and the data page?
At database level, the LSN of the last modification to the db is stored in the header of the master data file. At data file level, the LSN of the last change to a page within the file is stored in the header of the data file. At data page level, the LSN of the last change to the data page is stored.
What is a dirty page?
A modified page in the buffer pool. Every dirty page tracks the LSN in the transaction log that corresponds to the change that modified the page in the buffer pool.
What happens to dirty pages when SQL server executes a checkpoint?
All dirty pages in the buffer pool are written out to the data files.
What happens during the checkpoint process?
During the checkpoint process, SQL Server compares the LSN of the dirty page in the buffer pool to the LSN of the data page on disk.

If the LSN of the data page on disk is equal to or less than the LSN of the dirty page in the buffer pool as well as equal to or less than the LSN for the data file, the page on disk is overwritten with the page from the buffer pool.

If the LSN of the dirty page is greater than the page on disk or the data file containing the page, the page in the buffer pool is overwritten by the page on disk.

When the checkpoint process finishes writing dirty pages to the data files, the largest LSN written to each file is written into the header of the file.

In addition, the largest LSN written across the entire checkpoint process is written to the header of the master data file. SQL Server ensures that the LSN for every page within a file is equal to or less than the LSN for the file and that the LSN for every file within a database is equal to or less than the LSN for the database.

The final step in the process is to clear the flag on each dirty page affected by the checkpoint that designates the page has changed.
What are the two phases of restart recover. When does restart recovery take place?
UNDO and REDO. It takes place when SQL server is started.
What happens during REDO phase of restart recovery?
All committed transactions in the transaction log are flushed to disk.
What happens during the UNDO phase of restart recovery?
During UNDO, which occurs after REDO, the transaction log is examined and any transactions that are still open are invalidated, ensuring that they cannot be written to disk.
What is rolling forward?
After UNDO phase completes, the database is rolled forward: SQL Server reads the last LSN recorded in the transaction log, increments the LSN and writes the new LSN into the header of every data file within the database, ensuring that transactions older than the roll-forward point cannot be written to the data files.
What do all restore sequences begin with?
Either a full backup or filegroup backup.
After the database or filegroup being restored has been brought back online, can you apply additional differential or transaction log backups to the database?
No.
During a RESTORE command, what happens if the database does not already exist within the instance?
It is created.
What does the REPLACE option during a RESTORE command control?
Forces the restore over the top of an existing database.
Why does a restore take about 30% longer than the backup?
SQL is optimized to backup and can pull pages into the backup regardless of order. During a restore, the pages must be placed back into the database in sequential order.
What do the first pages within a database store?
The structural information about the db, such as the list of pages allocated to the db.
During a RESTORE command, what does the RECOVERY option provide?
After the RESTORE operation completes, the db is online and accessible.
During a RESTORE command, what does the NORECOVERY option provide?
The RESTORE operation completes, but the database is left in a RECOVERY state, such that subsequent differential and/or transaction log backups can be applied.
During a RESTORE command, what does the STANDBY option provide?
Allows you to issue SELECT statements against the database while still issuing additional differential and/or transaction log restores. If you restore a db with the STANDBY option, an additional file is created to make the db consistent as of the last restore that was applied.
During a RESTORE command, what does the MOVE option provide?
It allows you to change the location of db files during the restore.
What is the first step in any restore operation?
You should issue a transaction log backup against the original db. This is referred to as backing up the tail of the log.
What is the syntax for restoring a full or differential backup?
RESTORE DATABASE { database_name / @database_name_var }

[ FROM <backup_device> [ ,...n ] ]
[ WITH {[ RECOVERY / NORECOVERY /
STANDBY = {standby_file_name / @standby_file_name_var } ]
/ , <general_WITH_options> [ ,...n ]
/ , <replication_WITH_option>
/ , <change_data_capture_WITH_option>
/ , <service_broker_WITH options>
/ , <point_in_time_WITH_options‚ RESTORE_DATABASE>
} [ ,...n ]
]

<general_WITH_options> [ ,...n ]::=

--Restore Operation Options

MOVE 'logical_file_name_in_backup' TO 'operating_system_file_name'

[ ,...n ] / REPLACE / RESTART / RESTRICTED_USER
What is the syntax for restoring a transaction log backup?
RESTORE LOG { database_name / @database_name_var }

[ <file_or_filegroup_or_pages> [ ,...n ] ]
[ FROM <backup_device> [ ,...n ] ]
[ WITH {[ RECOVERY / NORECOVERY /
STANDBY = {standby_file_name / @standby_file_name_var } ]
/ , <general_WITH_options> [ ,...n ]
/ , <replication_WITH_option>
/ , <point_in_time_WITH_options‚ RESTORE_LOG>} [ ,...n ] ]
<point_in_time_WITH_options, RESTORE_LOG>::=
/ { STOPAT = { 'datetime' / @datetime_var }
/ STOPATMARK = { 'mark_name' / 'lsn:lsn_number' }
[ AFTER 'datetime' ]
/ STOPBEFOREMARK = { 'mark_name' / 'lsn:lsn_number' }
[ AFTER 'datetime' ]
During a transaction log restore, what does the STOPAT command allow?
Allows you to specify a date and time to which SQL Server restores.
During a transaction log restore, what do the STOPATMARK and STOPBEFOREMARK commands allow?
Allow you to specify either an LSN or a transaction log MARK to use for the stopping point in a restore operation.
How does the primary filegroup state affect the state of the db.
The state of a db equals the state of the primary filegroup.
To take advantage of the online restore capabilities of SQL Server 2008 Enterprise, what type of restores can you do?
Either a file or filegroup restore, which does not include the primary filegroup. A full restore affects the entire database, which includes the primary filegroup (which sets the state of the db).
What do you do if page corruption occurs in an index?
Drop and recreate the index.
What are the requirements for a page restore?
-- The database must be in either the Full or Bulked-logged recovery model.

-- You must be able to create a transaction log backup.

-- A page restore can apply only to a read/write filegroup.

-- You must have a valid full, file, or filegroup backup available.

-- The page restore cannot be executed at the same time as any other restore operation.
What is the syntax to restore a page?
RESTORE DATABASE database_name
PAGE = 'file:page [ ,...n ]' [ ,...n ]
FROM <backup_device> [ ,...n ]
WITH NORECOVERY
What are the steps to restore a page to a database?
1. Retrieve the PageID of the damaged page.

2. Using the most recent full, file, or filegroup backup, execute the following command:

RESTORE DATABASE database_name
PAGE = 'file:page [ ,...n ]' [ ,...n ]
FROM <backup_device> [ ,...n ]
WITH NORECOVERY

3. Restore any differential backups with the NORECOVERY option.

4. Restore any additional transaction log backups with the NORECOVERY option.

5. Create a transaction log backup.

6. Restore the transaction log backup from step #5 using the WITH RECOVERY option.
What is a best effort restore?
If the backup media is damaged, SQL server will continue past the source of damage and continue restoring as much of the database as possible. After the restore, the db is set to EMERGENCY mode.
What do you need to specify to restore from backup media that has been damaged?
CONTINUE_AFTER_ERROR for a RESTORE DATABASE or RESTORE LOG command.
What versions of SQL is database snapshot available?
Only SQL Server 2008 Enterprise
What happens if you create a database snapshot against a database with FILESTREAM data?
The FILESTREAM filegroup is disabled and not accessible.
What is the syntax to create a database snapshot?
CREATE DATABASE database_snapshot_name
ON
(NAME = logical_file_name,
FILENAME = 'os_file_name') [ ,...n ]
AS SNAPSHOT OF source_database_name
What are the requirements to create a database snapshot?
-- You must include an entry for each data file specified in the source database

--the logical name of each file must match the name in the source database exactly
What restrictions exist for a database snapshot?
-- You cannot back up, restore, or detach a Database Snapshot.

-- The Database Snapshot must exist on the same instance as the source database.

-- Full text indexes are not supported.

-- FILESTREAM is not supported, and any FILESTREAM data is inaccessible through the Database Snapshot.

-- You cannot create a Database Snapshot against a system database.

-- You cannot drop, restore, or detach a source database that has a Database Snapshot created against it.

-- You cannot reference filegroups that are off-line, defunct, or restoring.
How much space on disk does SQL Server allocate for a database snapshot?
SQL Server takes advantage of sparse files -- essentially an entry in the file allocation table and consumes almost no space on disk. As data is added to the file, the file automatically grows on disk.
How does a database snapshot act from an application perspective.
It looks and acts like a read-only database to any queries.
How much data does a database snapshot contain at the time of creation?
None.
How many pages are in an extent?
8 pages; SQL Server reads and writes extents.
What is the copy-on-write mechanism?
The means by which SQL Server manages changes that occur within the source database of a database that has a database snapshot. The first time a modification is made to a data page within an extent occurs in the source db, SQL Server copies the before image of the extent to the Database snapshot.
What is the max size of a database snapshot?
The amount of data that existed in the source database at the time of creation.
What is a database revert?
A special category of restoring data when you have a database snapshot. If you need to revert only a row or portion of a db, you can use and INSERT, UPDATE, DELETE or MERGE statement. SQL Server also allows you to revert the entire db using the snapshot, if necessary.
What is the syntax to revert a db from a database snapshot?
RESTORE DATABASE <database_name> FROM DATABASE_SNAPSHOT = <database_snapshot_name>
What restrictions are there on reverting a source database?
-- Only a single Database Snapshot can exist for the source database.

-- Full-text catalogs on the source database must be dropped and then re-created after the revert completes.

-- Because the transaction log is rebuilt, the transaction log chain is broken.

-- Both the source database and Database Snapshot are off-line during the revert process.

-- The source database cannot be enabled for FILESTREAM.
What two features are incompatible with Database snapshots?
FILESTREAM and full text indexes.
Prior to reverting a database using a Database snapshot, what must you do?
You must drop all database snapshots except the database snapshot being used as the source for the RESTORE command.
What is a job step?
The execution elements within a job.
What type of job steps can be executed?
Transact-SQL (T-SQL)

Replication tasks

Operating system tasks or executable files

Analysis Services tasks

Integration Services packages

ActiveX scripts
What is the default security context for a job step?
It corresponds to the login that is set as the owner of the job. You can also override the security context by specifying a proxy account that the SQL Server agent uses for the job step based on credentials assigned to the proxy account.
What options can a job step be configured with?
Logging

Notification to an operator

Retry settings that specify the number of times to retry a step as well as the number of minutes between retries

Control flow logic
What control flow options are available for a job?
Quit job reporting success

Quit job reporting failure

Go to next step

Go to a specific step number
What are the three logging options that are available to a job?
Log to a file that is overwritten each time, append to a file or log to a table (not recommended due to overhead).
In addition to any logging configured for a job step, what log information is gathered?
SQL Server logs information into the dbo.sysjobhistory table in the msdb database for each job step that is executed within the job. Some of the information recorded is:

-- job step
-- status
-- execution date and time
-- duration
--if an error occurs, the number, severity, and text of the last error message generated
If a job fails, where can you look to diagnose the problem?
The first place to look is in the job history, which can be accessed from SQL Server Management Studio (SSMS) by right-clicking a job and selecting View History. You can also look in the logging files that are configured for each job step. In some cases, you might find additional information in the Microsoft Windows event logs.
What is an Operator for a job?
An alias for a person, group or device. Operators are used to send notifications when jobs fail or an alert is generated. For each operator, you specify a name along with contact information.
What are the three types of SQL Server Agent alerts?
-- A SQL Server event

-- A performance condition alert

-- A windows management instrumentation (WMI) event
What are the two response actions that can be configured for an alert?
You can have an alert send a notification or execute a job in response to the alert condition.
What are the two basic parts of a TCP endpoint?
A transport and a payload
Endpoint can be of two different transports, what are they?
TCP and HTTP
What values can an Endpoint payload have?
SOAP, TSQL, SERVICE_BROKER and DATABASE_MIRRORING
What are the valid combinations of Endpoint Transport and Payload?
TCP TSQL

TCP SERVICE_BROKER

TCP DATABASE_MIRRORING

HTTP SOAP
What do TCP endpoint do?
They reject requests that are not properly formatted based on the endpoint definition.
What are the two layers of endpoint access?
The first layer is the endpoint state; the second layer is permission to connect to the endpoint (an application must have a login created in SQL Server that has the CONNECT permission granted on the endpoint before the connection is allowed through the endpoint).
What are the three states than an endpoint can have?
Started - endpoint is actively listening for connections and will reply

Stopped - endpoint is actively listening but returns a connection error to an application

Disabled - endpoint does not listen and does not respond to any connection attempted
What are the two arguments that are universal for all TCP endpoints? Which is required and which is optional?
LISTENER_PORT -Required

LISTENER_IP -Optional
What is the default TCP port for database mirroring?
5022
What is the default TCP port for TSQL?
1433
What is the default setting for LISTENER_IP?
ALL - listens for connections sent to any valid IP address configured on the machine
What additional options do both Database Mirroring and Service Broker endpoints offer that TSQ Endpoints do not?
They offer options to specify the authentication method and the encryption settings.
What authentication method can be used for Database Mirroring and Service Broker endpoints?
Windows-based authentication or certificates.
How do you specify windows-based authentication in Database mirroring and service broker endpoints?
By selecting the NTLM, KERBEROS or NEGOTIATE option. The NEGOTIATE option causes the instances to select the authentication method dynamically.
When should you use certificate-based authentication for endpoints?
When instances span non-trusted domains.
What is the default encryption algorithm used by SQL when encrypting communication between endpoints? What stronger algorithm can you specify?
RC4

AES - more overhead, will affect performance
How many TCP endpoints with a payload of DATABASE_MIRRORING can you specify for each instance?
Only one.
What third argument do Database mirroring endpoints offer?
You can specify that an endpoint is a PARTNER, WITNESS or ALL.

PARTNER - can participate only as the principal or as the mirror.

WITNESS - can participate only as a witness

ALL - can function in either role
What is the TSQL to create a database mirroring endpoint?
CREATE ENDPOINT [Mirroring]

AS TCP (LISTENER_PORT = 5022)

FOR DATA_MIRRORING (ROLE = PARTNER, ENCRYPTION = REQUIRED);

ALTER ENDPOINT [Mirroring] STATE = STARTED;
What additional argument is available for Service-Broker endpoints?
The MESSAGE_FORWARDING option, which enables messages destined for a different broker instance to be forwarded to a specified forwarding address. The options are ENABLED and DISABLED.
If MESSAGE_FORWARDING in a service broker endpoint is set to ENABLED, what additional option can you apply?
MESSAGE_FORWARDING_SIZE, which specifies the max amount of storage to allocate for forwarded messages.
What does DMV stand for?
Dynamic management view.
If you want to be able to connect to a SQL Server instance remotely, what needs to be enabled?
The Transmission Control Protocol/Internet Protocol (TCP/IP) network provider.
What are the two SQL features that pose the greatest security risk?
OPENROWSET/OPENDATARESOURCE and OLE Automation procedures.
How do you enable and disable SQL Server features?
By using sp_configure.
What features should you have disabled unless you need the specific functionality?
Ad Hoc Distributed Queries

CLR Enabled

Cross Database Ownership Chaining (CDOC)

Database Mail

External Key Management

Filestream Access Level

OLE Automation Procedures

Remote Admin Connections

SQL Mail extended stored procedures (XPs)

xp_cmdshell