Professional Documents
Culture Documents
Maintenance Training
www.huawei.com
Afternoon
Tablespace Management
Managing ASM
Oracle Common opraitions
Daily Database Check
Oracle Architecture
Managing an ORACLE Instance
Tablespace Management
Managing ASM
Oracle Common oprations
Daily Database Check
Library
Database cache
Redo log
buffer
buffer
cache Data dictionary
cache
PGA
Server
DBWn CKPT LGWR ARCn
process
User Archived
process Control Online redo log files
Data files files log files
Database
An Oracle instance:
A basic way of access to the Oracle database
Always opens and uses only one database at a time
Consists of the memory structure and the background pro
cesses Instance
Shared pool SGA
Memory structure
Library cache
Database Redo log
Data Dict. buffer cache buffer cache
cache
Background process
PMON SMON DBWR LGWR CKPT Others
Oracle database:
Is data set treated as a unit
Consists of three file types
Oracle database
Password file
Library Other
cache
SGA Shared
Shared pool
SQL area Data dictionary
Library cache
Database cache
Redo log
buffer
buffer
cache Data dictionary
cache Library Other
cache
DBWn CKPT LGWR SMON PMON ARCn RECO Others
DB_BLOCK_SIZE
DB_CACHE_SIZE
DB_RECYCLE_CACHE_SIZE
DBWn DB_KEEP_CACHE_SIZE
Data files
Dictionary cache
Database
Redo log
buffer Shared pool
buffer
cache
Free
I/O buffer
memory
Response Request
queue queue
Java Streams Large pool
pool pool Large pool
PGA
Server Private Cursor
PGA Session Work
process
SQL and SQL
memory area
areas area
Dedicated
connections
Shared
PGA
server Shared pool
or PGA
Shared server large pool
connections
PGA_AGGREGATE_TARGET :
Specifies the target aggregate PGA memory available to all server proces
ses attached to the instance
Can be modified dynamically at instance level
Example : 100,000 KB 、 2,500 MB 、 50 GB
Default : 10 MB or 20% of the size of the SGA, whichever is greater
WORKAREA_SIZE_POLICY :
Can be modified dynamically at the instance and session level
Default :AUTO
Library Other
cache
Free targe
t
Free PGA target P G A
SQL areas
SQL areas
SQL areas
SGA targ
et Buffer cache
SGA target
Buffer cache
Buffer cache
Large pool
Large pool
SGA memory
Large pool
250 MB
Memory target
MEMORY_TARGET
SGA_TARGET PGA_AGGREGATE_TARGET
SHARED_POOL_SIZE
Others
DB_CACHE_SIZE
LARGE_POOL_SIZE
JAVA_POOL_SIZE
STREAMS_POOL_SIZE
DB_KEEP_CACHE_SIZE LOG_BUFFER
DB_RECYCLE_CACHE_SIZE RESULT_CACHE_SIZE
DB_nK_CACHE_SIZE
N
MT=0 MMT>0 Y
ST>0 & PAT>0 ST+PAT<=MT<=MMT
Y
MT can be N Minimum possible values
MT=0 dynamically
changed later. Y
ST>0 & PAT=0 PAT=MT-ST
Y
SGA and PGA N
ST>0 are separately
Y
auto-tuned. ST=0 & PAT>0 ST=min(MT-PAT,SMS)
N
Only PGA N
is auto-tuned.
ST=60%MT
SGA and PGA cannot PAT=40%MT
grow and shrink automatically.
Database processes
Server process: Connects to the Oracle instance and is started when a user
establishes a session
Background processes: Are started when an OracleInstance
instance is started
SGA Shared pool
Library
Database cache
Redo log
buffer
buffer
PGA cache Data dictionary
cache
User Server
process process Background processes
DBWn CKPT LGWR SMON PMON ARCn RECO Others
Database user
Database user
Checkpoint
process
Data files
DBWn
LGWR
Instance
SMON
System Monitor
process
Temporary
segment
PMON User
Failed user
process
Process Monitor
process
Database buffer
cache
ARCn
ARCn
Data Control files Redo log Archived
files files Redo log
files
Tablespace
Data file
Segment Segment
Extent Blocks
Oracle Architecture
Managing an ORACLE Instance
Tablespace Management
Network Configuration
Daily Database Check
spfiledb01.ora
MOUNT
NOMOUNT
Starting the
Instance
SHUTDOWN
SHUTDOWN
MOUNT
Starting the
Instance
SHUTDOWN
SHUTDOWN
Starting the
Instance
SHUTDOWN
SHUTDOWN
STARTUP
STARTUP PFILE=$ORACLE_HOME/dbs/initdb01.ora
startup nomount
•create database
•create control file
startup mount
•move datafile
•recover database
• Open an database:
ALTER DATABASE db01 OPEN;
Shutdown mode A I T N
Allowing new access x x x x
Waiting till all current sessions are terminated
x x x o
Waiting till all current transactions are terminated
x x o o
Forced execution of checkpoint and closing all files
x o o o
Shutdown Mode:
NORMAL x NO
TRANSACTIONAL o YES
IMMEDIATE
ABORT
HUAWEI TECHNOLOGIES CO., LTD. Page 53
Shutting Down an Object
During a
Shutdown Normal,
Shutdown Transactional
In this shutdown mode: or After that, restarting
Shutdown Immediate
the database:
• Data block buffer
content written into • Instance recovery not
data file required
• Un-submitted
transactions rolled
back
• Resource released
Consistent Database
(Clean Database)
Inconsistent Database
(Dirty Database)
The background trace file is created only when the background process
detects an error.
The user trace file is created when user process is connected to the Oracle s
erver through the server process.
A user trace file contains traced SQL statements or user communication err
or messages.
A user trace file is created when an error occurs during a user session.
Its path is defined in the initialization parameter USER_DUMP_DEST.
It size is defined in the parameter MAX_DUMP_FILE_SIZE and the default
value is 10M.
DBA
Alert DBA
Auto incident creation
1 2 Targeted health checks
First failure capture Assisted SR filling
No Known
DBA bug?
Yes
EM Support Workbench:
4 Package incident info EM Support Workbench:
Data Repair
Apply patch/Data repair DBA
3
diag
rdbms
DB
Name
ADR metadata
SID
Home
incdir_1 … incdir_n
ADRCI
log.xml
V$DIAG_INFO
alert_SID.log
NAME VALUE
------------------- ---------------------------------------------------------------
Diag Enabled TRUE
ADR Base /u01/app/oracle
ADR Home /u01/app/oracle/diag/rdbms/orcl/orcl
Diag Trace /u01/app/oracle/diag/rdbms/orcl/orcl/trace
Diag Alert /u01/app/oracle/diag/rdbms/orcl/orcl/alert
Diag Incident /u01/app/oracle/diag/rdbms/orcl/orcl/incident
Diag Cdump /u01/app/oracle/diag/rdbms/orcl/orcl/cdump
Health Monitor /u01/app/oracle/diag/rdbms/orcl/orcl/hm
Default Trace File /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_11424.trc
Active Problem Count 3
Active Incident Count 8
Problem
Au Key Incident Status
tom
a tica
Flood l ly Collecting
control Automatic
Incident Ready
transition
nu a l ly Incident ID
Ma Tracking
DBA Data-Purged
Traces Closed
ADR
MMON Auto-purge
Non-critical
Error
Package to be
sent to
Oracle Support
Oracle Architecture
Managing an ORACLE Instance
Tablespace Management
Managing Asm
Oracle Common oprations
Daily Database Check
Database
Database
Extent
Oracle
OS block
block
System tablespace:
Created with the database
Non-System Tablespaces:
Different segments stored separately (e.g., undo segments,
temporary segments, application data)
Flag bit in the bitmap shows the free or used status of blocks.
Dictionary-Managed Tablespaces:
Default tablespace management method
You cannot:
Tablespace APP_DATA
100M
100M 200M
100M
app_data_01.dbf app_data_02.dbf app_data_03.dbf
ALTER DATABASE
DATAFILE '/u03/oradata/userdata02.dbf'
RESIZE 200M;
Tablespace APP_DATA
100M
100M 200M 200M
100M
Tablespace APP_DATA
Tablespace info:
DBA_TABLESPACES
V$TABLESPACE
Oracle Architecture
Managing an ORACLE Instance
Tablespace Management
Managing ASM
Oracle Common oprations
Daily Database Check
Operating system
File-system
Extent
file Allocation unit
or
raw device
Oracle
block Physical
block
ASM
instance
Database
instance
INSTANCE_TYPE = ASM
DB_UNIQUE_NAME = +ASM
ASM_POWER_LIMIT = 1
ASM_DISKSTRING = '/dev/rdsk/*s2', '/dev/rdsk/c1*'
ASM_DISKGROUPS = dgroupA, dgroupB
LARGE_POOL_SIZE = 8MB
$export ORACLE_SID=+ASM
$sqlplus /nolog
SQL> CONNECT / AS sysdba
Connected to an idle instance.
SQL> STARTUP;
ASM instance started
Total System Global Area 147936196 bytes
Fixed Size 324548 bytes
Variable Size 96468992 bytes
Database Buffers 50331648 bytes
Redo Buffers 811008 bytes
ASM diskgroups mounted
5
4
3
1 7 13 1 7 13 1 7 13
1 7 13 1 7 13 1 7 13
1 7 13 1 7 13 1 7 13
Disk group A
HUAWEI TECHNOLOGIES CO., LTD. Page 97
Create or Delete Disk Groups
Disk formatting
Add Datafile
SQL>alter tablespace test add datafile
‘+data’ size 1000M;
Listener Management
Local Service Name Configuration
Three important configuration files:
listener.ora
Tnsnames.ora
Sqlnet.ora
Oracle Architecture
Managing an ORACLE Instance
Tablespace Management
Managing ASM
Oracle Common oprations
Daily Database Check
$adrci
Output to altert_1.txt
Adrci>spool alert_1.txt
Purge table :
SQL >purge recyclebin;
Can find the cause and the recommended action through the error number
Usage
swith to oracle user
$ su - oracle
$ oerr parameter errornumber
parameter
The first three charaters of the oracle error information
Common used parameters: ora 、 exp 、 imp 、 tns 、 rman 、 pls
Error number
The number of Oracle error report
Example :
oerr ora 4031
oerr imp 0008
SQLPLUS offer some internal commands, which can make the query operaiti
on very simple
DESC
SHOW [ALL]
COL ... FORMAT ...
SET
EMP_NAME VARCHAR2(20)
EMP_GENDER CHAR(1)
EMP_DEPTID NUMBER
EMP_DEPT VARCHAR2(20)
EMP_ZONE VARCHAR2(20)
EMP_JOINED_DATE DATE
Quickly find out the name ,type and value of the oracle ins
tance’s initial parameters
FILE_NAME
--------------------------------------------------
FILE_ID TABLESPACE_NAME
---------- ------------------------------
BYTES BLOCKS STATUS RELATIVE_FNO AUT
---------- ---------- --------- ------------ ---
MAXBYTES MAXBLOCKS INCREMENT_BY USER_BYTES
---------- ---------- ------------ ----------
USER_BLOCKS
-----------
/opt/oracle/mounts/ora7/sysdata/hlrts01.dbf
5 HLRTS
1048576000 512000 AVAILABLE 5 NO
COUNT(*)
----------------
11119
Elapsed: 00:00:00.04
By this command,you can get the exact time that oracle spended on executing
a sql
The Programer can test a sql by this method to figure out how the sql impact th
e oracle instance’s performance
Example:
Sql> ! ls
Oracle Architecture
Managing an ORACLE Instance
Tablespace Management
Managing ASM
Oracle Common oprations
Daily Database Check
STATUS INSTANCE_ROLE
------------ ------------------
OPEN PRIMARY_INSTANCE
command
SQL>select * from v$version;
$cd $ORACLE_HOME/rdbms/admin
$sqlplus / as sysdba
SQL>@awrrpt
$rman target /
RMAN>list backup;
List of backup sets
===================
BS key Type LV size Device type elapsed time completion time
------- ---- -- ---------- ----------- ------------ ----------
60 Full 100K DISK 00:00:04 12-Dec-01
BP key: 61 Status: AVAILABLE TAG:
Piece Name:D:\ORACLE\ORA90\DATABASE\01DBGIVM_1_1
List of datafiles in backupset 60
File LV TYPE Ckp SCN Ckp Time Name
---- -- ---- ---------- ---------- ----
8 Full 1938523 12-12 月 -01 D:\ORACLE\ORADATA\ORA9I\USERS01.DBF
from dba_jobs;
www.huawei.com