Transcript Document

Automatic Storage Management
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-2
Copyright © 2004, Oracle. All rights reserved.
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
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
block
14-5
ASM Disk
File System
File
or
Raw Device
Allocation Unit
Physical
Block
Copyright © 2004, Oracle. All rights reserved.
ASM General Architecture
Node1
DB
Instance
SID=sales
Group Services
tom=ant
dick=ant
harry=ant
FG
FG
ASM
Instance
SID=ant
ASM
Instance
SID=bee
ASMB
DB
Instance
SID=test
ASM Disks
DBW0
RBAL
ASM Disks
ASM Diskgroup Tom
14-6
DB
Instance
SID=sales
ASMB DBW0
DBW0 ASMB
RBAL
Node2
Group Services
tom=bee
dick=bee
harry=bee
RBAL
RBAL
ARB0
ARB0
ARBA
ARBA
…
…
ASM Disks
ASM Disks
ASM Diskgroup Dick
Copyright © 2004, Oracle. All rights reserved.
RBAL
FG
FG
ASMB
DBW0
RBAL
DB
Instance
SID=test
ASM Disks
ASM Disks
ASM Diskgroup Harry
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 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-10
Copyright © 2004, Oracle. All rights reserved.
Accessing an ASM Instance
ASM
instance
AS SYSDBA
All operations
AS SYSOPER
Nondestructive
operations
Disk group
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
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 Performance Page
14-15
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 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
bytes
bytes
bytes
Copyright © 2004, Oracle. All rights reserved.
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 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
1
1
7
7
7
13
13
13
Failure group 1
1
1
1
7
7
7
13
13
13
Failure group 2
1
1
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 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
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.
Create Disk Group Page
14-24
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-25
Copyright © 2004, Oracle. All rights reserved.
Adding Disks to Disk Groups
ALTER DISKGROUP dgroupA ADD
'/dev/rdsk/c0t4d0s2' NAME
'/dev/rdsk/c0t5d0s2' NAME
'/dev/rdsk/c0t6d0s2' NAME
'/dev/rdsk/c0t7d0s2' NAME
DISK
A5,
A6,
A7,
A8;
ALTER DISKGROUP dgroupA ADD DISK '/devices/A*';
Disk formatting
Disk group rebalancing
14-26
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 dgroupA UNDROP DISKS;
ALTER DISKGROUP dgroupB REBALANCE POWER 5;
ALTER DISKGROUP dgroupA DISMOUNT;
ALTER DISKGROUP dgroupA 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 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 '+dgroupA';
Database File
RMAN
1
Automatic
ASM file
Creation
1
2
3
4
2
3
4
ASM File automatically spread inside Disk Group dgroupA
14-30
Copyright © 2004, Oracle. All rights reserved.
ASM Filenames
ASM
Filename
Reference
Fullyqualified
14-31
Numeric
Single-file
Creation
Alias
Multiple-file
Creation
Alias with
Incomplete
template
Copyright © 2004, Oracle. All rights reserved.
Incomplete
with
template
ASM File Name Syntax
1.
+<group>/<dbname>/<file_type>/<tag>.<file#>.<incarnation#>
2.
+<group>.<file#>.<incarnation#>
3.
+<group>/<directory1>/…/<directoryn>/<file_name>
4.
+<group>/<directory1>/…/<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
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
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
14-34
XTRANSPORT
Copyright © 2004, Oracle. All rights reserved.
ASM File Templates
System Template
External
Normal
High
Striped
CONTROLFILE
unprotected
2-way mirror
3-way mirror
fine
DATAFILE
unprotected
U
2-way2 mirror
3-way3 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
2-wayy mirror
3-wayy mirror
coarse
XTRANSPORT
unprotected
2-way mirror
3-way mirror
coarse
Mmirror
2-way
Mmirror
3-way
coarse
CHANGETRACKING
t
e
unprotected
c
unprotected
t
unprotected
e
d
unprotected
AUTOBACKUP
unprotected
i
2-way mirror
r
2-wayrmirror
2-wayomirror
2-wayr mirror
DUMPSET
unprotected
2-way mirror
PARAMETERFILE
DATAGUARDCONFIG
FLASHBACK
14-35
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
coarse
coarse
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';
14-36
Copyright © 2004, Oracle. All rights reserved.
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;
14-37
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-38
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
LOG_ARCHIVE_DEST_n
LOG_ARCHIVE_DEST
STANDBY_ARCHIVE_DEST
LARGE_POOL_SIZE = 8MB
…
14-40
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-41
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-42
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
14-43
Copyright © 2004, Oracle. All rights reserved.