Week 4 (9/25/12): Lecture Notes

advertisement
Fall 2012
ITEC 450
MODULE 2
DATABASE INSTALLATION AND
CONFIGURATION
1
Section 3: Database Design
PHASE OF DATABASE DESIGN
Fall 2012
ITEC 450
2
DB DESIGN
Fall 2012

Conceptual Database Design
 The process of constructing a model of the
ITEC 450
information used in an enterprise, independent of
all physical considerations
 Logical Database Design
 The process of constructing a model of the
information used in an enterprise based on a
specific data model, but independent of a
particular DBMS and other physical
considerations.

Physical Database Design
 The process of producing a description of the
implementation of the database on secondary
storage; it describes the storage structures and
access methods used to archieve efficient access
to the data
3
PHASE 2: CONCEPTUAL DB DESIGN
Fall 2012
DBMS-independent high-level data model
 Conceptual schema design
ITEC 450
Characteristics: expressiveness, simplicity and
understandability, minimalism, diagrammatic representation,
formality
 Approaches: centralized vs. view integration
 Outcome: E-R schema


Transaction design (application )
Technique: identify input/out and functional behavior
 Categories: retrieval, update, and mixed

4
ENTITY RELATIONSHIP MODEL
Fall 2012
ITEC 450
Steps to create E-R model:
 Create entities
 Identify key attributes
 Relate each entity via relationships
 Add detailed attributes
 Define cardinality
 Verify all business operations
5
ENTITY RELATIONSHIP MODEL
Fall 2012
 Entity Types
ITEC 450
An object or concept that is identified by the enterprise as having an
independent existence
 Attributes
A property of an entity or a relationship type
 Relationship Types
A meaningful association among entity types
6
NORMALIZATION
Fall 2012

Normalization
ITEC 450
 A technique for producing a set of relations with desirable
properties, given the data requirements of an enterprise
 UNF is a table that contains one or more repeating groups
 1NF is a relation in which the intersection of each row and column contains one
and only one value
 2NF is a relation that is in 1NF and every non-primary-key attribute is fully
functionally dependent on the primary key.
 3NF is a relation that is in 1NF, 2NF in which no non-primary-key attribute is
transitively dependent on the primary key
 BCNF is a relation in which every determinant is a candidate key
 4NF is a relation that is in BCNF and contains no trivial multi-valued dependency
 5NF is a relation that contains no join dependency
7
PHASE 4: LOGICAL DB DESIGN
System-independent mapping

From DBMS-independent EER to relational models
Tailoring the schemas to a specific DBMS
ITEC 450

Fall 2012

Define data types
 Create specific constraints


Result of this phase: DDL statements that specify the
conceptual and external level schemas (not physical
design parameters yet)
8
CHARACTERISTICS OF RELATIONAL MODEL
Fall 2012
ITEC 450
9
PHASE 5: PHYSICAL DB DESIGN
Choosing specific storage structures


Designing access paths


Indexing, clustering, and hashing
ITEC 450

Storage configuration
File organization
Fall 2012

Criteria
Response time
 Space utilization
 Transaction throughput

10
PHYSICAL DESIGN PROCESS
Volume
relations
Attribute data types
estimates
Physical record
descriptions (doesn’t always
match logical design)
Attribute definitions
Response time
Data
expectations
security needs
Backup/recovery needs
Integrity expectations
DBMS
technology used
ITEC 450
Normalized
Decisions
Fall 2012
Inputs
Leads to
File
organizations
Indexes and
database
architectures
Query optimization
11
FILE ORGANIZATION PRINCIPLES
Fall 2012
ITEC 450
Fast data retrieval
 High throughput for I/O
 Efficient use of storage space
 Protection from failures or data loss
 Accommodating growth

12
INDEXED FILE ORGANIZATIONS



ITEC 450
is a data structure used to
determine the location of rows in a file for
quick retrieval
 Indexing design:
Fall 2012
 Index
B-tree index – a keyed, treelike index structure
Bitmap index – a separate string of zeros and ones used
for a column with a very small number of distinct values
Hash Index – a transformed key value using a hash
algorithm
13
Fall 2012
ITEC 450
MODULE 2
DATABASE INSTALLATION AND
CONFIGURATION
14
Section 4: Oracle Database Creation
ASSIGNMENT 3-1-1: DO NOT CREATE A
STARTER DATABASE DURING INSTALLATION
Fall 2012
ITEC 450
15
ENTERPRISE EDITION
Fall 2012
ITEC 450
16
SUMMARY OF INSTALLATION
Fall 2012
ITEC 450
17
CREATING DATABASE
Fall 2012
ITEC 450
18
CREATING DATABASE
Fall 2012
ITEC 450
19
CREATING DATABASE
Fall 2012
ITEC 450
20
DBCA CREATION DEMO
Fall 2012
ITEC 450
21
CHOOSING CONFIGURATION
Important configuration tasks:

Choose a database type

Transactional, data warehouse, or hybrid
How should the database be managed?

OEM Grid Control or OEM Database Control
ITEC 450

Fall 2012

Decide on the DBA authentication method
 Select a storage mechanism



Decide on the file management method


OS, ASM, or raw devices
Specified or set using OMF
Set the initial parameters (init.ora)
22
DBA AUTHENTICATION METHODS
SYSDBA: ADMIN role and can CREATE DATABASE
 SYSOPER: has system privileges to start up, shut
down, and back up the database, and modify
database components


ITEC 450
The DBA authentication method encompasses
the method used to validate logon of users with
the SYSDBA or SYSOPER role
Fall 2012

Two authentication methods:
OS authentication
 Password file authentication

23
OPERATING SYSTEM (OS) AUTHENTICATION
1.
2.
3.
4.
5.
6.

Create OS user for the DBA
Unix only: Create an OSDBA group
Optional: Create an OSOPER group
Set the initialization parameter
REMOTE_LOGIN_PASSWORDFILE to NONE
Assign OS user to OSDBA or OSOPER group
Create Oracle user in DB with same name
ITEC 450

User logs without specifying user
name/password
To set up OS authentication, follow these steps:
Fall 2012

To log on to SQL*Plus using OS authentication:
sqlplus /nolog
CONNECT /@ORACLASS AS SYSDBA
24
PASSWORD FILE AUTHENTICATION

Create a new password file (orapwd)


ITEC 450

Encrypted file contains user names and
passwords
To set up password file authentication:
Fall 2012

Windows: PWD<sid>.ORA, in
ORACLE_HOME\database
Unix: orapw<sid>.ora, typically in ORACLE_HOME/dbs
REMOTE_LOGIN_PASSWORD FILE =
EXCLUSIVE
2. Log on to DB with SYSDBA privileges
3. Create the new DBA user name if needed
4. Grant SYSDBA or SYSOPER privilege to user
1.
25
INITIALIZATION PARAMETERS
Fall 2012
ITEC 450
26
INITIALIZATION PARAMETERS
Fall 2012
ITEC 450
27
INITIALIZATION PARAMETERS
Fall 2012
ITEC 450
28
CREATING DATABASE
To create a database you can use:

You can use the DBCA tool to generate scripts for
creating a database manually


ITEC 450
Database Configuration Assistant (DBCA tool)
 CREATE DATABASE command

Fall 2012

You can use these scripts if you have multiple
consistent databases to create at different sites
CREATE DATABASE gives you greater
flexibility but unnecessary complexity with
settings

You do need to be familiar with its syntax
29
DBCA – CHOOSE TEMPLATE
Fall 2012
ITEC 450
30
DBCA – NAME DATABASE
NOTE: FILL GLOBAL DATABASE NAME ONLY, SID WILL BE FILLED AUTOMATICALLY.
YOU WILL USE A DIFFERENT SID FOR YOUR ASSIGNMENT.
Fall 2012
ITEC 450
31
DBCA – DBA PASSWORDS
NOTE: HERE IS SYS AND SYSTEM PASSWORD DEFINED.
Fall 2012
ITEC 450
32
DBCA – ADD SAMPLE SCHEMAS
Fall 2012
ITEC 450
33
DBCA – STORAGE
NOTE: HERE IS THE PLACE TO DELETE REDO LOG GROUP 3
Fall 2012
ITEC 450
34
DBCA – CREATE DATABASE
Fall 2012
ITEC 450
35
DBCA – DATABASE CREATED
Fall 2012
ITEC 450
36
PHYSICAL DATABASE STRUCTURE

Network files under:





ITEC 450
C:\app\Administrator\product\11.2.0\dbhome_1\a
dmin\orcl450
Fall 2012
Initialization and Administration files under:
C:\app\Administrator\product\11.2.0\dbhome_1\n
etwork\admin
Main types of files – data files, control files, redo log files.
Initialization files – init.ora, SPFILE
Network files – tnsnames.ora, listener.ora
Administration files – alert.log, trace files
37
STARTING AND STOPPING THE
INSTANCE AND DATABASE
To shut down a running database using
SQL*Plus:

ITEC 450
Start a Command Prompt window (or shell)
2. Start up SQL*Plus without logging: sqlplus
/nolog
3. Connect as SYS with SYSDBA
CONNECT SYS/<password>@trial01 AS SYSDBA
4. Type SHUTDOWN IMMEDIATE and press Enter
Database closed.
Database dismounted.
ORACLE instance shut down.
1.
Fall 2012

There are four options for SHUTDOWN:

NORMAL, TRANSACTIONAL, IMMEDIATE,
ABORT
38
STARTING AND STOPPING THE
INSTANCE AND DATABASE
To start DB, change step 4 in previous slide:


PFILE parameter needed if you have not created the
SPFILE
ITEC 450
STARTUP
PFILE=ORACLE_BASE\admin\trial01\pfile\inittrial01.ora
Fall 2012

STARTUP options:

NOMOUNT, MOUNT, OPEN, PFILE
39
THE ALERT LOG AND TRACE FILES


All critical errors will be written to the alert log
ITEC 450
The alert log is essential because it will contain
all the essential information for the smooth
running of your database
Fall 2012

Trace files contain more detailed log and tracing
information about general processing

Trace files can be used to track down problems not
causing critical failures, generally using special tools

E.g. , TKPROF
Note: Some of the slides are from Oracle 10g Database
Administrator: Implementation and Administration by Gavin
Powell and Carol McCullough-Dieter
40
Download