INTRODUCTION TO CLARIFY/ORACLE FOR UNIX

Download Report

Transcript INTRODUCTION TO CLARIFY/ORACLE FOR UNIX

INTRODUCTION TO ORACLE
Lynnwood Brown
System Managers LLC
Introduction to Oracle Automatic Storage
Management (ASM)
Copyright System Managers LLC 2008 all rights reserved.
Introduction to ASM
File system preparation:
On the filer:
• Create Aggregate from multiple disks
• Create volume(s) on the Aggregate
• Create LUNs on the volumes (LUNs initiator groups maps
WWPN/WWNN from the filer to the server.
On the Unix/Linux server:
• Boot server to discover the new device
• Run “mkfs” to create the file system
• Create mount point
• Mount device on the mount point
Copyright System Managers LLC 2008 all rights reserved.
Introduction to ASM
Automatic Storage Management (ASM)
• Introduced in Oracle 10g, Automatic Storage Management
(ASM) simplifies administration of Oracle related files by
allowing the administrator to reference disk groups rather
than individual disks and files, which are managed by
ASM.
• In an ASM environment the regular Unix/Linux file system
is replaced by the ASM file system. The “mkfs” utility is
NOT run.
• ASM works with “raw” devices.
Introduction to ASM
ASM Instance Creation
• Create instance initialization file ”init+ASM.ora” in the “/tmp”
directory. Contents of the file: INSTANCE_TYPE=ASM
• Connect to the ASM instance:
– export ORACLE_SID=+ASM
– sqlplus / as sysdba
• Create instance “spfile”:
SQL> CREATE SPFILE FROM PFILE='/tmp/init+ASM.ora';
File created.
Copyright System Managers LLC 2008 all rights reserved.
Introduction to ASM
Start the ASM instance:
SQL> startup nomount
ASM instance started
Total System Global Area 125829120 bytes
Fixed Size 1301456 bytes
Variable Size 124527664 bytes
Database Buffers 0 bytes Redo Buffers 0 bytes
Copyright System Managers LLC 2008 all rights reserved.
Introduction to ASM
ASM Startup Options
• FORCE - Performs a SHUTDOWN ABORT before
restarting the ASM instance.
• MOUNT - Starts the ASM instance and mounts the disk
groups specified by the ASM_DISKGROUPS parameter.
• NOMOUNT - Starts the ASM instance without mounting
any disk groups.
• OPEN - This is not a valid option for an ASM instance.
Copyright System Managers LLC 2008 all rights reserved.
Introduction to ASM
ASM Shutdown Options
• NORMAL - The ASM instance waits for all connected
ASM instances and SQL sessions to exit then shuts down.
• IMMEDIATE - The ASM instance waits for any SQL
transactions to complete then shuts down. It doesn't wait
for sessions to exit.
• TRANSACTIONAL - Same as IMMEDIATE.
• ABORT - The ASM instance shuts down instantly.
Copyright System Managers LLC 2008 all rights reserved.
Introduction to ASM
ASMCMD
•
ASMCMD is a command-line utility that you can use to easily view and
manipulate files and directories within Automatic Storage Management
(ASM) disk groups. It can list the contents of disk groups, perform
searches, create and remove directories and aliases, display space
utilization
•
Accessing the ASMCMD CLI
Set ORACLE_HOME and ORACLE_SID to the ASM instance
Type asmcmd at the OS command prompt
ASMCMD >
Copyright System Managers LLC 2008 all rights reserved.
Introduction to ASM
• Every file created in ASM gets a system-generated filename,
otherwise known as a fully qualified filename. This is analogous
to a complete path name in a local file system.
• An example of a fully qualified filename is :
+dgroup2/sample/controlfile/Current.256.541956473
• ASM generates filenames according to the following scheme:
+diskGroupName/databaseName/fileType/fileTypeTag.
file.incarnation
• In the previous fully qualified filename, dgroup2 is the disk group
name, sample is the database name, controlfile is the file type,
and so on.
Copyright System Managers LLC 2008 all rights reserved.
Introduction to ASM
Using ASMCMD commands example
• ASMCMD [+] > cd +dgroup1
• ASMCMD [+DGROUP1] > cd sample/datafile
• ASMCMD [+DGROUP1/SAMPLE/DATAFILE] > ls
EXAMPLE.269.555342243 SYSAUX.257.555341961
SYSTEM.256.555341961 UNDOTBS1.258.555341963
UNDOTBS1.272.557429239 USERS.259.555341963
• ASMCMD [+DGROUP1/SAMPLE/DATAFILE] > rm
undotbs1.272.557429239
Copyright System Managers LLC 2008 all rights reserved.
ASMCMD Commands
Command
Function
ls
List directory
cd
Change directory
mkdir
Make directory
rm
Remove ASM file
lsct
List client information
help
Display help screen
exit
Exit ASMCMD
Copyright System Managers LLC 2008 all rights reserved.
Introduction to ASM
Creating ASM Disk Groups
Disk groups are created using the CREATE DISKGROUP statement. This
statement allows you to specify the level of redundancy:
• NORMAL REDUNDANCY - Two-way mirroring, requiring two
failure groups.
• HIGH REDUNDANCY - Three-way mirroring, requiring three failure
groups.
• EXTERNAL REDUNDANCY - No mirroring for disks that are
already protected using hardware mirroring or RAID.
Introduction to ASM
Creating ASM Disk Groups
SQL > CREATE DISKGROUP disk_group_1 NORMAL REDUNDANCY
FAILGROUP failure_group_1 DISK '/devices/diska1' NAME diska1,
'/devices/diska2' NAME diska2, FAILGROUP failure_group_2 DISK
'/devices/diskb1' NAME diskb1, '/devices/diskb2' NAME diskb2;
Disk Group Created
Dropping/deleting ASM Disk Groups
SQL > DROP DISKGROUP disk_group_1 INCLUDING CONTENTS;
Disk Group Dropped
Copyright System Managers LLC 2008 all rights reserved.
Introduction to ASM
Add disks to a DISKGROUP
SQL > ALTER DISKGROUP disk_group_1 ADD DISK '/devices/disk*3',
'/devices/disk*4';
Note: The wildcard "*" can be used to reference disks so long as the resulting
string does not match a disk already used by an existing disk group.
Drop disks from a DISKGROUP
SQL > ALTER DISKGROUP disk_group_1 DROP DISK diska2;
Copyright System Managers LLC 2008 all rights reserved.
Introduction to ASM
Disks can be resized using the RESIZE clause of the ALTER
DISKGROUP statement. The statement can be used to
resize individual disks, all disks in a failure group or all
disks in the disk group. If the SIZE clause is omitted the
disks are resized to the size of the disk returned by the OS.
Resize a specific disk.
SQL > ALTER DISKGROUP disk_group_1 RESIZE DISK diska1 SIZE
100G;
Resize all disks in a failure group.
SQL > ALTER DISKGROUP disk_group_1 RESIZE DISKS IN
FAILGROUP failure_group_1 SIZE 100G;
Resize all disks in a disk group.
SQL > ALTER DISKGROUP disk_group_1 RESIZE ALL SIZE 100G;
Introduction to ASM
Creating a tablespace in an ASM environment:
SQL> CREATE TABLESPACE NEW_TS DATAFILE
'+disk_group_1' SIZE 100M AUTOEXTEND ON;
Tablespace Created
Copyright System Managers LLC 2008 all rights reserved.
ASM Views
The ASM configuration can be viewed using the V$ASM_%
views:
View Name
ASM Instance
DB Instance
V$ASM_ALIAS
Displays a row for each
alias present in every
disk group mounted by
the ASM instance.
Returns no rows
V$ASM_CLIENT
Displays a row for each
database instance using a
disk group managed by
the ASM instance.
Displays a row for the
ASM instance if the
database has open ASM
files.
V$ASM_DISK
Displays a row for each
disk discovered by the
ASM instance, including
disks which are not part
of any disk group.
Displays a row for each
disk in disk groups in
use by the database
instance.
ASM Views
View Name
ASM Instance
DB Instance
V$ASM_DISKGROUP
Displays a row for each Displays a row for each
disk group discovered by disk group mounted by
the ASM instance.
the local ASM instance.
V$ASM_FILE
Displays a row for each
file for each disk group
mounted by the ASM
instance.
Displays no rows.
V$ASM_OPERATION
Displays a row for each
file for each long
running operation
executing in the ASM
instance.
Displays no rows.
ASM File Names
There are several ways to reference ASM file. Some forms are used
during creation and some for referencing ASM files. The forms for file
creation are incomplete, relying on ASM to create the fully qualified
name, which can be retrieved from the supporting views. The forms of
the ASM filenames are summarized below.
Filename Type
Format
Fully Qualified ASM Filename
+dgroup/dbname/file_type/file_type_ta
g.file.incarnation
Numeric ASM Filename
+dgroup.file.incarnation
Alias ASM Filenames
+dgroup/directory/filename
Introduction to ASM
ASM provides the following functionality:
• Manages groups of disks, called disk groups.
• Manages disk redundancy within a disk group.
• Provides near-optimal I/O balancing without any manual
tuning.
• Enables management of database objects without
specifying mount points and filenames.
• Supports large files.
Copyright System Managers LLC 2008 all rights reserved.