14 Automatic Storage Management Copyright 2004 Oracle All

  • Slides: 39
Download presentation
14 Automatic Storage Management Copyright © 2004, Oracle. All rights reserved.

14 Automatic Storage Management Copyright © 2004, Oracle. All rights reserved.

Objectives After completing this lesson, you should be able to: • Describe the concepts

Objectives After completing this lesson, you should be able to: • Describe the concepts of Automatic Storage Management (ASM) • Set up initialization parameter files for ASM and database instances • Execute SQL commands with ASM file names • Start up and shut down ASM instances • Administer ASM disk groups • Use RMAN to migrate your database to ASM 14 -2 Copyright © 2004, Oracle. All rights reserved.

What Is Automatic Storage Management? • • • Portable and high performance cluster file

What Is Automatic Storage Management? • • • Portable and high performance cluster file system Manages Oracle database files Data is spread across disks to balance load Integrated mirroring across disks Solves many storage management challenges Application Database File System Volume Manager ASM Operating System 14 -3 Copyright © 2004, Oracle. All rights reserved.

ASM Key Features and Benefits • • 14 -4 Stripes files, not logical volumes

ASM Key Features and Benefits • • 14 -4 Stripes files, not logical volumes Online disk reconfiguration and dynamic rebalancing Adjustable rebalancing speed Provide redundancy on a file basis ASM only supports Oracle database files Cluster aware Automatically installed Copyright © 2004, Oracle. All rights reserved.

ASM Concepts ASM Disk Group Database Tablespace ASM File Data file Segment Extent Oracle

ASM Concepts ASM Disk Group Database Tablespace ASM File Data file Segment Extent Oracle block 14 -5 ASM Disk File System File or Raw Device Allocation Unit Physical Block Copyright © 2004, Oracle. All rights reserved.

ASM General Architecture Node 1 DB Instance SID=sales Group Services tom=ant dick=ant harry=ant FG

ASM General Architecture Node 1 DB Instance SID=sales Group Services tom=ant dick=ant harry=ant FG FG ASM Instance SID=ant ASMB ASM Disks DBW 0 RBAL ASM Disks ASM Diskgroup Tom 14 -6 ASM Instance SID=bee RBAL FG FG ASMB RBAL DB Instance SID=test DB Instance SID=sales ASMB DBW 0 ASMB RBAL Node 2 Group Services tom=bee dick=bee harry=bee ARB 0 ARBA … … ASM Disks ASM Diskgroup Dick Copyright © 2004, Oracle. All rights reserved. DBW 0 RBAL DB Instance SID=test ASM Disks ASM Diskgroup Harry

ASM Instance Functionalities CREATE DISKGROUP ALTER SYSTEM RESTRICTED SESSION ASM instance Database instance ALTER

ASM Instance Functionalities CREATE DISKGROUP ALTER SYSTEM RESTRICTED SESSION ASM instance Database instance ALTER DISKGROUP 14 -8 DROP DISKGROUP Copyright © 2004, Oracle. All rights reserved.

ASM Instance Creation 14 -9 Copyright © 2004, Oracle. All rights reserved.

ASM Instance Creation 14 -9 Copyright © 2004, Oracle. All rights reserved.

ASM Instance Initialization Parameters INSTANCE_TYPE = ASM DB_UNIQUE_NAME = +ASM ASM_POWER_LIMIT = 1 ASM_DISKSTRING

ASM Instance Initialization Parameters INSTANCE_TYPE = ASM DB_UNIQUE_NAME = +ASM ASM_POWER_LIMIT = 1 ASM_DISKSTRING = '/dev/rdsk/*s 2', '/dev/rdsk/c 1*' ASM_DISKGROUPS = dgroup. A, dgroup. B LARGE_POOL_SIZE = 8 MB 14 -10 Copyright © 2004, Oracle. All rights reserved.

Accessing an ASM Instance ASM instance AS SYSDBA All operations AS SYSOPER Nondestructive operations

Accessing an ASM Instance ASM instance AS SYSDBA All operations AS SYSOPER Nondestructive operations Disk group Storage system 14 -11 Copyright © 2004, Oracle. All rights reserved.

Dynamic Performance View Additions V$ASM_TEMPLATE V$ASM_CLIENT V$ASM_DISKGROUP Disk group A Disk group B V$ASM_FILE

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 14 -12 Copyright © 2004, Oracle. All rights reserved.

ASM Home Page 14 -14 Copyright © 2004, Oracle. All rights reserved.

ASM Home Page 14 -14 Copyright © 2004, Oracle. All rights reserved.

ASM Performance Page 14 -15 Copyright © 2004, Oracle. All rights reserved.

ASM Performance Page 14 -15 Copyright © 2004, Oracle. All rights reserved.

ASM Configuration Page 14 -16 Copyright © 2004, Oracle. All rights reserved.

ASM Configuration Page 14 -16 Copyright © 2004, Oracle. All rights reserved.

Starting Up an ASM Instance $ sqlplus /nolog SQL> CONNECT / AS sysdba Connected

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 Fixed Size 324548 Variable Size 96468992 Database Buffers 50331648 Redo Buffers 811008 ASM diskgroups mounted 14 -17 bytes bytes Copyright © 2004, Oracle. All rights reserved.

Shutting Down an ASM Instance Database Instance A Database Instance B 2 ASM Instance

Shutting Down an ASM Instance Database Instance A Database Instance B 2 ASM Instance 3 SHUTDOWN NORMAL 1 14 -18 1 Copyright © 2004, Oracle. All rights reserved.

ASM Disk Groups • • • A pool of disks managed as a logical

ASM Disk Groups • • • A pool of disks managed as a logical unit Partitions total disk space into uniform sized units Spreads each file evenly across all disks Uses coarse or fine grain striping based on file type Administer disk groups not files ASM Instance Disk Group 14 -19 Copyright © 2004, Oracle. All rights reserved.

Failure Group Controller 1 Controller 2 Controller 3 6 5 4 3 2 1

Failure Group Controller 1 Controller 2 Controller 3 6 5 4 3 2 1 1 1 7 7 7 13 13 13 Failure group 2 1 13 13 13 Failure group 3 Disk group A 14 -20 7 7 7 Copyright © 2004, Oracle. All rights reserved.

Disk Group Mirroring • • Mirror at extent level Mix primary and mirror extents

Disk Group Mirroring • • Mirror at extent level Mix primary and mirror extents on each disk External redundancy: Defers to hardware mirroring Normal redundancy: – Two-way mirroring – At least two failure groups • High redundancy: – Three-way mirroring – At least three failure groups 14 -21 Copyright © 2004, Oracle. All rights reserved.

Disk Group Dynamic Rebalancing • • 14 -22 Automatic online rebalance whenever storage configuration

Disk Group Dynamic Rebalancing • • 14 -22 Automatic online rebalance whenever storage configuration changes Only move data proportional to storage added No need for manual I/O tuning Online migration to new storage Copyright © 2004, Oracle. All rights reserved.

ASM Administration Page 14 -23 Copyright © 2004, Oracle. All rights reserved.

ASM Administration Page 14 -23 Copyright © 2004, Oracle. All rights reserved.

Create Disk Group Page 14 -24 Copyright © 2004, Oracle. All rights reserved.

Create Disk Group Page 14 -24 Copyright © 2004, Oracle. All rights reserved.

Create or Delete Disk Groups CREATE DISKGROUP dgroup. A NORMAL REDUNDANCY FAILGROUP controller 1

Create or Delete Disk Groups CREATE DISKGROUP dgroup. A NORMAL REDUNDANCY FAILGROUP controller 1 DISK '/devices/A 1' NAME disk. A 1 SIZE 120 G FORCE, '/devices/A 2', '/devices/A 3' FAILGROUP controller 2 DISK '/devices/B 1', '/devices/B 2', '/devices/B 3'; DROP DISKGROUP dgroup. A INCLUDING CONTENTS; 14 -25 Copyright © 2004, Oracle. All rights reserved.

Adding Disks to Disk Groups ALTER DISKGROUP dgroup. A ADD '/dev/rdsk/c 0 t 4

Adding Disks to Disk Groups ALTER DISKGROUP dgroup. A ADD '/dev/rdsk/c 0 t 4 d 0 s 2' NAME '/dev/rdsk/c 0 t 5 d 0 s 2' NAME '/dev/rdsk/c 0 t 6 d 0 s 2' NAME '/dev/rdsk/c 0 t 7 d 0 s 2' NAME DISK A 5, A 6, A 7, A 8; ALTER DISKGROUP dgroup. A ADD DISK '/devices/A*'; Disk formatting Disk group rebalancing 14 -26 Copyright © 2004, Oracle. All rights reserved.

Miscellaneous Alter Commands ALTER DISKGROUP dgroup. A DROP DISK A 5; ALTER DISKGROUP dgroup.

Miscellaneous Alter Commands ALTER DISKGROUP dgroup. A DROP DISK A 5; ALTER DISKGROUP dgroup. A DROP DISK A 6 ADD FAILGROUP fred DISK '/dev/rdsk/c 0 t 8 d 0 s 2' NAME A 9; ALTER DISKGROUP dgroup. A UNDROP DISKS; ALTER DISKGROUP dgroup. B REBALANCE POWER 5; ALTER DISKGROUP dgroup. A DISMOUNT; ALTER DISKGROUP dgroup. A CHECK ALL; 14 -27 Copyright © 2004, Oracle. All rights reserved.

Monitoring Long-Running Operations Using V$ASM_OPERATION Column GROUP_NUMBER Disk group 14 -29 Description OPERATION Type

Monitoring Long-Running Operations Using V$ASM_OPERATION Column GROUP_NUMBER Disk group 14 -29 Description OPERATION Type of operation: REBAL STATE State of operation: QUEUED or RUNNING POWER Power requested for this operation ACTUAL Power allocated to this operation SOFAR Number of allocation units moved so far EST_WORK Estimated number of remaining allocation units EST_RATE Estimated number of allocation units moved per minute EST_MINUTES Estimated amount of time (in minutes) for operation termination Copyright © 2004, Oracle. All rights reserved.

ASM Files CREATE TABLESPACE sample DATAFILE '+dgroup. A'; Database File RMAN 1 Automatic ASM

ASM Files CREATE TABLESPACE sample DATAFILE '+dgroup. A'; Database File RMAN 1 Automatic ASM file Creation 1 2 3 4 ASM File automatically spread inside Disk Group dgroup. A 14 -30 Copyright © 2004, Oracle. All rights reserved.

ASM Filenames ASM Filename Reference Fullyqualified 14 -31 Numeric Single-file Creation Alias Multiple-file Creation

ASM Filenames ASM Filename Reference Fullyqualified 14 -31 Numeric Single-file Creation Alias Multiple-file Creation Incomplete Alias with Incomplete template Copyright © 2004, Oracle. All rights reserved.

ASM File Name Syntax 1. +<group>/<dbname>/<file_type>/<tag>. <file#>. <incarnation#> 2. +<group>. <file#>. <incarnation#> 3. +<group>/<directory

ASM File Name Syntax 1. +<group>/<dbname>/<file_type>/<tag>. <file#>. <incarnation#> 2. +<group>. <file#>. <incarnation#> 3. +<group>/<directory 1>/…/<directoryn>/<file_name> 4. +<group>/<directory 1>/…/<directoryn>/<file_name>(<temp>) 5. +<group> 6. +<group>(<temp>) 14 -32 Copyright © 2004, Oracle. All rights reserved.

ASM File Name Mapping Oracle File Type <File Type> <Tag> Def Template Control files

ASM File Name Mapping Oracle File Type <File Type> <Tag> Def Template Control files controlfile CF/BCF CONTROLFILE Data files datafile <ts_name>_<file#> DATAFILE Online logs online_log log_<thread#> ONLINELOG Archive logs archive_log parameter ARCHIVELOG Temp files temp <ts_name>_<file#> TEMPFILE Data file backup pieces backupset Client Specified BACKUPSET Data file incremental backup pieces backupset Client Specified BACKUPSET Arch log backup piece backupset Client Specified BACKUPSET Data file copy datafile <ts_name>_<file#> DATAFILE Initialization parameters init spfile PARAMETERFILE Broker configurations drc DATAGUARDCONFIG Flashback logs rlog <thread#>_<log#> FLASHBACK Change tracking bitmaps CTB BITMAP CHANGETRACKING Auto backup Auto. Backup Client Specified AUTOBACKUP Data Pump dump set Dumpset dump DUMPSET Cross-platform converted data files 14 -34 XTRANSPORT Copyright © 2004, Oracle. All rights reserved.

ASM File Templates System Template External Normal High Striped CONTROLFILE unprotected 2 -way mirror

ASM File Templates System Template External Normal High Striped CONTROLFILE unprotected 2 -way mirror 3 -way mirror fine DATAFILE unprotected U 2 -way 2 mirror 3 -way 3 mirror coarse ONLINELOG unprotected n 2 -way- mirror 3 -way- mirror fine ARCHIVELOG unprotected p 2 -way wmirror 3 -way wmirror coarse TEMPFILE r unprotected 2 -waya mirror 3 -waya mirror coarse BACKUPSET o unprotected XTRANSPORT unprotected CHANGETRACKING t e unprotected c unprotected t unprotected e d unprotected AUTOBACKUP unprotected M 2 -way mirror i 2 -way mirror r 2 -wayrmirror 2 -wayomirror 2 -wayr mirror DUMPSET unprotected 2 -way mirror PARAMETERFILE DATAGUARDCONFIG FLASHBACK 14 -35 2 -wayy mirror 2 -way mirror 3 -way mirror M 3 -way mirror i 3 -way mirror r 3 -wayr mirror 3 -wayomirror 3 -wayr mirror 3 -way mirror Copyright © 2004, Oracle. All rights reserved. coarse fine coarse

Template and Alias Examples ALTER DISKGROUP dgroup. A ADD TEMPLATE reliable ATTRIBUTES (MIRROR); ALTER

Template and Alias Examples ALTER DISKGROUP dgroup. A ADD TEMPLATE reliable ATTRIBUTES (MIRROR); ALTER DISKGROUP dgroup. A DROP TEMPLATE reliable; ALTER DISKGROUP dgroup. A DROP FILE '+dgroup. A. 268. 8675309'; ALTER DISKGROUP dgroup. A ADD DIRECTORY '+dgroup. A/mydir'; ALTER DISKGROUP dgroup. A ADD ALIAS '+dgroup. A/mydir/datafile. dbf' FOR '+dgroup. A. 274. 38745'; ALTER DISKGROUP dgroup. A DROP ALIAS '+dgroup. A/mydir/datafile. dbf'; 14 -36 Copyright © 2004, Oracle. All rights reserved.

Retrieving Aliases SELECT reference_index INTO : alias_id FROM V$ASM_ALIAS WHERE name = '+dgroup. A';

Retrieving Aliases SELECT reference_index INTO : alias_id FROM V$ASM_ALIAS WHERE name = '+dgroup. A'; 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; 14 -37 Copyright © 2004, Oracle. All rights reserved.

SQL Commands and File Naming CREATE CONTROLFILE DATABASE sample RESETLOGS ARCHIVELOG MAXLOGFILES 5 MAXLOGHISTORY

SQL Commands and File Naming CREATE CONTROLFILE DATABASE sample RESETLOGS ARCHIVELOG MAXLOGFILES 5 MAXLOGHISTORY 100 MAXDATAFILES 10 MAXINSTANCES 2 LOGFILE GROUP 1 ('+dgroup. A', '+dgroup. B') SIZE 100 M, GROUP 2 ('+dgroup. A', '+dgroup. B') SIZE 100 M DATAFILE '+dgroup. A. 261. 12345678' SIZE 100 M DATAFILE '+dgroup. A. 262. 87654321' SIZE 100 M; 14 -38 Copyright © 2004, Oracle. All rights reserved.

DBCA and Storage Options 14 -39 Copyright © 2004, Oracle. All rights reserved.

DBCA and Storage Options 14 -39 Copyright © 2004, Oracle. All rights reserved.

Database Instance Parameter Changes … INSTANCE_TYPE = RDBMS LOG_ARCHIVE_FORMAT DB_BLOCK_SIZE DB_CREATE_ONLINE_LOG_DEST_n DB_CREATE_FILE_DEST DB_RECOVERY_FILE_DEST CONTROL_FILES

Database Instance Parameter Changes … INSTANCE_TYPE = RDBMS LOG_ARCHIVE_FORMAT DB_BLOCK_SIZE DB_CREATE_ONLINE_LOG_DEST_n DB_CREATE_FILE_DEST DB_RECOVERY_FILE_DEST CONTROL_FILES LOG_ARCHIVE_DEST_n LOG_ARCHIVE_DEST STANDBY_ARCHIVE_DEST LARGE_POOL_SIZE = 8 MB … 14 -40 Copyright © 2004, Oracle. All rights reserved.

Migrating Your Database to ASM Storage 1. Shut down your database cleanly 2. Shutdown

Migrating Your Database to ASM Storage 1. Shut down your database cleanly 2. Shutdown the database and modify your server parameter file to use Oracle Managed Files (OMF) 3. Edit and execute the following RMAN script: STARTUP NOMOUNT; RESTORE CONTROLFILE FROM '/u 1/c 1. ctl'; ALTER DATABASE MOUNT; BACKUP AS COPY DATABASE FORMAT '+dgroup 1'; SWITCH DATABASE TO COPY; SQL "ALTER DATABASE RENAME '/u 1/log 1' TO '+dgroup 1' "; # Repeat RENAME command for all online redo log members. . . ALTER DATABASE OPEN RESETLOGS; SQL "ALTER DATABASE TEMPFILE '/u 1/temp 1' DROP"; 14 -41 Copyright © 2004, Oracle. All rights reserved.

Summary In this lesson, you should have learned how to: • Describe the concepts

Summary In this lesson, you should have learned how to: • Describe the concepts of Automatic Storage Management (ASM) • Set up initialization parameter files for ASM and database instances • Execute SQL commands with ASM file names • Start up and shut down ASM instances • Administer ASM disk groups • Use RMAN to migrate your database to ASM 14 -42 Copyright © 2004, Oracle. All rights reserved.

Practice 14 Overview: Using ASM This practice covers the following topics: • Creating an

Practice 14 Overview: Using ASM This practice covers the following topics: • Creating an ASM instance • Creating tablespaces that use ASM storage • Viewing ASM information • Migrating a tablespace to use ASM storage 14 -43 Copyright © 2004, Oracle. All rights reserved.