Tuesday, June 30, 2015

ASM Setup, Configuration, Steps to create disk groups and commands used.

1. What is ASM  Oracle ASM is a volume manager which provides a special file system designed especially for oracle db.  Replaces conventional file systems and volume managers  Capacity on demand  Add/drop disks online  Automatic I/O load balancing  Stripes data across disks to balance load  Automatic mirroring  Easy to set up and use  Works with SAN, NAS or file systems 2. What ASM does  Stripe & mirror data across multiple disks  Reduces management overhead  Provides 0, 2 or 3-way mirroring  Can store almost all types of database related files* 3. What ASM does not do.  Not an I/O broker or controller – I/O is still managed by the individual instances  Not a database – INSTANCE_TYPE=‘asm’  Acts as the mediator and definer  Not foolproof, luns can be removed out from under ASM! 4. ASM Setup  Install in own Oracle Home  Determine redundancy/mirroring  Determine LUN/Disk size  Partition devices  Install ASM software and start the “mini-cluster” 5. The “mini-cluster”  The Oracle Cluster Synchronization Services Daemon is required for ASM – even for a single (non-RAC) database  Used for communication between ASM and database instances  Root.sh will create an entry in /etc/inittab to respawn cssd  Only one ASM instance per node 6. init+ASM.ora *.asm_diskgroups=‘DATA' *.asm_diskstring='ORCL:*‘ -- linux *.asm_diskstring=‘/dev/asm_disk*’ -- unix *.asm_diskstring=‘/dev/c0t1d1*’ – unix *.asm_diskstring=‘/dev/sda1’ *.instance_type='asm' *.processes=500 - Set to minimum of 25 + 15 * number of databases uses ASM for storage 7. Diskgroups  Diskgroups are the logical storage units for ASM  One or more for all databases on a server or cluster  Often, two diskgroups are created, one for tablespace and another for FRA  Diskgroups may also be created by SAN speed (fast, middle, slow) 8. Redundancy ASM supports three types of redundancy  External – no mirroring within ASM, all at the OS level  Normal – the default – two way mirroring, each stripe is written to two extents  High – three way mirroring – each stripe written to one primary and two mirrored extents 9. Failgroups  Failgroups cannot be removed without recreating the diskgroup.  If one failgroup is lost or offline for a period of time, it will be re-synced when available again  Fail groups should be across different controllers or SANs\ 10. Tools to Manage ASM  SQL*Plus  ASMCMD  Grid Control / Database Control  SRVCTL – RAC only 11. Basic ASM Commands  Create a diskgroup: CREATE DISKGROUP dgroup1 DISK ’orcl:vol001’,’orcl:vol002’;  Drop a diskgroup DROP DISKGROUP dgroup1;  To drop a diskgroup which still contains data: DROP DISKGROUP dgroup1 INCLUDING CONTENTS;  Add luns to a diskgroup: ALTER DISKGROUP dgroup1 ADD DISK ‘orcl:vol006’;  Remove luns from a diskgroup: ALTER DISKGROUP dgroup1 REMOVE DISK ‘vol006’;  Do both at the same time: ALTER DISKGROUP dgroup1 ADD DISK 'ORCL:VOL003','ORCL:VOL004' DROP DISK 'VOL005' REBALANCE POWER 6; 12. Rebalancing  Redistribution only occurs when adding or dropping disk  Change the asm_power_limit, default 1, 0 up to 11  To modify the power limit for a disk group: alter diskgroup dgroup1 rebalance power 11;  Check on the status via V$ASM_OPERATION 13. Basic ASM Commands – Database level  Set for default diskgroup db_create_file_dest=‘+DGROUP1’  Create tablespaces without names using OMF CREATE TABLESPACE testts DATAFILE SIZE 5g; ALTER TABLESPACE testts ADD DATAFILE SIZE 10g;  Set for default diskgroup for logfiles: db_create_online_log_dest_1=‘+DGROUP1’ db_create_online_log_dest_2=‘+DGROUP1’  Create redo logs without names using OMF ALTER SYSTEM ADD LOGFILE SIZE 200m; 14. ASM Limitations  If ASM goes down, all instance that use ASM will immediately crash.  Normal or high redundancy may not show the actual disk use  Databases can remain unnoticed if not dropped  Loss of a disk (when using external redundancy) will result in the loss of the diskgroup 15. New ASM Features in 11gR2  ASM part of the clusterware  ACFS  ASMCA, ASMCMD  RAC - OCR/Voting disks in ASM  Diskgroup rename 16. How ASM Improves performance When you enter COMMIT, the information/data is written to REDOLOG files from REDOBUFFER. If redolog files is removed and then if we enter commit, as per oracle test it should not get completed but practically It will get completed ,coz commit goes through file system buffer ,also it depends on the operating system Read ahead and write delay is the basic concept of information technology architecture by itself. When you try to read the information from dba files to buffer cache….bunch of blocks will get pulled I to buffer cache..multi block read count is the parameter which is influencing how to read from block mechanism .. And when you save it, it goes to file system buffer to buffer cache. File system buffer will work like a shock absorber. It will work in there…till the file system buffer gets full; once the buffer is full the information will be written back to the appropriate files. File system buffer works great if the size of the amount is small like redo log file and control log files...for huge amount of data file system buffer may not be the solution.. For big size data. RAW partition is the solution. In case of raw partition .you keep the datafile on raw partition…raw partition will not use file system buffer, because it is not formatted as file system, operating system has no clue on managing raw partition. Oracle can manage raw partition .Information directly comes from raw partition to buffer cache and when you write it directly goes to raw partition. Because the amount of data I huge in size. Reading and writing directly from the raw partition will boost the IO performance than any other file system Note: CRD files much be in the shared storage. ASM is the replacement for volume manager. What volume manager can do, can be done by ASM without any extra cost…volume manager crated volume group in case of ASM we create disk group. ASM will use raw partition only. You can say a combination of raw disk and omf. Performance of raw disk and ease of use of omf. CRD FILES can be stored in (control files, redo log files and data files) 1. Cooked file system 2. Oracle managed files. (ease to use) 3. RAW Partitions (will boost the IO performance by 10 to 15 % by default ) Oracle files can be stored either in a file system, raw device, asm or in ocfs Earlier oracle had to use either a filer system or a raw device. Things might become a little slow when it is using file system as it has to go through its file system buffering. On the other hand oracle was not able l to keep multiple files in the raw device like a file system would allow. The solution: Write your own volume manager and your own file system, ORACLE created its own storage solution called ASM 17. Steps to create disk group for database using ASM Step 1: export ORACLE_SID = +ASM Step 2: vi init+ASM.ora Add the below variables. instance_type=asm Step 3: mkdir c:/asmdisks Step 4: asmtool -create /u01d/asmdisks/asmdisks1.asm 300 asmtool -create /u01d/asmdisks/asmdisks2.asm 300 Step 5: asmtool -create /u01d/asmdisks/asmdisks3.asm 300 Step 6: Add the below valu es init+ASM.ora ASM_DISKSTRING = ‘C:\asmdisk\*’ _ASM_ALLOW_ONLY_RAW_DISKS=FALSE Now we have to add two parameter in init+ASM.ora ASM_DISKSTRING = ‘C:\asmdisk\*’ //WHEN ASM START this parameter says to use the files which are in this directory .,to store the db that you manages. _ASM_ALLOW_ONLY_RAW_DISKS=FALSE // UNDOCUMENTED PARAMETER ..SHOULD BE USED ALONG WITH ORACLE SUPPORT ..ALL UNDOCUMENTED PROCEDURE HAS UNDERSCORE . by default asm uses only raw logical volume disk for storage ..by giving this parameter we are tricking asm …to tell asm to use files that we created . Step 7: export ORACLE_SID=+ASM Step 8: qlplus / as sysdba Step 9: startup now you can see no diskgroups mounted, It says no disk group mounted… coz we did not tell asm which disk group to be used. before oracle can manages the asm ..it need be in a disk group . Disk partition should belong to a disk group . Step 10: SQL> select path,mount_status from v$asm_disk; The staus of .asm file will be closed, this is they are not mounted. Step 11 : create diskgroup dgroup1 normal redundancy disk '/u01d/asmdisk/asmdisk1.asm', '/u01d/asmdisks/amsdisk2.asm'; Step 12: shutdown; Step 13: startup; AGain you can see no disk group mounted. Step 14: vi init+ASM.ora Add the below value. ASM_DISKGROUS='dgroup1' Step 15: sqlplus / as sysdsba startup; you can see ASM diskgroup mounted. Step 16: select name,state,total_mb from v$asm_diskgroup; Step 17: select name,state,path from v$asm_disk; 18. ORACLE ASM Instance. ORACLE has its own LVM now called ASM Which is nothing but an instance called ASM instance .which runs on the same server or operating system where db run.bascially it creates disk groups. It doesn’t matter where it comes from …you have to just choose the disk and create the disk groups in ASM .and use it for your db. Oracle asm has performance benefits. Will allow you to spread the load out and mirror data. Below are the other options to store your data file, control file, online redo log files Normal File Systems like Windows ntfs Aix jfs 2 Unix ufs Solaris zfs Hp veritise Linux ext3 ext4 Etc .this is easier to mange. Other options is to create datafiles etc inraw logical volume with out any file system on them (with out any cooked file system) This is more difficult to maintain …but possible 2nd option if you are not using ASM

No comments:

Post a Comment