0% found this document useful (0 votes)
10 views20 pages

Week 3 Content Dbad6020

This document outlines the planning and creation of a user database using SQL Server, detailing configuration options, steps, and tools involved. It explains the roles of data files and log files, emphasizing their importance for data storage and transaction integrity. Additionally, it covers authentication methods and SQL server security model objects, providing practical examples and instructions for database creation and management.

Uploaded by

Fathima
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views20 pages

Week 3 Content Dbad6020

This document outlines the planning and creation of a user database using SQL Server, detailing configuration options, steps, and tools involved. It explains the roles of data files and log files, emphasizing their importance for data storage and transaction integrity. Additionally, it covers authentication methods and SQL server security model objects, providing practical examples and instructions for database creation and management.

Uploaded by

Fathima
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 20

Learning Unit 3: Theme

1: Planning a User
Database
LO1:Explain the role of the configuration options for creating a database;
LO2:Evaluate the steps and considerations involved in planning a user database;
LO3:Discuss the tools and approaches to create a database with SQL Server;
LO4:Describe the role and uses of the main types of physical files in a SQL server
database;
LO5:Explain the different terminologies and settings of data files and log files;
LO6:Contrast two types of authentication for connecting to the database server using
examples;
LO7:Discuss the different objects in the SQL server security model;
LO8:Apply the principles of using:
o The system and user-defined data types in a given scenario;
o The object name conventions in a SQL database environment;
LO9:Explain how a SQL database is created using an example and appropriate tools
LO1:Explain the role of the configuration
options for creating a database

•Activity 4-1: Exploring the Configuration Options for


Creating a Database
•Objective: Find out more information about the default database
configuration settings using Books Online for SQL Server 2012.
•Description: Using Microsoft Books Online for SQL Server 2012,
you will learn more about database configuration settings and the
default settings of the model database.
•1. If necessary, start your computer and log on using an
Administrator account.
•2. Click the Start button, point to All Programs, and click
Internet Explorer to launch your Web browser. In the Address bar,
type msdn.microsoft.com and then press the Enter key to load
the Microsoft Developer Network site. See Figure 4-1.
3. Click Library to open the MSDN Library. In the search box in the upper-left
corner of the window, type model Database and then click the Search icon. See
Figure 4-2.
4. Click the model Database link, which should
be the top result in the search pane. See
Figure 4-3.
5. The “model Database” topic opens in Microsoft Books Online for SQL Server
2012.See Figure 4-4.
6. Scroll down the page, and review the configurable settings and their defaults in
the Database Options section. Next, review the Restrictions section for settings
that may not be altered in the model database.
LO3:Discuss the tools and approaches to
create a database with SQL Server;
LO3:Discuss the tools and approaches
to create a database with SQL Server
•1.If necessary, start your computer and log on
using an Administrator account.
•2. Click the Start button, point to All
Programs, click Microsoft SQL Server 2012,
and then click SQL Server Management
Studio. In the Connect to Server dialog
box,select Database Engine as the server type,
type LOCALHOST\SQLSERVERUA in the Server
name text box, and select Windows
Authentication from the Authentication list
box. Click Connect.
•3. In the Object Explorer navigation pane on the
left of the SQL Server Management Studio
window, expand the SQLSERVERUA folder by
clicking the + symbol. Right-click the
Databases folder, and in the shortcut menu,
click New Database (see Figure 4-6) to launch
the New Database dialog box.
• In the New Database dialog box, click in the
Database name text box and type TestOne
(using camel case) as your database name.
Click in the Initial Size (MB)text box, and type
50 for the data file (first row) and type 20 for
the log file (second row). Click the … icon in the
Autogrowth/Maxsize column for the data file. In
the Change Autogrowth for TestOne dialog box,
click the Enable Autogrowth check box, and
then type 10 in the File Growth In Megabytes
text box. Keep the default maximum file size
set to unlimited.
• Click OK. Now Click the … icon in the
Autogrowth/Maxsize column for the log file. In
the Change Autogrowth for TestOne_log dialog
box, click the Enable Autogrowth check box,
and then type 5 in the File Growth In
Megabytes text box. Keep the default
maximum file size set to unlimited. Click OK to
return to the New Database dialog box. Note
that this window gives you the ability to add
additional data or log files by clicking the Add
button. It also allows you to change the owner
of the database and the path to the physical
files. See Figure 4-7.
5. In the left navigation pane, click Options to open the Options page of database
properties
in the New Database dialog box. See Figure 4-8.
This page allows you to view or modify the
configuration options for the new
database.Many of these options should be
familiar to you because you read about
them in Activity 4-1 when you accessed the
“CREATE DATABASE (Transact-SQL)”
topic on Books Online for SQL Server 2012.
Keep the default configuration options.
6. In the left navigation pane, click
Filegroups to open the Filegroups page of
database
properties in the New Database dialog box.
See Figure 4-9. Figure 4-
7. This page allows you to view or modify the filegroups or filestreams for the
database.Every database must have a primary filegroup, which the database
will use as its default data storage location. A filegroup contains one or more
data files, which the database management system will fill in roughly equal
proportions. Additional user- defined filegroups can be added to improve
performance. For example, a nonprimary filegroup may be designated as the
data storage location for a particular table.
Filestreams are only needed if you intend to store unstructured data within the
database. Click the Help button at the top of the dialog box to open the
“Database Properties (Filegroups Page)” topic on Books Online for SQL Server
2012 in your Web browser. When youare finished reviewing the information,
close your Web browser.
8. In the New Database dialog
box, click OK to create the
database. The New
Databasedialog box closes, and
you are returned to Object
Explorer.
9. Click the Databases folder in
Object Explorer, and then click
the Refresh button on the
toolbar. If the Databases folder
is not already expanded, click
the + symbol to the left of the
folder to expand. You should see
your new database named
TestOne listed beneath
AdventureWorks2012. See
Figure 4-10.
10. In Object Explorer, right-click the
TestOne database, and then click
Properties to open the Database
Properties dialog box and view the
configuration settings of the
database that you created in Step 8.
See Figure 4-11. Close the
Database Properties dialog box by
clicking the X in the upper-right
corner of the window.
11. Using Object Explorer, you will now instruct the
database to generate a SQL CREATEDATABASE script that
will open in a Query Editor window using the
TestOnedatabaseNas your template for the configuration.
Right-click the TestOne database,point to Script
Database as, point to CREATE To, and then click New
Query Editor
• Window. See Figure 4-12.
12. The CREATE DATABASE script appears in a Query Editor
window on your right. You are making a clone of the
TestOne database, but you must use a different name
because a database name is unique. On the menu bar of
SQL Server Management Studio, click Edit, point to Find
and Replace, and then click Quick Replace. See Figure 4-
13.
13. In the Find and Replace dialog box, type TestOne in the
Find what text box, and type TestTwo in the Replace with
text box. Click Replace All. A dialog box opens informing
you that you have replaced 38 occurrences of TestOne with
TestTwo in thecurrentdocument. Click OK, and then close
the Find and Replace dialog box.
14. Review the SQL database CREATE script in the Query
Editor window. Note that some of the occurrences of
TestTwo are underlined in red. This is because the database
management system does not yet recognize TestTwo as a
valid database object (you are about to create it). Click the
Execute button on the toolbar or press the F5
15. In Object Explorer, click
Databases, and then click the
Refresh button on the toolbar.
Expand the Databases folder,
right-click the TestTwo
database, and then click
Properties to open the
Database Properties dialog box.
Click Files in the left navigation
menu. Scroll to the right, and
make a note of the file path and
filename for the data and log
file in the Database files
section. Copy the file path into
your Clipboard byclicking the
top cell in the Path column and
pressing Ctrl+C. See Figure 4-
15.
16. Click Cancel to close the Database
Properties dialog box. Click the Start
button, and then click Computer to launch
Windows Explorer.
Navigate to the file path location you wrote
down in Step 15, either by clicking through
the folder structure in the leftnavigation
pane, or by clicking in the Address bar,
entering the file path, and thenpressing
the Enter key. See Figure 4-16.
17. Note that this folder contains a data and log file for
each of the system databases and the user database that
you have created. For a production database server, it is
not recommended that you use the same physical disk
for both file types. Close Windows
Explorer.
18. Return to SQL Server Management Studio and click
the New Query button on the toolbar to launch an empty
Query Editor window. Type the following SQL query in the
Query Editor window: CREATE DATABASE TestThree.
Press the F5 shortcut key to execute your SQL query.
See Figure 4-17.
19. You have now created a new database called
TestThree using the SQL programming language using
the defaults from the model system database. You can
view this in Object Explorer by clicking the Databases
folder, clicking the Refresh button on the toolbar, and
then expanding the Databases folder.
LO4:Describe the role and uses of the main types of
physical files in a SQL server database;

There are two main types of physical files:data files and log files
A SQL Server database must have at least one of each file type.

Data files store the data that is organized in tables and indexes as well as the schemas to the various
objects that represent the logical structure of the database. A schema is a logical container that groups
together collections of objects within a database and allows them to be managed as a group. Data files
are placed into filegroups for storage management. Each databasemust have a primary filegroup with
at least one data file.
However, a database may have more than one data file in a filegroup; the database is able to use all
the data files concurrently, which can improve performance. If using more than one data file within a
filegroup, the data files should all be the same size as the database attempts to fill them equally.
Secondary user-defined filegroups can be created for a specific purpose, for example to store the data
from a specific object or database partition to improve I/O performance, a term used to describe the
number of read and write operations that can be processed by the physical disk in a given time frame.
To properly configure multiple data files and filegroups for best performance, you must know how the
physical drive is configured.
database transaction
Log files record the database transaction activity. A database transaction is a logical unit of work
reading or writing from a database. Database transactions are important for maintaining the integrity
and consistency of the database.
A database transaction is designed to rollback should the transaction fail. The rollback capability
relies on writing the transaction to the log file prior to committing the transaction to the data file.
The log of database transactions is also necessary when recovering a database from a backup—
which is done by replaying the transaction activity from the log to ensure no loss of data. It is possible
to have more than one

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy