Professional Documents
Culture Documents
Hong Lee
1
Relational Database Management System (RDBMS)
2
Database Market Share
3
What is an Instance?
4
What is a Schema?
5
Tables, Indexes, Constraints
6
The Three Normal Forms
7
The Three Normal Forms
Second Normal Form: All column values depends on the value of the
primary key
8
The Three Normal Forms
Third Normal Form: No column value depends on the value of any other
column except the primary key.
9
DBA Tasks
System DBA
– Installing and upgrading the database software and
application tools
– Allocating system storage and planning future storage
requirements for the database system
– Creating database and its parameters
– Creating database storage structures (tablespaces)
– Creating database objects (tables, views, indexes)
– Create users and grant database privileges
– Setup database security and auditing
– Setup database backup
– Recover database when necessary
– Setup database monitoring
– Database optimization and performance tuning
– Perform database maintenance (reorgs, collect stats)
– Design and Implement database high availability strategy
– Contact database vendor for technical support
– Ensuring compliance with the database license agreement
10
DBA Tasks
Application DBA
– Reviewing database designs and application functionalities
with the business, developers, and data modelers
– Reviewing database structure changes that provided by
application developers and data modelers
– Implement the database structure such as tables, indexes
– Working with application developers to tune the performance
of the database
– Reviewing and tuning the SQL scripts
– Designing and implementing the database migration
– Helping load/unload data
– Database refreshing and cloning
– Data replications
11
Oracle Instance and Database
• Oracle Instance
▪ Oracle background processes:
◦ SMON – System Monitoring
◦ PMON – Process Monitoring
◦ CKPT – Checkpoint process
◦ ARC0 – Archive log process
◦ LGWR – Log writer
◦ …
▪ Memory
◦ SGA – System Global Area
◦ PGA – Program(Private) Global Area
• Oracle Database
▪ Data files
▪ Control files
▪ Redo log files
▪ Archive log files
▪ Parameter files
12
A Simple View of Oracle Instance and Database
Shared_pool
Database
Buffer Cache Redo Log
Buffer
Database Files
Oracle Processes Control Files
Redo Log Files
Archive Log Files
13
Database Data Redo Log
Cache Buffer
14
How do I connect to the Oracle database
1 2
15
What is a Tablespace?
users01.dbf users02.dbf
16
Database Space Management
17
Database Space Management
18
Database Space Management
19
Automatic Storage Management (ASM)
20
Volume Management vs ASM
Tables Tables
TableSpaces TableSpaces
Files
Automatic
Storage
File Systems Management
Disk Groups
Physical Physical
Disks Disks
RPM
22
Install Software and Create Database
• Kernel settings:
– # Shmmax set to half of the physical mem.
– kernel.shmmax = 4294967296
– kernel.shmall = 2097152
– kernel.shmmni = 4096
– fs.file-max = 327679
– kernel.sem=250 32000 100 128
– net.ipv4.ip_local_port_range = 1024 65000
– net.core.rmem_default=262144
– net.core.wmem_default=262144
– net.core.rmem_max=262144
– net.core.wmem_max=262144
• OS Patches
• Run “root.sh”
• Oracle id: (ora1adm, ora5adm, ora9adm)
• Directories:
– /u01 – Oracle software
– /u02 ~ /uxx – Oracle database
• X-window is required
23
Sysadmin and DBA
24
Oracle Backup and Recovery
• SMON – System Monitor
– Background process that automatic recover the database after a
crash
• Export/Import
– Fast unload/load data and structure to a dump file
– Can only recover to when the export was taken
– Import will be slow for large database
– Best suited for Dev/Test, refreshing
• Data Pump
– Newer version of export and import
– Parallelism
– Can stop and restart
• RMAN (Recover Manager)
– Oracle backup and recover tool (language)
– Able to recover database to point-in-time
– Integrated with many media management tools
• Flashback recovery
– New technology that use Flashback Area and Undo space to undo
the changes
– Best suited for logical data corruption (user error)
25
Recovery with RMAN and tape
Logical Corruption
Database Restore the entire database and
roll forward to the desired time
Execute
SQL
User
Recover
Database
Command Center
System DBA
Coordinate
Close Ticket Recovery
Application DBA
System Analyst
26
Recovery with Flashback
Logical Corruption
Database
Execute
SQL
User
Flashback
Database
Notify
Application
DBA Undo changed data
back to the desired time
Application
DBA
27
Database Monitoring
• What:
• Database up and down
• Database alert log error
• Database directory usage (archive log, software)
• Database backup status
• Tablespace space usage
• Database listener up and down
• How:
• K-shell scripting integrated with NSM
• Oracle Enterprise Manager (OEM)/Grid Control
28
Oracle Enterprise Manager (OEM) / Grid Control
Grid control
console
Management Management
server (OMS) repository
Managed
targets
29
OEM/Grid Control – Server Performance
30
OEM/Grid Control – Database Performance
31
OEM/Grid Control – Top Activity
32
OEM/Grid Control – Top SQL
33
OEM/Grid Control – SQL Tuning
34
OEM/Grid Control – Memory Advice
35
High Availability – Standby Database
36
High Availability – Standby Database Failover
37
High Availability – Real Application Cluster
38
High Availability – Real Application Cluster
Node 1 Node n
39
High Availability – Real Application Cluster
40
High Availability – Real Application Cluster
RAC
41
QUESTIONS
ANSWERS
42