View
16
Download
0
Category
Preview:
Citation preview
Inderpal S. JohalInderpal S. JohalInderpal S. JohalInderpal S. JohalInderpal S. JohalInderpal S. JohalInderpal S. JohalInderpal S. JohalPrincipal Consultant
ORACLE 10g ASMORACLE 10g ASMORACLE 10g ASMORACLE 10g ASMMay 17th, 2006
Data Softech Inc.Data Softech Inc. 2Oracle 10g ASM Oracle 10g ASM
AgendaAgendaAgendaAgendaAgendaAgendaAgendaAgenda
� What is ASM
� Benefits of ASM
� ASM Architecture
� ASM Components
� DB Instance parameters to support ASM
� ASM Instance Monitoring using EM
� ASM Views
� Migrating from File system to ASM
� Miscellaneous Tips
� Q&A
Data Softech Inc.Data Softech Inc. 3Oracle 10g ASM Oracle 10g ASM
WWWWWWWWhat ishat ishat ishat ishat ishat ishat ishat is ASMASMASMASMASMASMASMASM
� ASM stands for Automatic Storage Management
� It is Oracle Cluster File System and Volume Manager
� Designed for Oracle Database Related Files
� Provide Storage management capabilities like striping as well as mirroring
Data filesData files
Log filesLog files
Archived filesArchived files
Control FilesControl Files
DataGuardDataGuard
Temp FileTemp File
SPfileSPfile
DG fileDG file
Flashback LogsFlashback Logs
Datapump FileDatapump File
Change Tracking FileChange Tracking File
Not Certified for
Trace Files
ORACLE_HOME
Voting Disk
OCR Files
Alert Log
Password File
Binary File (BFILE)
Data Softech Inc.Data Softech Inc. 4Oracle 10g ASM Oracle 10g ASM
BBBBBBBBenefits ofenefits ofenefits ofenefits ofenefits ofenefits ofenefits ofenefits of AAAAAAAAutomaticutomaticutomaticutomaticutomaticutomaticutomaticutomatic SSSSSSSStoragetoragetoragetoragetoragetoragetoragetorage MMMMMMMManagementanagementanagementanagementanagementanagementanagementanagement
� Provide efficient management of storage
� No need for buggy OCFS or expensive 3rd party CFS
� Provide integrated Cluster File system and Volume management capabilities
Tables
Tablespaces
Files
File systems
Logical Volumes
Physical Volumes
Tables
Tablespaces
Files
File systems
Logical Volumes
Physical Volumes
Traditional Volume Mgmt. ASMTraditional Volume Mgmt. ASM
Tables
Tablespaces
Disk Groups
Physical Volumes
Tables
Tablespaces
Disk Groups
Physical Volumes
AutomaticAutomaticStorageStorage
ManagementManagement
Data Softech Inc.Data Softech Inc. 5Oracle 10g ASM Oracle 10g ASM
BBBBBBBBenefits ofenefits ofenefits ofenefits ofenefits ofenefits ofenefits ofenefits of AAAAAAAAutomaticutomaticutomaticutomaticutomaticutomaticutomaticutomatic SSSSSSSStoragetoragetoragetoragetoragetoragetoragetorage MMMMMMMManagementanagementanagementanagementanagementanagementanagementanagement
� Provide efficient management of storage
� Provide integrated Cluster File system and Volume management capabilities
� No need for buggy OCFS or expensive 3rd Party CFS
� Provide Software Mirroring on top of vendor supplied SAN [2 or 3 Mirrors]
Triple Mirroring Double Mirroring No Mirroring
Data Softech Inc.Data Softech Inc. 6Oracle 10g ASM Oracle 10g ASM
BBBBBBBBenefits ofenefits ofenefits ofenefits ofenefits ofenefits ofenefits ofenefits of AAAAAAAAutomaticutomaticutomaticutomaticutomaticutomaticutomaticutomatic SSSSSSSStoragetoragetoragetoragetoragetoragetoragetorage MMMMMMMManagementanagementanagementanagementanagementanagementanagementanagement
� Provide efficient management of storage
� Provide integrated Cluster File system and Volume management capabilities
� No need for buggy OCFS or expensive 3rd Party CFS
� Provide Software Mirroring on top of vendor supplied SAN [2 or 3 Mirrors]
� Automatic online re-organization of disk space for any new addition/removal of storage capacity
Disk GroupDisk Group
Data Softech Inc.Data Softech Inc. 7Oracle 10g ASM Oracle 10g ASM
BBBBBBBBenefits ofenefits ofenefits ofenefits ofenefits ofenefits ofenefits ofenefits of AAAAAAAAutomaticutomaticutomaticutomaticutomaticutomaticutomaticutomatic SSSSSSSStoragetoragetoragetoragetoragetoragetoragetorage MMMMMMMManagementanagementanagementanagementanagementanagementanagementanagement
� Automatic IO load balancing as data is striped across disks and better performance
� Available for both Single Instance as well as RAC instance
� Free built in 10g kernel – Available even in Standard Edition
� Prevents Fragmentation and hence no need to relocate data to reclaim space
� Overcomes file system size limitations
� Prevents accidental file deletion
� Backup with RMAN
Data Softech Inc.Data Softech Inc. 8Oracle 10g ASM Oracle 10g ASM
ASM ASM ASM ASM ASM ASM ASM ASM ComponentsComponentsComponentsComponentsComponentsComponentsComponentsComponents
DATABASEDATABASE ASM DISK GROUPASM DISK GROUP
TABLESPACETABLESPACE
SEGMENTSEGMENT
EXTENTEXTENT
ORACLE BLOCKORACLE BLOCK
ASM FILEASM FILE
ALLOCATION UNITALLOCATION UNIT
PHYSICAL BLOCKPHYSICAL BLOCK
ASM DISKASM DISK
DATAFILEDATAFILE
FILE SYSTEM FILEOr
RAW DEVICE
FILE SYSTEM FILEOr
RAW DEVICE
ASM Disk ASM Disk ASM Disk
Data Softech Inc.Data Softech Inc. 9Oracle 10g ASM Oracle 10g ASM
PPPPPPPPrererererererere--------RRRRRRRRequisite forequisite forequisite forequisite forequisite forequisite forequisite forequisite for ASMASMASMASMASMASMASMASM� Need CSS daemon for creating an ASM instance
$ ps –ef | grep css1. In RAC, it is done by Oracle CLusterware2. In Single Instance environment, you have to run# $ORACLE_HOME/bin/localconfig add
To reconfigure the CSS daemon to run from the new Oracle home:# $ORACLE_HOME/bin/localconfig reset $ORACLE_HOME
� Need Additional at least 100M of memory for ASM instance
Data Softech Inc.Data Softech Inc. 10Oracle 10g ASM Oracle 10g ASM
ASM AASM AASM AASM AASM AASM AASM AASM Architecturerchitecturerchitecturerchitecturerchitecturerchitecturerchitecturerchitecture
PMONPMON SMONSMON
LGWRLGWR
DBWRDBWR
DB Instance
PMONPMON
SMONSMONLGWRLGWR
DBWRDBWR
ASM Instance +ASM1
Node 1
FG
Group Services+ASM1-->DG1+ASM1 -->DG2
OOCCSSSSDD
ARB0…
ARBa
ARB0…
ARBaRBALRBAL
GMONGMON
ASM Disk
DG1 – Disk Group
ASM Disk ASM Disk
DG2 – Disk Group
ASM Disk
RBALRBAL
ASMBASMB
Group Services+ASM2-->DG1+ASM2 -->DG2
OOCCSSSSDD
Node 2
SMONSMON
LGWRLGWR
PMONPMON
DBWRDBWR
DB Instance
LGWRLGWR
DBWRDBWR PMONPMON
SMONSMON
ASM Instance +ASM2
FG
ARB0…
ARBa
ARB0…
ARBaRBALRBAL
GMONGMON
RBALRBAL
ASMBASMB
ASM DiskASM Disk
DG3 – Disk Group
ASM Disk
SMONSMON
PMONPMON
DBWRDBWRLGWRLGWR
DB InstanceFG
ASMBASMB
RBALRBAL
+ASM2 -->DG3
Data Softech Inc.Data Softech Inc. 11Oracle 10g ASM Oracle 10g ASM
ASM ASM ASM ASM ASM ASM ASM ASM ComponentsComponentsComponentsComponentsComponentsComponentsComponentsComponents
�� ASM InstanceASM Instance
� ASM Disk
� Disk Group
� Failure Group
� ASM Files
Data Softech Inc.Data Softech Inc. 12Oracle 10g ASM Oracle 10g ASM
ASM ASM ASM ASM ASM ASM ASM ASM ComponentsComponentsComponentsComponentsComponentsComponentsComponentsComponents
�� ASM InstanceASM Instance
� ASM Disk
� Disk Group
� Failure Group
� ASM Files
Data Softech Inc.Data Softech Inc. 13Oracle 10g ASM Oracle 10g ASM
ASM ASM ASM ASM ASM ASM ASM ASM Components Components Components Components Components Components Components Components –––––––– ASM InstanceASM InstanceASM InstanceASM InstanceASM InstanceASM InstanceASM InstanceASM Instance
10g has two types of Instance� INSTANCE_TYPE = asm ASM Instance� INSTANCE_TYPE = rdbms [Default] DB Instance
Feature of ASM instance
� Do not mount the database but manage metadata required to make ASM files available for DB instances
� DB Instance access ASM files directly and contact ASM instance only for the layout of ASM files
� Smaller than DB instance < 100M
� Contains no physical files like log files / control files or data files
� Requires only the init.ora file for startup
� Instance Name is +ASM or +ASM1..n [RAC]
Data Softech Inc.Data Softech Inc. 14Oracle 10g ASM Oracle 10g ASM
ASM ASM ASM ASM ASM ASM ASM ASM Components Components Components Components Components Components Components Components –––––––– ASM InstanceASM InstanceASM InstanceASM InstanceASM InstanceASM InstanceASM InstanceASM Instance
� ASM instance have no user dictionary and so only way to connect is OS authentication with SYSDBA or SYSOPER privileges
ARB0…
ARBa
ARB0…
ARBa PMONPMON
SMONSMON
LGWRLGWR
DBWRDBWR RBALRBAL
GMONGMON
SGA
ASM Instance
ALL OperationsALL Operations Non-Destructive OperationsNon-Destructive Operations
ASM Disk ASM Disk ASM Disk
ASM Disk Group
SYSDBA SYSOPER
ALL SYSOPER as on RHSAnd
CREATE DISKGROUPADD/DROP/RESIZE DISK
STARTUP/SHUTDOWNALTER DISKGROUP MOUNT/DISMOUNTALTER DISKGROUP ONLINE/OFFLINE DISKALTER DISK REBALANCEALTER DISKGROUP CHECKAccess to all V$ASM_* views
Data Softech Inc.Data Softech Inc. 15Oracle 10g ASM Oracle 10g ASM
ASM ASM ASM ASM ASM ASM ASM ASM ComponentsComponentsComponentsComponentsComponentsComponentsComponentsComponents –––––––– ASMASMASMASMASMASMASMASM InstanceInstanceInstanceInstanceInstanceInstanceInstanceInstance
Database Configuration Assistant Oracle Universal InstallerManual using SQL
SQL> startup pfile=init+ASM.ora
Data Softech Inc.Data Softech Inc. 16Oracle 10g ASM Oracle 10g ASM
ASM ASM ASM ASM ASM ASM ASM ASM Components Components Components Components Components Components Components Components –––––––– ASM InstanceASM InstanceASM InstanceASM InstanceASM InstanceASM InstanceASM InstanceASM Instance
Starting an ASM instance using STARTUP commandStarting an ASM instance using STARTUP command
Mount the Disk Group as per ASM_DISKGROUPS settingMount the Disk Group as per ASM_DISKGROUPS setting
NOMOUNTNOMOUNT
MOUNT | OPENMOUNT | OPEN
Start the Instance but ignore ASM_DISKGROUPS settingStart the Instance but ignore ASM_DISKGROUPS setting
Perform SHUTDOWN ABORT to ASM before RestartingPerform SHUTDOWN ABORT to ASM before Restarting
Prevents DB instances connecting to the ASM instancePrevents DB instances connecting to the ASM instanceRESTRICTRESTRICT
FORCEFORCE
Shutting down and ASM instance using SHUTDOWN commandShutting down and ASM instance using SHUTDOWN commandASM instance wait until all SQL running in any connectedDB instance are complete before dismounting any Disk Group
ORA-15097 : Cannot SHUTDOWN ASM instance with Connected RDBMS instance
ASM instance wait until all SQL running in any connectedDB instance are complete before dismounting any Disk Group
ORA-15097 : Cannot SHUTDOWN ASM instance with Connected RDBMS instance
NORMALIMMEDIATE
TRANSACTIONAL
NORMALIMMEDIATE
TRANSACTIONAL
Shutdown ASM instance immediately without orderly Dismounting Disk Group. All connect DB instances also abortsShutdown ASM instance immediately without orderly Dismounting Disk Group. All connect DB instances also abortsABORTABORT
10g R210g R2
Data Softech Inc.Data Softech Inc. 17Oracle 10g ASM Oracle 10g ASM
ASM ASM ASM ASM ASM ASM ASM ASM Components Components Components Components Components Components Components Components –––––––– ASM InstanceASM InstanceASM InstanceASM InstanceASM InstanceASM InstanceASM InstanceASM Instance
$ sqlplus /nologSQL> connect / as sysdbaConnected to an Idle instanceSQL> startupASM instance started
Total System Global Area 79691776 bytesFixed Size 1247396 bytesVariable Size 53278556 bytesASM Cache 25165824 bytesASM diskgroups mounted
Data Softech Inc.Data Softech Inc. 18Oracle 10g ASM Oracle 10g ASM
� At least 600 K to LARGE_POOL_SIZE� At least 25 +15n to PROCESSES where n is no. of DB Instance
� Add the following Megabyte to SHARED_POOL_SIZE based on ASM mirroring and Total Database size
External Redundancy – ( dp_space / 100 +2 )Normal Redundancy – ( dp_space / 50 +4 )High Redundancy – ( dp_space / 33 +6 )
ASM ASM ASM ASM ASM ASM ASM ASM Components Components Components Components Components Components Components Components –––––––– DBDBDBDBDBDBDBDB InstanceInstanceInstanceInstanceInstanceInstanceInstanceInstance
NOTE : If you are using AMM, then ignore the above settings.
Data Softech Inc.Data Softech Inc. 19Oracle 10g ASM Oracle 10g ASM
ASM ASM ASM ASM ASM ASM ASM ASM Components Components Components Components Components Components Components Components –––––––– ASMASMASMASMASMASMASMASM InstanceInstanceInstanceInstanceInstanceInstanceInstanceInstance
ASM Instance init.ora parameters*.asm_diskgroups='DG_LOG','DG_DATA‘*.asm_diskstring=‘/dev/rdsk/c*’*.instance_type='asm‘*.asm_power_limit=1*.large_pool_size=12M*.remote_login_passwordfile='SHARED'*.user_dump_dest='/oracle/product/admin/+ASM/udump*.background_dump_dest='/oracle/product/admin/+ASM/bdump‘*.core_dump_dest='/oracle/product/admin/+ASM/cdump'
ASM Instance Binaries
� Use same ORACLE_HOME for ASM and DB Instance , if there is only one DB instance
� Use separate ORACLE_HOME for ASM instance if it supports severaldatabase instances
Data Softech Inc.Data Softech Inc. 20Oracle 10g ASM Oracle 10g ASM
ASM ASM ASM ASM ASM ASM ASM ASM Components Components Components Components Components Components Components Components –––––––– ASMASMASMASMASMASMASMASM & DB Instance& DB Instance& DB Instance& DB Instance& DB Instance& DB Instance& DB Instance& DB Instance
Three New Background Process for ASM instance
asm_rbal_+ASM -- Co-ordinate rebalance activity for Disk Groupasm_gmon_+ASM -- Disk Group Monitor Process asm_arb0_+ASM -- Perform Actual rebalance using Data extent
movement-- ARB0 – ARBa depending ASM_POWER_LIMIT setting
10g R210g R2
Two New Background Process for DB instance
ora_rbal_TEST -- performs global opens of the disk in the Disk groupsasm_asmb_TEST -- Connects to Foreground process in ASM instance to
receive periodic updates and verify that both ASM and DB instance are healthy.
Database instances are allowed to connect to only one ASM instance at a time and hence they have at most one ASMB process
Data Softech Inc.Data Softech Inc. 21Oracle 10g ASM Oracle 10g ASM
ASM ASM ASM ASM ASM ASM ASM ASM ComponentsComponentsComponentsComponentsComponentsComponentsComponentsComponents
� ASM Instance
�� ASM DiskASM Disk
� Disk Group
� Failure Group
� ASM Files
Data Softech Inc.Data Softech Inc. 22Oracle 10g ASM Oracle 10g ASM
ASM ASM ASM ASM ASM ASM ASM ASM Components Components Components Components Components Components Components Components –––––––– ASM DASM DASM DASM DASM DASM DASM DASM Disksisksisksisksisksisksisksisks� It is first task in ASM environment to discover and add Disks to ASM
management� In 10g Rel 2, Disk names are unique within Disk Group while in Rel 1 it
is unique within ASM instance.SQL> CREATE DISKGROUP data_dg1 EXTERNAL REDUNDANCY DISK
‘/dev/dsk/sdc4’,’/dev/dsk/sdd4’;SQL> SELECT name FROM v$asm_disk;
NameDATA_DG1_0000DATA_DG1_0001
Disk Selection for Disk Group� The disk must not have a pre-existing ASM header� The disk cannot have an Oracle File header� The disk is not already part of another Disk group
The above validation prevents ASM from destroying any The above validation prevents ASM from destroying any In use data deviceIn use data device
Adding Disks to Disk Groups� Check if disk is usable� Format the disk� Rebalance the Disk group ASM Disk ASM Disk ASM Disk
Disk Group
Data Softech Inc.Data Softech Inc. 23Oracle 10g ASM Oracle 10g ASM
ASM ASM ASM ASM ASM ASM ASM ASM Components Components Components Components Components Components Components Components –––––––– ASM DASM DASM DASM DASM DASM DASM DASM Disksisksisksisksisksisksisksisks
Means Disk is of Oracle Object but can only be added to disk group with FORCE keywordMeans Disk is of Oracle Object but can only be added to disk group with FORCE keyword
CANDIDATECANDIDATE
FOREIGNFOREIGN
Means Disk is available to be added to any disk groupMeans Disk is available to be added to any disk group
Same as CANDIDATE except that Disk is configured using ASMLIBSame as CANDIDATE except that Disk is configured using ASMLIB
Means Disk was formerly part of some disk groupMeans Disk was formerly part of some disk groupFORMERFORMER
PROVISIONEDPROVISIONED
Means Disk is already part of existing disk groupMeans Disk is already part of existing disk groupMEMBERMEMBER
Data Softech Inc.Data Softech Inc. 24Oracle 10g ASM Oracle 10g ASM
Disk or LUN
Access Units
ASM Disk
Database Files� AU are part of only one file� Span multiple ASM disks� A file can only exist in one ASM disk Group
ASM provides 2 levels of Striping� COARSE – 1 M, each AU is filled to 1M
� FINE – 128K are written to each 1M AU and so each AU has 8 pieces. Good for Logfiles
ASM ASM ASM ASM ASM ASM ASM ASM Components Components Components Components Components Components Components Components –––––––– ASM DASM DASM DASM DASM DASM DASM DASM DisksisksisksisksisksisksisksisksASM separate files into extent and divides the extent for each file evenly
across all of the disks
Disk Inputs
� Disks
� LUNS
� Partitions
Data Softech Inc.Data Softech Inc. 25Oracle 10g ASM Oracle 10g ASM
ASM ASM ASM ASM ASM ASM ASM ASM Components Components Components Components Components Components Components Components –––––––– ASM DASM DASM DASM DASM DASM DASM DASM Disks Configuration isks Configuration isks Configuration isks Configuration isks Configuration isks Configuration isks Configuration isks Configuration -------- SolarisSolarisSolarisSolarisSolarisSolarisSolarisSolaris
ASM with UNIX I/O:ASM with UNIX I/O:Tablespaces are created on raw character devices managed by ASM using standard Linux I/O routines.
# vi /etc/sysconfig/rawdevices/dev/raw/raw1 /dev/sdd1/dev/raw/raw2 /dev/sdd2/dev/raw/raw3 /dev/sdd3
# vi /etc/rc.d/rc.localchown oracle:dba /dev/raw/raw*chmod 660 /dev/raw/raw*
ASM with ASM with ASMLibASMLib I/O:I/O:Tablespaces are created on raw block devices managed by ASM using ASMLib. Download ASMLIB rpm at
http://www.oracle.com/technology/tech/linux/asmlib
# rpm -Uvh oracleasm-support-2.0.1-1.x86_64.rpm# rpm -Uvh oracleasm-2.6.9-22.0.1.ELsmp-2.0.1-1.x86_64.rpm# rpm -Uvh oracleasmlib-2.0.1-1.x86_64.rpm
Usage: /etc/init.d/oracleasm
{{start||stop||restart||enable||disable||configure||createdisk||deletedisk||querydisk||listdisks||scand
isks| | status}}# /etc/init.d/oracleasm createdisk VOL1 /dev/sdb2Marking disk "/dev/sdb2" as an ASM disk: [ OK ]
Data Softech Inc.Data Softech Inc. 26Oracle 10g ASM Oracle 10g ASM
ASM ASM ASM ASM ASM ASM ASM ASM Components Components Components Components Components Components Components Components –––––––– ASM DASM DASM DASM DASM DASM DASM DASM Disks Configuration isks Configuration isks Configuration isks Configuration isks Configuration isks Configuration isks Configuration isks Configuration -------- LinuxLinuxLinuxLinuxLinuxLinuxLinuxLinux
Configuring ASM DiskConfiguring ASM DiskCreate Partitions in Solaris and add them as disks in ASM Doc ID: 271621.1
# ls -lL c0t2d0s4crw-r----- 1 root sys 32, 20 Feb 24 07:14 c0t2d0s4
This shows that the major and minor device number for this slice is 32,20 respectively.The 'c' at the beginning shows that this is a character (raw) special file.
Let us create a directory to store these character special files:# mkdir asmdisk# cd asmdisk
usage: mknod name [ b/c major minor ] [ p ]# mknod disk1 c 32 20
# ls -lcrw-r--r-- 1 root other 32, 20 May 7 07:50 disk1
For this to be accessible to the ASM instance, we need to give oracle user permission to this file:# chown oracle:dba disk1crw-r--r-- 1 oracle dba 32, 20 May 7 07:50 disk1
asm_diskstring =‘/asmdisk/disk1’
# chown oracle:dba /dev/rdsk/c1t1d1s4# asm_diskstring =‘/dev/rdsk/c1t1d1s4’
Data Softech Inc.Data Softech Inc. 27Oracle 10g ASM Oracle 10g ASM
ASM ASM ASM ASM ASM ASM ASM ASM ComponentsComponentsComponentsComponentsComponentsComponentsComponentsComponents
� ASM Instance
� ASM Disk
�� Disk GroupDisk Group
� Failure Group
� ASM Files
Data Softech Inc.Data Softech Inc. 28Oracle 10g ASM Oracle 10g ASM
ASM ASM ASM ASM ASM ASM ASM ASM Components Components Components Components Components Components Components Components –––––––– ASM DASM DASM DASM DASM DASM DASM DASM Disk isk isk isk isk isk isk isk GGGGGGGGroupsroupsroupsroupsroupsroupsroupsroups
� It is collection of disks that can managed as logical unit.
� Easy to administer as number of Disk groups remains same while number of files and disks continually increases.
� After Disk group is created, metadata is stored in SGA on each disk header and include
� Creation data,
� Disk Group name and
� Redundancy type is stored in SGA and on each Disk header
� When you mount the Disk Group, ASM registers the following with CSS
� Disk Group name,
� Instance name
� Oracle Home Path
DB instance use the above information to build TNS string to connect to ASM Instance
� A disk group can contain files from different DB Instances which can be on same or reside on different servers
Data Softech Inc.Data Softech Inc. 29Oracle 10g ASM Oracle 10g ASM
ASM ASM ASM ASM ASM ASM ASM ASM Components Components Components Components Components Components Components Components –––––––– ASM DASM DASM DASM DASM DASM DASM DASM Disk isk isk isk isk isk isk isk GGGGGGGGroupsroupsroupsroupsroupsroupsroupsroups
Triple Mirroring Double Mirroring No Mirroring
Data Softech Inc.Data Softech Inc. 30Oracle 10g ASM Oracle 10g ASM
ASM ASM ASM ASM ASM ASM ASM ASM ComponentsComponentsComponentsComponentsComponentsComponentsComponentsComponents –––––––– ASM DASM DASM DASM DASM DASM DASM DASM Disk isk isk isk isk isk isk isk GGGGGGGGroups Creationroups Creationroups Creationroups Creationroups Creationroups Creationroups Creationroups Creation
DatabaseConfigurationAssistant
Oracle Universal Installer
Manual using SQL
SQL> CREATE DISKGROUP data_dg1 EXTERNAL REDUNDANCY
disk '/dev/raw/raw1','/dev/raw/raw2';
EnterpriseManager
Data Softech Inc.Data Softech Inc. 31Oracle 10g ASM Oracle 10g ASM
DDDDDDDDiskiskiskiskiskiskiskisk GGGGGGGGroup roup roup roup roup roup roup roup EEEEEEEExamplesxamplesxamplesxamplesxamplesxamplesxamplesxamples
Adding new disks to an existing ASM disk group. ALTER DISKGROUP data_dg1 ADD FAILGROUP ctlr3
DISK '/asmdisks/disk5' NAME dg_5 NOFORCE;
Resizing an ASM disk group. ALTER DISKGROUP data_dg1 RESIZE ALL SIZE 200M;
Resize all disks in a specific failure group ALTER DISKGROUP data_dg1 RESIZE DISKS IN FAILGROUP CTLR4 SIZE 48M;
Check all disks in a specific disk group; don't repair them -- even if a problem is foundALTER DISKGROUP data_dg1 CHECK ALL NOREPAIR;
Check a specific disk in a specific disk group, and repair the disk if neededALTER DISKGROUP data_dg1 CHECK DISK dg_5 ;
Manually rebalancing an ASM disk groupALTER DISKGROUP data_dg1 REBALANCE POWER 10;
Mounting and dismounting ASM disk groups ALTER DISKGROUP data_dg1 DISMOUNT; ALTER DISKGROUP data_dg1 MOUNT;
Drop just one disk ALTER DISKGROUP data_dg1 DROP DISK dg_5 ;
"Undrop" a recently-dropped disk ALTER DISKGROUP data_dg1 UNDROP DISK dg_5 ;
Data Softech Inc.Data Softech Inc. 32Oracle 10g ASM Oracle 10g ASM
TTTTTTTTablespace andablespace andablespace andablespace andablespace andablespace andablespace andablespace and DDDDDDDDiskiskiskiskiskiskiskisk GGGGGGGGrouprouprouprouprouprouprouproup
SQL> CREATE TABLESPACE indy_data DATAFILE '+DATA_DG1' size 100M ;
Set the parameter DB_CREATE_FILE_DEST to +DATA_DG1Examples: For the SID = DEVDB1
SQL> CREATE TABLESPACE indy_test_tblspc DATAFILE SIZE 100M ;+DATA_DG1/DEVDB1/datafile/indy_test_tblspc.299.121212129
SQL> CREATE TABLESPACE TEST100 DATAFILE '+DATADG1' size 100M ;
+DATA_DG1/DEVDB1/datafile/indy_test_tblspc.300.121212129
SQL> CREATE TEMPORARY TABLESPACE TEMP1 TEMPFILE '+DATADG1/DEVDB1/datafile/temp2.tst' size 100M ;
+DATA_DG1/DEVDB1/datafile/temp1.tst
Data Softech Inc.Data Softech Inc. 33Oracle 10g ASM Oracle 10g ASM
ASM ASM ASM ASM ASM ASM ASM ASM ComponentsComponentsComponentsComponentsComponentsComponentsComponentsComponents
� ASM Instance
� ASM Disk
� Disk Group
�� Failure GroupFailure Group
� ASM Files
Data Softech Inc.Data Softech Inc. 34Oracle 10g ASM Oracle 10g ASM
ASM ASM ASM ASM ASM ASM ASM ASM Components Components Components Components Components Components Components Components –––––––– ASM FASM FASM FASM FASM FASM FASM FASM Failure ailure ailure ailure ailure ailure ailure ailure GGGGGGGGroupsroupsroupsroupsroupsroupsroupsroups� ASM provides internal redundancy and high availability by way of Failure groups
� It is also collection of disk and is considered as subset of disk group.
� Disk group redundancy can be
� Normal – It is Two-way mirroring requiring at least two failure groups (default)
� High – It is high degree Three-way mirroring requiring at least three failure groups
� Once a Disk group is created, its redundancy cannot be changed. The only way to change he redundancy is to create new Disk group with required redundancy and move the datafiles on it using RMAN restore or using DBMS_FILE_TRANSFER
� ASM does not mirror disks but it mirror extents. When ASM allocates primary extent (first extent) of a file to one disk in DG, its mirror copy of that extent to another disk in DG
Triple Mirroring Double Mirroring No Mirroring
Data Softech Inc.Data Softech Inc. 35Oracle 10g ASM Oracle 10g ASM
ASM ASM ASM ASM ASM ASM ASM ASM ComponentsComponentsComponentsComponentsComponentsComponentsComponentsComponents
� ASM Instance
� ASM Disk
� Disk Group
� Failure Group
�� ASM FilesASM Files
Data Softech Inc.Data Softech Inc. 36Oracle 10g ASM Oracle 10g ASM
ASM FASM FASM FASM FASM FASM FASM FASM Filesilesilesilesilesilesilesiles -------- TTTTTTTTypesypesypesypesypesypesypesypes
Def Template FileType FileTypeTAG Def StripingDef Template FileType FileTypeTAG Def Striping
ARCHIVELOGARCHIVELOG
autobackupautobackup
BACKUPSETBACKUPSET
changetrackingchangetracking
CONTROLFILECONTROLFILE
drcdrc
DATAFILEDATAFILE
dumpsetdumpset
FLASHBACKFLASHBACK
online_logonline_log
PARAMETERFILEPARAMETERFILE
temptemp
XTRANSPORTXTRANSPORT
Thread_thread#_seq_seq#Thread_thread#_seq_seq#
COARSECOARSE
COARSECOARSE
COARSECOARSE
COARSECOARSE
FINEFINE
COARSECOARSE
archive_logarchive_log COARSECOARSE
AUTOBACKUPAUTOBACKUP Client SpecifiedClient Specified
Client SpecifiedClient Specifiedbackupsetbackupset COARSECOARSE
Current | BackupCurrent | Backupcontrolfilecontrolfile FINEFINE
<ts_name>_<file#><ts_name>_<file#>datafiledatafile COARSECOARSE
log_<log#>log_<log#>rlogrlog FINEFINE
spfilespfileinitinit COARSECOARSE
tsnametsname COARSECOARSE
ctfctf
Db_unique_nameDb_unique_name
User_obj#_file#User_obj#_file#
Group_<group#>Group_<group#>
<ts_name>_<file#><ts_name>_<file#>
Fully Qualified ASM Filename: By default ASM automatically generates filename in the following form +group/dbname/file_type/file_type_tag.file.incarnation
e.g. +ddg1/indydbn/controlfile/current.256.2195494
CHANGETRACKINGCHANGETRACKING
DATAGUARDCONFIGDATAGUARDCONFIG
DUMPSETDUMPSET
ONLINELOGONLINELOG
TEMPFILETEMPFILE
Data Softech Inc.Data Softech Inc. 37Oracle 10g ASM Oracle 10g ASM
ASMCMD ASMCMD ASMCMD ASMCMD ASMCMD ASMCMD ASMCMD ASMCMD –––––––– CCCCCCCCommandommandommandommandommandommandommandommand LLLLLLLLineineineineineineineine IIIIIIIInterfacenterfacenterfacenterfacenterfacenterfacenterfacenterface
$ export ORACLE_SID=+ASM$ asmcmd help
cd
rm
mkalias
pwd
ls
du
lsct
find
rmalias lsdg
Data Softech Inc.Data Softech Inc. 38Oracle 10g ASM Oracle 10g ASM
ASMCMD EASMCMD EASMCMD EASMCMD EASMCMD EASMCMD EASMCMD EASMCMD Examplesxamplesxamplesxamplesxamplesxamplesxamplesxamples$ export ORACLE_SID=+ASM$ asmcmdASMCMD> ls -ltrState Type Rebal Unbal NameMOUNTED EXTERN N N DG_DATA/ASMCMD> cd DG_DATAASMCMD> ls -ltrType Redund Striped Time Sys Name
Y DEVPROF/ASMCMD> cd DEVPROF
ASMCMD> ASMCMD> lsls --ltrltrType Redund Striped Time Sys Name
Y ARCHIVELOG/Y CONTROLFILE/Y DATAFILE/Y DUMPSET/Y ONLINELOG/Y PARAMETERFILE/Y TEMPFILE/
ASMCMD> ASMCMD> lsls --ltrltr CONGTROLFILECONGTROLFILEType Redund Striped Time Sys NameCONTROLFILE UNPROT FINE MAY 22 15:00:00 Y Current.1326.591118473CONTROLFILE UNPROT FINE MAY 22 15:00:00 Y Current.263.590674673CONTROLFILE UNPROT FINE MAY 22 15:00:00 Y Current.264.590674673
Data Softech Inc.Data Softech Inc. 39Oracle 10g ASM Oracle 10g ASM
ASM DASM DASM DASM DASM DASM DASM DASM Dictionaryictionaryictionaryictionaryictionaryictionaryictionaryictionary VVVVVVVViewsiewsiewsiewsiewsiewsiewsiews
ASM Views ASM Instance DB InstanceASM Views ASM Instance DB Instance
Row for each DB Instance using Disk group Managed by ASM instanceRow for each DB Instance using Disk group Managed by ASM instance
V$ASM_DISKGROUPV$ASM_DISKGROUP_STAT
V$ASM_DISKGROUPV$ASM_DISKGROUP_STAT
V$ASM_CLIENTV$ASM_CLIENT
Row for all Disk group discovered by the ASM instanceRow for all Disk group discovered by the ASM instance
Row for all disks discovered by ASM Instance even they are not part of any Disk group
Row for all disks discovered by ASM Instance even they are not part of any Disk group
Row for all ASM file available in all disk group like online log, archivedData files, control file etc
Row for all ASM file available in all disk group like online log, archivedData files, control file etc
V$_ASM_FILEV$_ASM_FILE
V$ASM_DISKV$ASM_DISK_STAT
V$ASM_DISKV$ASM_DISK_STAT
Row for each Disk Group used by DB InstanceRow for each Disk Group used by DB Instance
Row for all disk group mounted or dismountedRow for all disk group mounted or dismounted
Row for disks in the disk group in use by DB instance Row for disks in the disk group in use by DB instance
No rowsNo rows
Row for every active ASM long running Operation in an ASM instanceRow for every active ASM long running Operation in an ASM instanceV$_ASM_OPERATIONV$_ASM_OPERATION No rowsNo rows
Row for every alias present in all mounted Disk groupRow for every alias present in all mounted Disk groupV$_ASM_ALIASV$_ASM_ALIAS No rowsNo rows
Data Softech Inc.Data Softech Inc. 40Oracle 10g ASM Oracle 10g ASM
File System to ASM MigrationFile System to ASM MigrationFile System to ASM MigrationFile System to ASM MigrationFile System to ASM MigrationFile System to ASM MigrationFile System to ASM MigrationFile System to ASM Migration
� Using EM
� Using RMAN Manually
� Using DBMS_FILE_TRANSFER
� Using XMLDB
Data Softech Inc.Data Softech Inc. 41Oracle 10g ASM Oracle 10g ASM
File System to ASM MigrationFile System to ASM MigrationFile System to ASM MigrationFile System to ASM MigrationFile System to ASM MigrationFile System to ASM MigrationFile System to ASM MigrationFile System to ASM Migration
�� Using EMUsing EM
� Using RMAN Manually
� Using DBMS_FILE_TRANSFER
� Using XMLDB
Data Softech Inc.Data Softech Inc. 42Oracle 10g ASM Oracle 10g ASM
MMMMMMMMoving from oving from oving from oving from oving from oving from oving from oving from FFFFFFFFileileileileileileileile SSSSSSSSystem toystem toystem toystem toystem toystem toystem toystem to ASM ASM ASM ASM ASM ASM ASM ASM -------- EMEMEMEMEMEMEMEM
� It uses RMAN for the movement
� Job is scheduled using DBMS_SCHEDULER
Data Softech Inc.Data Softech Inc. 43Oracle 10g ASM Oracle 10g ASM
File System to ASM MigrationFile System to ASM MigrationFile System to ASM MigrationFile System to ASM MigrationFile System to ASM MigrationFile System to ASM MigrationFile System to ASM MigrationFile System to ASM Migration
� Using EM
�� Using RMAN ManuallyUsing RMAN Manually
� Using DBMS_FILE_TRANSFER
� Using XMLDB
Data Softech Inc.Data Softech Inc. 44Oracle 10g ASM Oracle 10g ASM
MMMMMMMMoving from oving from oving from oving from oving from oving from oving from oving from FFFFFFFFileileileileileileileile SSSSSSSSystem toystem toystem toystem toystem toystem toystem toystem to ASM ASM ASM ASM ASM ASM ASM ASM -------- MMMMMMMMANUALANUALANUALANUALANUALANUALANUALANUAL
Database Migration
� Create an ASM instance
� Create the Required Disk Groups
� Setup OMF parameters
� Perform RMAN steps
� Backup as copy database format ‘+DiskGroup’
� Switch Database to copy
� Recreate Temp files
� Drop and recreate Online Redo log groups to ASM
Tablespace Migration� Take tablespace offline� Backup copy of tablespace to ASM
using RMAN� Switch the Tablespace to ASM
using RMAN� Bring the Tablespace online
SPFILE Migration� Create PFILE� Create SPFILE in required
disk Group� Edit $OH/dbs/init+ASM.ora
and add SPFILE=dg_pathspecified in step 2
Data Softech Inc.Data Softech Inc. 45Oracle 10g ASM Oracle 10g ASM
File System to ASM MigrationFile System to ASM MigrationFile System to ASM MigrationFile System to ASM MigrationFile System to ASM MigrationFile System to ASM MigrationFile System to ASM MigrationFile System to ASM Migration
� Using EM
� Using RMAN Manually
�� Using DBMS_FILE_TRANSFERUsing DBMS_FILE_TRANSFER
� Using XMLDB
Data Softech Inc.Data Softech Inc. 46Oracle 10g ASM Oracle 10g ASM
DBMS_FILE_TRANSFERDBMS_FILE_TRANSFERDBMS_FILE_TRANSFERDBMS_FILE_TRANSFERDBMS_FILE_TRANSFERDBMS_FILE_TRANSFERDBMS_FILE_TRANSFERDBMS_FILE_TRANSFER andandandandandandandand ASMASMASMASMASMASMASMASM
File System ASM DiskDBMS_FILE_TRANSFER
File System to ASM
ASM Disk File SystemDBMS_FILE_TRANSFER
ASM to File System
10g R210g R2
10g R210g R2
ASM Disk ASM DiskDBMS_FILE_TRANSFER
ASM to ASM
COPY_FILE - Read Local File and copy it to new location on local system
GET_FILE - Contact Remote DB to read Remote file and copy it to Local system
PUT_FILE - Read Local File and contact Remote DB to copy it to remote system
Note : This operation can be performed directly without having to convert the datafileIt will only be used for Database files like Datafile, tempfiles,controlfiles etc
COPY_FILE - Read Local File and copy it to new location on local system
GET_FILE - Contact Remote DB to read Remote file and copy it to Local system
PUT_FILE - Read Local File and contact Remote DB to copy it to remote system
Note : This operation can be performed directly without having to convert the datafileIt will only be used for Database files like Datafile, tempfiles,controlfiles etc
Data Softech Inc.Data Softech Inc. 47Oracle 10g ASM Oracle 10g ASM
DBMS_FILE_TRANSFER ExampleDBMS_FILE_TRANSFER ExampleDBMS_FILE_TRANSFER ExampleDBMS_FILE_TRANSFER ExampleDBMS_FILE_TRANSFER ExampleDBMS_FILE_TRANSFER ExampleDBMS_FILE_TRANSFER ExampleDBMS_FILE_TRANSFER ExampleSQL> CREATE DIRECTORY NonASM AS '/export/home/oracle/data' ;Directory created.
SQL> CREATE DIRECTORY ASM_D AS as '+DATAD_G1/DEVPROF' ;Directory created.
SQL> begin 2 DBMS_FILE_TRANSFER.COPY_FILE(3 source_directory_object => ‘ASM_D' ,4 source_file_name => 'spfiledevprof.ora' , 5 destination_directory_object => ‘NonASM' ,6 destination_file_name => 'spfileDEV.ora');7 end ;8 /
PL/SQL procedure successfully completed.
Data Softech Inc.Data Softech Inc. 48Oracle 10g ASM Oracle 10g ASM
File System to ASM MigrationFile System to ASM MigrationFile System to ASM MigrationFile System to ASM MigrationFile System to ASM MigrationFile System to ASM MigrationFile System to ASM MigrationFile System to ASM Migration
� Using EM
� Using RMAN Manually
� Using DBMS_FILE_TRANSFER
�� Using XMLDBUsing XMLDB
Data Softech Inc.Data Softech Inc. 49Oracle 10g ASM Oracle 10g ASM
ASM ASM and and XMLDBXMLDBSQL> CREATE DIRECTORY test_asm as ‘+DG_DATA’;
SQL> GRANT READ,WRITE ON DIRECTORY test_asm TO indy;
$ expdp indy/indy DUMPFILE=test_asm:indy.dmp nologfile=y ….
$ export ORACLE_SID=+ASM
$ asmcmd
ASMCMD> cd DG_DATA
ASMCMD> ls
prof.dmp=>+DG_DATA/DEVPROF/DUMPSET/PROFNETSYS_EXPORT_TABLE_01_54652_1.1332.59266069
SQL> select dbms_xdb.cfg_get "xdbconfig.xsd" from dual;SQL>declare
newconfig XMLType;begin--ftp port setting
select updatexml(dbms_xdb.cfg_get(),'/xdbconfig/sysconfig/protocolconfig/ftpconfig/ftp-port/text()',6010)
into newconfig from dual;dbms_xdb.cfg_update(newconfig);--http port setting
select updatexml(dbms_xdb.cfg_get(),'/xdbconfig/sysconfig/protocolconfig/httpconfig/http-
port/text()',6020) into newconfig from dual;dbms_xdb.cfg_update(newconfig);
end;
Data Softech Inc.Data Softech Inc. 50Oracle 10g ASM Oracle 10g ASM
ASM ASM ASM ASM ASM ASM ASM ASM and and and and and and and and XMLDBXMLDBXMLDBXMLDBXMLDBXMLDBXMLDBXMLDB
$ ftp indy.prnewswire.com 6010Name (indy.prnewswire.com:oracle): systemPassword:FTP> cd sys/asm/DG_DATAFTP> binaryFTP> get prof.dmpLocal : prof.dmp remote: prof.dmp250 BIN Data Connection336 BIN Transfer CompleteFTP> quit
� Cannot logon as SYS to view /sys/asm
� Need DBA privileges to view /sys/asm
� Cannot put regular files under /sys/asm
Data Softech Inc.Data Softech Inc. 51Oracle 10g ASM Oracle 10g ASM
EM Home Page ..EM Home Page ..EM Home Page ..EM Home Page ..EM Home Page ..EM Home Page ..EM Home Page ..EM Home Page ..
Data Softech Inc.Data Softech Inc. 52Oracle 10g ASM Oracle 10g ASM
EM Home Page ..EM Home Page ..EM Home Page ..EM Home Page ..EM Home Page ..EM Home Page ..EM Home Page ..EM Home Page ..
Data Softech Inc.Data Softech Inc. 53Oracle 10g ASM Oracle 10g ASM
EM Home Page ..EM Home Page ..EM Home Page ..EM Home Page ..EM Home Page ..EM Home Page ..EM Home Page ..EM Home Page ..
Data Softech Inc.Data Softech Inc. 54Oracle 10g ASM Oracle 10g ASM
EM Home Page ..EM Home Page ..EM Home Page ..EM Home Page ..EM Home Page ..EM Home Page ..EM Home Page ..EM Home Page ..
Data Softech Inc.Data Softech Inc. 55Oracle 10g ASM Oracle 10g ASM
EM Monitoring MetricsEM Monitoring MetricsEM Monitoring MetricsEM Monitoring MetricsEM Monitoring MetricsEM Monitoring MetricsEM Monitoring MetricsEM Monitoring Metrics
Data Softech Inc.Data Softech Inc. 56Oracle 10g ASM Oracle 10g ASM
Final Thoughts Final Thoughts Final Thoughts Final Thoughts Final Thoughts Final Thoughts Final Thoughts Final Thoughts …………………………………………........� Go with Oracle 10g Release 2 on production for ASM environment
� Work on the following for backup as well data files movement
� RMAN
� XMLDB
� DBMS_FTP_TRANSFER
� You need ASM on Standby ( Physical ) location, if the Primary database is using ASM
� If you are on Linux, then use ASMLIB with ASM
Data Softech Inc.Data Softech Inc. 57Oracle 10g ASM Oracle 10g ASM
MMiscisc. T. Tipsips #1#1
� Oracle ASM webpage: http://www.oracle.com/technology/products/database/asm/index.html
� Upgrade ASM using Metalink 329987.1
� Re-creating ASM Instances and Diskgroups Doc ID: Note:268481.1
� How To Reclaim Asm Disk Space? Doc ID: Note:351866.1
� How to Re-configure Asm Disk Group? Doc ID: Note:331661.1
� How to Move Asm Database Files From one Diskgroup To Another ? Doc ID: Note:330103.1
� “Tuning Oracle Database 10g on Linux Using ASM”, Bert Scalzo, 2006, http://www.oracle.com/technology/oramag/webcolumns/2003/techarticles/scalzo_asm.html
� “Oracle Database 10g Release 2 Automated Storage Management Overview and Technical Best Practices”, Nitin Vengurlekar, Oracle Corporation 2005
Data Softech Inc.Data Softech Inc. 58Oracle 10g ASM Oracle 10g ASM
MMiscisc. T. Tipsips #2#2
ASM MetadataASM Metadata
� It is stored in all ASM Disks header and contain information� Disk group name� Physical size of all Disks in the Disk Group� Allocation Unit (AU) Size� Disk Own Size� Failure Group� Name of Disk� Creation Date� Redundancy Type
� Metadata is also stored as ASM file on ASM disks. These Files are internal to data and has file_number less than 256. This is the reason when creating Database on ASM have SYSTEM datafile as file_number as 256 and onwards
� Metadata is always mirrored across three disk ( if Available) even you are choosing EXTERNAL REDUNDACY.
� Metadata is also stored in SGA of Database Instance copied by ASMB
Q U E S T I O N S
A N S W E R S
Data Softech Inc.Data Softech Inc. 60Oracle 10g ASM Oracle 10g ASM
THANKSTHANKSTHANKSTHANKSTHANKSTHANKSTHANKSTHANKS
Recommended