Oracle Live

13/01/2020

DEBUG – OSWATCHER

Filed under: Database — mogukiller @ 2:59 pm
Tags: ,

Referencias:
OSWatcher (Includes: [Video]) (Doc ID 301137.1)
OS Watcher Users Guide (Doc ID 1531223.1)
OSWatcher Analyzer User Guide (Doc ID 461053.1)

Ejecutables:

  1. oswbb: a unix shell script data collector which collects and stores the data
  2. oswbba: a java utility which will analyze the data automatically and provide adv ice and produce graphs and an html document

OSWatcher can be downloaded ways:

standalone. Installing the standalone version will always give you the very latest version
installing as part of the TFA Database Support Tools Bundle

Parametrizacion:

ARG1 = snapshot interval in seconds. (30 segundos by default)
ARG2 = the number of hours of archive data to store. (48 horas by default)
ARG3 = (optional) the name of a compress utility to compress each file automatically after it is created.
ARG4 = (optional) an alternate (non default) location to store the archive directory.

Informacion obtenida:

  • ps
  • top
  • ifconfig
  • mpstat
  • iostat
  • netstat
  • traceroute
  • vmstat
  • sar (HP-UX Only)
  • cpuinfo (Linux Only)
  • meminfo (Linux Only)
  • slabinfo (Linux Only)

— iostat

Field Description
r/s Shows the number of reads/second
w/s Shows the number of writes/second
kr/s Shows the number of kilobytes read/second
kw/s Shows the number of kilobytes written/second
wait Average number of transactions waiting for service (queue length)
actv Average number of transactions actively being serviced
wsvc_t Average service time in wait queue, in milliseconds <<<<<<<<<<< IMPORTANTE
asvc_t Average service time of active transactions, in milliseconds
%w Percent of time there are transactions waiting for service
%b Percent of time the disk is busy
device Device name

— oswmpstat

nota mpstat obtiene informacion a nivel de CPU

csw Context switches
icsw Involuntary context switches
smtx Number of times a CPU failed to obtain a mutex
xcal Processor cross-calls (when one CPU wakes up another by interrupting it).

What to look for:

Involuntary context switches (this is probably the more relevant statistic when examining performance issues.)
Number of times a CPU failed to obtain a mutex. Values consistently greater than 200 per CPU causes system time to increase.
xcal is very important, show processor migration

— oswnetstat

Values to look at:

Collisions (Collis)
Output packets (Opkts)
Input errors (Ierrs)
Input packets (Ipkts)

Para sacar el ratio:

Network collision rate = Output collision / Output packets << 0.1
Input Error Rate = Ierrs / Ipkts. << 0.25

Many performance problems associated with the network involve the retransmission of the TCP packets.

%segment-retrans=(tcpRetransSegs / tcpOutDataSegs) * 100

— oswprvtnet

Informacion de red

— oswtop

load averages: 0.11, 0.07, 0.06 12:50:36

The three numbers are the average of the depth of the run queue over the last 1, 5, and 15 minutes.
In this example we can see that .11 processes were on the run queue on average over the last minute,
.07 processes on average on the run queue over the last 5 minutes, etc.
It is important to determine what the average load of the system is through benchmarking and then look for deviations.
A dramatic rise in the load average can indicate a serious performance problem.

136 processes: 133 sleeping, 2 running, 1 on cpu

Memory: 2048M real, 1061M free, 542M swap in use, 1605M swap free

It reflects how much real and swap memory a computer has, and how much is free.
«Real» memory is the amount of RAM installed in the system, a.k.a. the «physical» memory. «Swap» is virtual memory stored on the machines disk.

What to Look For

Large run queue. Large number of processes waiting in the run queue may be an indication that your system does not have sufficient CPU capacity.
Process consuming lots of CPU. A process which is «hogging» CPU is always suspect. If this process is an oracle foreground process its most likely running an expensive query that should be tuned.
Oracle background process should not hog CPU for long periods of time.
High load averages. Processes should not be backed up on the run queue for extended periods of time.
Low swap space. This is an indication you are running low on memory.

— oswvmstat

r Number of processes that are in a wait state and basically not doing anything but waiting to run
b Number of processes that were in sleep mode and were interrupted since the last update
w Number of processes that have been swapped out by mm and vm subsystems and have yet to run.
swap The amount of swap space currently available free The size of the free list
pi kilobytes paged in
po kilobytes paged out

What to look for:
Large run queue

-- Instalacion

tar xvf oswbb.tar

chmod 744 *

-- Uninstall

rm -rf oswbb

-- Configuracion

nota: Para cambiar la ubicacion de los resultados

Opcion 1:

export OSWBB_ARCHIVE_DEST=/usr/app/archive

Opcion 2: Configurarlo en el 4th parametro

./startOSWbb 30 48 None /usr/app/archive

'nota: 3rd parametro indica el compresor para los resultados'
'nota: oswatcher deja un heartbeat file en /tmp osw.hb donde indica la ubicacion de los resultados. Este fichero se borra cuando se para Oswatcher'

-- Otras Variables de entorno

export OSW_PS_SAMPLE_MULTIPLIER=3

'nota: Indica cuantas veces se lanzara el comando PS. ej Configuramos un sampleo cada 20 seg. Pues configurando este valor a 3, se lanzará el ps
cada 60 seg (20 seg * 3)'

'nota: OSWatcher captura la informacion en un formato de fecha English. Para que sea de tipo Unix hacemos esto'

vi OSWatcher.sh

oswgCompliance=1



-- Añadir pluggins al oswatcher

'nota: Podemos crear y añadir nuestros propios scripts al oswatcher'

Ej:

cat >call_du.sh
#!/bin/sh

du >> $1

'$1 sera el directorio para dejar los datos'

cd $HOME_OSWATCHER

vi extras.txt
call_du.sh du oswdu 

'# shell_script utility_name directory_name
 # where shell_script = shell program to execute
 # where utility_name = name of this program 
 # where directory_name is directory name under the archive'

-- Start OSWatcher

nohup ./startOSWbb.sh 60 10 &

-- Stop OSWatcher

./stopOSWbb.sh

------------------------------
-- oswbba
------------------------------

java -version >= que 8

java -Duser.language=en_US -jar oswbba.jar -i C:\lmds\Papelera\archive

-Duser.language=en_US : por si la variable LANG es diferente entre origen y donde analizo los datos
-D		: Para que te genere un dashboard de la informacion
-A		: Para que genere un analisis de
-b Jan 9 13:15:00 2013 -e Jan 19 13:30:00 2013 : Fijamos el inicio y fin del analisis

/*
Parsing Completed.


Enter 1 to Display CPU Process Queue Graphs
Enter 2 to Display CPU Utilization Graphs
Enter 3 to Display CPU Other Graphs
Enter 4 to Display Memory Graphs
Enter 5 to Display Disk IO Graphs

Enter GC to Generate All CPU Gif Files
Enter GM to Generate All Memory Gif Files
Enter GD to Generate All Disk Gif Files
Enter GN to Generate All Network Gif Files

Enter L to Specify Alternate Location of Gif Directory
Enter Z to Zoom Graph Time Scale (Does not change analysis dataset)
Enter B to Returns to Baseline Graph Time Scale (Does not change analysis dataset)
Enter R to Remove Currently Displayed Graphs

Enter X to Export Parsed Data to Flat File
Enter S to Analyze Subset of Data(Changes analysis dataset including graph time scale)
Enter A to Analyze Data
Enter D to Generate DashBoard

Enter Q to Quit Program
*/

24/04/2019

Database – Transportable Tablespaces

Filed under: Database,Laboratorios,Recuperacion DB — mogukiller @ 5:14 pm

Presento un mecanismo de migración mediante transportable tablespace. En este caso no existe un cambio de plataforma. Adicionalmente añado como hacerlo con RMAN para evitar tener que poner los TS en READ-ONLY durante el proceso de pruebas de migración.

(more…)

08/02/2019

SQL – SPM Tabajar con Baselines

Filed under: SQL Tuning — mogukiller @ 2:58 pm
Tags:
Os dejo los procedimientos básicos para trabajar con baselines. En este laboratorio se construye un plan de ejecución y se le asigna a un sql_id ya cargado en la shared.
------------------------------------------
-- SQL - SQL Plan Baseline LABORATORIO
------------------------------------------
Fecha: 2019/02/04

Version 12.1.0.2

'Referencias:
	https://docs.oracle.com/database/121/TGSQL/tgsql_spm.htm#TGSQL94621
'
'
SQL plan management :
	- Mecanismo por el cual el optimizador siempre va a utilizar planes de ejecucion conocidos.
	- Utiliza el mecanismo SQL plan baseline. Conjunto de planes aceptados que el optimizador puede utilizar.
	- Un plan de ejecucion aceptado dentro de una base line contiene: SQL hashplan. Bind Values. Optimizer Environment
	- Componentes:
		- Plan Capture: 	Almacena informacion relevante de los planes de ejecucion de las queries.
		- Plan Selection: 	Detecta cambios en el plan de ejecucion y selecciona los planes mas apropiados.
		- Plan Evolution: 	Añade nuevos planes al SQL plan baseline. De forma manual o automatica.
	- Cuando la ejecucion de una query genera un plan de ejecucion nuevo que no esta en el SQL plan baseline, este se inserta en la holding area.
	Mas tarde se evaluara si el plan de ejecucion es mas optimo que el que se esta utilizando. Se es mas optimo ese plan promociona a la SQL plan baseline.
	- Se puede considerar un SQL Plan Baseline como un conjunto de planes de ejecucion aceptados
	- Plan Capture:	Se puede configurar de forma automatica o manual. 
		Automatica: OPTIMIZER_CAPTURE_SQL_PLAN_BASELINES
		Manual:		Se pueden capturar planes de ejecucion desde: Library Cache, STS, Staging Table, Stored Outline. El comportamiento es diferente,
					si la SQL plan baseline existe o no para esa query.
					Si no existe: 	Crea un plan history y un plan baseline. Marca el plan como aceptado. Añade el plan a la baseline.
					Si existe:		Marca el plan como aceptado. Añade el plan a la baseline sin berificar rendimiento
					Cualquier plan añadido manualmente se marca como ACEPTADO.
	- Plan Selection: 	Cuando la base de datos realizan un Hard Parse generando un plan de mejor coste. El optimizador intenta encontrar una coincidencia en la 
						SQL Plan Baseline de esa query. Si la baseline existe y el plan generado no esta en la baseline el optimizador lo marca como UNACCEPTED y
						lo añade al plan history. Si existen planes FIXED el optimizado utiliza el de menor coste. Sino existen FIXED el optimizador usa el de menor
						coste. Si por ejemplo se ha borrado un indice y todos los planes aceptados hacen referencia a ese indice se usara el nuevo plan.
	- Plan Evolution:	Previen que un plan que mejora una query, pueda perjudicar otras.
	
	- Storage Architecture
		- SQL Management Base (SMB) : Repositorio logico en el diccionario. Contiene:
			- SQL statement log (solo sql ids). Cuando captura se realiza de forma automatica. Se tiene en cuenta el SQL Text. View SQLLOG$
			- SQL plan history (SQL Plan Baselines). Contiene baselines y unaccepted plans 
			- SQL Profiles
			- SQL Patches
		- Enabled: 	Un plan de una baseline puede estar enabled aun estando unaccepted. Se puede configurar un plan como Disabled y el optimizador no lo vuelve
			a utilizar aunque este Accepted.
		- Accepted: Es un plan que esta en la baseline y puede usarse por el optimizador.
		- Fixed:	Es un plan aceptado y marcado como preferente. El optimizador unicamente considera esos plan de ejecucion.
'	
-- Queries:

cat >ver_baselines.sql

 COL SQL_HANDLE FOR A25
 COL PLAN_NAME FOR A30
 COL PARSING_SCHEMA_NAME FOR A20
 COL SQL_TEXT FOR A70
 SELECT 
	SQL_HANDLE
	,PLAN_NAME					
	,PARSING_SCHEMA_NAME	-- Schema
	,ENABLED
	,ACCEPTED
	,FIXED
	,EXECUTIONS
	,SQL_TEXT
 FROM DBA_SQL_PLAN_BASELINES 
 WHERE 1=1
	AND PARSING_SCHEMA_NAME = 'MOGU'
 ORDER BY CREATED;	
/*
SQL_HANDLE                PLAN_NAME                      PARSING_SCHEMA_NAME  ENA ACC FIX EXECUTIONS SQL_TEXT
------------------------- ------------------------------ -------------------- --- --- --- ---------- ----------------------------------------------------------------------
SQL_a7293c388afd8743      SQL_PLAN_afa9w725gv1u3f5bed313 MOGU                 YES YES NO           5 SELECT COL1 FROM T_SPM A WHERE COL1=:v_valor
SQL_a7293c388afd8743      SQL_PLAN_afa9w725gv1u3b15e74e7 MOGU                 NO  YES YES          2 SELECT COL1 FROM T_SPM A WHERE COL1=:v_valor
*/

cat >ver_cursor.sql
 
col sql_text for a70
col EXACT_MATCHING_SIGNATURE for 999999999999999999999999999999
SELECT SQL_ID,CHILD_NUMBER, EXACT_MATCHING_SIGNATURE, PLAN_HASH_VALUE, EXECUTIONS, SQL_TEXT FROM V$SQL WHERE SQL_TEXT LIKE '%T_SPM A%';

/*
SQL_ID        CHILD_NUMBER        EXACT_MATCHING_SIGNATURE PLAN_HASH_VALUE EXECUTIONS SQL_TEXT
------------- ------------ ------------------------------- --------------- ---------- ----------------------------------------------------------------------
cvt131a0uhdu8            0            12045224891926808387      3591932400          4 SELECT COL1 FROM T_SPM A WHERE COL1=:v_valor
8khv6xfmw5xc6            0             4304014121199009545      3211120540          2 SELECT/*+ FULL(A)  COL1 FROM T_SPM A WHERE COL1=:v_valor
*/ 
1.- Parametrizacion del entorno

'nota: Configuramos para que use baselines pero que no las genere de forma automatica'
 
ALTER SYSTEM SET OPTIMIZER_CAPTURE_SQL_PLAN_BASELINES = FALSE SCOPE=BOTH SID='*';
ALTER SYSTEM SET OPTIMIZER_USE_SQL_PLAN_BASELINES = TRUE SCOPE=BOTH SID='*';

'nota: Deshabilitamos Dinamic Sampling. Para evitar cambios de planes de ejecucion'

ALTER SYSTEM SET OPTIMIZER_DYNAMIC_SAMPLING=0 SCOPE=BOTH SID='*';

2.- Creamos una tabla con 1M de registros.

conn mogu/temporal1

CREATE TABLE T_SPM 
AS
SELECT
  dbms_random.random AS COL1,
  dbms_random.string('u',25) AS COL2 
FROM dual connect by level <1000000;
 
UPDATE T_SPM SET COL1=1 WHERE COL1'cvt131a0uhdu8',PLAN_HASH_VALUE =>3591932400);

PRINT :res

@ver_baselines.sql
 
/*
SQL_HANDLE                ORIGIN         PARSING_SCHEMA_NAME  ENA ACC FIX CREATED          EXECUTIONS SQL_TEXT
------------------------- -------------- -------------------- --- --- --- ---------------- ---------- ----------------------------------------------------------------------
SQL_a7293c388afd8743      MANUAL-LOAD    MOGU                 YES YES NO  2019-02-08 12:59          5 SELECT COL1 FROM T_SPM A WHERE COL1=:v_valor
*/

exec :res := DBMS_SPM.LOAD_PLANS_FROM_CURSOR_CACHE( sql_id => '8khv6xfmw5xc6', plan_hash_value => 3211120540, sql_handle => 'SQL_a7293c388afd8743');
PRINT :res
/*
       RES
----------
         1
*/		 
 
@ver_baselines.sql 
 
/*
SQL_HANDLE                ORIGIN         PARSING_SCHEMA_NAME  ENA ACC FIX CREATED          EXECUTIONS SQL_TEXT
------------------------- -------------- -------------------- --- --- --- ---------------- ---------- ---------------------------------------------
SQL_a7293c388afd8743      MANUAL-LOAD    MOGU                 YES YES NO  2019-02-08 12:59          5 SELECT COL1 FROM T_SPM A WHERE COL1=:v_valor
SQL_a7293c388afd8743      MANUAL-LOAD    MOGU                 YES YES NO  2019-02-08 13:05          2 SELECT COL1 FROM T_SPM A WHERE COL1=:v_valor

SQL_HANDLE                PLAN_NAME                      EXECUTIONS
------------------------- ------------------------------ ----------
SQL_a7293c388afd8743      SQL_PLAN_afa9w725gv1u3b15e74e7          2
SQL_a7293c388afd8743      SQL_PLAN_afa9w725gv1u3f5bed313          5
*/

'Nota: Para revisar el plan de ejecucion asociado a la baseline'

SET LINESIZE 400
SET PAGESIZE 2000
SELECT t.*
  FROM TABLE(DBMS_XPLAN.DISPLAY_SQL_PLAN_BASELINE(
      plan_name       =>  'SQL_PLAN_afa9w725gv1u3b15e74e7'
	  ,format		  =>  'TYPICAL'))t;
	  
/*
--------------------------------------------------------------------------------
Plan name: SQL_PLAN_afa9w725gv1u3b15e74e7         Plan id: 2975757543
Enabled: YES     Fixed: NO      Accepted: YES     Origin: MANUAL-LOAD
Plan rows: From dictionary
--------------------------------------------------------------------------------

Plan hash value: 3211120540

---------------------------------------------------------------------------
| Id  | Operation         | Name  | Rows  | Bytes | Cost (%CPU)| Time     |
---------------------------------------------------------------------------
|   0 | SELECT STATEMENT  |       |       |       |  1476 (100)|          |
|*  1 |  TABLE ACCESS FULL| T_SPM |     1 |     8 |  1476   (1)| 00:00:01 |
---------------------------------------------------------------------------
*/

'nota: Fijamos el plan'

SET SERVEROUTPUT ON
DECLARE
  l_plans_altered  PLS_INTEGER;
BEGIN
  l_plans_altered := DBMS_SPM.alter_sql_plan_baseline(
    sql_handle      => 'SQL_a7293c388afd8743',
    plan_name       => 'SQL_PLAN_afa9w725gv1u3b15e74e7',
    attribute_name  => 'fixed',
    attribute_value => 'YES');

  DBMS_OUTPUT.put_line('Plans Altered: ' || l_plans_altered);
END;
/
/*
Plans Altered: 1
*/

@ver_baselines.sql
 
/*
SQL_HANDLE                PLAN_NAME                      PARSING_SCHEMA_NAME  ENA ACC FIX EXECUTIONS SQL_TEXT
------------------------- ------------------------------ -------------------- --- --- --- ---------- ----------------------------------------------------------------------
SQL_a7293c388afd8743      SQL_PLAN_afa9w725gv1u3f5bed313 MOGU                 YES YES NO           5 SELECT COL1 FROM T_SPM A WHERE COL1=:v_valor
SQL_a7293c388afd8743      SQL_PLAN_afa9w725gv1u3b15e74e7 MOGU                 YES YES YES          2 SELECT COL1 FROM T_SPM A WHERE COL1=:v_valor
*/

	  
'nota: Validamos que coje el plan fijado por baseline'

EXEC :v_valor := 10 'nota: Valor muy selectivo.'

SELECT COL1 FROM T_SPM A WHERE COL1=:v_valor;

/*

Execution Plan
----------------------------------------------------------
Plan hash value: 3211120540

---------------------------------------------------------------------------
| Id  | Operation         | Name  | Rows  | Bytes | Cost (%CPU)| Time     |
---------------------------------------------------------------------------
|   0 | SELECT STATEMENT  |       |     1 |     8 |  1478   (1)| 00:00:01 |
|*  1 |  TABLE ACCESS FULL| T_SPM |     1 |     8 |  1478   (1)| 00:00:01 |
---------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   1 - filter("COL1"=TO_NUMBER(:V_VALOR))

Note
-----
   - SQL plan baseline "SQL_PLAN_afa9w725gv1u3b15e74e7" used for this statement <<<< 'SQL_a7293c388afd8743',
    plan_name       => 'SQL_PLAN_afa9w725gv1u3b15e74e7',
    attribute_name  => 'ENABLED',
    attribute_value => 'NO');

  DBMS_OUTPUT.put_line('Plans Altered: ' || l_plans_altered);
END;
/

@ver_baselines
/*
SQL_HANDLE                PLAN_NAME                      PARSING_SCHEMA_NAME  ENA ACC FIX EXECUTIONS SQL_TEXT
------------------------- ------------------------------ -------------------- --- --- --- ---------- ----------------------------------------------------------------------
SQL_a7293c388afd8743      SQL_PLAN_afa9w725gv1u3f5bed313 MOGU                 YES YES NO           5 SELECT COL1 FROM T_SPM A WHERE COL1=:v_valor
SQL_a7293c388afd8743      SQL_PLAN_afa9w725gv1u3b15e74e7 MOGU                 NO  YES YES          2 SELECT COL1 FROM T_SPM A WHERE COL1=:v_valor
*/


'Nota Para borrar una baseline'

SET SERVEROUTPUT ON
declare
  l_plans_altered  pls_integer;
begin
  l_plans_altered := dbms_spm.drop_sql_plan_baseline(
	  sql_handle => 'SQL_a7293c388afd8743',
	  plan_name  => 'SQL_PLAN_afa9w725gv1u3b15e74e7');
  DBMS_OUTPUT.put_line('Plans Altered: ' || l_plans_altered);
end;
/

/*
SQL_HANDLE                PLAN_NAME                      PARSING_SCHEMA_NAME  ENA ACC FIX EXECUTIONS SQL_TEXT
------------------------- ------------------------------ -------------------- --- --- --- ---------- ----------------------------------------------------------------------
SQL_a7293c388afd8743      SQL_PLAN_afa9w725gv1u3f5bed313 MOGU                 YES YES NO           5 SELECT COL1 FROM T_SPM A WHERE COL1=:v_valor
*/

31/10/2018

Database – Remove Chained Rows

Filed under: Database — mogukiller @ 3:51 pm
Tags:

Hay que diferenciar entre chained rows y migrated rows. La primera se origina cuando un registro no cabe en un bloque y es necesario originar bloques encadenados para almacenar el bloque. El segundo se origina cuando se hace un update del registro y el resultado no cabe en el bloque, ahí Oracle genera un puntero y mueve el registro a un bloque nuevo.

A continuación muestro 3 posibles opciones para limpiar las filas migradas:

(more…)

24/10/2018

DATABASE – Resize database -MGMTDB

Filed under: Database — mogukiller @ 12:14 pm
Tags:

Cuando queremos crearnos una maqueta de 12.2 no podemos prescindir del repositorio de Cluster Health Monitor, la base de datos -MGMTDB. Para crear esta base de datos el instalador requiere de 40GB de diskgroup.
A continuación os dejo el procedimiento para hacer el resize de esa base de datos y dejarla en unos 3G.

Version: 12.2.0.1

Referencias:
	MDBUtil: GI Management Repository configuration tool (Doc ID 2065175.1)
	How to Move/Recreate GI Management Repository (GIMR / MGMTDB) to Different Shared Storage (Diskgroup, CFS or NFS etc) (Doc ID 1589394.1)

-- Deshabilitamos CHM
crsctl stop res ora.crf -init
crsctl modify res ora.crf -attr ENABLED=0 -init


ALTER SESSION SET CONTAINER = GIMR_DSCREP_10;

CREATE USER MOGU identified by temporal1;
GRANT CONNECT TO MOGU;
GRANT DBA TO MOGU;

CREATE OR REPLACE DIRECTORY EXPORT AS '/export/home/oracle/export';
GRANT WRITE, READ ON DIRECTORY EXPORT TO MOGU;

GIMR_DSCREP_10 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.163.1.100)(PORT = 1525))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = gimr_dscrep_10)
    )
  )

-- como backup
expdp MOGU/temporal1@GIMR_DSCREP_10 dumpfile=exp_schema_cha.dmp  directory=export nologfile=yes schemas=CHA
ALTER SESSION SET CONTAINER = GIMR_DSCREP_10;
DROP USER CHA CASCADE;
DROP TABLESPACE SYSMGMTDATACHAFIX INCLUDING CONTENTS AND DATAFILES;
CREATE TABLESPACE SYSMGMTDATACHAFIX DATAFILE SIZE 200M;
impdp MOGU/temporal1@GIMR_DSCREP_10 dumpfile=exp_schema_cha.dmp  directory=export nologfile=yes schemas=CHA;


GRANT READ ON SYS.V_$ASM_DISKGROUP  TO CHA; 
GRANT READ ON SYS.V_$EVENT_NAME     TO CHA; 
GRANT READ ON SYS.V_$SESSION        TO CHA; 
GRANT READ ON SYS.DBA_DATA_FILES    TO CHA;
GRANT EXECUTE ON DBMS_CRYPTO   TO CHA;
GRANT EXECUTE ON DBMS_LOCK     TO CHA;
GRANT EXECUTE ON DBMS_SYSTEM   TO CHA;

ALTER PACKAGE CHA.CHA_CAL_DATA     COMPILE;
ALTER PACKAGE CHA.CHA_LCMGMT       COMPILE;
ALTER PACKAGE CHA.CHA_TEMP_MODEL   COMPILE;
ALTER PACKAGE CHA.FTE_MGMT         COMPILE;
ALTER PROCEDURE  CHA.GLOBAL_LOCK   COMPILE;


ALTER DATABASE DATAFILE '+DATA2/_MGMTDB/78F606F9409B08BDE054080027A68F12/DATAFILE/sysmgmtdata.282.990353579' RESIZE 200M;
ALTER DATABASE DATAFILE '+DATA2/_MGMTDB/78F606F9409B08BDE054080027A68F12/DATAFILE/syscalogdata.281.990353553' RESIZE 100M;
ALTER DATABASE DATAFILE '+DATA2/_MGMTDB/78F606F9409B08BDE054080027A68F12/DATAFILE/sysmgmtdatadb.283.990353639' RESIZE 200M;

-- Redimensionamos los redologs.

ALTER DATABASE  ADD LOGFILE SIZE 100M;
ALTER DATABASE  ADD LOGFILE SIZE 100M;
ALTER DATABASE  ADD LOGFILE SIZE 100M;

ALTER DATABASE DROP LOGFILE GROUP 2;
ALTER DATABASE DROP LOGFILE GROUP 3;

alter system switch logfile;
alter system checkpoint;

ALTER DATABASE DROP LOGFILE GROUP 1;

Validamos el tamaño:

/*
Diskgroup / DB Name                      File Type                    Space MB Sys?
---------------------------------------- ------------------ ------------------ ----
+DATA2/ASM                               PASSWORD                            0    Y
****************************************                    ------------------
                                                                             0

+DATA2/clmds                             OCRFILE                           160    Y
                                         OCRBACKUP                           8    Y
                                         ASMPARAMETERFILE                    1    Y
****************************************                    ------------------
                                                                           169

+DATA2/_mgmtdb                           DATAFILE                        3,308    Y
                                         TEMPFILE                          246    Y
                                         ONLINELOG                         306    Y
                                         CONTROLFILE                        24    Y
                                         PARAMETERFILE                       1    Y
****************************************                    ------------------
                                                                         3,885

+DATA2/orapwasm                          PASSWORD                            0    N
****************************************                    ------------------
                                                                             0

+DATA2/orapwasm_backup                   PASSWORD                            0    N
****************************************                    ------------------
                                                                             0

                                                            ------------------
Grand Total:                                                             4,054
*/

-- Intentamos parar la instancia -MGMTDB

su - grid
export ORACLE_SID=-MGMTDB
SQL> shutdown immediate

crsctl status resurce ora.mgmtdb -p
srvctl disable mgmtdb



27/05/2018

DATABASE – Validar si ORACLE_HOME esta creado para RAC o para Standalone

Filed under: Database — mogukiller @ 4:06 pm

Cuando no estamos seguros si un home de oracle pertenece a un RAC o se ha creado como Standalone podemos seguir los pasos de la siguiente nota:

Referencia: How to Check Whether Oracle Binary/Instance is RAC Enabled and Relink Oracle Binary in RAC (Doc ID 284785.1)

(more…)

16/04/2018

DATABASE – Materialized Views

Filed under: Database — mogukiller @ 10:19 am

Pongo un tutorial sencillo para la creacion y administracion de vistas materializadas. Hay mucho mas que cortar aqui. Pero para lo que necesito me sobra y me basta.
(more…)

11/04/2018

DATABASE – Access Control List (ACL)

Filed under: Database — mogukiller @ 11:56 am

Cuando quieres tener un control de quien y como se utilizan los paquetes que usan el protocolo TCP es necesario que configures en tu base de datos las listas de control de acceso o ACL.

Os dejo un pequeño laboratorio donde configuro y gestiono ACL en bases de datos version 12.1.0.2 y 11.2.0.4.

(more…)

22/03/2018

Database – Advanced Row Compression

Filed under: Database — mogukiller @ 1:40 pm

Recordar que habilitar la compresión de Advanced Row Compression requiere del licenciamiento de Advanced Compression.
Advance Row Compression esta destinada a entornos transaccionales OLTP o DatawareHouse.
Os dejo un pequeño manual para configurar ARC utilizando ALTER TABLE .. MOVE. Adicionalmente pongo como analizar previamente el ratio de compresion con DBMS_COMPRESSION o que tablas son susceptibles de comprimir utilizando Heat Maps.

(more…)

11/03/2018

Database – LogMiner Tutorial

Filed under: Database,Troubleshooting — mogukiller @ 9:59 am
Tags:

LogMiner es una herramienta que nos permite analizar las transacciones presentes en el redo de los archiver logs. Para mapear los identificadores que hay en el redo con los objetos de base de datos es necesario indicar a LogMiner donde encontrar el diccionario. El diccionario lo pudemos obtener de dos maneras.

Utilizando el diccionario directamente de base de datos o extraer una foto de un instante de tiempo y almacenarla en los redo. Yo personalmente utilizo el online de la base de datos, pero en el caso que se modificase la definición de la tabla en las sql anteriores me empezarían a aparecer valores del tipo HEXTORAW(‘6161’).
(more…)

Página siguiente »

Crea una web o blog en WordPress.com