Manage and Configure Databases Flashcards

1
Q

What is Auto_Close?

A

When all users disconnect from a database, then the database releases all of the resources for itself. Bad if you have connections come and go often. Good with a small database that is only accessed by a few users.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is Auto_Shrink?

A

Disk space does not shrink when you remove a lot of files. Better to start with as big as you think you need and give it as much space as you are able.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How can you make sure that all databases start with the same options?

A

Go to the MODEL database and set up the options how you want. New databases will have those same options.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What file extension does the Primary Data File have?

A

.mdf

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What file extension does the Transaction Log File have?

A

.ldf

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What file extension do the Secondary Data Files have?

A

.ndf

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the benefit to having multiple data files?

A

Your database can be searching two different drives at the same time and can increase performance.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is required in order to move a table to a different file group?

A

A clustered index.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the t-sql syntax to move the storage to a different file group?

A

CREATE CLUSTERED INDEX [INDEXNAME] ON [TABLENAME] (
COLUMN1
)
ON [FILEGROUP]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How do you initially create a table on a different file group?

A

CREATE TABLE [tablename] ( col1 ) ON [FileGroup]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is partitioning?

A

It is the ability to divide out a table and send data to different file groups.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are the four steps to create a partition?

A

Create Filegroups/files
Create partition function
Create partition scheme
Create/Modify table using partition scheme

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a partition function?

A

This is the filter for your data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the t-sql needed to create a Partition?

A

CREATE PARTITION FUNCTION NAME as RANGE [Right, Left] FOR VALUES (N’VALUE1’, N’VALUE2’)

CREATE PARTITION SCHEME [SCHEMENAME] AS PARTITION [NAME] TO ([FILEGROUP1],[FILEGROUP2],[FILEGROUP3])

CREATE CLUSTERED INDEX [INDEXNAME] ON [TABLENAME] ( COL1 ) ON [NAME] ([COL1])

DROP INDEX [INDEXNAME] ON [TABLENAME]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How can you see which partition data is going into?

A

SELECT $PARTITION.PARTITIONNAME(VALUE) AS PARTITIONNUMBER

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is a way that we can ease backing up and restoring huge amounts of data?

A

By using Files and FileGroups. You can backup strictly file groups and then restore those file groups without having to do the entire database.

17
Q

What is the t-sql to backup a single filegroup?

A

BACKUP DATABASE [DB] FILEGROUP=N’FILEGROUP’ TO DISK = N’C:\PATH’ WITH NAME = N’NAME’

18
Q

What is the t-sql to drop the size of a database file down?

A

dbcc shrinkfile(FileName, size)

19
Q

How do you keep the transaction log size down?

A

Run a transaction log backup

20
Q

What is the t-sql to drop the size of an entire database?

A

dbcc shrinkdatabase([db], PercentToStayOpen)

21
Q

How can you truncate a database file?

A

dbcc shrinkfile(FileID, truncateonly)

22
Q

What is a database container?

A

When you just have users that are connected to it that are not linked to any logins.

23
Q

How do you set up database containment?

A
USE MASTER
GO
sp_configure 'contained database authentication', 1
GO 
RECONFIGURE
GO
ALTER DATABASE [DBNAME] SET CONTAINMENT = PARTIAL WITH NO_WAIT
GO