You are on page 1of 132

Oracle 11g

Maintenance Training

 www.huawei.com

HUAWEI TECHNOLOGIES CO., LTD.


HUAWEI TECHNOLOGIES CO., LTD. Page 1
Schedule – Day
 Morning
 Oracle Architecture
 Managing an ORACLE Instance

 Afternoon
 Tablespace Management
 Managing ASM
 Oracle Common opraitions
 Daily Database Check

HUAWEI TECHNOLOGIES CO., LTD. Page 2


Contents

 Oracle Architecture
 Managing an ORACLE Instance
 Tablespace Management
 Managing ASM
 Oracle Common oprations
 Daily Database Check

HUAWEI TECHNOLOGIES CO., LTD. Page 3


Objectives

After learning this part, you will be expected to learn:


 Describe the architecture and main components of an Ora
cle server;
 List the structures involved in establishing a connection to
Oracle instances
 Advanced features: RAC, Data Guard

HUAWEI TECHNOLOGIES CO., LTD. Page 4


Oracle Database Architecture: Overview
Instance

SMON PMON RECO Others

SGA Shared pool

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

HUAWEI TECHNOLOGIES CO., LTD. Page 5


Oracle Server

One Oracle server:


 Is a database management system that
Oracle server
provides open, exhaustive and
comprehensive management services;
 Consists of an Oracle database and an
Oracle instance

HUAWEI TECHNOLOGIES CO., LTD. Page 6


Oracle Instance

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

HUAWEI TECHNOLOGIES CO., LTD. Page 7


Oracle Database

 Oracle database:
 Is data set treated as a unit
 Consists of three file types

Oracle database

Data Control Redo log


Parameter file file file file Archived log file

Password file

HUAWEI TECHNOLOGIES CO., LTD. Page 8


Physical Structure

The physical storage of an Oracle database is dependent on


actual operating system files:
 Control files
 Data files Title
Control
files
 Redo log files Data files
(including data
Online redo
dictionary)
log files

HUAWEI TECHNOLOGIES CO., LTD. Page 9


Oracle Database DB structures
Memory

Memory Structures - Process


- Storage

Server Server Background


PGA PGA PGA
process 1 process 2 process

Data dictionary SGA


Shared
cache
SQL area

Library Other
cache

Redo log Shared pool


buffer
Free
Database buffer I/O buffer
memory
cache
Response Request
Java Streams queue queue
pool pool Large pool

HUAWEI TECHNOLOGIES CO., LTD. Page 10


System Global Area (SGA)

 The system global area (SGA) consists of the following me


mory areas:
 Shared pool
 Database Buffer Cache
 Redo log buffer cache
 Two optional memory structures can be configured within
the SGA:
 Large pool
 JAVA pool

HUAWEI TECHNOLOGIES CO., LTD. Page 11


Shared Pool
 Is a portion of the SGA
 Contains:
 Library cache

–Shared SQL area


 Data dictionary cache
 Control structures
Instance

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

HUAWEI TECHNOLOGIES CO., LTD. Page 12


Database Buffer Cache
SGA
Server LRU Checkpoint
lists queue DB buffer cache

DB_BLOCK_SIZE
DB_CACHE_SIZE
DB_RECYCLE_CACHE_SIZE
DBWn DB_KEEP_CACHE_SIZE

Data files

HUAWEI TECHNOLOGIES CO., LTD. Page 13


Redo Log Buffer Cache
Shared
Redo logDatabase pool cache
Library
buffer buffer cache

Dictionary cache

User global area

Server LGWR ARCn


process
Control files

SQL> UPDATE employees


2 SET salary=salary*1.1 Archived
Data files
3 WHERE employee_id=736; log files
Redo log files

HUAWEI TECHNOLOGIES CO., LTD. Page 14


Large Pool
 Provides large memory allocations for:
 Session memory for the shared server and the Oracle XA interface
 I/O server processes
 Oracle Database backup and restore operations

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

HUAWEI TECHNOLOGIES CO., LTD. Page 15


Java Pool
and Streams Pool
 Java pool memory is used in server memory for all session-specific
Java code and data in the JVM.
 Streams pool memory is used exclusively by Oracle Streams to:
 Store buffered queue messages
 Provide memory for Oracle Streams processes

Java pool Streams


pool

HUAWEI TECHNOLOGIES CO., LTD. Page 16


Program Global Area (PGA)

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

HUAWEI TECHNOLOGIES CO., LTD. Page 17


PGA Parameters

 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

HUAWEI TECHNOLOGIES CO., LTD. Page 18


Automatic shared memory management

 Automatically tunes five important sga components depend


on the workload of the instance
 Increase efficiency of the use of SGA
 Reduce memory leak
Buffer cache
Buffer cache
Large pool
Large pool

Shared pool Shared pool


Java pool Java pool
Online users Batch jobs
HUAWEI TECHNOLOGIES CO., LTD.
Automatic Memory Management
Parameter Specifies

SGA_TARGET Total size of all SGA components

MEMORY_TARGET Oracle systemwide usable


memory
Data dictionary SGA
Shared
cache
SQL area

Library Other
cache

Redo log Shared pool


buffer
Free
Database buffer I/O buffer
memory
cache
Response Request
Java Streams queue queue
pool pool Large pool

HUAWEI TECHNOLOGIES CO., LTD. Page 20


Automatic Memory Management:
Overview
Untunable Untunable
10g&11g

Untunable Memory target


11g

PGA PGA PGA


PGA memory

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

Shared pool Shared pool Shared pool

Java pool Java pool Java pool


Streams pool Streams pool Streams pool

Other SGA Other SGA Other SGA

OLTP BATCH BATCH

HUAWEI TECHNOLOGIES CO., LTD. Page 21


Automatic Memory Management:
Overview
11g 11g
350 MB 350 MB
Memory Memory
max target max target
300 MB
Memory target

250 MB
Memory target

ALTER SYSTEM SET


MEMORY_TARGET=300M;

HUAWEI TECHNOLOGIES CO., LTD. Page 22


Oracle Database 11g Memory
Parameters
MEMORY_MAX_TARGET
SGA_MAX_SIZE

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

HUAWEI TECHNOLOGIES CO., LTD. Page 23


Automatic Memory Parameter
Dependency N Y Y
MT>0 MMT=0 MMT=MT
N

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.

Both SGA and PGA can grow and shrink automatically.

HUAWEI TECHNOLOGIES CO., LTD. Page 24


DB structures
Process Architecture - Memory
 Process
- Storage
 User process
 Is started when a database user or a batch process connects to Oracle
Database

 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

HUAWEI TECHNOLOGIES CO., LTD. Page 25


Process Structures

Server Server Server Server Server


Server n
processes
SGA
Shared pool
Library
Database
Redo log cache
buffer
buffer SGA
cache Data dictionary
cache

CKPT RECO PMON SMON DBWn LGWR ARCn Others


Oracle
background
processes
HUAWEI TECHNOLOGIES CO., LTD. Page 26
User Process

 The user process requires interaction between Oracle serv


ers:
 It must set up a connection first.
 It does not interact with the Oracle server directly
Server
process
User
process
Connection
established

Database user

HUAWEI TECHNOLOGIES CO., LTD. Page 27


Server Process

A server process is a program that directly interacts wit


h the Oracle server.
 In response to user requests, it makes a call to the serve
r, and returns the result to the user.
Server
process
Connection
established Session created
User Oracle server
process

Database user

HUAWEI TECHNOLOGIES CO., LTD. Page 28


Background Processes
 The relationship between the physical and memory
 structures is maintained and enforced by Oracle’s background proces
ses.
 Mandatory background processes
 DBWn PMON CKPT
 LGWR SMON RECO
 Optional background processes
 ARCn LMON Snnn
 QMNn LMDn
 CJQ0 Pnnn
 LCKn Dnnn

HUAWEI TECHNOLOGIES CO., LTD. Page 29


Checkpoint Process (CKPT)

 Records checkpoint information in


 Control file
 Each data file header

CKPT Control file

Checkpoint
process

Data files

HUAWEI TECHNOLOGIES CO., LTD. Page 30


Database Writer Process (DBWn)

 Writes modified (dirty) buffers in the database buffer cache to


disk:
 Asynchronously while performing other processing
 Periodically to advance the checkpoint

DBWn

Database buffer Database writer Data files


cache process

HUAWEI TECHNOLOGIES CO., LTD. Page 31


LogWriter Process (LGWR)
 Writes the redo log buffer to a redo log file on disk
 Writes:
 When a user process commits a transaction
 When the redo log buffer is one-third full
 Before a DBWn process writes modified buffers to disk

LGWR

Redo log buffer LogWriter process Redo log files

HUAWEI TECHNOLOGIES CO., LTD. Page 32


System Monitor Process (SMON)

 Performs recovery at instance startup


 Cleans up unused temporary segments

Instance
SMON

System Monitor
process

Temporary
segment

HUAWEI TECHNOLOGIES CO., LTD. Page 33


Process Monitor Process (PMON)

 Performs process recovery when a user process fails


 Cleans up the database buffer cache
 Frees resources that are used by the user process

 Monitors sessions for idle session timeout


 Dynamically registers database services with listeners

PMON User
Failed user
process
Process Monitor
process
Database buffer
cache

HUAWEI TECHNOLOGIES CO., LTD. Page 34


Archiver Process

 An optional background process


 Automatically archiving online redo log files when ARCHIV
ELOG mode is configured
 Saving all database changes

ARCn
ARCn
Data Control files Redo log Archived
files files Redo log
files

HUAWEI TECHNOLOGIES CO., LTD. Page 35


Other Processes

 MMON: Performs manageability-related background tasks


 MMNL: Performs frequent and lightweight manageability-related
tasks
 MMAN: Performs automatic memory management tasks
 CJQ0: Runs user jobs used in batch processing
 QMNx: Monitors the Streams Advanced Queuing message queues

HUAWEI TECHNOLOGIES CO., LTD. Page 36


Logical Structure

 An Oracle logical structure hierarchy describes how the ph


ysical space of a database is used, including tablespaces, s
egments, extents and blocks.

Tablespace
Data file
Segment Segment

Extent Blocks

HUAWEI TECHNOLOGIES CO., LTD. Page 37


Summary

After learning this part, you are expected to know:


 Database file: Data file, control file, online redo log
 SGA memory structure: Database Buffer Cache, shared po
ol, redo log buffer cache.
 Main background processes:
DBWn, LGWR, CKPT, PMON, SMON, and ARCn
 Advanced features: RAC, Data Guard

HUAWEI TECHNOLOGIES CO., LTD. Page 38


Contents

 Oracle Architecture
 Managing an ORACLE Instance
 Tablespace Management
 Network Configuration
 Daily Database Check

HUAWEI TECHNOLOGIES CO., LTD. Page 39


Objectives

After learning this part, you are expected to know:


 Create and manage initialized parameter files
 Start and close instances
 Monitor and use diagnostic files

HUAWEI TECHNOLOGIES CO., LTD. Page 40


Starting and Stopping Database Control

$ emctl start dbconsole


Oracle Enterprise Manager 11g Database Control Release 11.1.0.1.0
Copyright (c) 1996, 2006 Oracle Corporation. All rights reserved.
https://edrsr17p1.us.oracle.com:1158/em/console/aboutApplication
Starting Oracle Enterprise Manager 11g Database Control .............
started.
------------------------------------------------------------------
Logs are generated in directory /u01/app/oracle/product/11.1.0/db_1/
edrsr17p1.us.oracle_orcl/sysman/log

$ emctl stop dbconsole


Oracle Enterprise Manager 11g Database Control Release 11.1.0.1.0
Copyright (c) 1996, 2006 Oracle Corporation. All rights reserved.
https://edrsr17p1.us.oracle.com:1158/em/console/aboutApplication
Stopping Oracle Enterprise Manager 11g Database Control ...
... Stopped.

HUAWEI TECHNOLOGIES CO., LTD.


Initialization Parameter Files
Oracle Instance

Shared pool SGA


Library
cache Data buffer Redo log
Data dict. cache buffer
cache

PMON SMON DBW0 LGWR CKPT Others

spfiledb01.ora

SQL> CONNECT / AS SYSDBA


SQL> STARTUP

HUAWEI TECHNOLOGIES CO., LTD. Page 42


Initialization Parameter Files

 Instance access entry


 There are two types of parameters:
 Explicit: There is an entry in the file
 Implicit: There is no entry in the file, but it is assigned a default value

 Different initialization files can be used in different environments to optimize


the execution of a single database.
 Changing parameter settings in a file and validating the change depend on
the type of initialization parameter file.
 Static initialization parameter file (PFILE)
 Persistent initialization parameter file (SPFILE)

HUAWEI TECHNOLOGIES CO., LTD. Page 43


PFILE
initSID.ora

 The PFILE is a text file that can be maintained using a standard


operating system editor.
 Modify the file manually.
 The modification will take effect the next time when the database is
started.
 The default path is $ORACLE_HOME/dbs.

HUAWEI TECHNOLOGIES CO., LTD. Page 44


SPFILE
spfileSID.ora
 The SPFILE file is a binary file in which the modification can take effect
without the need of restarting the database.
 The file resides on the ORACLE server side.
 The ALTER SYSTEM command can be used to change the value of
parameters directly.
 It can determine whether the modification will take effect temporarily in
the memory or the modification will take effect persistently from now on.
 Modified values can be deleted and reset to default value of instances.

ALTER SYSTEM SET undo_tablespace = 'UNDO2';

HUAWEI TECHNOLOGIES CO., LTD. Page 45


An Example of SPFILE
*.background_dump_dest='$ORACLE_HOME/admin/db01/bdump'
*.db_block_size=4096
*.db_files=40
*.db_name='db01'
*.instance_name='db01'
*.remote_login_passwordfile='exclusive'
*.shared_pool_size=31457280 # 30M Shared Pool
*.undo_management='AUTO'
db01.undo_tablespace='UNDOTBS01'
db02.undo_tablespace='UNDOTBS02'
...
HUAWEI TECHNOLOGIES CO., LTD. Page 46
Creating an SPFILE File

An SPFILE is created from an initSID.ora file using the CREATE SPFILE


command. This can be executed before or after the database is open.

CREATE SPFILE FROM PFILE;

CREATE PFILE=‘/tmp/test.ora’ FROM SPFILE;

HUAWEI TECHNOLOGIES CO., LTD.


Starting Up a Database
NOMOUNT
OPEN
STARTUP

MOUNT

NOMOUNT

Starting the
Instance
SHUTDOWN
SHUTDOWN

HUAWEI TECHNOLOGIES CO., LTD. Page 48


Starting Up a Database
MOUNT
OPEN
STARTUP

MOUNT

Opening the Control


File
NOMOUNT

Starting the
Instance
SHUTDOWN
SHUTDOWN

HUAWEI TECHNOLOGIES CO., LTD. Page 49


Starting Up a Database
OPEN
OPEN
STARTUP Opening All Files Described in
the Control File of the Instance
MOUNT

Opening the Control


File
NOMOUNT

Starting the
Instance
SHUTDOWN
SHUTDOWN

HUAWEI TECHNOLOGIES CO., LTD. Page 50


STARTUP Command

Start up an instance and open a database:

STARTUP

STARTUP PFILE=$ORACLE_HOME/dbs/initdb01.ora

startup nomount

•create database
•create control file
startup mount

•move datafile
•recover database

HUAWEI TECHNOLOGIES CO., LTD. Page 51


The ALTER DATABASE Command

 Change the Status of the Database (UNMOUNT TO MOUNT):

ALTER DATABASE db01 MOUNT;

• Open an database:
ALTER DATABASE db01 OPEN;

HUAWEI TECHNOLOGIES CO., LTD. Page 52


Shutting Down the Database

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)

HUAWEI TECHNOLOGIES CO., LTD. Page 54


Shutting Down an Object
During a
Shutdown Abort
After that, restarting the
or database:
In this shutdown mode: Instance Failure
or
Startup Force • Modified information is
• Modified data block buffer
written to the redo log file
content are not written into
data file
• Uncommitted changes
must be rolled back with
• Uncommitted transactions
the rollback segment
are not rolled back
• Resource released

Inconsistent Database
(Dirty Database)

HUAWEI TECHNOLOGIES CO., LTD. Page 55


Managing Instances by Checking Diagnostic
Files
 A diagnostic file covers the information of important event
s that occurred while an instance is running.
 Diagnostic files are the basis for daily management of data
bases and help solve problems.
 There are following types of diagnostic files:
 Alert log file (alertSID.log)
 Background trace file
 User trace file

HUAWEI TECHNOLOGIES CO., LTD. Page 56


Alert Log File
The alert log file keeps a record of some operating commands and
results of major events while the database is running.
 It is used for diagnosis of error messages in daily database running.
 Each file has corresponding timestamp information.
 Its path is defined in the initialization parameter
BACKGROUND_DUMP_DEST.

HUAWEI TECHNOLOGIES CO., LTD. Page 57


Background Trace File
The background trace file keeps a record of error messages detected by
background processes.

 The background trace file is created only when the background process
detects an error.

 Its path is defined in the initialization parameter


BACKGROUND_DUMP_DEST.

HUAWEI TECHNOLOGIES CO., LTD. Page 58


User Trace File

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.

HUAWEI TECHNOLOGIES CO., LTD. Page 59


Ease Diagnosis: Automatic Diagnostic Workflow
Automatic
Critical Diagnostic
Error Repository

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

HUAWEI TECHNOLOGIES CO., LTD. Page 60


ADRCI: The ADR Command-Line Tool

 Allows interaction with ADR from OS prompt


 Can invoke IPS with command line instead of EM
 DBAs should use EM Support Workbench:
 Leverages same toolkit/libraries that ADRCI is built upon
 Easy to follow GUI

ADRCI> show incident


ADR Home = /u01/app/oracle/product/11.1.0/db_1/log/diag/rdbms/orcl/orcl:
*****************************************************************************
INCIDENT_ID PROBLEM_KEY CREATE_TIME
------------ -------------------------------------- ---------------------------------
1681 ORA-600_dbgris01:1,_addr=0xa9876541 17-JAN-07 09.17.44.843125000…
1682 ORA-600_dbgris01:12,_addr=0xa9876542 18-JAN-07 09.18.59.434775000…
2 incident info records fetched
ADRCI>

HUAWEI TECHNOLOGIES CO., LTD. Page 61


Automatic Diagnostic Repository
DIAGNOSTIC_DEST
Support Workbench
$ORACLE_BASE BACKGROUND_DUMP_DEST
CORE_DUMP_DEST
USER_DUMP_DEST
$ORACLE_HOME/log
ADR
Base

diag

rdbms

DB
Name

ADR metadata
SID
Home

alert cdump incpkg incident hm trace (others)

incdir_1 … incdir_n

ADRCI
log.xml
V$DIAG_INFO
alert_SID.log

HUAWEI TECHNOLOGIES CO., LTD. Page 62


V$DIAG_INFO

SQL> SELECT * FROM V$DIAG_INFO;

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

HUAWEI TECHNOLOGIES CO., LTD. Page 63


Location for Diagnostic Traces
Diagnostic Data Previous Location ADR Location
Foreground process traces USER_DUMP_DEST $ADR_HOME/trace

Background process traces BACKGROUND_DUMP_DEST $ADR_HOME/trace

Alert log data BACKGROUND_DUMP_DEST $ADR_HOME/alert&trace

Core dumps CORE_DUMP_DEST $ADR_HOME/cdump

Incident dumps USER|BACKGROUND_DUMP_DEST $ADR_HOME/incident/incdir_n

ADR trace = Oracle Database 10g trace – critical error trace

HUAWEI TECHNOLOGIES CO., LTD. Page 64


Viewing the Alert Log Using Enterprise
Manager

HUAWEI TECHNOLOGIES CO., LTD. Page 65


Viewing the Alert Log Using ADRCI
adrci> set homepath diag/rdbms/orcl/orcl
adrci> show alert –tail

ADR Home = /u01/app/oracle/diag/rdbms/orcl/orcl:


*************************************************************************
2007-04-16 22:10:50.756000 -07:00
ORA-1654: unable to extend index SYS.I_H_OBJ#_COL# by 128 in tablespace
SYSTEM
2007-04-16 22:21:20.920000 -07:00
Thread 1 advanced to log sequence 400
Current log# 3 seq# 400 mem# 0: +DATA/orcl/onlinelog/group_3.266.618805031
Current log# 3 seq# 400 mem# 1: +DATA/orcl/onlinelog/group_3.267.618805047

Thread 1 advanced to log sequence 401
Current log# 1 seq# 401 mem# 0: +DATA/orcl/onlinelog/group_1.262.618804977
Current log# 1 seq# 401 mem# 1: +DATA/orcl/onlinelog/group_1.263.618804993
DIA-48223: Interrupt Requested - Fetch Aborted - Return Code [1]

adrci> SHOW ALERT -P "MESSAGE_TEXT LIKE '%ORA-600%'"

ADR Home = /u01/app/oracle/diag/rdbms/orcl/orcl:


*************************************************************************
adrci>

HUAWEI TECHNOLOGIES CO., LTD. Page 66


Viewing the Alert Log Using ADRCI
adrci> set homepath diag/rdbms/orcl/orcl
adrci> show alert –tail

ADR Home = /u01/app/oracle/diag/rdbms/orcl/orcl:


*************************************************************************
2007-04-16 22:10:50.756000 -07:00
ORA-1654: unable to extend index SYS.I_H_OBJ#_COL# by 128 in tablespace
SYSTEM
2007-04-16 22:21:20.920000 -07:00
Thread 1 advanced to log sequence 400
Current log# 3 seq# 400 mem# 0: +DATA/orcl/onlinelog/group_3.266.618805031
Current log# 3 seq# 400 mem# 1: +DATA/orcl/onlinelog/group_3.267.618805047

Thread 1 advanced to log sequence 401
Current log# 1 seq# 401 mem# 0: +DATA/orcl/onlinelog/group_1.262.618804977
Current log# 1 seq# 401 mem# 1: +DATA/orcl/onlinelog/group_1.263.618804993
DIA-48223: Interrupt Requested - Fetch Aborted - Return Code [1]

adrci> SHOW ALERT -P "MESSAGE_TEXT LIKE '%ORA-600%'"

ADR Home = /u01/app/oracle/diag/rdbms/orcl/orcl:


*************************************************************************
adrci>

HUAWEI TECHNOLOGIES CO., LTD. Page 67


Problems and Incidents
Problem ID
Critical
Error Problem

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

HUAWEI TECHNOLOGIES CO., LTD. Page 68


Summary

After learning this part, you are expected to know:

 How to create and manage initialization parameter files

 How to start up and shut down instances and databases

 How to monitor and use diagnostic files

HUAWEI TECHNOLOGIES CO., LTD. Page 69


Practice

The practice in this part covers the following:


 Creating an SPFILE file
 Starting up and shutting down an database in different ways
 Please refer to “Oracle Database Hands-on Practice”.

Classroom practice- 〉 Managing an Oracle Instance

ctice HUAWEI TECHNOLOGIES CO., LTD.


Contents

 Oracle Architecture
 Managing an ORACLE Instance
 Tablespace Management
 Managing Asm
 Oracle Common oprations
 Daily Database Check

HUAWEI TECHNOLOGIES CO., LTD. Page 71


Objectives

After learning this part, you are expected to know:


 Logical structure of the database
 Create tablespace
 Resize the tablespace
 Allocate space for temporary segments
 Change the status of tablespace
 Change tablespace storage parameter settings

HUAWEI TECHNOLOGIES CO., LTD. Page 72


Overview

Database

Data Control Redo log


files files files

HUAWEI TECHNOLOGIES CO., LTD. Page 73


Database Architecture

Database

Tablespace Data file

Logically Segment Physically

Extent

Oracle
OS block
block

HUAWEI TECHNOLOGIES CO., LTD. Page 74


System and Non-System Tablespaces

 System tablespace:
 Created with the database

 Contains the data dictionary

 Contains the SYSTEM undo segment

 Non-System Tablespaces:
 Different segments stored separately (e.g., undo segments,
temporary segments, application data)

 Control the amount of space allocated to user’s objects

HUAWEI TECHNOLOGIES CO., LTD. Page 75


Tablespace Management
 Locally managed tablespaces:
 Free extents are contained in their own bitmap

 Each bit in the bitmap corresponds to a block or a group of blocks

 Flag bit in the bitmap shows the free or used status of blocks.

 Dictionary-Managed Tablespaces:
 Default tablespace management method

 Free extents recorded in the data dictionary

HUAWEI TECHNOLOGIES CO., LTD. Page 76


Locally Management Tablespaces

CREATE TABLESPACE userdata


DATAFILE '/u01/oradata/userdata01.dbf' SIZE 500M
EXTENT MANAGEMENT LOCAL UNIFORM SIZE 256K;

 Simplifying the content contained in the data dictionary


 Space allocation and recycle do not generate undo information
 Eliminating the need to coalesce adjacent extents

HUAWEI TECHNOLOGIES CO., LTD. Page 77


Dictionary Managed Tablespaces

CREATE TABLESPACE userdata


DATAFILE '/u01/oradata/userdata01.dbf' SIZE 500M
EXTENT MANAGEMENT DICTIONARY
DEFAULT STORAGE ( initial 1M NEXT 1M );

 Extents are managed in the data dictionary


 Each segment stored on the tablespace can have different storage
parameters
 Required to coalesce adjacent extents

HUAWEI TECHNOLOGIES CO., LTD. Page 78


Undo Tablespace

 Used to restore undo information


 Cannot contain other objects
 Extents managed locally
 DATAFILE and EXTENT MANAGEMENT are only limited to
creation
CREATE UNDO TABLESPACE undo1
DATAFILE '/u01/oradata/undo101.dbf' SIZE 40M;

HUAWEI TECHNOLOGIES CO., LTD. Page 79


Temporary Tablespaces

 Used for sorting


 Cannot contain fixed objects
 Local tablespace management is preferred.

CREATE TEMPORARY TABLESPACE temp


TEMPFILE '/u01/oradata/temp01.dbf' SIZE 500M
EXTENT MANAGEMENT LOCAL UNIFORM SIZE 10M;

HUAWEI TECHNOLOGIES CO., LTD. Page 80


Restrictions on Default Temporary Tablespaces

You cannot:

 Drop the default temporary tablespace until after a new default is m


ade available

 Take the default temporary tablespace offline.

 Can not change the default temporary tablespace to a permanent t


ablespace

HUAWEI TECHNOLOGIES CO., LTD. Page 81


Drop Tablespace

 Remove a tablespace from the data dictionary


 Use AND DATAFILES to drop a tablespace data file from the operating
system:

DROP TABLESPACE userdata


INCLUDING CONTENTS AND DATAFILES;

HUAWEI TECHNOLOGIES CO., LTD. Page 82


Resize Tablespaces

 Increase data files


 Resize a data file:
 Automatically
 Manually

Tablespace APP_DATA

100M
100M 200M
100M
app_data_01.dbf app_data_02.dbf app_data_03.dbf

HUAWEI TECHNOLOGIES CO., LTD. Page 83


Manually Resize Data Files

ALTER DATABASE
DATAFILE '/u03/oradata/userdata02.dbf'
RESIZE 200M;

Tablespace APP_DATA

100M
100M 200M 200M
100M

app_data_01.dbf app_data_02.dbf app_data_03.dbf app_data_04.dbf

HUAWEI TECHNOLOGIES CO., LTD. Page 84


Add a Data File to the Tablespace

ALTER TABLESPACE app_data


ADD DATAFILE '/u01/oradata/userdata03.dbf'
SIZE 200M;

Tablespace APP_DATA

100M 100M 200M


100M
app_data_01.dbf app_data_02.dbf app_data_03.dbf

HUAWEI TECHNOLOGIES CO., LTD. Page 85


Move Data Files (Modify Tablespace)

 The tablespace must be online.


 The destination data file must be present.

ALTER TABLESPACE userdata


RENAME
DATAFILE '/u01/oradata/userdata01.dbf'
TO '/u01/oradata/userdata01.dbf';

HUAWEI TECHNOLOGIES CO., LTD. Page 86


Obtain Tablespace Information

 Tablespace info:
 DBA_TABLESPACES
 V$TABLESPACE

 Data file info:


 DBA_DATA_FILES
 V$DATAFILE

 Temporary file info:


 DBA_TEMP_FILES
 V$TEMPFILE

HUAWEI TECHNOLOGIES CO., LTD. Page 87


Summary

After learning this part, you are expected to know:


 How to store data separately using tablespaces
 Resize tablespaces:
 Add data files
 Extend data files

 Use locally managed tablespaces


 Use temporary tablespaces

HUAWEI TECHNOLOGIES CO., LTD. Page 88


Practice

The practice in this part covers the following:


 Create tablespaces
 Resize tablespaces
 Please refer to Oracle Database Hands-on Practice → Tablespace
Management

HUAWEI TECHNOLOGIES CO., LTD.


Contents

 Oracle Architecture
 Managing an ORACLE Instance
 Tablespace Management
 Managing ASM
 Oracle Common oprations
 Daily Database Check

HUAWEI TECHNOLOGIES CO., LTD. Page 90


Automatic Storage Management

 Is a portable and high-performance


cluster file system
 Manages Oracle database files
Application
 Spreads data across disks
to balance load
Database
 Mirrors data
File
 Solves storage-management system
ASM
challenges Volume
manager

Operating system

HUAWEI TECHNOLOGIES CO., LTD. Page 91


ASM: Key Features and Benefits

 Stripes files but not logical volumes


 Provides online disk reconfiguration and dynamic rebalancing
 Allows for adjustable rebalancing speed
 Provides redundancy on a per-file basis
 Supports only Oracle database files
 Is cluster aware
 Is automatically installed

HUAWEI TECHNOLOGIES CO., LTD. Page 92


ASM: Concepts
ASM
Database
disk group

Tablespace Data file ASM file

Segment ASM disk

File-system
Extent
file Allocation unit
or
raw device
Oracle
block Physical
block

HUAWEI TECHNOLOGIES CO., LTD. Page 93


ASM Instance Functionalities

CREATE DISKGROUP ALTER SYSTEM RESTRICTED SESSION

ASM
instance

Database
instance

ALTER DISKGROUP DROP DISKGROUP

HUAWEI TECHNOLOGIES CO., LTD. Page 94


ASM Instance Init Parameters

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

HUAWEI TECHNOLOGIES CO., LTD. Page 95


Starup Up ASM Instance

$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

HUAWEI TECHNOLOGIES CO., LTD. Page 96


Failure Group

Controller 1 Controller 2 Controller 3


6

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

Failure group 1 Failure group 2 Failure group 3

Disk group A
HUAWEI TECHNOLOGIES CO., LTD. Page 97
Create or Delete Disk Groups

CREATE DISKGROUP dgroupA NORMAL REDUNDANCY


FAILGROUP controller1 DISK
'/devices/A1' NAME diskA1 SIZE 120G FORCE,
'/devices/A2',
'/devices/A3'
FAILGROUP controller2 DISK
'/devices/B1',
'/devices/B2',
'/devices/B3';

CREATE DISKGROUP DATA EXTERNAL REDUNDANCY


DISK'/dev/rdsk/c3t19d5s4',
'/dev/rdsk/c3t19d16s4',
'/dev/rdsk/c3t19d17s4',
'/dev/rdsk/c3t19d18s4';

DROP DISKGROUP dgroupA INCLUDING CONTENTS;

HUAWEI TECHNOLOGIES CO., LTD. Page 98


Adding Disks to Disk Groups

ALTER DISKGROUP dgroupA ADD DISK


'/dev/rdsk/c0t4d0s2' NAME A5,
'/dev/rdsk/c0t5d0s2' NAME A6,
'/dev/rdsk/c0t6d0s2' NAME A7,
'/dev/rdsk/c0t7d0s2' NAME A8;

ALTER DISKGROUP dgroupA ADD DISK '/devices/A*';

Disk formatting

Disk group rebalancing

HUAWEI TECHNOLOGIES CO., LTD. Page 99


Maintenance tablespace using ASM
Create tablespace
SQL>Create tablespace test datafile ‘+
DATA’ size 1000M;

SQL>create bigfile tablespace btest da


tafile ‘+data' Size AUTOEXTEND ON;

Add Datafile
SQL>alter tablespace test add datafile
‘+data’ size 1000M;

HUAWEI TECHNOLOGIES CO., LTD. Page 100


Get ASM info
 ASM Diskgroup information:
 V$ASM_DISKGROUP
 ASM Disk information:
 V$ASM_DISK

SQL>select name,path from v$asm_disk;


 NAME PATH
------------------------------ ----------------------------------------
DISKG01_0000 /dev/vg02/rvg02_disk01
DISKG01_0001 /dev/vg02/rvg02_disk02
DISKG02_0000 /dev/vg02/rvg02_disk03
DG_ARCH_0000 /dev/vg02/rvg02_disk04

HUAWEI TECHNOLOGIES CO., LTD. Page 101


Summary

 Listener Management
 Local Service Name Configuration
 Three important configuration files:
 listener.ora
 Tnsnames.ora
 Sqlnet.ora

HUAWEI TECHNOLOGIES CO., LTD. Page 102


Practice

The practice in this part covers the following:


 Please refer to "Oracle Database Hands-on Practice"

Classroom practice-> Network Configuration

HUAWEI TECHNOLOGIES CO., LTD. Page 103


Contents

 Oracle Architecture
 Managing an ORACLE Instance
 Tablespace Management
 Managing ASM
 Oracle Common oprations
 Daily Database Check

HUAWEI TECHNOLOGIES CO., LTD. Page 104


Starup and Stop Database
 Logon oracle
 Startup ORACLE
su - oracle
$ sqlplus "/as sysdba"
SQL> startup
 Stop ORACLE
$ sqlplus "/as sysdba"
SQL> shutdown immediate

HUAWEI TECHNOLOGIES CO., LTD. Page 105


Check alert log

$adrci

Display tail of alert log

.Adrci>set home diag/rdbms/ora11g/ora11g2

adrci> show alert –tail

Output to altert_1.txt

Adrci>spool alert_1.txt

Adrci>show alert –tail 1000

Adrci >spool off

HUAWEI TECHNOLOGIES CO., LTD. Page 106


Flashback drop table
SQL > drop table test;
Query recyclebin
SQL>show recyclebin
ORIGINAL NAME RECYCLEBIN NAME OBJECT TYPE DROP TIME
---------------- ------------------------------ ------------ -------------------
TEST BIN$ZiqfHU3CJhTgRAARhesgfg==$0 TABLE 2009-03-28:17:42:2
6
Using falshback to restore table
SQL>flashback table test to before drop;

Purge table :
SQL >purge recyclebin;

HUAWEI TECHNOLOGIES CO., LTD. Page 107


Oracle common operation - oerr

 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

HUAWEI TECHNOLOGIES CO., LTD. Page 108


SQLPLUS Tips (1)

 SQLPLUS offer some internal commands, which can make the query operaiti
on very simple

 Common commands includes:

 DESC
 SHOW [ALL]
 COL ... FORMAT ...

 SET

HUAWEI TECHNOLOGIES CO., LTD. Page 109


SQLPLUS Tips (2)
 The command used to query the structure of the table or view
 DESC Usage:

DESC <table name> | <viewname> | <package name>


 Example:

SQL> DESC EMP_HW


Name Null? Type

----------------------------------------- --------------- -------------------------

EMP_ID NOT NULL NUMBER

EMP_NAME VARCHAR2(20)

EMP_GENDER CHAR(1)

EMP_DEPTID NUMBER

EMP_DEPT VARCHAR2(20)

EMP_ZONE VARCHAR2(20)

EMP_JOINED_DATE DATE

HUAWEI TECHNOLOGIES CO., LTD. Page 110


Sqlplus Tips (3)

 Quickly find out the name ,type and value of the oracle ins
tance’s initial parameters

 SQL> SHOW PARAMETER control_files

 NAME TYPE VALUE


 ------------------------------------ --------- ------------------------------
 control_files string /opt/oracle/mounts/ora7/sysdat
 a/control01.ctl, /opt/oracle/m
 ounts/ora7/sysdata/control02.c
 tl, /opt/oracle/mounts/ora7/sy
 sdata/control03.ctl

HUAWEI TECHNOLOGIES CO., LTD. Page 111


Sqlplus Tips (3)
 Format the output report
 Sometimes,the report is very disorderd,and is not clear to read. example :

 SQL> SELECT * FROM DBA_DATA_FILES;

 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

HUAWEI TECHNOLOGIES CO., LTD. Page 112


Sqlplus Tips (4) continue
 You can use SET and COL command to format output report in SQLPLUS
SQL> SET LINE 200

SQL> COL FILE_NAME format a40

SQL>col tablespace_name format a35

SQL> SELECT file_name,file_id,tablespace_name FROM DBA_DATA_FILES;


 FILE_NAME FILE_ID TABLESPACE_NAME
 --------------------------------------------------------------- ----------- -------------
 /opt/oracle/mounts/ora7/sysdata/hlrts01.dbf 5 HLRTS
 /opt/oracle/mounts/ora7/sysdata/utmp01.dbf 6 UTMP
 /opt/oracle/mounts/ora7/sysdata/systmp01.dbf 4 SYSTMP
 /opt/oracle/mounts/ora7/sysdata/rbs01.dbf 3 RBS
 /opt/oracle/mounts/ora7/sysdata/tools01.dbf 2 TOOLS
 /opt/oracle/mounts/ora7/sysdata/system01.dbf 1 SYSTEM
 /opt/oracle/mounts/ora7/sysdata/hlrts02.dbf 7 HLRTS
 /opt/oracle/mounts/ora7/sysdata/hlrts03.dbf 8 HLRTS
 /opt/oracle/mounts/ora7/sysdata/hlrts04.dbf 9 HLRTS

HUAWEI TECHNOLOGIES CO., LTD. Page 113


Sqlplus Tips (5)
 You can use “SET TIMING ON”command to get the excution time of a sql
 SQL> SET TIMING ON
 SQL> SELECT COUNT(*) FROM EMP_HW;

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

HUAWEI TECHNOLOGIES CO., LTD. Page 114


Sqlplus Tips (6)

 Use “!” to execute an operation system’s command in sqlplus

 Example:

 Sql> ! ls

 Sql> ! mv a.dat b.dat

HUAWEI TECHNOLOGIES CO., LTD. Page 115


Sqlplus Tips (7)

 Spool the result of the sqlplus to a file

 Sql> spool c:\a.txt


 Sql> select * from tab;
 Sql> spool off

HUAWEI TECHNOLOGIES CO., LTD. Page 116


Contents

 Oracle Architecture
 Managing an ORACLE Instance
 Tablespace Management
 Managing ASM
 Oracle Common oprations
 Daily Database Check

HUAWEI TECHNOLOGIES CO., LTD. Page 117


Check Database Status

 Confirm whether the database is in open status and provid


es service normally.

oracle% sqlplus "/as sysdba"

SQL> select status, instance_role from v$instance;

STATUS INSTANCE_ROLE

------------ ------------------

OPEN PRIMARY_INSTANCE

HUAWEI TECHNOLOGIES CO., LTD. Page 118


Check Database Version

 The database must be patched with the latest patchset;


 8i requires 8.1.7.4;
 9i requires 9.2.0.5 or later patch version.

 command
SQL>select * from v$version;

HUAWEI TECHNOLOGIES CO., LTD. Page 119


Query memory area of oracle

 Memory size used by oracle should be less than ½ of physi


cal memory size.
 Query the memory used by oracle :
SQL>show parameter memory_max_target
SQL>show parameter memory_target
 Query physical memory :
Solaris: $ /usr/sbin/prtconf |grep -i "Memory size"
HP:$ grep Physical /var/adm/syslog/syslog.log
AIX:$ /usr/sbin/lsattr -E -l sys0 -a realmem

HUAWEI TECHNOLOGIES CO., LTD. Page 120


Check Log File
 During database running, query v$log_history to observe the switching
time of the log switch.
 It is recommended that the online log be better switched every one hou
r at non-peak period, and be switched every 20 minutes at service sum
mit.
SQL>select to_char(first_time,'yyyy-mm-dd hh24:mi:ss') change_time from v$l
og_history;
CHANGE_TIME
-------------------
2004-04-06 10:02:52
2004-04-06 10:10:45
2004-04-06 10:17:01

HUAWEI TECHNOLOGIES CO., LTD. Page 121


Check tablespace
 Check such information as the size, left space and used space percentage of each
tablespace
 Especially when the left space of the service tablespace is less than 50M or the use
d space percentage is greater than 90%, consider increasing the size of the tables
pace.
SQL>col Tablespace format a24
SQL>select df.tablespace_name "Tablespace",df.bytes/(1024*1024) "Total Size(MB)",
sum(fs.bytes)/(1024*1024) "Free Size(MB)", round(sum(fs.bytes)*100/df.bytes) "%
Free",
round((df.bytes-sum(fs.bytes))*100/df.bytes) "% Used"
from dba_free_space fs,
(select tablespace_name, sum(bytes) bytes from dba_data_files group by tables
pace_name ) df
where fs.tablespace_name = df.tablespace_name
group by df.tablespace_name, df.bytes;

HUAWEI TECHNOLOGIES CO., LTD. Page 122


View the asm diskgroup’s free spa
ce when using asm
 You should view the asm diskgroup’s free space termly w
hen using asm
SQL> select name,total_mb,free_mb,free_mb/total_mb*100
free_pct from v$asm_diskgroup

NAME TOTAL_MB FREE_MB FREE_PCT


------------------------------ ---------- ---------- ----------
DG_ARCH 16384 9572 58.4228516
DISKG01 32768 15287 46.6522217
DISKG02 16384 12186 74.3774414

HUAWEI TECHNOLOGIES CO., LTD. Page 123


Query the users who connecting to oracl
e
 Query the detail information of the users who is connectti
ng to oracle
select username,machine,program,status from v$session wher
e osuser <> 'oracle';

USERNAME MACHINE PROGRAM STATUS

--------------- -------------------- -------------------- --------

CORPRING CHINA\MENGWEI INACTIVE

SYSTEM CHINA\H36922 dbsnmp.exe INACTIVE

HUAWEI TECHNOLOGIES CO., LTD. Page 124


generate database performance’s repo
rt
 su –oracle

$cd $ORACLE_HOME/rdbms/admin

$sqlplus / as sysdba

SQL>@awrrpt

HUAWEI TECHNOLOGIES CO., LTD. Page 125


Database backup’s Check-LIST

$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

HUAWEI TECHNOLOGIES CO., LTD. Page 126


Check Job Status

 The Broken column must be N. If the Broken column is Y, c


heck the oracle alarm log and analyze the job failure cause.
After the fault is cleared, run exec dbms_job.run(:job);
SQL>select job,what,to_char(next_date,’yyyy/mm/dd hh24:m
i:ss’),broken,failures

from dba_jobs;

HUAWEI TECHNOLOGIES CO., LTD. Page 127


Query SQL Statement According to PID

 Execute the command top, finding that some Oracle process


es occupy too much CPU.
 Query SQL statements executed in the process according to
PID. After “Enter value for pid:” prompts, type PID of the Or
acle service process. Press Enter and then get the results.
select a.username "user",a.sid, a.program "program",
substr(d.sql_text,1,1000)
from v$session a, v$process b, v$sql d
where a.paddr = b.addr and b.spid = &PID and
d.address(+) = a.sql_address and d.hash_value(+) = a.sql_hash_va
lue;
HUAWEI TECHNOLOGIES CO., LTD. Page 128
Check backup - LIST Command

 Lists backup sets and copies of datafiles


 Lists backup sets and copies of any datafile for a specified tablespace
 Lists backup sets and copies containing archive logs for a specified
range

HUAWEI TECHNOLOGIES CO., LTD.


Summary
 Check Database Status
 Check Database Version
 View SGA
 Check rollback section competition
 Check Log File
 Check tablespace
 Check Job Status
 Check backup

HUAWEI TECHNOLOGIES CO., LTD. Page 130


Practice

The practice in this part covers the following:


 Please refer to "Oracle Database Hands-on Practice"

Classroom practice-> Daily Database Check

HUAWEI TECHNOLOGIES CO., LTD. Page 131


Thank You

www.huawei.com

You might also like