Professional Documents
Culture Documents
Databases: Database Architecture
Databases: Database Architecture
Databases: Database Architecture
A database in Microsoft SQL Server consists of a collection of tables that contain data
and other objects, such as views, indexes, stored procedures, and triggers, defined to
support activities performed with the data. The data stored in a database is usually related
to a particular subject or process, such as inventory information for a manufacturing
warehouse.
SQL Server can support many databases. Each database can store either interrelated
or unrelated data from other databases. For example, a server can have one database that
stores personnel data and another that stores product-related data. Alternatively, one
database can store current customer order data, and another related database can store
historical customer orders used for yearly reporting.
Database Architecture:
Microsoft SQL Server 2000 data is stored in databases. The data in a database is
organized into the logical components visible to users. A database is also physically
implemented as two or more files on disk.
When using a database, you work primarily with the logical components such as
tables, views, procedures, and users. The physical implementation of files is largely
transparent. Typically, only the database administrator needs to work with the physical
implementation.
Each instance of SQL Server has four system databases (master, model, tempdb,
and msdb) and one or more user databases. Some organizations have only one user
database, containing all the data for their organization. Some organizations have different
databases for each group in their organization, and sometimes a database used by a single
application. For example, an organization could have one database for sales, one for payroll,
one for a document management application, and so on. Sometimes an application uses
only one database; other applications may access several databases.
It is not necessary to run multiple copies of the SQL Server database engine to allow
multiple users to access the databases on a server. An instance of the SQL Server Standard
or Enterprise Edition is capable of handling thousands of users working in multiple
databases at the same time. Each instance of SQL Server makes all databases in the
instance available to all users that connect to the instance, subject to the defined security
permissions.
Types of Databases:
System Databases
System Databases:
Along with the installation of SQL Server FOUR databases will be created
automatically called as system databases. They can be used by any user anywhere from
SQL Server.
The System Databases are:
master
The master database records all of the system level information for a SQL Server
system. It records all login accounts and all system configuration settings. master is
the database that records the existence of all other databases, including the location
of the database files. master records the initialization information for SQL Server;
always have a recent backup of master available.
model
The model database is used as the template for all databases created on a system.
When a CREATE DATABASE statement is issued, the first part of the database is
created by copying in the contents of the model database, then the remainder of the
new database is filled with empty pages. Because tempdb is created every time SQL
Server is started, the model database must always exist on a SQL Server system.
msdb
The msdb database is used by SQL Server Agent for scheduling alerts and jobs, and
recording operators.
tempdb
tempdb holds all temporary tables and temporary stored procedures. It also fills any
other temporary storage needs such as work tables generated by SQL Server.
tempdb is a global resource; the temporary tables and stored procedures for all
users connected to the system are stored there. tempdb is re-created every time
SQL Server is started so the system starts with a clean copy of the database
The databases that are created by the users are called as user defined databases.
While creating a database, the user has to specify a name to the database and the
details of data files, which are used to specify the location, where the database data is to be
stored.
Creating a Database:
To create a database, determine the name of the database, its owner (the user who
creates the database), its size, and the files and filegroups used to store it.
1. Open the 'Management Studio’ tool and connect to the required instance of SQL
Server with desired authentication.
2. Expand ‘Databases’ Item. It displays list of already existing databases.
3. Right Click on the ‘Databases’ item and select ‘New Database’ option.
4. Provide a name to the Database and specify the details of primary and log file and
‘Database Files’ section.
5. Click ok.
Example:
sp_helpdb emp
NOTE: The sp_helpdb system stored procedure without a database name reports
information about all the databases in the system.
TABLES
Example:
DROP DATABASE dbSample