Wednesday, February 25, 2009

Oracle RAC handson Part 3 ASM setup

Making Disks Available to ASMLib

creating an ASM disk

[root@ca-test1 /]# /etc/init.d/oracleasm createdisk DISK1 /dev/sdg1

Creating Oracle ASM disk "DISK1" [ OK ]

Unmarking disk:

[root@ca-test1 /]# /etc/init.d/oracleasm deletedisk DISK1

Deleting Oracle ASM disk "DISK1" [ OK ]

Any operating system disk can be queried to see if it is used by ASM:

[root@ca-test1 /]# /etc/init.d/oracleasm querydisk /dev/sda1

Checking if device "/dev/sda1" is an Oracle ASM disk [ OK ]

[root@ca-test1 /]# /etc/init.d/oracleasm querydisk /dev/sdb1

Checking if device "/dev/sdb1" is an Oracle ASM disk [FAILED]

Existing disks can be listed and queried:

[root@ca-test1 /]# /etc/init.d/oracleasm listdisks

DISK1

DISK2

DISK3

[root@ca-test1 /]# /etc/init.d/oracleasm querydisk DISK1

Checking for ASM disk "DISK1" [ OK ]

When a disk is added to a RAC setup, the other nodes need to be notified about it. Run the 'createdisk' command on one node, and then run 'scandisks' on every other node:

[root@ca-test1 /]# /etc/init.d/oracleasm scandisks

Scanning system for ASM disks [ OK ]


ASM operations using OEM and sqlplus



ASM disk discovery:


SQL> select name, header_status, path from v$asm_disk;

NAME HEADER_STATU PATH

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

FOREIGN /dev/raw/raw1

FOREIGN /dev/raw/raw2

DISK1 MEMBER ORCL:DISK1

DISK10 MEMBER ORCL:DISK10

DISK2 MEMBER ORCL:DISK2

DISK3 MEMBER ORCL:DISK3

DISK4 MEMBER ORCL:DISK4

DISK5 MEMBER ORCL:DISK5

DISK6 MEMBER ORCL:DISK6

DISK7 MEMBER ORCL:DISK7

DISK8 MEMBER ORCL:DISK8

DISK9 MEMBER ORCL:DISK9

ASM redundancy and usable disks:

SQL> select name, type, total_mb, free_mb, required_mirror_free_mb,

2 usable_file_mb from v$asm_diskgroup;

NAME TYPE TOTAL_MB FREE_MB REQUIRED_MIRROR_FREE_MB USABLE_FILE_MB

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

DISKGRP1 NORMAL 204796 199978 0 99989

DISKGRP2 EXTERN 204796 204659 0 204659

Add disk to disk group


ALTER DISKGROUP DISKGRP1 ADD FAILGROUP DISK10 DISK 'ORCL:DISK10' NAME DISK10 SIZE 102398 M;

Drop disk from disk group




ALTER DISKGROUP DISKGRP1 DROP DISK DISK10


Create disk group






CREATE DISKGROUP DISKGRP2 EXTERNAL REDUNDANCY DISK 'ORCL:DISK3' NAME DISK3 SIZE 102398 M ,'ORCL:DISK4' NAME DISK4 SIZE 102398 M;

Rebalance disk:



ALTER DISKGROUP DISKGRP2 REBALANCE;
ALTER DISKGROUP DISKGRP2 REBALANCE POWER 5 WAIT;
MOUNT/DISMOUNT diskgroup
ALTER DISKGROUP dgroup1 MOUNT;
ALTER DISKGROUP dgroup1 DISMOUNT;
File and Directory manipulation

ALTER DISKGROUP dgroup1 ADD DIRECTORY '+dgroup1/mydir';

ALTER DISKGROUP dgroup1 RENAME DIRECTORY '+dgroup1/mydir'

TO '+dgroup1/yourdir';

ALTER DISKGROUP dgroup1 DROP DIRECTORY '+dgroup1/yourdir' FORCE;

ALTER DISKGROUP dgroup1 ADD ALIAS '+dgroup1/mydir/second.dbf'

FOR '+dgroup1/sample/datafile/mytable.342.3';

ALTER DISKGROUP dgroup1 RENAME ALIAS '+dgroup1/mydir/datafile.dbf'

TO '+dgroup1/payroll/compensation.dbf';

ALTER DISKGROUP dgroup1 DROP ALIAS '+dgroup1/payroll/compensation.dbf';

ALTER DISKGROUP dgroup1 DROP FILE '+dgroup1/payroll/compensation.dbf';
Or ASMCMD can be used with UNIX like interface:

Command

Description

cd

Changes the current directory to the specified directory.

du

Displays the total disk space occupied by ASM files in the specified ASM directory and all its subdirectories, recursively.

exit

Exits ASMCMD.

find

Lists the paths of all occurrences of the specified name (with wildcards) under the specified directory.

help

Displays the syntax and description of ASMCMD commands.

ls

Lists the contents of an ASM directory, the attributes of the specified file, or the names and attributes of all disk groups.

lsct

Lists information about current ASM clients.

lsdg

Lists all disk groups and their attributes.

mkalias

Creates an alias for a system-generated filename.

mkdir

Creates ASM directories.

pwd

Displays the path of the current ASM directory.

rm

Deletes the specified ASM files or directories.

rmalias

Deletes the specified alias, retaining the file that the alias points to.



Jeff Hunter wrote nice article to use zero padded file as disk device for ASM disk here.

Metalink note 311350.1, How to cleanup ASM installation (RAC and Non-RAC), outlines how to drop an ASM cleanly.

No comments:

Post a Comment