viernes, 5 de julio de 2019

Agregar raw device al oracle rac


En el siguiente ejemplo nos piden agregar 2 luns


 ora1]# rescan-scsi-bus.sh
Scanning SCSI subsystem for new devices
Scanning host 0 for  SCSI target IDs  0 1 2 3 4 5 6 7, all LUNs
 Scanning for device 0 0 0 0 ... 0 ...
OLD: Host: scsi0 Channel: 00 Id: 00 Lun: 00
      Vendor: HP       Model: LOGICAL VOLUME   Rev: 4.52
      Type:   Direct-Access                    ANSI SCSI revision: 05
 Scanning for device 0 3 0 0 ... 0 ...
OLD: Host: scsi0 Channel: 03 Id: 00 Lun: 00
      Vendor: HP       Model: P440ar           Rev: 4.52
      Type:   RAID                             ANSI SCSI revision: 05
Scanning host 1 for  all SCSI target IDs, all LUNs
 Scanning for device 1 0 0 0 ...
OLD: Host: scsi1 Channel: 00 Id: 00 Lun: 00
      Vendor: EMC      Model: Invista          Rev: 5520
      Type:   Direct-Access                    ANSI SCSI revision: 04
 Scanning for device 1 0 0 1 ...

ACA CORTO LA SALIDA PORQUE ES MUY LARGA

8 new or changed device(s) found.
        [1:0:0:31]
        [1:0:0:32]
        [1:0:1:31]
        [1:0:1:32]
        [2:0:0:31]
        [2:0:0:32]
        [2:0:1:31]
        [2:0:1:32]
0 remapped or resized device(s) found.
0 device(s) removed.

Si el procedimiento de arriba no funciona o no esta instalado el rescan-scsi-bus.sh , copiar y pegar el script siguiente :

for s in $(ls /sys/class/scsi_host)
        do
        FILE="/sys/class/fc_host/$s/issue_lip"
        if [ -f $FILE ];
        then
                        echo $s "lip"
                        echo "1" > /sys/class/fc_host/$s/issue_lip
        #else
                        #echo "File $FILE no existe"
        fi
        FILE="/sys/class/scsi_host/$s/scan"
        if [ -f $FILE ];
        then
                        echo $s "scan"
                        echo "- - -" > /sys/class/scsi_host/$s/scan
        #else
           #echo "File $FILE does not exist."
        fi
        sleep 3
        done

Ahora chequeo en Ambos Nodos, si en la salida del multipath -ll veo las luns que me asigno storage

[ ora1 ]# multipath -F; multipath -v2
Jul 05 14:19:09 | mp_fra02: map in use
Jul 05 14:19:09 | mp_redo01: map in use
Jul 05 14:19:09 | mp_fra01: map in use
Jul 05 14:19:09 | mp_scannetfs: map in use
Jul 05 14:19:09 | mp_data12: map in use
Jul 05 14:19:09 | mp_data09: map in use
Jul 05 14:19:09 | mp_data11: map in use
Jul 05 14:19:09 | mp_data08: map in use
Jul 05 14:19:09 | mp_data10: map in use
Jul 05 14:19:09 | mp_data07: map in use
Jul 05 14:19:09 | mp_data06: map in use
Jul 05 14:19:09 | mp_data05: map in use
Jul 05 14:19:09 | mp_data04: map in use
Jul 05 14:19:09 | mp_u01: map in use
Jul 05 14:19:09 | mp_ocr03: map in use
Jul 05 14:19:09 | mp_data03: map in use
Jul 05 14:19:09 | mp_u00: map in use
Jul 05 14:19:09 | mp_fra04: map in use
Jul 05 14:19:09 | mp_data02: map in use
Jul 05 14:19:09 | mp_ocr02: map in use
Jul 05 14:19:09 | mp_fra03: map in use
Jul 05 14:19:09 | mp_redo02: map in use
Jul 05 14:19:09 | mp_data01: map in use
Jul 05 14:19:09 | mp_ocr01: map in use
Jul 05 14:19:09 | mpatha: ignoring map
create: mp_data13 (36000144000000010601ec9b99d38f9ec) undef EMC,Invista
size=310G features='0' hwhandler='0' wp=undef
`-+- policy='round-robin 0' prio=1 status=undef
  |- 1:0:0:31 sdct 70:16  undef ready running
  |- 2:0:0:31 sdcx 70:80  undef ready running
  |- 1:0:1:31 sdcv 70:48  undef ready running
  `- 2:0:1:31 sdcz 70:112 undef ready running
create: mp_data14 (36000144000000010601ec9b99d38f9f0) undef EMC,Invista
size=310G features='0' hwhandler='0' wp=undef
`-+- policy='round-robin 0' prio=1 status=undef
  |- 1:0:0:32 sdcu 70:32  undef ready running
  |- 2:0:0:32 sdcy 70:96  undef ready running
  |- 1:0:1:32 sdcw 70:64  undef ready running
  `- 2:0:1:32 sdda 70:128 undef ready running
[ora1]#

[ora1]# multipath -F; multipath -v2
Jul 05 14:20:57 | mp_fra02: map in use
Jul 05 14:20:57 | mp_redo01: map in use
Jul 05 14:20:57 | mp_fra01: map in use
Jul 05 14:20:57 | mp_scannetfs: map in use
Jul 05 14:20:57 | mp_data12: map in use
Jul 05 14:20:57 | mp_data09: map in use
Jul 05 14:20:57 | mp_data11: map in use
Jul 05 14:20:57 | mp_data08: map in use
Jul 05 14:20:57 | mp_data10: map in use
Jul 05 14:20:57 | mp_data07: map in use
Jul 05 14:20:57 | mp_data06: map in use
Jul 05 14:20:57 | mp_data05: map in use
Jul 05 14:20:57 | mp_data04: map in use
Jul 05 14:20:57 | mp_u01: map in use
Jul 05 14:20:57 | mp_data03: map in use
Jul 05 14:20:57 | mp_ocr03: map in use
Jul 05 14:20:57 | mp_u00: map in use
Jul 05 14:20:57 | mp_fra04: map in use
Jul 05 14:20:57 | mp_data02: map in use
Jul 05 14:20:57 | mp_ocr02: map in use
Jul 05 14:20:57 | mp_fra03: map in use
Jul 05 14:20:57 | mp_redo02: map in use
Jul 05 14:20:57 | mp_data01: map in use
Jul 05 14:20:57 | mp_ocr01: map in use
Jul 05 14:20:57 | mpatha: ignoring map
create: mp_data13 (36000144000000010601ec9b99d38f9ec) undef EMC,Invista
size=310G features='0' hwhandler='0' wp=undef
`-+- policy='round-robin 0' prio=1 status=undef
  |- 1:0:0:31 sdct 70:16  undef ready running
  |- 2:0:0:31 sdcx 70:80  undef ready running
  |- 1:0:1:31 sdcv 70:48  undef ready running
  `- 2:0:1:31 sdcz 70:112 undef ready running
create: mp_data14 (36000144000000010601ec9b99d38f9f0) undef EMC,Invista
size=310G features='0' hwhandler='0' wp=undef
`-+- policy='round-robin 0' prio=1 status=undef
  |- 1:0:0:32 sdcu 70:32  undef ready running
  |- 2:0:0:32 sdcy 70:96  undef ready running
  |- 1:0:1:32 sdcw 70:64  undef ready running
  `- 2:0:1:32 sdda 70:128 undef ready running
[ora1]#

[~]# multipath -ll|grep -i 00010601ec9b99d38f9ec
mpathz (36000144000000010601ec9b99d38f9ec) dm-57 EMC,Invista
[root@plscannetora1 ~]# multipath -ll|grep -i 00010601ec9b99d38f9f0
mpathaa (36000144000000010601ec9b99d38f9f0) dm-58 EMC,Invista
[ora1]#

Chequeo lo mismo en el otro nodo del rac

[ora2 ~]# multipath -ll|grep -i 00010601ec9b99d38f9ec
mpathz (36000144000000010601ec9b99d38f9ec) dm-57 EMC,Invista
[root@plscannetora2 ~]# multipath -ll|grep -i 00010601ec9b99d38f9f0
mpathaa (36000144000000010601ec9b99d38f9f0) dm-58 EMC,Invista
[ora2 ~]#

En ambos nodos del rac, hago un bkp del multipath.conf

[ora1]# cp multipath.conf multipath.conf.ant

[ora2 ]# ls -l multipath.conf
-rw-r--r-- 1 root root 6433 May 22  2018 multipath.conf
[ora2 ]# cp multipath.conf multipath.conf.ant


En AMBOS nodos del rac ,edito el multipath.conf , y agrego la lun con el nombre que me indico base de datos, en este ejemplo el nombre que pidieron fue mp_data13 y mp_data14

multipath {
                wwid                    36000144000000010601ec9b99d38f9ec
                alias                   mp_data13
        }
        multipath {
                wwid                    36000144000000010601ec9b99d38f9f0
                alias                   mp_data14
        }


Luego en uno de los nodos ejecuto el fdisk pero con la opcion -u para poder generar :

[ora1 ~]# fdisk -u /dev/mapper/mp_data13

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c').

Command (m for help): d
Selected partition 1

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First sector (63-650119679, default 63): 128
Last sector, +sectors or +size{K,M,G} (128-650119679, default 650119679):
Using default value 650119679

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 83

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 22: Invalid argument.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
[ora1 ~]#

[ora1 ~]# fdisk -u /dev/mapper/mp_data14

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c').

Command (m for help): d
Selected partition 1

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First sector (63-650119679, default 63): 128
Last sector, +sectors or +size{K,M,G} (128-650119679, default 650119679):
Using default value 650119679

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 83

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 22: Invalid argument.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
[ora1 ~]#

Solo en uno de los nodos , por ultimo ejecutar

[ora1 ~]# partprobe /dev/mapper/mp_data13
[ora1 ~]# partprobe /dev/mapper/mp_data14

chequeamos en el /dev/mapper/ como quedaron o si tienen reglas udev ( si las tienen aparece como owner oracle:grid , en ese caso hay que agregar en el /etc/udev...)

[ora1 ~]# ls -ltr /dev/mapper/mp_data1*
lrwxrwxrwx 1 root root 8 Jan  8 08:14 /dev/mapper/mp_data10 -> ../dm-11
lrwxrwxrwx 1 root root 8 Jan  8 08:14 /dev/mapper/mp_data11 -> ../dm-13
lrwxrwxrwx 1 root root 8 Jan  8 08:14 /dev/mapper/mp_data12 -> ../dm-28
lrwxrwxrwx 1 root root 8 Jan  8 08:15 /dev/mapper/mp_data10p1 -> ../dm-30
lrwxrwxrwx 1 root root 8 Jan  8 08:15 /dev/mapper/mp_data11p1 -> ../dm-36
lrwxrwxrwx 1 root root 8 Jan  8 08:15 /dev/mapper/mp_data12p1 -> ../dm-43
lrwxrwxrwx 1 root root 8 Jul  5 14:46 /dev/mapper/mp_data13p1 -> ../dm-59
lrwxrwxrwx 1 root root 8 Jul  5 14:46 /dev/mapper/mp_data13 -> ../dm-57
lrwxrwxrwx 1 root root 8 Jul  5 14:46 /dev/mapper/mp_data14p1 -> ../dm-60
lrwxrwxrwx 1 root root 8 Jul  5 14:46 /dev/mapper/mp_data14 -> ../dm-58
[ora1 ~]# 

En el otro nodo del rac, ejecutar un multipath -F ; multipath -v2 para que tome lo que ejecute en el otro nodo cuando hice el partprobe

[ora2 ~]# multipath -F; multipath -v2
Jul 05 15:25:38 | mp_fra02: map in use
Jul 05 15:25:38 | mp_redo01: map in use
Jul 05 15:25:38 | mp_fra01: map in use
Jul 05 15:25:38 | mp_scannetfs: map in use
Jul 05 15:25:38 | mp_data12: map in use
Jul 05 15:25:38 | mp_data09: map in use
Jul 05 15:25:38 | mp_data11: map in use
Jul 05 15:25:38 | mp_data08: map in use
Jul 05 15:25:38 | mp_data10: map in use
Jul 05 15:25:38 | mp_data07: map in use
Jul 05 15:25:38 | mp_data06: map in use
Jul 05 15:25:38 | mp_data05: map in use
Jul 05 15:25:38 | mp_data04: map in use
Jul 05 15:25:38 | mp_u01: map in use
Jul 05 15:25:38 | mp_data03: map in use
Jul 05 15:25:38 | mp_ocr03: map in use
Jul 05 15:25:38 | mp_u00: map in use
Jul 05 15:25:38 | mp_fra04: map in use
Jul 05 15:25:38 | mp_data02: map in use
Jul 05 15:25:38 | mp_ocr02: map in use
Jul 05 15:25:38 | mp_fra03: map in use
Jul 05 15:25:38 | mp_redo02: map in use
Jul 05 15:25:38 | mp_data01: map in use
Jul 05 15:25:38 | mp_ocr01: map in use
Jul 05 15:25:38 | mpatha: ignoring map
create: mp_data13 (36000144000000010601ec9b99d38f9ec) undef EMC,Invista
size=310G features='0' hwhandler='0' wp=undef
`-+- policy='round-robin 0' prio=1 status=undef
  |- 1:0:0:31 sdct 70:16  undef ready running
  |- 2:0:0:31 sdcx 70:80  undef ready running
  |- 1:0:1:31 sdcv 70:48  undef ready running
  `- 2:0:1:31 sdcz 70:112 undef ready running
create: mp_data14 (36000144000000010601ec9b99d38f9f0) undef EMC,Invista
size=310G features='0' hwhandler='0' wp=undef
`-+- policy='round-robin 0' prio=1 status=undef
  |- 1:0:0:32 sdcu 70:32  undef ready running
  |- 2:0:0:32 sdcy 70:96  undef ready running
  |- 1:0:1:32 sdcw 70:64  undef ready running
  `- 2:0:1:32 sdda 70:128 undef ready running
[ora2 ~]# 

Instalar docker-compose


Para instalar docker-compose, primero se debe instalar docker


[app5 ~]# yum install docker
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
rhel-7-server-extras-rpms                                                                          | 2.0 kB  00:00:00
rhel-7-server-optional-rpms                                                                        | 2.0 kB  00:00:00
rhel-7-server-rpms                                                                                 | 2.0 kB  00:00:00
rhel-7-server-supplementary-rpms                                                                   | 2.0 kB  00:00:00
Dependencies Resolved

==========================================================================================================================
 Package                        Arch          Version                              Repository                        Size
==========================================================================================================================
Installing:
 docker                         x86_64        2:1.13.1-88.git07f3374.el7           rhel-7-server-extras-rpms         17 M
Installing for dependencies:
 PyYAML                         x86_64        3.10-11.el7                          rhel-7-server-rpms               153 k
 atomic-registries              x86_64        1:1.22.1-26.gitb507039.el7           rhel-7-server-extras-rpms         35 k
 audit-libs-python              x86_64        2.8.4-4.el7                          rhel-7-server-rpms                76 k
 checkpolicy                    x86_64        2.5-8.el7                            rhel-7-server-rpms               295 k
 container-selinux              noarch        2:2.74-1.el7                         rhel-7-server-extras-rpms         37 k
 container-storage-setup        noarch        0.11.0-2.git5eaf76c.el7              rhel-7-server-extras-rpms         35 k
 containers-common              x86_64        1:0.1.31-7.gitb0b750d.el7            rhel-7-server-extras-rpms         18 k
 docker-client                  x86_64        2:1.13.1-88.git07f3374.el7           rhel-7-server-extras-rpms        3.8 M
 docker-common                  x86_64        2:1.13.1-88.git07f3374.el7           rhel-7-server-extras-rpms         95 k
 docker-rhel-push-plugin        x86_64        2:1.13.1-88.git07f3374.el7           rhel-7-server-extras-rpms        1.9 M
 libsemanage-python             x86_64        2.5-14.el7                           rhel-7-server-rpms               113 k
 libyaml                        x86_64        0.1.4-11.el7_0                       rhel-7-server-rpms                55 k
 oci-register-machine           x86_64        1:0-6.git2b44233.el7                 rhel-7-server-extras-rpms        1.1 M
 oci-systemd-hook               x86_64        1:0.1.18-2.git3efe246.el7            rhel-7-server-extras-rpms         34 k
 oci-umount                     x86_64        2:2.3.4-2.git87f9237.el7             rhel-7-server-extras-rpms         32 k
 policycoreutils-python         x86_64        2.5-29.el7                           rhel-7-server-rpms               456 k
 python-IPy                     noarch        0.75-6.el7                           rhel-7-server-rpms                32 k
 python-pytoml                  noarch        0.1.14-1.git7dea353.el7              rhel-7-server-extras-rpms         18 k
 setools-libs                   x86_64        3.3.8-4.el7                          rhel-7-server-rpms               620 k
Updating for dependencies:
 audit                          x86_64        2.8.4-4.el7                          rhel-7-server-rpms               250 k
 audit-libs                     i686          2.8.4-4.el7                          rhel-7-server-rpms               101 k
 audit-libs                     x86_64        2.8.4-4.el7                          rhel-7-server-rpms               100 k

Transaction Summary
==========================================================================================================================
Install  1 Package  (+19 Dependent packages)
Upgrade             (  3 Dependent packages)

Total download size: 27 M
Is this ok [y/d/N]: y
Downloading packages:


El paso siguiente es bajar de internet, el docker compose, se puede bajar de esta web :

https://github.com/docker/compose/releases

Al ingresar al link mencionado arriba, me baja el archivo docker-compose-Linux-x86_64 , el cual lo debo poner en /usr/local/bin/ con el nombre docker-compose tal como muestro a continuacion:

mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose

Eso es todo

miércoles, 3 de julio de 2019

Restore de Sistema Operativo de una maquina virtual


Con el equipo prendido, ir a cd/dvd drive 1 y seleccionar
Connect to ISO image on local disk
















Elegir la imagen para bootear


 Abrir una consola, ir a VM, Guest, y enviar un Crl +Alt + Del


















En este paso, hay que darle para entar al Setup del equipo y seleccionar la secuencia de booteo
como CD-rom














Grabar los cambios y salir


















Cuando bootea de CD, tipear linux rescue






















Cuando bootea de Cd, hay que setear la red ( tener a mano, la ip , y mascara de red del equipo a restorear)





















En este paso CAMBIAR a MANUAL, para ponerle la direccion ip y la mascara de red
















setearle el gateway




























Aparece un cartel de que vamos a montar la instalacion Linux como read/write en el /mnt/sysimage
darle ( Continue )



OJO ACA
Mucho cuidado, tipear < NO > porque caso contrario intentara crear una nueva particion en el disco, borrando la existente























OJO Aca tambien, porque volvera a intentar crear una nueva particion, asi que tipear < NO >

nos muestra un carte del finalizacion


















nos muestra un carte del finalizacion
























Ahora si, chequeo la conectividad contra el equipo linux234
ping 10.1.2.3
Si funciona la red, lo que debo hacer es :

df -h
umount -l /mnt/sysimage/dev
umount /mnt/sysimage/boot
umount /mnt/sysimage
mkfs.ext3 /dev/VolGroup00/LogVol00 *** o LV_root como o se llame donde monta el /
mount /dev/VolGroup00/LogVol00 /mnt/sysimage
cd /mnt/sysimage
ssh root@10.1.2.3 gzip -dc /backupsos/lnx0038/lnx0038.root.*gz | restore -xvolf -

En este ejemplo el restore tardaba muchisimo debido a que tenia mas de 3 millones de archivos en el /var/spool/clientmqueue/* , y lo solucionamos , agregando un disco, creando un fs nuevo /restore , copiando el archivo.dump.gz a dicho fs y descomprimiendolo despues. Y Ademas, el restore lo hicimos selectivo, es decir de todo menos del /var/spool/clientmqueue


la sintaxis usada fue :

cd /mnt/sysimage; restore -ivf /mnt/sysimage/restore/lnx0038.root.dump


**con los parametros ivf lo abre en modo interactivo, te move, con cd , ls, seleccionas con add y lo extraes con ex