Sei sulla pagina 1di 40

SAP BASIS Introductory Training

Program
DAY 11 Database Administration Oracle

CONFIDENTIAL

Day 11 : Agenda
09:00 AM-10:15 AM Database Monitoring
10:15 AM-10:30 AM Break
10:30 AM-01:00 PM Additional features of BRTOOLS
01:00 PM-02:00 PM Lunch Break
02:00 PM-03:15 PM Backup Methods
03:15 PM-03:30 PM Break
03:30 PM-05:30 PM Recovery Methods
05:30 PM-06:00 PM Exercise & Break Out Session

18 October 2010

Database Monitoring

18 October 2010

Database Monitoring SAP Database Monitors


DBA Cockpit
DB02

DB12

DB13

DB13C

DB14

ST04

Live SAP system

SAP DBA
Poor
Performance,
Warnings,
Errors

DB16

DB17

DB21

DB26

BR* TOOLS

Analyze the problem using


SAP tool for monitoring and
managing database

18 October 2010

DB20

DBA Cockpit
DBA Planning Calendar
The DBA planning calendar is a simple interface to schedule background jobs named DBA:* performing
administrative jobs.
These background jobs look up table SDBAC to check, depending on the SAP release, the database system, and
the operating system, which operating system level command should be executed on which server.
The DBA planning calendar provides templates for all activities that are recommended to be performed regularly
on the database.
DBA Operations Monitor
Use the DBA Operations Monitor (transaction DB14 or Jobs DBA Logs in the DBA Cockpit menu tree) to
monitor online database operations.
It is used to monitor the runtime of operations.
The DBA Operations Monitor provides an overview of activities of any of the BR*Tools.
Space
Transaction DB02 or Space Space Overview in the DBA Cockpit menu tree shows the functions for monitoring
disk space in the database.
This overview contains information about how much disk space the database is using. To ensure that the required
data for this overview is available, a background job must be scheduled first.
Available disk space information about individual tablespaces or tables is provided in additional sub-monitors.
Information is also provided about the growth of the individual database objects.
Performance
Database performance can be analyzed with transaction ST04 or Performance Performance Overview in the
DBA Cockpit menu tree. ST04 has many functions, the most important for performance are: viewing the SQL
cache, checking Oracle delays using v$system_event, and monitoring database buffer activity and monitoring
Oracle shadow processes.

18 October 2010

DBA Cockpit - Features


Provides central
functions to manage
the system landscape,
for example:
Access to system
configuration where
you configure and set
up your system
landscape
Management of
database connections
Lets you choose the
system to monitor.
Also, additional
information about a
distributed database
system is displayed if
available.

Provides a minimum of functions, for example, to display or


hide the areas on the left side.

Application toolbar

System
Landscape
Toolbar

Central system data

This area is common to most


actions. It provides, for example, the
following data:
Time of last refresh
Database startup time
Name of database
It is not available for all database
platforms. For more information, see
the
corresponding database-specific
section.

Action area
Displays the details of the currently
selected action.

Navigation
Frame

Action message window

Framework message window

Only appears with certain actions


and displays additional information
that is related to the selected action.

Displays the message window


provided by the framework.

Displays a tree structure divided at the top level into the main task areas of database
administration. These are, for example, performance monitoring, space management,
and job scheduling. Within each task area, there is a set of related action nodes.

18 October 2010

Performance (Oracle) DBA Cockpit Tool


Performance Overview
Wait event analysis
SQL statement analysis
Statistical Information
Feature monitoring
Additional functions
RAC statistics

18 October 2010

DBA Cockpit
Check the database
Adapt next extents
Check and update statistics
Clean up logs

18 October 2010

Cost Based Optimizer (CBO) and Database Statistics


Whenever a valid SQL statement is processed Oracle has to decide how to retrieve the
necessary data. This decision can be made using one of two methods:
Rule Based Optimizer (RBO) - This method is used if the server has no internal
statistics relating to the objects referenced by the statement. This method is no
longer favored by Oracle and will be not be supported from Oracle 10g releases.
Cost Based Optimizer (CBO) - This method is used if internal statistics are present.
The CBO checks several possible execution plans and selects the one with the
lowest cost, where cost relates to system resources.
If new objects are created, or the amount of data in the database changes, the statistics
will no longer represent the real state of the database and the CBO decision process may
be seriously impaired.
CBO will work efficiently only if Database statistics are updated regularly

18 October 2010

BREAK

18 October 2010

Additional Features of
BRTOOLS

18 October 2010

SAP Database Administration Tools BR*TOOLS


BR*TOOLS
1.
2.
3.
4.
5.
6.
7.
8.
9.

BRBACKUP

BRARCHIVE

Instance Management
Space Management
Segment Management
Backup and database copy
Restore and recovery
Check and verification
Database Statistics
Additional functions
Exit Program

BRRESTORE

BRRECOVER

BRSPACE

BRCONNECT

18 October 2010

BR*TOOLS
BRTOOLS

Responsible Tools

Log Directory

Configuration file

1. Instance Management
2. Space Management
3. Segment Management
4. Backup and database copy
5. Restore and recovery
6. Check and verification
7. Database Statistics
8. Additional functions
9. Exit Program

Brspace
Brspace
Brspace
Brbackup/Brarchive
Brrecover
Brconnect/Brbackup
Brconnect
Brconnect

Sapreorg
Sapreorg
Sapreorg
Sapbackup/saparch
Sapbackup
Sapcheck/sapbackup
Sapcheck
Sapcheck

spfile<DBSID>.sap
Init<DBSID>.sap

1=Database instance management

2=Database space management

3=Database segment management

4=Backup and database copy

1. Startup database
2. Shutdown database
3. Alter database instance
4. Alter database parameters
5. Recreate database
6. Show instance status
7. Show database parameters
8. Show database owners

1. Extend tablespace
2. Create tablespace
3. Drop tablespace
4. Alter tablespace
5. Alter data file
6. Move data file
7. Additional space functions

1. Reorganize tables
2. Rebuild indexes
3. Export tables
4. Import tables
5. Alter tables
6. Alter indexes
7. Additional segment functions

1. Database backup
2. Archive log backup
3. Database copy
4. Non-database backup
5. Backup of database disk backup
6. Verification of database backup
7. Verification of archive log backup
8. Additional functions

5=Restore and recovery

6=Database check and verification

7=Processing database statistics

8=Additional BR*Tools functions

1. Complete database recovery


2. Database point-in-time recovery
3. Tablespace point-in-time recovery
4. Whole database rest
5. Restore of individual backup files
6. Restore and application of archivelog files
7. Disaster recovery

1. Database system check


2. Validation of database structure
3. Verifiication of database blocks

1. Update database statistics


2. Collect missing statistics
3. Delete harmful statistics
4. Manage database statistics

1. Show profiles and logs


2. Clean up DBA logs and tables
3. Adapt NEXT extents
4. Change password of database user
5. Create/change synonyms for DBA tables

18 October 2010

Database space management BR*TOOLS


Extend tablespace
Create tablespace
Drop tablespace
Alter tablespace
Alter data file
Move data file
Additional space functions
Reset program status

2=Database space management


1.Extend tablespace
2.Create tablespace
3.Drop tablespace
4.Alter tablespace
5.Alter data file
6.Move data file
7.Additional space functions

18 October 2010

Data Segment Management BR*TOOLS


Reorganize tables
Rebuild Indexes
Export tables
Import tables
Alter tables
Alter Indexes
Additional Segment functions
Reset program status

3=Database segment management


1.Reorganize tables
2.Rebuild indexes
3.Export tables
4.Import tables
5.Alter tables
6.Alter indexes
7.Additional segment functions

18 October 2010

Alter tablespace main menu BR*TOOLS


Set tablespace online
Set tablespace offline
Set backup status
Reset backup status
Coalesce free extents
Rename tablespace

2=Database space management


1.Extend tablespace
2.Create tablespace
3.Drop tablespace
4.Alter tablespace
5.Alter data file
6.Move data file
7.Additional space functions

18 October 2010

Alter Data file main menu BR*TOOLS


Set data file online
Set data file offline
Turn on and maintain autoextend
Turn off autoextend
Resize data file
Rename data file
Drop empty data file

2=Database space management


1.Extend tablespace
2.Create tablespace
3.Drop tablespace
4.Alter tablespace
5.Alter data file
6.Move data file
7.Additional space functions

18 October 2010

LUNCH BREAK

18 October 2010

Backup Methods

18 October 2010

Backup & Recovery


Database

External Factors
(fire, flood, earth quake)

Physical Error
(hardware failure)

Logical Error
(deleted table, dropped tablespace)

Data
loss

A good database backup strategy prevents data


loss and minimizes system downtime

Procedure and
Escalation plan
------------------------------------------------------------------------------------

18 October 2010

Backup Methods
Closed or Opened
Database

Closed Database

No archive mode

Archive mode

Physical backup
18 October 2010

Closed Database Backup


Data files

Control files

Parameter files

Password files

Redo log files

Online or offline
storage

18 October 2010

Open Database Backup


Data files

Control files

Parameter files

Password files

Redo log files

Archived redo log files

Online or offline
storage

18 October 2010

Backup Types
OFFLINE

ONLINE

Complete

Whole (All)

Incremental
(with RMAN)

Partial

Full

18 October 2010

BREAK

18 October 2010

Recovery Methods

18 October 2010

Media Failure & Recovery: Archivelog Mode


Failure: loss of disk, data file, or corruption
Recovery
Data files for restore must be offline.
Restore only lost or damaged data files.
Do not restore the control files, redo log files, password files, or parameter files.
Recover the data files
Advantages
Only need to restore lost files
Recovers all data to the time of failure
Recovery time is the time it takes to restore lost files and apply all archived log files
Disadvantage
Must have all archived log files since the backup from which you are restoring

18 October 2010

Complete Recovery Methods


1. Closed database recovery for:
System data files
Rollback segment data files
Whole database
2. Opened database recovery, with database initially opened: for file loss
3. Opened database recovery with database initially closed: for hardware failure
4. Data file recovery with no data file backup

18 October 2010

1. Closed database recovery


This method of recovery generally uses either the RECOVER DATABASE or RECOVER
DATAFILE commands when:
The database is not operational a 24 hour a day, 7 days a week.
The recovered files belong to the system or rollback segment tablespace.
The whole database, or a majority of the data files, need recovery.

18 October 2010

2. Opened database recovery, with database initially opened


This method of recovery is generally used when:
File corruption, accidental loss of file, or media failure has occurred, which has not
resulted in the database being shut down.
The database is operational a 24 hour a day, 7 days a week. Downtime for the
database must be kept to a minimum.
Recovered files do not belong to the system or rollback tablespaces.

18 October 2010

3. Opened database recovery with database initially closed


This method of recovery is generally used when:
A media or hardware failure has brought the system down.
The database is operational a 24 hour a day, 7 days a week database. Down-time for
the database must be kept to a minimum.
The restored files do not belong to the system or rollback tablespace.

18 October 2010

4. Data file recovery with no data file backup


This method of recovery is generally used when:
Media or user failure has resulted in loss of a data file that was never backed up.
All archived logs exist since the file was created.
The restored files do not belong to the system or rollback tablespace.
Note: During recovery, all archived logs files need to be available to the Oracle
server on disk. If they are on a backup tape, you must restore them first.

18 October 2010

Recover Syntax
Recover a mounted database:
SQL> recover database;
SQL> recover datafile /disk1/data/df2.dbf;
SQL> alter database recover database;
Recover an opened database:
SQL> recover tablespace USER_DATA;
SQL> recover datafile 2;
SQL> alter database recover datafile 2;

18 October 2010

Locating Data files for recovery


Files Needed for Recovery
View V$RECOVER_FILE to locate data files needing recovery.
View V$LOG_HISTORY for a list of all archived logs for the database.
View V$RECOVERY_LOG for a list of all archived logs required for recovery.

18 October 2010

Oracle Recovery

18 October 2010

SAP Tools: Backup, Restore, Recovery


Oracle Database
Data files

Control files

Detailed log
Summary
Log

BRBACKUP
CPIO/DD/RMAN
parallel

Media

Offline
redo log files

Online
redo log files

BRRECOVER
BRRESTORE

BRARCHIVE

Detailed log
Summary
Log

CPIO/DD/RMAN
parallel

Media

18 October 2010

Summary
Database Monitoring
DBA Cockpit
BR*TOOLS
Backup & Recovery
Backup methods
Recovery methods
SAP Tools for Backup & Recovery

18 October 2010

Exercise &
Break Out Session

18 October 2010

Exercise
Logon to the operating system level with the userid/password provided by the instructor
Instructor Steps
Start the BRTOOLS from command line
Demonstrate how to switch from ArchiveLog Mode to Non-ArchiveLog mode
Stop the SAP instance
Perform an offline backup of the database
Note the directories involved : sapbackup , oraarch & saparch
Explain the difference between oraarch and saparch
Restart the Oracle and SAP instance
Return to BRTOOLS
Demonstrate how to check the status of extents for non auto extensible tablespaces
Add an extent
Show the commands involved in the process
Finally , explain the differences between various types of database startup modes :
NOMOUNT , MOUNT & OPEN
Explain the differences between shutdown modes : NORMAL , IMMEDIATE &
ABORT

18 October 2010

Q&A Session

18 October 2010

Potrebbero piacerti anche