02 - Database Environment
02 - Database Environment
• The process of choosing and installing DBMS is one of the primary task of DBA
• Choosing a suitable DBMS for the Organizations
• Large Company
• Medium Company
• Small Company
• Start select product from tier 1 until lower-tier
• Consider following factor
• OS support - Scalability - Reference Customer
• Type of organization - Release schedule
• Technicians - Cost of ownership
• Benchmark - Availability of supporting software tools
Tier 1 vs Tier 2
• Open-source DBMS : PostgreSQL, MySQL
• Non relational DBMS : IMS, IDMS (CODASYL)
• NoSQL DBMS : CouchDB, MongoDB, Hadoop and Hbase, Cassandra
• Object-Oriented DBMS : ObjectDesign, Versant, Object Store, Ontos, Poet
• PC-Based DBMS : dBase, FileMaker, SQLite, Lotus, Microsoft Access, Paradox
• Need a strategy and a plan for selecting the appropriate DBMS for specific situation.
4
When choosing a DBMS, be sure to consider each of these factors:
• Operating system support
• Type of organization
• Benchmarks - Transaction Processing Performance Council (TPC) publishes official database
performance benchmarks that can be used as a guideline for the basic overall performance of many
different types of database processing
• Scalability
• Availability of supporting software tools
• Technicians
• Cost of ownership
• Release schedule
• Reference customers
5
DBMS Architectures
7
departmental DBMS
• sometimes referred to as a workgroup DBMS
• serves the middle ground
• supports small to medium-size workgroups within an organization
• Typically runs on a UNIX, Linux, or Windows server
8
personal DBMS
• designed for a single user
• typically on a low- to medium-powered PC platform
• suitable only for very small-scale projects and should never be deployed for multiuser applications
9
mobile DBMS
• specialized version of a departmental or enterprise DBMS for remote users who are not usually
connected to the network
• enables local database access and modification on a laptop or handheld device
• provides a mechanism for synchronizing remote database changes to a centralized enterprise or
departmental database server
10
Installing DBMS
• The very first thing to do when you install a DBMS for the first time is to understand the prerequisites
• Hardware Requirements. Choose the correct DBMS for your needs and match your hardware to the
requirements of the DBMS
• Storage Requirements. DBMS will use disk storage for the following items: index, system catalog or
data dictionary, log files, start-up or control files, work files, default databases, temporary database
structures, system dump and error-processing files, DBA databases.
• Memory Requirements. A DBMS requires memory for basic functionality and will use it for most
internal processes such as maintaining the system global area and performing many DBMS tasks.
• A DBMS requires a significant amount of memory to cache data in memory structures in order to
avoid I/O. Reading data from a disk storage device is always more expensive and slower than moving
the data around in memory.
12
Configuring the DBMS
• Configuring the DBMS. Configuring the system parameters of the DBMS controls the manner in
which the DBMS functions and the resources made available to it.
• During the installation process, the input provided to the installation script will be used to establish
the initial settings of the system parameters.
• DBMS also provides a method to change the system parameters once the DBMS is operational.
• Example what system parameters control:
• authorization to the DBMS
• number of active database logs
• set the amount of memory used for data and program caching
• turn DBMS features on or off
• etc…
13
Connecting the DBMS
• Connecting the DBMS to Supporting Infrastructure Software. Connection the DBMS to other system
software components that must interact with the DBMS.
• Typical infrastructure software that may need to be configured to work with the DBMS includes:
• networks
• transaction processing monitors
• message queues
• other types of middleware
• programming languages
• systems management software
• operations and job control software
• Web servers
• application servers
14
Installation Verification
• Installation Verification. Tests to verify that the DBMS has been properly installed and configured.
• Example: Create a set of SQL code that comprises SELECT, INSERT, UPDATE, and DELETE statements
issued against sample databases. Running such a script after installation helps you to verify that the
DBMS is installed correctly and operating as expected.
• DBMS Environments. To support database development, the DBA needs to create multiple DBMS
environments, for example, testing, quality assurance, integration, and production work.
15
Upgrading DBMS Versions and Releases
• A new version of software is a major concern, with many changes and new features.
• A release is typically minor, with fewer changes and not as many new features.
16
Upgrading to a new DBMS offers both rewards and risks.
Benefits: Risks:
• new features and functionality • databases will not be available while the DBMS
is being upgraded (downtime)
• enhanced performance and availability
features that can optimize existing applications • The cost of an upgrade can be a significant
barrier
• DBMS vendors often provide better support
and respond to problems faster for a new • may cause features and syntax that are being
release of their software. used in existing applications to be deprecated
• An effective DBMS upgrade strategy must balance the benefits against the risks of upgrading.
17
Database Standards and Procedures
• Before a newly installed DBMS can be used effectively, standards and procedures must be developed
for database usage.
• Standards are common practices that ensure the consistency and effectiveness of the database
environment, such as database naming conventions.
• Procedures are defined, step-by-step instructions that direct the processes required for handling
specific events, such as a disaster recovery plan.
• The DBA should develop database standards and procedures as a component of corporate-wide IT
standards and procedures. They should be stored together in a central location as a printed
document, in an online format, or as both.
18
Standar Example:
• Database Naming Conventions
• Roles and Responsibilities
• Communication Standards
• Data Administration Standards
• Database Administration Standards
• System Administration Standards
• Database Application Development Standards
• Database Security Standards
• Application Migration and Turnover Procedures
• Design Review Guidelines
• Operational Support Standards
19
© 2018 // FILKOM UB // ALL RIGHTS
Database Support Roles and Responsibilities
p = primary responsibility
x = involved
20
Database Administration Standards example:
• how requests are made to create a new database or make changes to existing databases
• specify which types of database objects and DBMS features are favored and under which
circumstances they are to be avoided
• establish backup and recovery procedures (including disaster recovery plans)
• the methods used to transform a logical data model into a physical database implementation
• cover database performance monitoring and tuning
21
System Administration Standards example:
• DBMS installation and testing procedures
• Upgrade policies and procedures
• Bug fix and maintenance practices
• A checklist of departments to notify for impending changes
• Interface considerations
• DBMS storage, usage, and monitoring procedures
22
Database Application Development Standards example:
• A description of how database access differs from flat file access
• SQL coding standards
• SQL performance tips and techniques
• Program preparation procedures and guidance on how to embed SQL in an application program
• Interpretations of SQLSTATEs and error codes
• References to other useful programming materials for teleprocessing monitors, programming
languages, and general application development standard
23
Db2 Architecture
24
• Db2 Environment
• Db2 Environment - The Big Picture
• Db2 Environment - Instances
• Db2 Environment - Databases
• Db2 Process Model
• Db2 Memory Model
• Db2 Storage Model
25
Db2 Environment
26
The Big Picture
The Db2 environment comprises of various components that makes Db2 function.
These components control the behavior of database system.
Environment Variables
• Example:
OS Environment Variable : TEMP
Db2 Environment Variable : Db2INSTANCE
Db2 Instance
• You may want to have multiple instances per server for the following reasons :
• You want to separate your Production and Test environments but you cannot afford to have different
servers.
• The Db2 registry variables provide a centralized location where some key variables influencing Db2's
behavior reside.
• To view the current Db2 registry variables, issue the following command from the CLP:
• Db2set -all
Connectivity and Directories
• In Db2, directories are used to store connectivity information about databases and the servers on
which they reside.
• Configuration Assistant graphical tool may be used very conveniently to set up database and server
connectivity.
• A database is a collection of information organized into interrelated objects like table spaces, tables,
and indexes.
• Databases are closed and independent units associated to an instance. Because of this
independence, objects in two or more databases can have the same name.
DB configuration file (db cfg)
• Table spaces are logical objects used as a layer between logical tables and physical containers.
• SYSCATSPACE
• TEMPSPACE1
• USERSPACE1
Buffer Pools
• A buffer pool is an area in memory which is used to improve the performance of queries.
• Buffer pools are one of the most important objects to tune for database performance.
39
Db2 Process Model - Highlight
• A process is an executing instance of an application. It can contain multiple threads. A thread could
be considered as a light-weight version of a process
• Thus, the essential difference between a thread and a process is the work that each one is used to
accomplish. Threads are used for small tasks, whereas processes are used for more ‘heavyweight’
tasks – basically the execution of applications.
• A process is an executing instance of an application. It can contain multiple threads. A thread could
be considered as a light-weight version of a process
• Thus, the essential difference between a thread and a process is the work that each one is used to
accomplish. Threads are used for small tasks, whereas processes are used for more ‘heavyweight’
tasks – basically the execution of applications.
• An agent can be thought of as a 'worker' that performs all Database operations on behalf of an
application.
• The following list includes some of the important EDUs that are used by each database:
45
Db2 Memory Model - Highlight
46
Database Instance Memory (DIM)
• The memory allocated for each DBMS instance is Database Instance Memory or Instance Shared
Memory
• It is used for instance level tasks such as monitoring, auditing and inter-node communication
• It is allocated when the Db2 is started (db2start), and freed when it is stopped (db2stop)
47
Database Instance Memory cont..
48
Database Global Memory (DGM)
• It is allocated when you start or initially connect to a database and is released when you stop or
disconnect.
49
Database Global Memory cont..
The amount of memory that is reserved for the database global memory for a
database is determined by the DATABASE_MEMORY configuration parameter
50
Db2 Application Global Memory (AGM)
APPL_MEMORY
51
Db2 Agent Private Memory (APM)
• Agents perform work for the applications, they are used for such things as:
• Building Query Plans
• Executing Query Plans
• Handling Cursors
• Sorting
• Gathering Statistics
52
Db2 Storage Model
53
Db2 Storage Model
• To understand the Db2 storage model, we need to understand the following architecture:
Instance – Db2
P1 P2 P3 P4 P5
tb1 C1
P6 .. .. ..
C2
tb2
tb3 tb4 C3
.. .. Pn
Db2 Tablespaces : Characteristics
• Tablespaces are logical objects between the logical tables and physical container
• All tables, indexes, and other data are stored in a table space
• A tablespace is made up of containers
• Containers are made up of pages
• Page is the lowest unit of storage in Db2
• Page sizes are in denominations of
• 4K, 8K, 16K and 32K
Directory Hierarchy – OS File System
Required Tablespaces in Db2
• Each database must have a minimal set of table spaces that are used for storing system, user and
temporary data: