14 Copyright © 2004, Oracle. All rights reserved. Automatic Storage Management.
-
Upload
ruth-mckinney -
Category
Documents
-
view
227 -
download
0
Transcript of 14 Copyright © 2004, Oracle. All rights reserved. Automatic Storage Management.
14Copyright © 2004, Oracle. All rights reserved.
Automatic Storage Management
14-2 Copyright © 2004, Oracle. All rights reserved.
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-3 Copyright © 2004, Oracle. All rights reserved.
What Is Automatic Storage Management?
• Portable and high performancecluster file system
• Manages Oracle database files
• Data is spread across disksto balance load
• Integrated mirroring acrossdisks
• Solves many storage management challenges
ASM
FileSystem
VolumeManager
Operating System
Application
Database
14-4 Copyright © 2004, Oracle. All rights reserved.
ASM Key Features and Benefits
• 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
14-5 Copyright © 2004, Oracle. All rights reserved.
ASM Concepts
Database
Tablespace
Segment
Extent
Oracleblock
Data file
PhysicalBlock
ASMDisk Group
ASM Disk
ASM File
Allocation UnitFile System
Fileor
Raw Device
14-6 Copyright © 2004, Oracle. All rights reserved.
ASM General Architecture
ASM Instance
SID=ant
ASM Instance
SID=bee
ASM Disks ASM Disks ASM Disks ASM Disks ASM Disks ASM Disks
ASM Diskgroup Tom ASM Diskgroup Dick ASM Diskgroup Harry
DB Instance
SID=sales
DB Instance
SID=test
DB Instance
SID=sales
DB Instance
SID=test
ASMB
ASMB
FG
FG FG
FG
Node2Node1 Group Servicestom=ant
dick=antharry=ant
Group Services tom=bee
dick=beeharry=bee
DBW0
DBW0DBW0
DBW0ASMB
RBAL RBAL
ARB0
ARBA
…ARB0
ARBA
…
ASMB
RBAL
RBAL RBAL
RBAL
14-8 Copyright © 2004, Oracle. All rights reserved.
ASM Instance Functionalities
CREATE DISKGROUP
ALTER DISKGROUP DROP DISKGROUP
ALTER SYSTEM RESTRICTED SESSION
ASMinstance
Database instance
14-9 Copyright © 2004, Oracle. All rights reserved.
ASM Instance Creation
14-10 Copyright © 2004, Oracle. All rights reserved.
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
14-11 Copyright © 2004, Oracle. All rights reserved.
Accessing an ASM Instance
Disk group Disk group
Storage system
AS SYSDBA AS SYSOPERASM
instance
All operations Nondestructiveoperations
14-12 Copyright © 2004, Oracle. All rights reserved.
Dynamic Performance View Additions
Storage system
V$ASM_DISKGROUPV$ASM_CLIENT
V$ASM_DISK
V$ASM_FILE
V$ASM_TEMPLATE
V$ASM_ALIAS
V$ASM_OPERATION
Disk group A Disk group B
14-14 Copyright © 2004, Oracle. All rights reserved.
ASM Home Page
14-15 Copyright © 2004, Oracle. All rights reserved.
ASM Performance Page
14-16 Copyright © 2004, Oracle. All rights reserved.
ASM Configuration Page
14-17 Copyright © 2004, Oracle. All rights reserved.
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
14-18 Copyright © 2004, Oracle. All rights reserved.
Shutting Down an ASM Instance
SHUTDOWN NORMAL
ASM Instance
Database Instance A Database Instance B
1 1
2
3
14-19 Copyright © 2004, Oracle. All rights reserved.
ASM Disk Groups
• A pool of disks managed asa 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
Disk Group
ASMInstance
14-20 Copyright © 2004, Oracle. All rights reserved.
Failure Group
Controller 1 Controller 2
Failure group 1 Failure group 2
Disk group A
Controller 3
Failure group 3
1 7 13
1 7 131 7 13
1 7 13
1 7 131 7 13
1 7 13
1 7 131 7 13
2
3
4
5
6
14-21 Copyright © 2004, Oracle. All rights reserved.
Disk Group Mirroring
• Mirror at extent level
• Mix primary and mirror extents on each disk
• External redundancy:Defers to hardwaremirroring
• Normal redundancy: – Two-way mirroring– At least two failure groups
• High redundancy: – Three-way mirroring– At least three failure groups
14-22 Copyright © 2004, Oracle. All rights reserved.
Disk Group Dynamic Rebalancing
• Automatic online rebalance wheneverstorage configurationchanges
• Only move data proportional to storage added
• No need for manual I/O tuning
• Online migration tonew storage
14-23 Copyright © 2004, Oracle. All rights reserved.
ASM Administration Page
14-24 Copyright © 2004, Oracle. All rights reserved.
Create Disk Group Page
14-25 Copyright © 2004, Oracle. All rights reserved.
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;
14-26 Copyright © 2004, Oracle. All rights reserved.
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
14-27 Copyright © 2004, Oracle. All rights reserved.
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 dgroupB REBALANCE POWER 5;
ALTER DISKGROUP dgroupA UNDROP DISKS;
ALTER DISKGROUP dgroupA DISMOUNT;
ALTER DISKGROUP dgroupA CHECK ALL;
14-29 Copyright © 2004, Oracle. All rights reserved.
Monitoring Long-Running Operations Using V$ASM_OPERATION
Column Description
GROUP_NUMBER Disk group
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
14-30 Copyright © 2004, Oracle. All rights reserved.
ASM Files
Database File
ASM File automatically spread inside Disk Group dgroupA
CREATE TABLESPACE sample DATAFILE '+dgroupA';
1234
1 2 3 4
Automatic ASM fileCreation
RMAN
14-31 Copyright © 2004, Oracle. All rights reserved.
ASM Filenames
ASM Filename
Fully-qualified
Incompletewith
templateNumeric Alias
Alias withtemplate
Incomplete
ReferenceSingle-fileCreation
Multiple-fileCreation
14-32 Copyright © 2004, Oracle. All rights reserved.
ASM File Name Syntax
1.
2.
3.
4.
5.
6.
+<group>/<dbname>/<file_type>/<tag>.<file#>.<incarnation#>
+<group>.<file#>.<incarnation#>
+<group>/<directory1>/…/<directoryn>/<file_name>
+<group>
+<group>(<temp>)
+<group>/<directory1>/…/<directoryn>/<file_name>(<temp>)
14-34 Copyright © 2004, Oracle. All rights reserved.
ASM File Name MappingOracle 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 incrementalbackup 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 drc DATAGUARDCONFIG
Flashback logs rlog <thread#>_<log#> FLASHBACK
Change tracking bitmaps CTB BITMAP CHANGETRACKING
Auto backup AutoBackup Client Specified AUTOBACKUP
Data Pump dump set Dumpset dump DUMPSET
Cross-platform converted data files
XTRANSPORT
14-35 Copyright © 2004, Oracle. All rights reserved.
ASM File Templates
System Template StripedExternal Normal High CONTROLFILE fineunprotected 2-way mirror 3-way mirror
DATAFILE coarseunprotected 2-way mirror 3-way mirror
ONLINELOG fineunprotected 2-way mirror 3-way mirror
ARCHIVELOG coarseunprotected 2-way mirror 3-way mirror
TEMPFILE coarseunprotected 2-way mirror 3-way mirror
BACKUPSET coarseunprotected 2-way mirror 3-way mirror
XTRANSPORT coarseunprotected 2-way mirror 3-way mirror
PARAMETERFILE coarseunprotected 2-way mirror 3-way mirror
DATAGUARDCONFIG coarseunprotected 2-way mirror 3-way mirror
FLASHBACK fineunprotected 2-way mirror 3-way mirror
CHANGETRACKING coarseunprotected 2-way mirror 3-way mirror
AUTOBACKUP coarseunprotected 2-way mirror 3-way mirror
DUMPSET coarseunprotected 2-way mirror 3-way mirror
Unprotected
2-way
Mirror
3-way
Mirror
14-36 Copyright © 2004, Oracle. All rights reserved.
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';
Template and Alias Examples
14-37 Copyright © 2004, Oracle. All rights reserved.
Retrieving Aliases
SELECT reference_index INTO :alias_idFROM V$ASM_ALIAS WHERE name = '+dgroupA';
SELECT reference_index INTO :alias_id FROM V$ASM_ALIASWHERE parent_index = :alias_id AND name = 'mydir';
SELECT name FROM V$ASM_ALIAS WHERE parent_index = :alias_id;
14-38 Copyright © 2004, Oracle. All rights reserved.
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
DATAFILE '+dgroupA.262.87654321' SIZE 100M;
14-39 Copyright © 2004, Oracle. All rights reserved.
DBCA and Storage Options
14-40 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
LOG_ARCHIVE_DEST_n
LOG_ARCHIVE_DEST
STANDBY_ARCHIVE_DEST
LARGE_POOL_SIZE = 8MB
…
14-41 Copyright © 2004, Oracle. All rights reserved.
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 '/u1/c1.ctl';ALTER DATABASE MOUNT;BACKUP AS COPY DATABASE FORMAT '+dgroup1';SWITCH DATABASE TO COPY;SQL "ALTER DATABASE RENAME '/u1/log1' TO '+dgroup1' ";# Repeat RENAME command for all online redo log members ...ALTER DATABASE OPEN RESETLOGS;SQL "ALTER DATABASE TEMPFILE '/u1/temp1' DROP";
14-42 Copyright © 2004, Oracle. All rights reserved.
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-43 Copyright © 2004, Oracle. All rights reserved.
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