Oracle Live

12/04/2016

RAC – Comandos administración II

Filed under: RAC — mogukiller @ 12:01 am

Manual de gestion del cluster y sus recursos asociados.

Version 10.2.0.5 y 11.2.0.3

-- Para ver los servicios registrados
-- Listamos los nodos de un cluster
-- Start / Stop la pila del cluster
-- Enable / Disable del cluster
-- Start / Stop Services
-- Show configuration
-- Show static configuration (dependencias)
-- Show status
-- Arrancar / Parar Recursos cluster
-- Habilitamos / Deshabilitamos recursos del cluster
-- Gestionar servicios
-- Modificamos servicio
-- Especificamos variables de entorno
-- Comprobamos estado de los voting diks / OCR
-- Configuración de red
-- Para ver si se ha quedado algun semaforo de oracle levantado
-- Reubicacion servicios

-- Listamos los nodos de un cluster

> olsnodes -n
mdor1dbebd11    1
mdor1dbebd12    2

-- Para ver los servicios registrados
'-- Oracle 10g'
>crs_stat -t 

'nota: esta es la macro de E///'
>CRS_STAT

HA Resource                                   Target     State             
-----------                                   ------     -----             
ora.SOPSDP10.SOPSDP10_I1.inst                 ONLINE     ONLINE on boe1bdsdp1
ora.SOPSDP10.SOPSDP10_I2.inst                 ONLINE     ONLINE on boe1bdsdp2
ora.SOPSDP10.db                               ONLINE     ONLINE on boe1bdsdp2
ora.SOPSDP9.SOPSDP9_I1.inst                   ONLINE     ONLINE on boe1bdsdp1
ora.SOPSDP9.SOPSDP9_I2.inst                   ONLINE     ONLINE on boe1bdsdp2
ora.SOPSDP9.db                                ONLINE     ONLINE on boe1bdsdp1
ora.boe1bdsdp1.LISTENER_BOE1BDSDP1.lsnr       ONLINE     ONLINE on boe1bdsdp1
ora.boe1bdsdp1.gsd                            ONLINE     ONLINE on boe1bdsdp1
ora.boe1bdsdp1.ons                            ONLINE     ONLINE on boe1bdsdp1
ora.boe1bdsdp1.vip                            ONLINE     ONLINE on boe1bdsdp1
ora.boe1bdsdp2.LISTENER_BOE1BDSDP2.lsnr       ONLINE     ONLINE on boe1bdsdp2
ora.boe1bdsdp2.gsd                            ONLINE     ONLINE on boe1bdsdp2
ora.boe1bdsdp2.ons                            ONLINE     ONLINE on boe1bdsdp2
ora.boe1bdsdp2.vip                            ONLINE     ONLINE on boe1bdsdp2

'-- Oracle 11g'
> crsctl status resource -t
> crsstat 'nota: macro para E///'

-------------------------------------------
-- Start / Stop la pila del cluster
-------------------------------------------
-- A nivel de nodo
	[root]> crsctl stop crs		'nota: este comando para el proceso ohasd'
	[root]> crsctl start crs
	[root]> crsctl check crs	

-- A nivel de cluster
	[root]> crsctl stop cluster -all	'nota: este comando NO para el proceso ohasd.'
	[root]> crsctl start cluster -all   'nota: si he bajado con crsctl stop crs NO puedo subir con este'
	[root]> crsctl check cluster -all
	/* SALIDA
	**************************************************************
	mogubedb11n1:
	CRS-4537: Cluster Ready Services is online
	CRS-4529: Cluster Synchronization Services is online
	CRS-4533: Event Manager is online
	**************************************************************
	mogubedb11n2:
	CRS-4537: Cluster Ready Services is online
	CRS-4529: Cluster Synchronization Services is online
	CRS-4533: Event Manager is online
	**************************************************************
	*/
	
	'-- podemos levantar los sevicios de cluster de un solo nodo'
	[root]> crsctl stop|start|check cluster -n mogulanbedb11n2

------------------------------------------
-- Enable / Disable del cluster
------------------------------------------	
[root]$ crsctl enable crs
[root]$ crsctl disable crs

------------------------------------------	
-- Start / Stop Services
------------------------------------------
-- Base de datos:
	srvctl start database -d DATABASE_NAME ( antes de bajar srvctl stop services -d DATABASE_NAME)
	srvctl stop database -d DATABASE_NAME 

-- Instancia:
	srvctl start instance  -d DATABASE_NAME -i INSTANCE_NAME 
	srvctl stop instance  -d DATABASE_NAME -i INSTANCE_NAME  
	srvctl start instance -d <database_name> -i <instance_name> -o mount
	
	srvctl start instance -d moguland -n mogubedb11n1 <<< -- te sube todos los recursos que esten ubicados en ese nodo

-- Listener
	srvctl start listener  -n NODO
	srvctl stop listener  -n NODO
 
-- Parada y arranque servicios
	srvctl start service -d nombre_base_de_datos
	srvctl stop service -d db_name [-s service_name_list [-i inst_name]]

-- Paramos todas las aplicaciones de un nodo (para hacer que el nodo no de servicio)
	srvctl stop nodeapp -n mogubedb11n2 -r
	'[-r] rebalancea la Virtual IP'

-------------------------------------	
-- Arrancar / Parar Recursos cluster
-------------------------------------
> crsctl stop resource xag.GG_PRMY.goldengate		<<<<< Para un determinado recurso.
> crsctl stop resource xag.GG_PRMY.goldengate -f	<<<<< Si un recurso tiene dependencias. El cluster intenta parar las dependencias y el recurso.

-------------------------------------	
-- Reubicacion servicios
-------------------------------------
   srvctl relocate service -d db_unique_name -s service_name  -i old_instance_name -t new_instance_name [-f]   
  	 
'NOTA: Este cambio no es permanente, si hubiese que hacerlo permanente habria que cambiar el servicio'

 Ejemplo: srvctl relocate service -d ARPPGA -s ARPPGATUX_UP05 -i ARPPGA2 -t ARPPGA3 -f

-- Reubicamos una virtual
	srvctl relocate vip -i mogubedb11n2 -n mogubedb11n2
	'-i nombre de la vip
	 -n nombre del nodo
	 -f forzamos
	'
--------------------------------------
-- Show configuration
--------------------------------------
-- Base de datos
	srvctl config database -d moguland
-- Listener
	srvctl config listener -l listener_name -a
	'	-a muestra infromacion detallada'
	srvctl config listener
	' saca la info de todos los listeners'
	
-- Servicios
	srvctl config service -d ARPPGA -s nombre_del_servicio
	/* SALIDA
	Database unique name: moguland
	Database name: moguland
	Oracle home: /export/app/oracle/product/11.2.0.3
	Oracle user: oracle
	Spfile: +RECO/moguland/spfilemoguland.ora
	Domain: 
	Start options: open
	Stop options: immediate
	Database role: PRIMARY
	Management policy: AUTOMATIC
	Server pools: moguland
	Database instances: moguland1,moguland2
	Disk Groups: RECO,DATA
	Mount point paths: 
	Services: 
	Type: RAC
	Database is administrator managed
	*/

-----------------------------------
-- Show status
-----------------------------------	
-- listener
	srvctl status listener
	/*
		Listener LISTENER is enabled
		Listener LISTENER is running on node(s): mogubedb11n1,mogubedb11n2
		Listener LISTENER2 is enabled
		Listener LISTENER2 is not running	
	*/
-- nodeaps
	srvctl status nodeapps
	/*	
		VIP be1-v is enabled
		VIP be1-v is running on node: mogubedb11n1
		VIP be2-v is enabled
		VIP be2-v is running on node: mogubedb11n2
		Network is enabled
		Network is running on node: mogubedb11n1
		Network is running on node: mogubedb11n2
		GSD is disabled
		GSD is not running on node: mogubedb11n1
		GSD is not running on node: mogubedb11n2
		ONS is enabled
		ONS daemon is running on node: mogubedb11n1
		ONS daemon is running on node: mogubedb11n2
	*/

-- vip
	srvctl config vip -n mogubedb11n1
	srvctl config vip -i mogubedb11n1 

---------------------------------------------------------
-- Habilitamos / Deshabilitamos recursos del cluster
---------------------------------------------------------

-- Enable / Disable database
	srvctl disable database -d moguland
	' ahora no funcionaria el comando srvctl start database'
	srvctl enable database -d moguland
-- Enable / Disable instance
	srvctl disable instance -d moguland -i moguland2
	' ahora al hacer un start database solo sube una instancia'
	srvctl enable instance -d moguland -i moguland2
-- Enable / Disable service
	srvctl disable service -d moguland -s "lista_servicios" [ -i instance_name | -n node_name ]
	' si no indicamos la instancia lo deshabilita de todos los nodos donde este registrado'
	srvctl enable service -d moguland -s "lista_servicios" [ -i instance_name | -n node_name ]

-------------------------------------------------------
-- Habilitamos / Deshabilitamos reinicio AUTOMATICO
-------------------------------------------------------
'nota: para evitar que el cluster me levante el servicio'
-- Enable / Disable Modo automatico database
	srvctl modify database -d PRUEBA -y AUTOMATIC
	srvctl modify database -d PRUEBA -y LOCAL
'nota: para revisar el estado'
	srvctl config database -d PRUEBA
	/*
		Management policy: MANUAL
	*/
---------------------------------------------------
-- Modificamos servicio
---------------------------------------------------
srvctl modify service -d PRUEBA -s BATCH -n -i PRUEBA1 -a PRUEBA2		<< -- Preferred PRUEBA1, available PRUEBA2

---------------------------------------------------
-- Gestionar servicios
---------------------------------------------------
-- Add / Remove servicios
	srvctl add service -d moguland -s moguland_up00 -r moguland1 -a mogulandn2
	srvctl add service -d moguland -s moguland_up00 -r moguland1 -a mogulandn2 -q TRUE -e SELECT -m BASIC -w 10 -z 150
	srvctl remove service -d moguland -s moguland_up00 -f
	
-- Start / Stop Services
	srvctl start service -d moguland -s moguland_up00
	srvctl stop service -d moguland -s moguland_up00
-- Configuracion del servicio
	srvctl config service -d moguland -s moguland_up00
	/*
	Service name: moguland_up00
	Service is enabled
	Server pool: moguland_moguland_up00
	Cardinality: 1
	Disconnect: false
	Service role: PRIMARY
	Management policy: AUTOMATIC
	DTP transaction: false			<<<<< Se suele modificar para permitir transacciones distribuidas
	AQ HA notifications: false
	Failover type: NONE
	Failover method: NONE
	TAF failover retries: 0
	TAF failover delay: 0
	Connection Load Balancing Goal: LONG
	Runtime Load Balancing Goal: NONE
	TAF policy specification: NONE
	Edition: 
	Preferred instances: moguland1
	Available instances: mogulandn2	
	*/
	
-------------------------------------------------------
-- Comprobamos estado de los voting diks / OCR
-------------------------------------------------------	
-- Voting disk
[root]> crsctl query css votedisk

/* SALIDA
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   79c3171bb12c4fffbff05661f44714d2 (/dev/asm-disk1) [DATA]
Located 1 voting disk(s).
*/

-- OCR

[root]> ocrcheck
/* SALIDA
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       2852
         Available space (kbytes) :     259268
         ID                       :  391716493
         Device/File Name         :      +DATA
                                    Device/File integrity check succeeded  <<< --Puede haber hasta 5 copias
                                    Device/File not configured
                                    Device/File not configured
                                    Device/File not configured
                                    Device/File not configured
         Cluster registry integrity check succeeded
         Logical corruption check succeeded
*/
[grid]> cluvfy comp ocr -n all -verbose
/*
	Verifying OCR integrity 
	Checking OCR integrity...
	Checking the absence of a non-clustered configuration...
	All nodes free of non-clustered, local-only configurations
	ASM Running check passed. ASM is running on all specified nodes
	Checking OCR config file "/etc/oracle/ocr.loc"...
	OCR config file "/etc/oracle/ocr.loc" check successful
	Disk group for ocr location "+DATA" available on all the nodes
*/

'-- muestra los backups de ocr'
[root]> ocrconfig -showbackup [auto | manual]
/* SALIDA
	mogubedb11n1     2014/11/28 11:47:51     /export/app/11.2.0/grid/cdata/scan1/backup00.ocr
	mogubedb11n1     2014/11/28 01:10:43     /export/app/11.2.0/grid/cdata/scan1/backup01.ocr
	mogubedb11n1     2014/11/27 21:10:43     /export/app/11.2.0/grid/cdata/scan1/backup02.ocr
	mogubedb11n1     2014/11/27 21:10:43     /export/app/11.2.0/grid/cdata/scan1/day.ocr
	mogubedb11n1     2014/11/21 14:32:48     /export/app/11.2.0/grid/cdata/scan1/week.ocr
*/
'-- creamos un backup de forma manual'
[root]> ocrconfig -manualbackup
/*
	mogubedb11n1     2014/12/18 11:51:44     /export/app/11.2.0/grid/cdata/scan1/backup_20141218_115144.ocr
*/

'-- hacemos un backup logico'
[root]> ocrconfig -export /tmp/backup_ocr_logic.ocr

----------------------------------------
-- Configuración de red
----------------------------------------
' nota: muestra las redes configuradas por el cluster'
> oifcfg getif
/*
	eth1  10.10.204.128  global  public
	eth2  10.10.208.128  global  cluster_interconnect
*/
' nota: configuracion de las vips'
> srvctl config nodeapps -a 						<<< toda las VIP
> srvctl config nodeapps -n ixtla1dbebd21 -a		<<< las de un determinado nodo
/*
	VIP exists.: /bebd21-v/192.168.10.168/255.255.255.0/bond1.101
*/

'nota: configuracion de los interfaces de red'
> netstat -nr
/*
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
10.10.208.128   0.0.0.0         255.255.255.192 U         0 0          0 eth2
10.10.204.128   0.0.0.0         255.255.255.192 U         0 0          0 eth1
10.10.206.128   0.0.0.0         255.255.255.192 U         0 0          0 eth4
10.10.67.128    0.0.0.0         255.255.255.192 U         0 0          0 eth3
10.10.67.192    0.0.0.0         255.255.255.192 U         0 0          0 eth5
10.10.67.0      0.0.0.0         255.255.255.128 U         0 0          0 eth0
0.0.0.0         10.10.67.1      0.0.0.0         UG        0 0          0 eth0
*/

'nota: que listener esta escuchando'
netstat -natup | grep 1521 | grep tnslsnr

-- Como esta configurado un servicio
'nota: version 10g'
crs_stat -p [Nombre del servicio]
/*
NAME=ora.PEOPGE.PEOPGE1.inst
TYPE=application
ACTION_SCRIPT=/softw/app/oracle/product/10.2.0/db/bin/racgwrap
ACTIVE_PLACEMENT=0
AUTO_START=1
CHECK_INTERVAL=600
DESCRIPTION=CRS application for Instance
FAILOVER_DELAY=0
FAILURE_INTERVAL=0
FAILURE_THRESHOLD=0
HOSTING_MEMBERS=mirbesg10
OPTIONAL_RESOURCES=
PLACEMENT=restricted
REQUIRED_RESOURCES=
RESTART_ATTEMPTS=5
SCRIPT_TIMEOUT=600
START_TIMEOUT=0
STOP_TIMEOUT=0
UPTIME_THRESHOLD=7d
*/

-- Para ver si se ha quedado algun semaforo de oracle levantado

export ORACLE_SID=xxx
$ORACLE_HOME/bin/sysresv

IPC Resources for ORACLE_SID "COPPGA2" :
Shared Memory
ID              KEY
No shared memory segments used
Semaphores:
ID              KEY
No semaphore resources used
Oracle Instance not alive for sid "COPPGA2"

-- Especificamos variables de entorno

'nota: son variables que internamente utilizan los componentes de oracle'
srvctl setenv database -d prueba -T ORACLE_HOME=/export/oracle/app/oracle/product/11.2.0.3
srvctl unsetenv database -d prueba -t "variable=valor"
srvctl getenv database -d prueba

----------------------------------------------
-- Show static configuration (dependencias)
----------------------------------------------
> crsctl status resource ora.ptq001.db -p       
/* SALIDA
NAME=ora.ptq001.db
TYPE=ora.database.type
ACL=owner:usodbms:rwx,pgrp:oinstall:r--,other::r--,group:dba:r-x,group:racoper:r-x,user:usosasm:r-x
ACTIONS=
ACTION_SCRIPT=
ACTION_START_OPTION=
ACTION_TIMEOUT=600
ACTIVE_PLACEMENT=0
AGENT_FILENAME=%CRS_HOME%/bin/oraagent%CRS_EXE_SUFFIX%
AUTO_START=restore
CARDINALITY=2
CHECK_INTERVAL=1
CHECK_TIMEOUT=30
CLEAN_TIMEOUT=60
CLUSTER_DATABASE=true
DATABASE_TYPE=RAC
DB_UNIQUE_NAME=PTQ001
DEGREE=1
DELETE_TIMEOUT=60
DESCRIPTION=Oracle Database resource
ENABLED=1
FAILOVER_DELAY=0
FAILURE_INTERVAL=60
FAILURE_THRESHOLD=1
GEN_AUDIT_FILE_DEST=/apps/oradb/audit/PTQ001/adump
GEN_START_OPTIONS=
GEN_USR_ORA_INST_NAME=
GEN_USR_ORA_INST_NAME@SERVERNAME(tehol041)=PTQ0011
GEN_USR_ORA_INST_NAME@SERVERNAME(tehol042)=PTQ0012
HOSTING_MEMBERS=
INSTANCE_FAILOVER=0
INTERMEDIATE_TIMEOUT=0
LOAD=1
LOGGING_LEVEL=1
MANAGEMENT_POLICY=AUTOMATIC
MODIFY_TIMEOUT=60
NLS_LANG=
OFFLINE_CHECK_INTERVAL=0
ONLINE_RELOCATION_TIMEOUT=0
ORACLE_HOME=/u01/oradb/rdbms1120/112040
ORACLE_HOME_OLD=
PLACEMENT=restricted
PWFILE=
RANK=0
RELOCATE_ACTION=0
RELOCATE_BY_DEPENDENCY=1
RESTART_ATTEMPTS=2
ROLE=PRIMARY
SCRIPT_TIMEOUT=60
SERVER_CATEGORY=
SERVER_POOLS=ora.PTQ001
SERVER_POOLS_PQ=
SPFILE=+DG_DATOS/PTQ001/spfilePTQ001.ora
START_CONCURRENCY=0
START_DEPENDENCIES=hard(ora.DG_DATOS.dg,ora.DG_RECO.dg,ora.DBFS_DG.dg) weak(type:ora.listener.type,global:type:ora.scan_listener.type,uniform:ora.ons,global:ora.gns) pullup(ora.DG_DATOS.dg,ora.DG_RECO.dg,ora.DBFS_DG.dg)
START_TIMEOUT=600
STOP_CONCURRENCY=0
STOP_DEPENDENCIES=hard(intermediate:ora.asm,shutdown:ora.DG_DATOS.dg,shutdown:ora.DG_RECO.dg,shutdown:ora.DBFS_DG.dg)
STOP_TIMEOUT=600
TYPE_VERSION=3.3
UPTIME_THRESHOLD=1h
USER_WORKLOAD=yes
USE_STICKINESS=0
USR_ORA_DB_NAME=PTQ001
USR_ORA_DOMAIN=
USR_ORA_ENV=
USR_ORA_FLAGS=
USR_ORA_INST_NAME=
USR_ORA_INST_NAME@SERVERNAME(tehol041)=PTQ0011
USR_ORA_INST_NAME@SERVERNAME(tehol042)=PTQ0012
USR_ORA_OPEN_MODE=open
USR_ORA_OPI=false
USR_ORA_STOP_MODE=immediate
 */
 
 

Dejar un comentario »

Aún no hay comentarios.

RSS feed for comments on this post. TrackBack URI

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s

Crea un blog o un sitio web gratuitos con WordPress.com.

A %d blogueros les gusta esto: