Showing posts with label Oracle ASM. Show all posts
Showing posts with label Oracle ASM. Show all posts

Sunday, August 16, 2020

Oracle ASMCMD commands

 

Oracle ASMCMD commands


Introduction


Oracle ASMCMD commands used in linux in command line utility


$export ORACLE_SID=+ASM

$cd $ORACLE_HOME/bin

$asmcmd

ASMCMD>exit


The asmcmd utility "-p" option used in it will display the current path 


$asmcmd -p

ASMCMD[+]>cd FLASH

ASMCMD[+FLASH]>



cd command is used to changes to a specific directory


ASMCMD [+diskgroup2/crm] >cd+diskgroup1/hrms

ASMCMD[+diskgroup1/hrms]> cd DATAFILE

ASMCMD[+diskgroup1/hrms/DATAFILE]>cd..

ASMCMD[+]>cd +diskgroup1/sample/C*



pwd command is used for absolute path for current directory


ASMCMD>pwd


help command is used to display all the lists of the ASMCMD commands and general information on ASCMD utility


ASMCMD>help

ASMCMD>help lsct

ASMCMD>?

ASMCMD> ? mkgrp


du command is used to display the total space in the files and directories 


ASMCMD[+diskgroup1/prod]>du

Used_MB   Mirror_Used_MB

1300                3200



Find Command is used to display the absolute path of all occurances of the specified name pattern  wild cards can also be used in specified directories and its subdirectories


ASMCMD>find +diskgroup1 undo *

+diskgroup1/crm/DATAFILE/UNDOTBS1.347.4444421853

+diskgroup1/crm/DATAFILE/UNDOTBS1.361.4461812843


ASMCMD>find -t CONTROLFILE +diskgroup_data/hrms *

+diskgroup_data/hrms/CONTROLFILE/Current.150.44421274

+diskgroup_data/hrms/CONTROLFILE/Current.151.44421764


ASMCMD[+]>find--type CONTROLFILE +data/devdb *

+data/devdb/CONTROLFILE/Current.150.582466152



ls commands is used to display the list of contents of an ASM directory


ASMCMD[+diskgroup1/sample/DATAFILE]>ls

SYSAUX .346.666621122

SYSTEM.345.666621122

UNDOTBS1.347.66621123

UNDOTBS1.365.666211239

USERS.369.66621123

EXAMPLE.349.66662


how many databases are using an ASM instance 


ASMCMD[+DG1_FRA]>lsct

DB_NAME Status Software_version Compatible_version  instance_Name

DEV CONNECTED  10.2.0.1.0         10.2.0.1.0                                      DEV

TEST CONNECTED 10.2.0.1.0          10.2.0.1.0                                      TEST



mkdir is used to create the ASM directories under current Directory


ASMCMD[+diskgroup1]> mkdir subd1 subd2



rm command used to delete the specified ASM files and directories


ASMCMD[+diskgroup1/sample/DATAFILE]>rm alias382.f

ASMCMD>rm -rf +dg/orcl/DATAFILE

ASMCMD>rm -rf fradg/*


chown command is used changes the owner of a file or list of files


ASMCMD[+fra/orcl/archivelog/flashback]>chown asmdba1:asm_fra log_8.153.576541269

ASMCMD>chown oracle1:asm_users+data/hrms/controlfile/current.164.543781436


mount command will used to mount the specific diskgroups one or more diskgroups


ASMCMD[+]> mount -f data

ASMCMD[+]> mount --restrict data

ASMCMD[+]>mount -a


unmount command will be used dismount the specified diskgroup


dismounted all the diskgroups mounted in the oracle ASM instance

ASMCMD[+] unmount -a


force the dismount of the data in diskgroup

ASMCMD[+] unmount -f data


SQL equivalent for unmount command as

sql>ALTER DISKGROUP  diskgroup_name DISMOUNT;



ASMCMD> lsdg

ASMCMD>lsdg -g

ASMCMD>lsct

ASMCMD>lsattr -G DATA

ASMCMD>lsattr -G DATA -1

exit

sqlplus /as sysasm

sql> alter diskgroup



Note: Info on OracleASMCMD commands it may differ from your environment like production,testing,dev,and naming conventions directories


THANKS FOR VIEWING MY BLOG FOR MORE UPDATES FOLLOW ME 


 





Saturday, August 15, 2020

Oracle ASM Commands

 

Oracle ASM Commands


ASM SQL * Plus commands



Start the ASM instance


$ export ORACLE_SID=+ASM

$ sqlplus '/as sysdba'


sql>startup


ASM instance started



Stop the ASM instance


$export ORACLE_SID=+ASM

$sqlplus '/as sysdba'

shutdown immediate



Adding Diskgroup


sql>create diskgroup oradg  external redundancy disk 'ORCL:VOL5';


Diskgroup created

sql>select  group_number,disk_number,mode_status,name from v$asm_disk;


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;



Drop a Diskgroup


Disk groups can be deleted using the DROP DISKGROUP statement


DROP DISKGROUP disk_group_1 INCLUDING CONTENTS;



Adding disks to existing groups


Disks can be added or removed from disk groups using the ALTER DISKGROUP statement


wild cards can be used to reference disks resulting strings does not match a disk already used by an existing disk group


Add disk


ALTER DISKGROUP disk_group_1 ADD DISK


'/devices/disk*3'

'/devices/disk*4';


Drop a Disk


ALTER DISKGROUP disk_group_1 DROP DISK diska2;


Resizing Disks


Disks can be resized using the RESIZE clause of the ALTER DISKGROUP statement .the statement can be used to resize individul disks ,all data in a failure group or all 


disks in the disk group ,if the SIZE class is ommitted the disks are resized to the size of the disk returned by the os


Resize a specif disk


ALTER DISKGROUP disk_group_1

RESIZE DISK diska1 SIZE 200G;



Resize all disks in a failure group


ALTER DISKGROUP disk_group_1

RESIZE DISKS IN FAILGROUP failure_group_1 SIZE 200G;



Resize all disks in a diskgroup


ALTER DISKGROUP disk_group_1

RESIZE ALL SIZE 200G;


Manually Mounting asm diskgroups


Manually Disk groups are mounted at  ASM instance startup and unmounted at ASM instance shutdown ,mounting and dismounting will be done using ALTER DISKGROUP statement


ALTER DISKGROUP ALL DISMOUNT;

ALTER DISKGROUP ALL MOUNT;

ALTER DISKGROUP disk_group_1 DISMOUNT;

ALTER DISKGROUP disk_group_1 MOUNT;



Drop file inside ASM


Files are not deleted automatically they created by using alias names as they are not OMF(Oracle managed files)

when ever a recovery happens point of time before the file was created  for this scenearios manullay deleted the file


Drop file using an alias


ALTER DISKGROUP disk_group_1 DROP FILE '+disk_group_1/my_dir/my_file.dbf';


Drop file using a numeric from  filename


ALTER DISKGROUP disk_group_1 DROP FILE '+disk_group_1.245.3';


Drop file using a fully qualified file name


ALTER DISKGROUP disk_group_1 DROP FILE'+disk_group_1/mydb/datafile/my_cs.369.3';



Checking Metadata


Check metadata for a specific file


ALTER DISKGROUP disk_group_1 CHECK FILE '+disk_group_1/my_dir/my_file.dbf';




Check metadata for a specific failure group in the disk group


ALTER DISKGROUP disk_group_1 CHECK FAILGROUP failure_group_1;



Check metadata for a specific disk in the disk group


ALTER DISKGROUP disk_group_1 CHECK DISK diska1;


Check metadata for asll disks in the diskgroup


ALTER DISKGROUP disk_group_1 CHECK ALL;



Rebalancing


Rebalancing speed is controlled by the ASM_POWER_LIMIT initialization parameter setting to 0 will disable disk rebalancing


ALTER DISKGROUP data REBALANCE POWER 12 WAIT;




Converting a database to ASM


Ensure the database is using SPFILE and not PFILE (it about time after all)set parameters on the target database


for eg :if we set both DB_CREATE_FILE_DEST and DB_RECOVERY_FILE_DEST  we should get mirrored control files and duplexed log files by default


sql> alter system set DB_CREATE_FILE_DEST='+DATA'

sql>alter system set DB_RECOVERY_FILE_DEST_SIZE= 20G;

sql>alter system set DB_RECOVERY_FILE_DEST='+RECOVER';

sql>alter system set CONTROL_FILES='+DATA';


start the database in NOMOUNT mode and restore the control file into the new location from the old location


RMAN>connect target/

RMAN> STARTUP NOMOUNT;

RMAN>RESTORE CONTROLFILE FROM 'old_control_file_name';



Mount the database and copy the database into the ASM disk group;


RMAN>ALTER DATABASE MOUNT;

RMAN> CONFIGURE DEVICE TYPE DISK PARALLESISM 6;

RMAN>BACKUP AS COPY  DATABASE FORMAT '+DATA';


Switch all datafiles to the new ASM location and open the database


RMAN>SWITCH DATABASE TO COPY;

RMAN>ALTER DATABASE OPEN;


Add new tempfiles and drop the old tempfiles


sql>alter tablespace temp add tempfile;

sql>alter database tempfile '-' DROP;

sql>select * from dba_temp_files;


optionally move SPFILE into ASM


sql>CREATE SPFILE '+DATA' FROM PFILE;


Move redo log files into ASM for each group


sql>ALTER DATABASE DROP LOGFILE GROUP 1;

sql>ALTER DATABASE ADD LOGFILE GROUP 1 SIZE 200M;


logfile is active and cannot be dropped issue an aaALTER DATABASE SWITCH LOGFILE ; command and try again



Convert a tablespace to ASM


ensure the database is in archive log mode and from rman


connect target;

sql "alter tablespace TSNAME offline";

backup as copy tablespace TSNAME to copy;

sql "alter tablespace TSNAME online";

exit;



Convert a datafile to ASM

ensure the database is in archive log mode and from rman


connect target;


sql "alter database datafile '--' offline";

backup as copy datafile'-- 'format '+DATA';   

switch datafile '--' to copy;

sql "alter database datafile '--' 'online";

exit;


Create new tablespace on ASM


CREATE TABLESPACE my_ts DATAFILE '+disk_group_1'SIZE 200M AUTOEXTEND ON;

  



Note :Info on  Oracle asm commands it may be differ from your environment prod,test,dev


THANKS FOR VIEWING MY BLOG FOR MORE UPDATES FOLLOW ME



 






Oracle ASM Background process

 Oracle ASM Background process


Introduction


Like Database we have background processes like SMON,PMON,DBWR,CKPT and LGWR similarly our ASM have some background processThe Background process starts while instance started in NoMount stage


1)RBAL : RBAL runs in both database and ASM instances.In the database instance,it does a global open of ASM disks,in an ASM instance,it also  coordinates rebalance activity for disk groups .RBAL(Rebalance),The primary function of this background process is to open all disks listed under  each disk group and to make them available to the various clients .Apart from this RBAL back ground process also creates a rebalance plan to move extents,between the disks when a disk is added to the disk group or removed from a existing disk groups 


2)ARBn: The ARBn performs the actual rebalance data extent movement in aan automatic  storage management instance,there can be many of these process running at a time ,named,ARB0,ARB1and so on .


3)ASMB: ASMB runs in a database instance that is using an ASM disk group,ASMB communicates with the ASM instance managing storage and providing statastics ,ASMB can also runs in the ASM Instances ,ASMB runs in ASM instances when the ASMCMD Commands runs or when the database Instance first starts in the spfile is stored in the ASM instance


4)GMON: GMON maintains disks membership in ASM disk group, the process is responsible for managing the disk level activities  (drop/off -line) and advancing disk group compatibility


5)MARK: The MARK allocation unit (AU) for resync coordinator ,MARK processes coordinates  the updates to the registry,when the disks go offline,this process runs in the RDBMS instance and is started only when disks go off-line in ASM redundancy disk groups


6)Onnn: One or more slave process forming a pool of connections to the ASM instance for exchanging message


7)PZ9x: these processes slave processes where  xis a number ,used in  fetching data on behalf of GV$queries


8)VKTM: This VKTM process is used the fast timer and has the same functionality in the RDBMS instances



Background process search in UNIX


ps-ef |grep asm



THANKS FOR VIEWING MY BLOG FOR MORE UPDATES FOLLOW ME 


Friday, August 14, 2020

Oracle ASM

 

Oracle ASM

Introduction:


Oracle introduced ASM (Automatic storage management) with 10 g version ,ASM is a logical volume Manager owned by oracle and it helps to create logical volumes on physical disks to store the database and its components and  it widely used in Real Application Cluster,ASM is built on OMF,ASM acts as a buit in oracle volume manager by handling striping and mirroring functions ,previously managed by third party tools,is a Poratable volume manager to manage pool of shared disks,ASM is an instance not a database will have separate SGA and set of bg process.

Raw Devices


OCFS2 ----->Orcale clusterd File system


ASM------->Automatic Storage Management


is a part grid of infrastructure software in 10g ,we have separate home for ASM installed from 11g, one single home for clusterware and ASM with grid infra home


eg : /u01/app/11.2.0/grid

     /u01/app/12.2.0/grid


Manages oracle data files (eg:DATA) spreads data across disks for faster performance and work load balance 


Note: Oracle recommends to manage with  minimum 4 disks for each disk group,supports online disks reconfiguration and rebalancing provides adjustable rebalncing speed,for every node,we have ASM instance default installed while grid software

rac1 --->+ASM1

rac2---->+ASM2


ps -ef |grep pmon


To view the information in grid will usse performance views with gv$


gv$session

gv$process

gv$instance

gv$database


for finding information on every instance using global/grid views


number of nodes -4

 node-1

 node-2

 node-3

 node-4


Number of ASM Instances :4(eg: +ASM1,+ASM2,+ASM3,+ASM4)

Number of ASM Instance on each node :1(eg: on rac1,+ASM1)

Number of RDBMS Instances :3  prod,dev.test

Number of RDBMS Instances on each node :3(prod1,dev1,test1)

Each database number of instance on 4 node? 4

eg:2dbs,each db has 4 instances if 4 nodes

prod(DB)-->prod1,prod2,prod3,prod4(Instances)

Test(DB)--->test1,test2,test3,test4


eg:


3 databases in a cluster


rac1----> +ASM1,prod1,dev1,test1

rac2---->+ASM2,prod2,dev2,test2


sql>select inst_id,instance_number,host_name,status from gv$instance;


grid infrastructure

clusterware|ASM

cluster--clusterware

storage--ASM--automatic storage management


Linux/oradata-->dbfiles--->managed linux os--->notshared--->single instance accessed


rac1

rac2

rac3

rac4

access-->shared storage across multiple nodes/server with in a cluster


asmdisk1,asmdisk2 -disk1,disk2--drivers--asmdrivers--boot/list

p1

p2

p3

p4

p5

one more cluster -it own his shared storage ASM is a volume manager to manage pool of disks 

using logical storage unit as disk group associated with one or more physical disks


two disk groups


DATA--->dbfiles,redo,controfile,spfile,ocr,vote

FRA---->archives,backupsets


min 4 disks avail for each disk group


DATA---->asmdisk1,asmdisk2,asmdisk3(3 dsiks)can add more

FRA ----->asmdisk4,asmdisk5(2 disks)


online---->add disk without downtime spreads data across disks forfatsre performance can be rebalanced by adding disks/removing disks


ASM is an instance,not a database on everynode,default one ASM instance runs/starts on a clusterware startup


connect and verify the instances status of every node with in a cluster from any one single instance using gv$instance


select inst_id,instance_name,instance_number,status from gv$instance;


number of rdbms instances on 4 nodes


rac1-->prod1,dev1,test1

rac2--->prod2,dev2,test2

rac3--->prod3,dev3,test3

rac4--->prod4,dev4,test4


including ASM -->overall on a 4 node cluster with 3 database 3 rdbms*4 nodes=12 inst+4 ASM=16 instances

 


Log in to asm


Tools 

asmca - configuration assistant

ascmd - command line


$asmcmd

mkdir

cp

ls

mv

du


xhost +

su - oracle

.grid_env

$asmca


create diskgroups/add disks/drop disks

mount diskgroups/Dismount diskgroup/local


Oracle recommends to manage with min three diskgroups


DATA - datafiles,redo,control,ocr,voting disk

FRA - fast recovery area - rman,archives,flashback logs,redo

,control files

Each diskgroup may have one or more disks


Brief few views in ASM


v$asm_file

v$asm_diskgroups

V$asm_disks

v$asm_operation

v$asm_disk_stat

v$asm_client


sql>select hot_used_mb,cold_used_mb,free_mb,total_mb,name,label,path from v$asm_disk;


sqlplus '/as sysasm'


SQL> SELECT name, free_mb, total_mb, free_mb/total_mb*100 as percentage FROM v$asm_diskgroup;


How to configure ASM diskstring to discover the disks while boot?


sql>alter system set asm_diskstring='/dev/oracleasm/disks/*' sid='*' scope=spfile;

Note: sid='*'  to apply in every instance with in a cluster.



SQL> alter system set asm_diskgroups=DATA sid='*';


Mounting diskgroups in ASM


sql>alter diskgroup all mount;

ASM - DiskGroups



set wrap off

set lines 155 pages 9999

col "Group Name" for a6    Head "Group|Name"

col "Disk Name"  for a10

col "State"      for a10

col "Type"       for a10   Head "Diskgroup|Redundancy"

col "Total GB"   for 9,990 Head "Total|GB"

col "Free GB"    for 9,990 Head "Free|GB"

col "Imbalance"  for 99.9  Head "Percent|Imbalance"

col "Variance"   for 99.9  Head "Percent|Disk Size|Variance"

col "MinFree"    for 99.9  Head "Minimum|Percent|Free"

col "MaxFree"    for 99.9  Head "Maximum|Percent|Free"

col "DiskCnt"    for 9999  Head "Disk|Count"

 

prompt

prompt ASM Disk Groups

prompt ===============

 

SELECT g.group_number  "Group"

,      g.name          "Group Name"

,      g.state         "State"

,      g.type          "Type"

,      g.total_mb/1024 "Total GB"

,      g.free_mb/1024  "Free GB"

,      100*(max((d.total_mb-d.free_mb)/d.total_mb)-min((d.total_mb-d.free_mb)/d.total_mb))/max((d.total_mb-d.free_mb)/d.total_mb) "Imbalance"

,      100*(max(d.total_mb)-min(d.total_mb))/max(d.total_mb) "Variance"

,      100*(min(d.free_mb/d.total_mb)) "MinFree"

,      100*(max(d.free_mb/d.total_mb)) "MaxFree"

,      count(*)        "DiskCnt"

FROM v$asm_disk d, v$asm_diskgroup g

WHERE d.group_number = g.group_number and

d.group_number <> 0 and

d.state = 'NORMAL' and

d.mount_status = 'CACHED'

GROUP BY g.group_number, g.name, g.state, g.type, g.total_mb, g.free_mb

ORDER BY 1

/

------------------------------------------------------

ASM - Disk in Use

-----------------------------------------------

prompt ASM Disks In Use

prompt ================

 

col "Group"          for 999

col "Disk"           for 999

col "Header"         for a9

col "Mode"           for a8

col "State"          for a8

col "Created"        for a10          Head "Added To|Diskgroup"

--col "Redundancy"     for a10

--col "Failure Group"  for a10  Head "Failure|Group"

col "Path"           for a19

--col "ReadTime"       for 999999990    Head "Read Time|seconds"

--col "WriteTime"      for 999999990    Head "Write Time|seconds"

--col "BytesRead"      for 999990.00    Head "GigaBytes|Read"

--col "BytesWrite"     for 999990.00    Head "GigaBytes|Written"

col "SecsPerRead"    for 9.000        Head "Seconds|PerRead"

col "SecsPerWrite"   for 9.000        Head "Seconds|PerWrite"

 

select group_number  "Group"

,      disk_number   "Disk"

,      header_status "Header"

,      mode_status   "Mode"

,      state         "State"

,      create_date   "Created"

--,      redundancy    "Redundancy"

,      total_mb/1024 "Total GB"

,      free_mb/1024  "Free GB"

,      name          "Disk Name"

--,      failgroup     "Failure Group"

,      path          "Path"

--,      read_time     "ReadTime"

--,      write_time    "WriteTime"

--,      bytes_read/1073741824    "BytesRead"

--,      bytes_written/1073741824 "BytesWrite"

,      read_time/reads "SecsPerRead"

,      write_time/writes "SecsPerWrite"

from   v$asm_disk_stat

where header_status not in ('FORMER','CANDIDATE','PROVISIONED')

order by group_number

,        disk_number

/

------------------------------------------------------

ASM - File Types in Diskgroups

-----------------------------------------------


Prompt File Types in Diskgroups

Prompt ========================

col "File Type"      for a16

col "Block Size"     for a5    Head "Block|Size"

col "Gb"             for 9990.00

col "Files"          for 99990

break on "Group Name" skip 1 nodup

 

select g.name                                   "Group Name"

,      f.TYPE                                   "File Type"

,      f.BLOCK_SIZE/1024||'k'                   "Block Size"

,      f.STRIPED

,        count(*)                               "Files"

,      round(sum(f.BYTES)/(1024*1024*1024),2)   "Gb"

from   v$asm_file f,v$asm_diskgroup g

where  f.group_number=g.group_number

group by g.name,f.TYPE,f.BLOCK_SIZE,f.STRIPED

order by 1,2;


------------------------------------------------------

ASM - Instances currently accessing these diskgroups

------------------------------------------------------

prompt Instances currently accessing these diskgroups

prompt ==============================================

col "Instance" form a8

select c.group_number  "Group"

,      g.name          "Group Name"

,      c.instance_name "Instance"

from   v$asm_client c

,      v$asm_diskgroup g

where  g.group_number=c.group_number


------------------------------------------------------

ASM - Assigned ASM disks and their paths

------------------------------------------------------


prompt Assigned ASM disks and their paths

prompt ==============================

col "Disk Size"    form a9

select header_status                   "Header"

, mode_status                     "Mode"

, path                            "Path"

, lpad(round(os_mb/1024),7)||'Gb' "Disk Size"

from   v$asm_disk

where header_status in ('MEMBER')

order by path


------------------------------------------------------

ASM - Free ASM disks and their paths

------------------------------------------------------


prompt Free ASM disks and their paths

prompt ==============================

col "Disk Size"    form a9

select header_status                   "Header"

, mode_status                     "Mode"

, path                            "Path"

, lpad(round(os_mb/1024),7)||'Gb' "Disk Size"

from   v$asm_disk

where header_status in ('PROVISIONED','FORMER')

order by path

/

------------------------------------------------------

ASM -  ASM disks and their paths

------------------------------------------------------


prompt  ASM disks and their paths

prompt ==============================

col "Disk Size"    form a9

select header_status                   "Header"

, mode_status                     "Mode"

, path                            "Path"

, lpad(round(os_mb/1024),7)||'Gb' "Disk Size"

from   v$asm_disk

where header_status in ('MEMBER','PROVISIONED','CANDIDATE','FORMER')

order by path

/

------------------------------------------------------

ASM - Current ASM disk operations

------------------------------------------------------


prompt Current ASM disk operations

prompt ===========================

select *

from   v$asm_operation

/


views

-----

v$asm_operation

v$asm_disks

v$asm_diskgroups

v$asm_file

v$asm_client

v$asm_disk_stats



-- Check ASM diskgroup built on raw devices

set pages 50000 lines 120

col path for a15

select a.path,b.NAME from v$asm_disk a, v$asm_diskgroup b

where a.GROUP_NUMBER=b.GROUP_NUMBER and

a.path like '%raw%' ;


--check how the different disks of the diskgroups are utilized

select

        instname,

        dbname,

        group_number,

        failgroup,

        disk_number,

        reads,

        writes

from v$asm_disk_iostat

order by 1,2,3,4,5,6

/

set pages 50000 lines 120

col path for a30

select disk_number,

mount_status,

header_status,

mode_status,

state,path

from v$asm_disk ;


set pages 50000 lines 120

select path,redundancy,total_mb,free_mb,failgroup from v$asm_disk where mount_status='CACHED' and header_status='MEMBER' and mode_status='ONLINE' and state='NORMAL'order by path;


Note : to mount diskgroup - use


sql>alter diskgroup all mount;


or specific diskgroup.

list from v$asm_diskgroup(name,state)

then

sql>alter diskgroup DATA mount;


Note: For ASM Instance , Will start and mount the diskgroups.

No DB will open or there in ASM.

gv$instance (instance_name,status)


using asmca - asm configuration assistant

To create diskgroup/adding/removing disks.


#xhost + 

$su - oracle

$. grid_env

$asmca


Click on tab ( disk group)

-> Create/mount/dismount


Diskgroup Name : FRA

External

Choose - Disk2

AU - 4

Versions - 11.2.0.0.0

Ok


-? Adding disks : 

righ click on diskgroup

then

choose - add disk.

Note : in FRA - fast recovery area

holds - backup sets,redo,control

archivelogs.

oracle recommends to manage with min two asm diskgroups.

DATA - to hold datafiles

FRA - 


For every diskgroup , recommend with min 4 disks

for better performance with best practice.

with Allocation Unit (AU) - 4mb(best)

is a fundamental unit in which contiguous disk space is

allocated to asm files.

default - 1 , can have 2,4,8,16,32,64


To dismount - Diskgroups

-----------------------------

right click - dismount on local node

      or

      Dismount on all nodes

Dropping a diskgroup

-------------------------

right click - drop diskgroup


Creating Diskgroup

------------------

sql>CREATE DISKGROUP fra EXTERNAL REDUNDANCY  DISK 'ORCL:DISK2';

sql>select name,state from v$asm_diskgroup;

SQL> alter diskgroup FRA dismount;

sql>select name,state from v$asm_diskgroup;

SQL> alter diskgroup FRA mount;

sql>select name,state from v$asm_diskgroup;

SQL> DROP DISKGROUP FRA INCLUDING CONTENTS;


Mounting/Unmounting disk group.

--------------------

SQL>alter diskgroup FRA mount;

SQL>alter diskgroup FRA dismount;

sql>alter diskgroup all mount;

sql>alter diskgroup all dismount;


Dropping Diskgroup:

-------------------------

SQL> DROP DISKGROUP FRA INCLUDING CONTENTS;


Add Disk 2

--------------

sql>CREATE DISKGROUP OCRvote  EXTERNAL REDUNDANCY  DISK 'ORCL:DISK2';

sql>ALTER DISKGROUP DATA ADD DISK 'ORCL:DISK2';

sql>select * from v$asm_operation; (on another terminal - monitor)


-- Drop a disk. if two disks are there

sql>ALTER DISKGROUP DATA DROP DISK DISK2;

sql>select * from v$asm_operation;


With wait - using runtime rebalance

--------------------------------

ALTER DISKGROUP DATA ADD DISK

      'ORCL:DISK2'

       REBALANCE POWER 2 WAIT;


How to check consistency for metadata for all disks ?

ALTER DISKGROUP DATA CHECK ALL;


Drop Diskgroup using force.

---------------------------

If unable to mount ,use force

SQL> DROP DISKGROUP OCRVOTE FORCE;


ALTER DISKGROUP DATA ADD DISK

'/devices/diska5' NAME diska5,

'/devices/diska6' NAME diska6,

'/devices/diska7' NAME diska7,

'/devices/diska8' NAME diska8;

=========================================

Creating of Diskgroup with Normal redundancy


CREATE DISKGROUP DATA NORMAL REDUNDANCY

   FAILGROUP fg1 DISK '/devices/diskg1'

   FAILGROUP fg2 DISK '/devices/diskg2'

   QUORUM FAILGROUP fg3 DISK '/devices/diskg3'

   ATTRIBUTE 'compatible.asm' = '11.2.0.0.0';


ALTER DISKGROUP data1 ADD DISK

      '/devices/diskd*'

       REBALANCE POWER 5 WAIT;


Explain With or with out rebalance operation while adding disk?


With out -


With option - then it runs with rebalance 5 and does not return until the rebalance operation is complete.

----------------------------------------------------------

The size support by Type of redundancy

Each Diskgroup supports - size.

------------------------------

External - Supports up to 140PB from 11.1

           till 10.1 - 16TB

Normal -   11.1 -? 23PB

           10.1 -? 5.8TB

High   -  11.1 -? 15PB

           10.1 -? 3.9TB 


ASM_POwer_limit supports up to 1024 

--------------------------------------------------


ASM Commands - interactive mode.

-----------

$asmcmd


chdg Changes a disk group (add, drop, or rebalance).

chkdg Checks or repairs a disk group.

dropdg Drops a disk group.

iostat - Displays I/O statistics for disks.

lsattr - Lists the attributes of a disk group.

lsdg - Lists disk groups and their information.

lsdsk - Lists disks Oracle ASM disks.

lsod - Lists open devices.


md_backup - Creates a backup of the metadata of mounted disk groups.

md_restore - Restores disk groups from a backup of the metadata.

mkdg - Creates a disk group.

mount - Mounts a disk group.


The attribute can be set with SQL, ASMCMD, or ASMCA.


Brief few views to find information in ASM


v$asm_disk - Disk Utilization

v$asm_diskgroup

v$asm_client

v$asm_file

v$asm_disk_stat

v$asm_operation - For finding rebalacing status while add/remove disks


Tasks - ASM

-----------

Adding Diskgroup

Adding Disk to a Diskgroup

Dropping Disk

Dropping Diskgroup

Monitoring rebalancing operation

mounting/dismounting - diskgroups

ASM Instance - start/stop/status - using srvctl / sqlplus


Oracle recommends to manage with min two diskgroups.

DATA - to store datafiles,spfile,ocr/voting. ( while cluster install)

FRA - to store controlfiles,redo,archives,backupsets

OCRVOTE - to store ocr/vote if multiplexing.



asmca 

asmcmd


Changing parameter in cluster nodes

use sid='*' to effect/change in all nodes of a cluster.


NON ASM to ASM

RAC Files 


----------------------------------

For Deinstalling - DB

Bring up cluster on all nodes  - verify status

su - oracle

. db_env

cd $ORACLE_HOME/deinstall

./deinstall

Accept the inputs...done.

---------------------------------

NOn asm - to ASM

deinstall Database

Bring down cluster services,crs

On rac1 , 

su - oracle

. db_env

/database/

./runInstaller

here choose file system(not asm)

dbname - prod

/oradata

sqlplus '/as sysdba'

shutdown immediate

----------------------------

ASM 

instance


. grid_env

export ORACLE_HOME=/u01/app/11.2.0/grid/bin

export ORACLE_SID=+ASM1


Tools

----

asmca - configuration assistant - create diskgroups/drop / add disks/drop disks/mount/unmount

asmcmd - command line interpreter to manage files/diskgroups


ASM Views - brief information of ASM file/disks/diskgroups/status

----------------------------------------------------------

v$asm_file

v$asm_diskgroups

V$asm_disks

v$asm_operation

v$asm_disk_stat

v$asm_client


ASM - Tasks


Monitor the usage of the diskgroup 

Allocate disks to the diskgroup

Monitor rebalancing activity when disk was added/removed

List of diskgroups

list of files in diskgroup and its usage

diskgroup status - mounted/unmounted/online

Disks Provisioned/former/member - online/offline - status



Note: info on oracle ASM it my be differ from your environment production,development,testing 


THANKS FOR VIEWING MY BLOG FOR MORE UPDATES FOLLOW ME






ITIL Process

ITIL Process Introduction In this Blog i am going to explain  ITIL Process, ITIL stands for Information Technology Infrastructure Library ...