Guía rápida de uso de Oracle ASMLib
Oracle
ASMLib es una herramienta opcional en sistemas Linux, facilita la administración
de dispositivos de almacenamiento a nivel de sistema operativo para la manipulación
dentro de una instancia ASM.
Instalación de ASMLib: para
instalar la librería basta con utilizar YUM para descargarla de los
repositorios públicos de Oracle.
[root@oel-pruebas]#
yum install oracleasm-support oracleasmlib
..
.. skipping a bunch of things...
..
Resolving Dependencies
--> Running transaction check
---> Package oracleasm-2.6.18-194.el5.x86_64
0:2.0.5-1.el6 set to be updated
---> Package oracleasm-support.x86_64
0:2.1.4-1.el6 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package
Arch
Version
Repository Size
================================================================================
…
…
Complete!
|
Configuración
de la herramienta: lo siguiente es configurar la herramienta, en este paso
indicaremos las reglas que va a seguir ASMLib para asignar permisos a los
DiskGroup.
[root@oel-pruebas]#
oracleasm configure -i
Configuring the Oracle ASM library driver.
This will configure the on-boot properties of the
Oracle ASM library
driver. The following questions will
determine whether the driver is
loaded on boot and what permissions it will
have. The current values
will be shown in brackets ('[]'). Hitting
<ENTER> without typing an
answer will keep that current value. Ctrl-C
will abort.
Default user to own the driver interface []:
oracle
Default group to own the driver interface []: dba
Start Oracle ASM library driver on boot (y/n)
[n]: y
Scan for Oracle ASM disks on boot (y/n) [y]:
Writing Oracle ASM library driver configuration:
done
|
Y
finalmente inicializamos la herramienta
[root@oel-pruebas]#
/usr/sbin/oracleasm init
Creating /dev/oracleasm mount point:
/dev/oracleasm
Loading module "oracleasm": oracleasm
Mounting ASMlib driver filesystem: /dev/oracleasm
|
Creando un ASM Disk para agregarlo a un DiskGroup
Una vez
hayamos configurado nuestra herramienta, vamos a ver su funcionamiento.
Para crear
un nuevo ASM Disk primero debemos crear la partición en el nuevo dispositivo en
el equipo:
[root@oel-pruebas ~]# fdisk -l
Disk /dev/sdf: 10.7 GB,
10737418240 bytes
255 heads, 63
sectors/track, 1305 cylinders
Units = cylinders of 16065
* 512 = 8225280 bytes
Sector size
(logical/physical): 512 bytes / 512 bytes
I/O size
(minimum/optimal): 512 bytes / 512 bytes
Disk identifier:
0x00000000
|
Mediante
fdisk creamos la partición que se convertirá en nuestro disco ASM:
[root@oel-pruebas ~]# fdisk /dev/sdf
Device contains neither a
valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS
disklabel with disk identifier 0xe55fc480.
Changes will remain in
memory only, until you decide to write them.
After that, of course, the
previous content won't be recoverable.
Warning: invalid flag
0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible
mode is deprecated. It's strongly recommended to
switch off the mode (command 'c')
and change display units to
sectors (command 'u').
Command (m for help): m
Command action
a
toggle a bootable flag
b
edit bsd disklabel
c
toggle the dos compatibility flag
d
delete a partition
l
list known partition types
m
print this menu
n
add a new partition
o
create a new empty DOS partition table
p
print the partition table
q
quit without saving changes
s
create a new empty Sun disklabel
t
change a partition's system id
u
change display/entry units
v
verify the partition table
w
write table to disk and exit
x
extra functionality (experts only)
Command (m for help): n
Command action
e
extended
p
primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1305,
default 1):
Using default value 1
Last cylinder, +cylinders
or +size{K,M,G} (1-1305, default 1305):
Using default value 1305
Command (m for help): w
The partition table has
been altered!
Calling ioctl() to re-read
partition table.
Syncing disks.
|
Con la partición
creada, ahora podemos usar ASMLib para presentar el disco a la instancia ASM:
el comando para crear un nuevo disco es createdisk
[root@oel-pruebas ~]# /usr/sbin/oracleasm createdisk
DATA3 /dev/sdf1
Writing disk header:
done
Instantiating disk:
done
[root@oel-pruebas ~]# /usr/sbin/oracleasm listdisks
DATA1
DATA2
DATA3
|
listdisks nos
permite listar los discos existentes, visibles para ASM. Ó podemos listar el
directorio /dev/oracleasm/disks/
[root@oel-pruebas ~]# cd
/dev/oracleasm/disks/
[root@oel-pruebas disks]#
ls -lL
total 0
brw-rw----. 1 oracle dba
8, 49 Jun 26 19:36 DATA1
brw-rw----. 1 oracle dba
8, 65 Jun 26 19:36 DATA2
brw-rw----. 1 oracle dba 8, 81 Jun 26 19:35 DATA3
|
Finalmente nuestro
dispositivo está listo para ser agregado a cualquier diskgroup dentro de
nuestra base de datos:
[oracle@oel-pruebas ~]$
sqlplus / as sysdba
SQL*Plus: Release
11.2.0.4.0 Production on Sun Jun 26 19:42:04 2016
Copyright (c) 1982, 2013,
Oracle. All rights reserved.
SQL> col header_status
format a40
SQL> set lines 999
SQL> select
path,header_status from v$asm_disk;
PATH HEADER_STATUS
------------------------- ----------------------------------------
/dev/oracleasm/disks/DATA3
MEMBER
/dev/oracleasm/disks/DATA1
MEMBER
/dev/oracleasm/disks/DATA3 CANDIDATE
|
La
facilidad de esta herramienta, agiliza mucho la administración física de
dispositivos antes de manipularnos en la instancia ASM. Cabe mencionar que no
es la única forma de crear discos en Linux.
Para otras
referencias puedes consultar:
Feliz
lectura!
Comments
Post a Comment