SAINORA

HomeBlogsASM

ASM

groupadd oinstall

groupadd dba

groupadd oper

useradd -g oinstall -G dba oracle

passwd oracle


mkdir -p /u01/app/oracle/product/10.2.0/db_1

chown -R oracle:oinstall /u01


ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE

ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME

ORACLE_SID=TSH1; export ORACLE_SID

ORACLE_TERM=xterm; export ORACLE_TERM

PATH=/usr/sbin:$PATH; export PATH

PATH=$ORACLE_HOME/bin:$PATH; export PATH


LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH

CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

 

/etc/udev/rules.d/60-raw.rules

 

ACTION=="add", KERNEL=="sdb1", RUN+="/bin/raw /dev/raw/raw1 %N"

ACTION=="add", KERNEL=="sdc1", RUN+="/bin/raw /dev/raw/raw2 %N"

ACTION=="add", KERNEL=="sdd1", RUN+="/bin/raw /dev/raw/raw3 %N"

 

ACTION=="add", KERNEL=="raw*", OWNER=="oracle", GROUP=="oinstall", MODE=="0660"

 

$ /bin/raw /dev/raw/raw1 /dev/sdb1

$ /bin/raw /dev/raw/raw2 /dev/sdc1

$ /bin/raw /dev/raw/raw3 /dev/sdd1

 

 

# raw -qa

# oracleasm configure
# oracleasm createdisk vol1 /dev/sdb1

 

ASM registers its name with database instance using CSS(Cluster syncronization service)

Stripping

There are two type os stripping

1. coarse 
The size is 1 mb and is mainly configured for datafile, archivelog files.
2. fine
the size is 128k and is mainy used for redo logfiles, controlfiles.

 

Mirroring

Three way of mirroring

1. External - unprotected
2. Normal - 2 way mirroring
3. High - 3 way mirroring

 

 

----------------------------------------------------------------------
Advantages of ASM:

- Automatic load balancing
- Prevents fragmentation
- Free to implement(No license)
- Uses striping and mirroring

Files that are managed by ASM

control file
data files
online redolog files
archived log files
spfile
rman backup
datapump files
Flash Recovery Area

 

Files that are not managed by ASM
trace files
oracle software
initfile
password file

ASM Processes

at asm instance
RBAL  rebalance master - Does rebalance when disk is added or removed.
ARB0 to ARB9  - RBAL's job is actually done by these slaves.
at database instance
GMON - Diskgroup monitor
PSPx - Process Spawners

ASMB -  which communicates between database and ASM instances.
Provides heart beat and ASm statistics
RBAL -  Open and Closes ASM instance

 

 

 

-------------------------------------------------------------------------------------------
ASM parameters

asm_diskstring = '/dev/raw/raw1', '/dev/raw/raw2', '/dev/raw/raw3', '/dev/raw/raw4'
asm_diskgroups = 'DG1'
background_dump_dest='/u01/app/admin/+ASM/bdump'
core_dump_dest='/u01/app/admin/+ASM/cdump'
instance_type='asm'
large_pool_size=20M
asm_power_limit=3

user_dump_dest='/u01/app/admin/+ASM/udump'
remote_login_passwordfile='SHARED'

 

Default values

processes                                integer             40
db_cache_size                         big integer 24M
sga_max_size                          big integer 80M
shared_pool_size                    big integer 40M

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

SQL> startup nomount
ORA-29701: unable to connect to Cluster Manager

Solution :

[root@asmhost bin]# ./localconfig add

 

SQL> startup nomount
ASM instance started

Total System Global Area   83886080 bytes
Fixed Size                    1217836 bytes
Variable Size          57502420 bytes
ASM Cache              25165824 bytes
SQL>

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

[oracle@asmhost ~]$ asmcmd
ORA-12162: TNS:net service name is incorrectly specified (DBD ERROR: OCIServerAttach)

set ORACLE_SID

[oracle@asmhost ~]$ export ORACLE_SID=+ASM
[oracle@asmhost ~]$ asmcmd
ASMCMD>
-------------------------------------------------------------

Renaming datafile location in ASM.

SQL> select name  from v$datafile;

NAME
--------------------------------------------------------------------------------
+DG1/sss/datafile/system.257.794414075
+DG1/sss/datafile/undotbs.264.794414085
+DG1/sss/datafile/sysaux.263.794414087
+DG1/sss/datafile/t1.dbf
+DG1/sss/datafile/t2.259.794414253
+DG1/sss/datafile/ddd.dbf

 alter tablespace test offline; -- where datafiles of tablespace test is need to be renamed.
or
alter datafile '+DG1/sss/datafile/ddd.dbf' offline;

 

Use Rman to copy the file from one asm location to another asm location.

$ rman target /

RMAN> copy datafile '+DG1/sss/datafile/ddd.dbf' to  '+DG1/sss/d1.dbf';

 

 

 

 Connect to database and issue:

SQL > alter database rename file '+DG1/sss/datafile/ddd.dbf' to '+DG1/sss/d1.dbf';

 SQL > alter tablespace t3 online;

 

SQL> select name  from v$datafile;

NAME
--------------------------------------------------------------------------------
+DG1/sss/datafile/system.257.794414075
+DG1/sss/datafile/undotbs.264.794414085
+DG1/sss/datafile/sysaux.263.794414087
+DG1/sss/datafile/t1.dbf
+DG1/sss/datafile/t2.259.794414253
+DG1/sss/d1.dbf

 

-------------------------------------------------------------------------------------------------------------------------
It is possible to change AU size and strip size in 10G. How ?

 

SQL> col name format a30
SQL> col value format a20

SQL> select x.ksppinm NAME, v.KSPPSTVL VALUE from x$ksppi x, x$ksppsv v where x.indx = v.indx and x.ksppinm like '%asm%'
SQL> /

NAME                          VALUE
------------------------------ --------------------
asm_diskstring
_asm_disk_repair_time         14400
asm_diskgroups
asm_power_limit               1
_asm_ausize                   1048576
_asm_blksize                  4096
_asm_acd_chunks               1
_asm_libraries                ufs
_asm_maxio                    1048576
_asm_allow_only_raw_disks     TRUE
_asmlib_test                  0
_asm_allow_resilver_corruption FALSE
_asmsid                       asm
_asm_wait_time                18
_asm_stripewidth              8
_asm_stripesize               131072
_asm_droptimeout              60
_asm_emulmax                  10000
_asm_emultimeout              0
_asm_kfdpevent                0

20 rows selected.

 

set the parameters _asm_ausize and _asm_stripesize and restart the database.

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

 

Managing diskgroup

NORMAL Redundancy- stripping and mirroring

create diskgroup dg1
normal redundancy
failgroup fg1
disk '\dev\raw\raw1' name Disk1
failgroup
fg2 disk '\dev\raw\raw2' name Disk2;

External Redundancy - stripping

create diskgroup dge
external redundancy
disk '\dev\raw\raw3'
name E_Disk1;

 

drop diskgroup dg1 including contents;

alter diskgroup dg1  resize disk 'Disk1' size 200M;

alter database dg1 undrop disks;

alter diskgroup dg1 rebalance power 5;

alter diskgroup dg1 dismount;
alter diskgroup dg1 mount;

alter diskgroup dg1 check all; 

 

alter diskgroup dg1
add disk '/dev/raw/raw4';

alter diskgroup dg1 drop file '+dg1/sss/datafile/test.dbf';

 alter diskgroup dg1 drop disk Disk1;

 

Managing ASM Directories

alter diskgroup dg1 add directory '+dg1/sss'

Managing ASM Aliases

alter diskgroup dg1 add alias '+dg1/sss/df.dbf' for '+dg1/sss/datafile/test,123.4';
alter diskgroup dg1 drop alias '+dg1/sss/df.dbf'

 

 

 

ASM Monitoring scripts

 

select name, group_number, name, type, state, total_mb, free_mb from v$asm_diskgroup;
select group_number, disk_number, name, failgroup, create_date, path, total_mb from v$asm_disk;
select group_number, operation, state, power, actual, sofar, est_work, est_rate, est_minutes from v$asm_operation;
select path, reads, writes, read_time, write_time,
read_time/decode(reads,0,1,reads) "AVGRDTIME",
write_time/decode(writes,0,1,writes) "AVGWRTIME"
from v$asm_disk_stat;

 

Related ASM Views

V$ASM_DISKGROUP
V$ASM_DISK
V$ASM_FILE
V$ASM_CLIENT
V$ASM_OPERATION
V$ASM_TEMPLATE
V$ASM_ALIAS

V$ASM_ATTRIBUTE (disk_repair_time and au_size)

V$ASM_DISK_IOSTAT
V$ASM_FILESYSTEM
V$ASM_USER
V$ASM_USERGROUP
V$ASM_USERGROUP_MEMBER
V$ASM_VOLUME
V$ASM_VOLUME_STAT

           

Published on 18th June 2013

Published by Gopinathan D