Search This Blog

Total Pageviews

Saturday, 31 March 2018

Oracle CREATE ASM DISKGROUP manually in 11gR2/12C

Oracle CREATE ASM DISKGROUP manually in 11gR2/12C


Create ASM DiskGroup ....!!!!


Node 1

#ls -ltr  /dev/mapper/
lrwxrwxrwx 1 root root       8 Mar 29 10:01 ora_fra_0003p1 -> ../dm-29
lrwxrwxrwx 1 root root       8 Mar 29 10:01 ora_acfs_0001 -> ../dm-43

#oracleasm createdisk -v ORA_0001 /dev/mapper/ora_acfs_0001


# oracleasm listdisks
DATA_0000
FRA_0000
GRID_0000
ORA_0001  <<<<<< New disk 


ls -alrt /dev/oracleasm/disks/ORA*

scan and list 
# date ; hostname;  oracleasm scandisks ; for d in `oracleasm listdisks | sort`; do oracleasm querydisk -p $d; done

Node2
#oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Cleaning disk "ORA_0001"
Scanning system for ASM disks...

#oracleasm listdisks
DATA_0000
FRA_0000
GRID_0000
ORA_0001  <<<<<< New disk 



Node3
#oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Cleaning disk "ORA_0001"
Scanning system for ASM disks...

#oracleasm listdisks
DATA_0000
FRA_0000
GRID_0000
ORA_0001  <<<<<< New disk 




-- for  Candidate disk !!!


ASMCMD [+] > lsdsk --candidate -p
Group_Num  Disk_Num      Incarn  Mount_Stat  Header_Stat  Mode_Stat  State   Path



set echo off feedback 6 heading on linesize 200 pagesize 300 termout on timing off trimout  on trimspool on  verify  off
clear columns breaks computes
column disk_group_name        format a12           head 'disk group name'
column disk_file_path         format a45           head 'path'
column disk_file_name         format a12           head 'file name'
column disk_file_fail_group   format a12           head 'fail group'
column total_mb               format 999,999,999   head 'file size (mb)'
column used_mb                format 999,999,999   head 'used size (mb)'
column pct_used               format 999.99        head 'pct. used'
break on report on disk_group_name skip 1
compute sum label ""              of total_mb used_mb on disk_group_name
compute sum label "grand total: " of total_mb used_mb on report
SELECT
   NVL(a.name, '[CANDIDATE]')                       disk_group_name
 , b.path                                           disk_file_path
 , b.name                                           disk_file_name
 , b.failgroup                                      disk_file_fail_group
 , b.total_mb                                       total_mb
 , (b.total_mb - b.free_mb)                         used_mb
-- , ROUND((1- (b.free_mb / b.total_mb))*100, 2)    pct_used
FROM v$asm_diskgroup a ,v$asm_disk b 
where a.group_number (+) =b.group_number 
ORDER BY a.name;




Disk Group N Path                                          File Name    Fail Group   File Size (MB) Used Size (MB)
------------ --------------------------------------------- ------------ ------------ -------------- --------------
************
[candidate]  /dev/oracleasm/disks/ORA_0001                                                        0              0
************                                                                         -------------- --------------
                                                                                                  0              0


SQL> CREATE DISKGROUP ORAFS EXTERNAL REDUNDANCY disk '/dev/oracleasm/disks/ORA_0001';


Check the disk group ...

[grid]$ asmcmd -p
ASMCMD [+] > lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  1048576     51200    51150                0           51150              0             N  ORAFS/


ASMCMD [+] > ls -l +         <<<< for DiskGroup !!!

ASMCMD [+] > lsdsk -t -G DATA

Create_Date  Mount_Date  Repair_Timer  Path
01-FEB-18    01-FEB-18   0             ORCL:DATA0
01-FEB-18    01-FEB-18   0             ORCL:DATA1
01-FEB-18    01-FEB-18   0             ORCL:DATA2
01-FEB-18    01-FEB-18   0             ORCL:DATA3



set echo off feedback 6 heading on linesize 200 pagesize 300 termout on timing off trimout  on
set trimspool on  verify  off
clear columns breaks computes
column disk_group_name        format a12           head 'disk group name'
column disk_file_path         format a45           head 'path'
column disk_file_name         format a12           head 'file name'
column disk_file_fail_group   format a12           head 'fail group'
column total_mb               format 999,999,999   head 'file size (mb)'
column used_mb                format 999,999,999   head 'used size (mb)'
column pct_used               format 999.99        head 'pct. used'
break on report on disk_group_name skip 1
compute sum label ""              of total_mb used_mb on disk_group_name
compute sum label "grand total: " of total_mb used_mb on report
SELECT
   NVL(a.name, '[CANDIDATE]')                       disk_group_name
 , b.path                                           disk_file_path
 , b.name                                           disk_file_name
 , b.failgroup                                      disk_file_fail_group
 , b.total_mb                                       total_mb
 , (b.total_mb - b.free_mb)                         used_mb
 , ROUND((1- (b.free_mb / b.total_mb))*100, 2)      pct_used
FROM v$asm_diskgroup a ,v$asm_disk b 
where a.group_number (+) =b.group_number 
ORDER BY a.name;





*********************************************************************

Imp ......

On all the Nodes mount the DiskGroup !!!!!!!!!!!!!!!!!!!!!

SQL>  alter diskgroup ORAFS mount ;

Diskgroup altered.

ASMCMD [+] > lsdg -g     <<<<<<<< check for all node 
*********************************************************************


If Required .. 

sqlplus> alter diskgroup ORACFS set attribute 'compatible.asm'='11.2.0.0.0'; 



set linesize 200 
col compatibility          form a15
col database_compatibility form a25
col name                   form a20
select group_number, name, compatibility, database_compatibility from v$asm_diskgroup;



set linesize 200  pagesize 300
col value for a10
col name  for a50
select group_number, name, value from v$asm_attribute
where 1=1
and group_number=1
;

GROUP_NUMBER NAME                                               VALUE
------------ -------------------------------------------------- ----------
           1 idp.type                                           dynamic
           1 idp.boundary                                       auto
           1 disk_repair_time                                   3.6h




 asmcmd lsattr -G DATA -l
Name                     Value
access_control.enabled   FALSE
access_control.umask     066
au_size                  1048576
cell.smart_scan_capable  FALSE
compatible.asm           12.1.0.0.0
compatible.rdbms         10.1.0.0.0
content.check            FALSE
content.type             data
disk_repair_time         3.6h
failgroup_repair_time    24.0h
idp.boundary             auto
idp.type                 dynamic
phys_meta_replicated     true
sector_size              512
thin_provisioned         FALSE




[grid@rac01 ~]$ asmcmd -p

ASMCMD [+] > lsattr -G DATA -l
Name                     Value
access_control.enabled   FALSE
access_control.umask     066
au_size                  1048576
cell.smart_scan_capable  FALSE
compatible.asm           12.1.0.0.0
compatible.rdbms         10.1.0.0.0
content.check            FALSE
content.type             data
disk_repair_time         3.6h
failgroup_repair_time    24.0h
idp.boundary             auto
idp.type                 dynamic
phys_meta_replicated     true
sector_size              512

thin_provisioned         FALSE


=====





set pagesize 0

select
'GROUP_NUMBER            : '||GROUP_NUMBER  ||chr(10)||
'NAME            : '||NAME    ||chr(10)||
'SECTOR_SIZE            : '||SECTOR_SIZE    ||chr(10)||
'BLOCK_SIZE            : '||BLOCK_SIZE    ||chr(10)||
'ALLOCATION_UNIT_SIZE      : '||ALLOCATION_UNIT_SIZE    ||chr(10)||
'STATE              : '||STATE    ||chr(10)||
'TYPE          : '||TYPE ||chr(10)||
'TOTAL_MB              : '||TOTAL_MB      ||chr(10)||
'FREE_MB      : '||FREE_MB ||chr(10)||
'HOT_USED_MB          : '||HOT_USED_MB    ||chr(10)||
'COLD_USED_MB    : '||COLD_USED_MB            ||chr(10)||
'REQUIRED_MIRROR_FREE_MB  : '||REQUIRED_MIRROR_FREE_MB  ||chr(10)||
'USABLE_FILE_MB    : '||USABLE_FILE_MB  ||chr(10)||
'OFFLINE_DISKS              : '||OFFLINE_DISKS    ||chr(10)||
'COMPATIBILITY            : '||COMPATIBILITY    ||chr(10)||
'DATABASE_COMPATIBILITY         : '||DATABASE_COMPATIBILITY     ||chr(10)||
'VOTING_FILES            : '||VOTING_FILES
from  v$asm_diskgroup
where 1=1
order by 1
;

set pagesize 100



7 comments:

Anuj Singh said...

ALTER DISKGROUP ORAFS SET ATTRIBUTE 'compatible.asm' = '11.2.0.4', 'compatible.rdbms' = '11.2.0.4', 'compatible.advm' = '11.2.0.4';

or
ASMCMD [+] > setattr -G ORAFS compatible.advm 11.2.0.4

Anuj Singh said...




set linesize 200 pagesize 200
col disk_gp for a10
col fileid for a100
select tablespace_name,substr(file_name, 1, instr(file_name, '/',+2)) disk_gp , listagg(file_id, ',') within group (order by file_id) as fileid
from dba_data_files
group by tablespace_name,substr(file_name, 1, instr(file_name, '/',+2))
order by 1;

Anuj Singh said...


set pages 10 feedback off
select listagg (name, ' ') within group (order by name) "DiskGroupNamefrom" from v$asm_diskgroup;

Anuj Singh said...

set pages 10 feedback off
select listagg ('+'||name, ' ') within group (order by name) "DiskGroupNamefrom" from v$asm_diskgroup;

Anuj Singh said...

How To Gather & Backup ASM/ACFS Metadata In A Formatted Manner version 10.1, 10.2, 11.1, 11.2, 12.1 and 12.2? (Doc ID 470211.1)

Anuj Singh said...

http://anuj-singh.blogspot.com/2011/09/oracle-asm-disk-report.html

Anuj Singh said...



http://anuj-singh.blogspot.com/2011/09/oracle-asm-disk-report.html

Oracle DBA

anuj blog Archive