Вы находитесь на странице: 1из 58

Administering Storage in RAC (Part I)

Objectives

After completing this lesson, you should be able to do the following: Describe automatic storage management (ASM) Install the ASM software Set up initialization parameter files for ASM and database instances Start up and shut down ASM instances Add ASM instances to the target list of Database Control Use Database Control to administer ASM in a RAC environment

What Is Automatic Storage Management?


Is a purpose-built cluster file system and volume manager Manages Oracle database files Applicati Spreads data across disks on to balance load Database Provides integrated mirroring File ASM across disks system Solves many storage Logical management challenges
volume manager

Operating system

ASM: Key Features and Benefits

Stripes files rather than logical volumes Enables online disk reconfiguration and dynamic rebalancing Provides adjustable rebalancing speed Provides redundancy on a file basis Supports only Oracle files Is cluster aware Is automatically installed as part of the base code set

ASM: New Concepts


Database ASM disk group Data file ASM file

Tablespace

Segment

ASM disk

Extent

Oracle block

File system file or raw device

Allocation unit Physical block

ASM: General Architecture


Node1

DB Instance SID=sale
s
DBW0 RBAL ASMB

Group Services tom=ant dick=ant harry=ant

Group Services tom=bee dick=bee harry=bee

Node2

DB Instance SID=sale
s
ASMB DBW0 RBAL FG FG ASMB DBW0 RBAL

FG FG

ASMB

ASM Instanc e SID=ant


RBAL ARB0

ASM Instanc e SID=bee


RBAL ARB0

DB Instanc e SID=tes t
ASM disks

DBW0 RBAL

ARBA

ARBA

DB Instanc e SID=tes t
ASM disks

ASM disks

ASM disks

ASM disks

ASM disks

ASM Disk group Tom

ASM Disk group Dick

ASM Disk group Harry

Notes only slide

ASM Instance and Crash Recovery in RAC


Both instances mount disk group Node1 Node2
+ASM1 +ASM2

ASM instance recovery


Node1 +ASM1

ASM instance failure

Node2 +ASM2

Disk group repaired by Node1 surviving Node2 instance +ASM2


Disk group A

Disk group A

Disk group A

Only one instance mounts disk Node1 Node2 group +ASM1


Disk Group A

ASM crash recovery


ASM instance failure Node1 Node2
+ASM1 +ASM2

+ASM2

Disk group repaired Node1when next Node2 mounted


Disk Group A

+ASM2

Disk Group A

ASMLibs

An ASMLib is a storage-management interface between Oracle kernel and disk storage. You can load multiple ASMLibs. Purpose built drivers can provide:
o o o

Device discovery More efficient I/O interface Increased performance and reliability

Oracle freely delivers an ASMLib on Linux. Several participating storage vendors such as EMC and HP are joining this initiative.

Oracle Linux ASMLib Installation: Overview


1. Install the ASMLib packages on each node:
o o

http://otn.oracle.com/tech/linux/asmlib Install oracleasm-support, oracleasmlib, and kernel-related packages Load ASM driver and mount ASM driver file system Use the oracleasm script with the configure option

2. Configure ASMLib on each node:


o o

3. Make disks available to ASMLib by marking disks using oracleasm createdisk on one node. 4. Make sure that disks are visible on other nodes using oracleasm scandisks. 5. Use appropriate discovery strings for this ASMLib.

Oracle Linux ASMLib Installation

Install the packages as the root user:


# rpm -i oracleasm-support-version.arch.rpm \ oracleasm-kernel-version.arch.rpm \ oracleasmlib-version.arch.rpm

Run oracleasm with the configure option:


# /etc/init.d/oracleasm configure
o o o

Provide oracle UID as the driver owner. Provide dba GID as the group of the driver. Load the driver at system startup.

Notes only page

ASM Library Disk Creation

Identify the device name for the disks that you want to use with the fdisk l command. Create a single whole-disk partition on the disk device with fdisk. Enter a command similar to the following to mark the shared disk as an ASM disk:
/etc/init.d/oracleasm createdisk disk1 /dev/sdbn

To make the disk available on the other nodes, enter the following as root on each node:
# /etc/init.d/oracleasm scandisks

Set the ASM_DISKSTRING parameter

Notes only page

ASM Administration

ASM instance

Disk groups and disks

Files
0010 0010

ASM Instance Functionalities


CREATE DISKGROUP ALTER SYSTEM RESTRICTED SESSION

ASM instanc e

Database instance ALTER DISKGROUP DROP DISKGROUP

ASM Instance Creation

ASM Instance Initialization 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

PROCESSES = 25 + 15*<#DB inst using ASM for their storage>

RAC and ASM Instances Creation

ASM Instance Initialization Parameters and RAC


CLUSTER_DATABASE: This parameter must be set to TRUE. ASM_DISKGROUP:
o o

Multiple instances can have different values. Shared disk groups must be mounted by each ASM instance. Multiple instances can have different values. With shared disk groups, every instance should be able to see the common pool of physical disks.

ASM_DISKSTRING:
o o

ASM_POWER_LIMIT: Multiple instances can have different values.

Discovering New ASM Instances with EM


If new ASM targets are not discovered:
<Target TYPE="osm_instance" NAME="+ASMn" DISPLAY_NAME="+ASMn"> <Property NAME="SID" VALUE="+ASMn"/> <Property NAME="MachineName" VALUE="clusnode1_vip"/> <Property NAME="OracleHome" VALUE="/u01/app/oracle/..."/> <Property NAME="UserName" VALUE="sys"/> <Property NAME="password" VALUE="manager" ENCRYPTED="FALSE"/> <Property NAME="Role" VALUE="sysdba"/> <Property NAME="Port" VALUE="1521"/> </Target>

$ emctl config agent addtarget <filename> $ emctl stop agent $ emctl start agent

Accessing an ASM Instance


AS SYSDBA
ASM instanc e

All operations Disk group Disk group

Storage system

Dynamic Performance View Additions


V$ASM_TEMPLATE V$ASM_CLIENT V$ASM_DISKGROUP Disk group A Disk group B

V$ASM_FILE V$ASM_ALIAS
Storage system

V$ASM_DISK V$ASM_OPERATION

ASM Home Page

ASM Performance Page

ASM Configuration Page

Starting Up an ASM Instance

$ 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

Shutting Down an ASM Instance


SHUTDOWN DB instance immediately aborted

DB

ASM

ASM

SHUTDOWN NORMAL

SHUTDOWN IMMEDIATE

ASM Administration

ASM instance

Disk groups and disks

Files
0010 0010

ASM Disk Group

Is a pool of disks managed as a logical unit Partitions total disk space into uniform-sized units Spreads each file evenly across all disks Provides coarse- or finegrain striping based on file type Administers disk groups, not files

ASM instanc e

Disk group

Failure Group

Controller 1
6 5 4 3 2 1 1 1 7 7 7 13 13 13

Controller 2

Controller 3

1 1 1

7 7 7

13 13 13

1 1 1

7 7 7

13 13 13

Failure group 1

Failure group 2 Disk group A

Failure group 3

Disk Group Mirroring

Mirror at AU level Mix primary and mirror AUs on each disk External redundancy: Defers to hardware mirroring Normal redundancy:
o o

Two-way mirroring At least two failure groups Three-way mirroring At least three failure groups

High redundancy:
o o

Disk Group Dynamic Rebalancing

Automatic online rebalancing whenever storage configuration changes Only move data proportional to storage added No need for manual I/O tuning Online migration to new storage

ASM Administration Page

Create Disk Group Page

ASM Disk Groups with EM in RAC

Disk Group Performance Page and RAC

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';

DROP DISKGROUP dgroupA INCLUDING CONTENTS;

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

Miscellaneous Alter Commands


ALTER DISKGROUP dgroupA DROP DISK A5; ALTER DISKGROUP dgroupA DROP DISK A6 ADD FAILGROUP fred DISK '/dev/rdsk/c0t8d0s2' NAME A9; ALTER DISKGROUP dgroupA UNDROP DISKS; ALTER DISKGROUP dgroupB REBALANCE POWER 5; ALTER DISKGROUP dgroupA DISMOUNT; ALTER DISKGROUP dgroupA CHECK ALL;

Notes only page

Monitoring Long-Running Operations Using V$ASM_OPERATION


Column GROUP_NUMBER Disk group OPERATION STATE POWER ACTUAL SOFAR EST_WORK EST_RATE EST_MINUTES
Type of operation: REBAL State of operation: QUEUED or RUNNING Power requested for this operation Power allocated to this operation Number of allocation units moved so far Estimated number of remaining allocation units Estimated number of allocation units moved per minute Estimated amount of time (in minutes) for operation termination

Description

ASM Administration

ASM instance

Disk groups and disks

Files
0010 0010

ASM Files
CREATE TABLESPACE sample DATAFILE '+dgroupA';
Database file 1 2 3 4

RMAN

Mandatory for backups

Automatic ASM file management

ASM file automatically spread inside dgroupA

ASM File Names


ASM file name

Referenc e

Singlefile creation

Multiplefile creation

Fully qualifie d

Numeric

Alias

Alias Incomplet Incomplet with e e template with template

ASM File Name Syntax


+<group>/<dbname>/<file_type>/<tag>.<file#>.<incarnation#>

1 2 3 4 5 6

+<group>.<file#>.<incarnation#>

+<group>/<directory1>//<directoryn>/<file_name>

+<group>/<directory1>//<directoryn>/<file_name>(<temp>)

+<group>

+<group>(<temp>)

Notes only slide

ASM File Name Mapping


Oracle File Type Control
files files Data Online logs Archive logs Temp files Data file backup pieces Data file incremental backup backup Arch log pieces piece Data file copy Initialization parameters Broker configurations Flashback logs Change tracking bitmaps Auto Data backup Pump dump set Cross-platform converted data files

<File Type> controlfil


e datafile online_lo g archive_lo g temp backupse t backupse t backupse t datafile init drc rlog CTB AutoBacku p Dumpset

<Tag>
CF/BCF <ts_name>_<file# > log_<thread# > parameter <ts_name>_<file# > Client Specified Client Specified Client Specified <ts_name>_<file# > spfile drc <thread#>_<log# > BITMAP Client Specified dump

Def Template
CONTROLFILE DATAFILE ONLINELOG ARCHIVELOG TEMPFILE BACKUPSET BACKUPSET BACKUPSET DATAFILE PARAMETERFILE DATAGUARDCONFIG FLASHBACK CHANGETRACKING AUTOBACKUP DUMPSET XTRANSPORT

ASM File Templates


System Template CONTROLFILE
DATAFILE ONLINELOG ARCHIVELOG TEMPFILE BACKUPSET XTRANSPORT PARAMETERFILE DATAGUARDCONFIG FLASHBACK CHANGETRACKING AUTOBACKUP DUMPSET

Externa l unprotecte
d unprotecte U unprotecte nd

Normal
2-way mirror 2-way mirror 2 2-way mirror -

High
3-way mirror 3-way mirror 3 3-way mirror -

Stripe d fine
coarse fine coarse coarse coarse coarse coarse coarse fine coarse coarse coarse

pd unprotecte rd unprotecte od unprotecte td unprotecte e unprotecte cd td unprotecte ed unprotecte dd


unprotecte d unprotecte d unprotecte d

w 2-way mirror a 2-way mirror


2-way mirror 2-way mirror M 2-way mirror i

w 3-way mirror a 3-way mirror


3-way mirror 3-way mirror M 3-way mirror i

r 2-way mirror r 2-way mirror


2-way mirror 2-way mirror 2-way mirror

r 3-way mirror r 3-way mirror


3-way mirror 3-way mirror 3-way mirror

o r

o r

Template and Alias: Examples


ALTER DISKGROUP dgroupA ADD TEMPLATE reliable ATTRIBUTES (MIRROR); ALTER DISKGROUP dgroupA DROP TEMPLATE reliable; ALTER DISKGROUP dgroupA DROP FILE '+dgroupA.268.8675309'; ALTER DISKGROUP dgroupA ADD DIRECTORY '+dgroupA/mydir'; ALTER DISKGROUP dgroupA ADD ALIAS '+dgroupA/mydir/datafile.dbf' FOR '+dgroupA.274.38745'; ALTER DISKGROUP dgroupA DROP ALIAS '+dgroupA/mydir/datafile.dbf';

Retrieving Aliases

SELECT reference_index INTO :alias_id FROM V$ASM_ALIAS WHERE name = '+dgroupA'; SELECT reference_index INTO :alias_id FROM V$ASM_ALIAS WHERE parent_index = :alias_id AND name = 'mydir'; SELECT name FROM V$ASM_ALIAS WHERE parent_index = :alias_id;

SQL Commands and File Naming

CREATE CONTROLFILE DATABASE sample RESETLOGS ARCHIVELOG MAXLOGFILES 5 MAXLOGHISTORY 100 MAXDATAFILES 10 MAXINSTANCES 2 LOGFILE GROUP 1 ('+dgroupA','+dgroupB') SIZE 100M, GROUP 2 ('+dgroupA','+dgroupB') SIZE 100M DATAFILE '+dgroupA.261.12345678' SIZE 100M, '+dgroupA.262.12345678' SIZE 100M;

DBCA and Storage Options

Database Instance Parameter Changes


INSTANCE_TYPE = RDBMS LOG_ARCHIVE_FORMAT DB_BLOCK_SIZE DB_CREATE_ONLINE_DEST_n DB_CREATE_FILE_DEST_n DB_RECOVERY_FILE_DEST CONTROL_FILES LOG_ARCHIVE_DEST_n LOG_ARCHIVE_DEST STANDBY_ARCHIVE_DEST

Database Instance Parameter Changes


Add at least 600 KB to LARGE_POOL_SIZE Add the following to SHARED_POOL_SIZE:
(DB_SPACE/100+2)*#_External_Red OR (DB_SPACE/50+4)*#_Normal_Red OR (DB_SPACE/33+6)*#_High_Red SELECT d+l+t DB_SPACE FROM (SELECT SUM(bytes)/(1024*1024*1024) d FROM v$datafile), (SELECT SUM(bytes)/(1024*1024*1024) l FROM v$logfile a, v$log b WHERE a.group#=b.group#), (SELECT SUM(bytes)/(1024*1024*1024) t FROM v$tempfile WHERE status='ONLINE');

Add at least 16 to PROCESSES

Summary

In this lesson, you should have learned how to: Use the DBCA to create an ASM instance Start up and shut down ASM instances Create and maintain ASM disk groups Create database files using ASM

Practice 5 Overview

This practice covers the following topics: Installing ASMLib. Using the DBCA to create ASM instances. Discovering ASM instances in Database Control. Creating new ASM disk groups using Database Control. Generating automatic disk group rebalancing operations.