1 Nuevas características Oracle11g Hector Gabriel Ulloa Ligarius13 de Abril del 2009 Hector Gabriel Ulloa Ligarius OCP Oracle 11g Oracle Database 11g Top New Features : Summary 11g New Features : Top 5 Features In 11g
2 Lanzamiento en New York , USA11 Julio 2007
3 Oracle 11g Result Cache SQL Query Result CachePL/Sql Function Result Cache 11g New Feature PL/SQL Function Result Cache 11g New Feature : SQL Query Result Cache
4 Oracle 11g Result Cache : SQL Query Result CacheParámetro RESULT_CACHE_MODE : MANUAL o FORCE MANUAL con hint /*+ result_cache */ FORCE con hint /*+ no_result_cache */ Parámetro RESULT_CACHE_MAX_RESULT 11g New Feature : SQL Query Result Cache SQL Query Result Cache Shared Pool < 75%
5 Oracle 11g Result Cache : SQL Query Result CacheDBMS_RESULT_CACHE.MEMORY_REPORT Restricciones : Diccionario de datos , secuencia.nextval y secuencia.currval Invalidaciones en memoria 11g New Feature : SQL Query Result Cache
6 Oracle 11g Result Cache : Pl/Sql Function Result CacheRestricciones : Modo OUT, ni IN con BLOB , ni con REF CURSOR , tampoco bloque anónimos Modo de trabajo : Verifica los parámetros de entrada de la función (sólo IN) 11g New Feature PL/SQL Function Result Cache Vistas : V$RESULT_CACHE_OBJECTS
7 Oracle 11g Result Cache : Pl/Sql Function Result CacheEjemplo (relies_on Tablas o vistas en que la función tiene dependencia) Create or replace function get_name (id number) return varchar2 result_cache relies_on(emp) is v_return varchar2(30); begin select ename into v_return from emp where empno=id; Return v_return; end; / 11g New Feature PL/SQL Function Result Cache
8 Oracle 11g Invisible indexes OPTIMIZER_USE_INVISIBLE_INDEXESTRUE o FALSE Para testing o índices temporales Mantenidos en DML operations, no como los UNUSABLES 11g New Feature : Invisible Index Nueva columna VISIBILITY
9 Oracle 11g Invisible indexes EjemploCREATE INDEX emp_ename ON emp(ename) TABLESPACE users STORAGE (INITIAL 20K NEXT 20k PCTINCREASE 75) INVISIBLE; 11g New Feature : Invisible Index ALTER INDEX index_name [VISIBLE | INVISIBLE]
10 Oracle 11g Sequences without Select Antes Select secuencia.nextvalInto variable From dual; Sequences in PL/SQL Expressions Ahora variable := secuencia.nextval;
11 Oracle 11g Global ADDM – en RAC Antes : Sólo vistas GV$Ahora : Database ADDM Página 49 : Oracle Press 11g : New Features for Administrators
12 Uso excesivo de Global ResourcesOracle 11g Global ADDM – en RAC Uso excesivo de Global Resources Hot Blocks Database Tráfico Interconnect Latencias de red Página 49 : Oracle Press 11g : New Features for Administrators Instance
13 Oracle 11g Data Recovery AdvisorHerramienta automática para detección de fallas , a nivel de bloques, pérdida de dbf , por ejemplo Reparación manual o a través del Advisor Repara bases de datos inactivas, montadas o abiertas Data Recovery Advisor -Reference Guide 11g Data Recovery Advisor: How to recover from missing datafile Distintas interfaces de trabajo
14 Oracle 11g Data Recovery AdvisorArquitecturas soportadas : Sólo single Database Arquitecturas No soportadas : RAC , ni reparaciones sobre la StandBy Interfaces : Recovery Manager , Grid Control , Database Control Data Recovery Advisor -Reference Guide 11g Data Recovery Advisor: How to recover from missing datafile En RMAN : RMAN> list failure all;
15 Oracle 11g Real Application Testing : Database ReplayCreación de ambientes de Test muy muy similares a producción. Forma segura de validar , upgrades, parches, creación de índices. El problema mas recurrente es equiparar la carga de trabajo en test .
16 Oracle 11g Real Application Testing : Database Replay
17 Oracle 11g Partitioning Reference PartitioningTransportable Tablespace Partitioning 11g Partitioning Enhancements Virtual Columns Partitioning
18 Oracle 11g Reference PartitioningProblemas al particionar tablas por columnas que no existen Capacidad para particionar una tabla a través de su llave foránea El principal problema al momento de particionar , es que no todas las tablas tienen los mismos campos para particionar
19 Oracle 11g Reference Partitioning Ejemplo create table customers( cust_id number primary key, cust_name varchar2(200), rating varchar2(1) not null ) partition by list (rating) ( partition pA values ('A'), partition pB values ('B') ); create table sales ( sales_id number primary key, cust_id number not null, sales_amt number, constraint fk_sales_01 foreign key (cust_id) references customers ) partition by reference (fk_sales_01); El principal problema al momento de particionar , es que no todas las tablas tienen los mismos campos para particionar
20 Particionar una tabla mediante una columna calculadaOracle 11g Virtual Columns Partitioning Particionar una tabla mediante una columna calculada Ejemplo : create table sales ( sales_id number, cust_id number, sales_amt number, sale_category varchar2(6) generated always as Sólo por claridad ( case when sales_amt <= then 'LOW' else 'ULTRA' end ) virtual ) partition by list (sale_category) ( partition p_low values ('LOW'), partition p_ultra values ('ULTRA')) El principal problema al momento de particionar , es que no todas las tablas tienen los mismos campos para particionar
21 Oracle 11g Sensitive Password Por defecto habilitadoParámetro SEC_CASE_SENSITIVE_LOGIN El upgrade desde 10g,mantiene las password en 11g 11g R1 New Feature : Case Sensitive Passwords and Strong User Authentication El orapwd también permite password sensitive DBA_USERS.PASSWORD_VERSIONS
22 Oracle 11g Hot Patching Permite instalar parches con la base arribaCon utilitario OPatch OPatch detecta conflictos entre patchset Disponible para ambientes en RAC Restricciones : Sólo linux x86 y Solaris SPARC
23 Oracle 11g AMM : Automatic Memory Management En Oracle 10g : ASMMEn Oracle 11g : AMM Automatic Memory Management(AMM) on 11g How To Use Automatic Shared Memory Management (ASMM) In Oracle10g
24 Oracle 11g AMM : Automatic Memory ManagementAutomatic Memory Management(AMM) on 11g How To Use Automatic Shared Memory Management (ASMM) In Oracle10g
25 Oracle 11g Virtual columnsNo consumen espacio, se calculan “on the fly” antes se calculaban con triggers Se pueden crear índices No soportado para IOT, EXTERNAL, CLUSTER ni TEMPORARY Definición de la tabla en DBA_TAB_COLUMNS.DATA_DEFAULT
26 Oracle 11g Virtual columns Ejemplo : Create table employee( emp_id number primary key, salary number (8,2) not null, years_of_service number not null, curr_retirement as (salary*.0005 * years_of_service) ); select table_name, column_name, data_default from dba_tab_columns where table_name='EMPLOYEE' and column_name='CURR_RETIREMENT'; TABLE_NAME COLUMN_NAME DATA_DEFAULT EMPLOYEE CURR_RETIREMENT "SALARY"*.0005*"YEARS_OF_SERVICE"
27 Se debe tener Wallet OpenOracle 11g TTE : Transparent Tablespace Encryption TDE en Oracle 10g TTE en Oracle 11g Encriptación física 11g New Feature : Transparent Data Encryption at Tablespace Level Se debe tener Wallet Open Exp/Imp no soportado
28 Oracle 11g TTE : Transparent Tablespace Encryption Implementación :Se crea el Wallet SQL> alter system set wallet open identified by “wallet1"; b) En Oracle 10g se encripta la columna SQL> alter table ejemplo modify campo1 encrypt; c) En Oracle 11g se crea un tablespace encriptado SQL> create tablespace EJEMPLO_TTE ENCRYPTION default storage (ENCRYPT) datafile ‘ruta/datafile.dbf’ size XMB; 11g New Feature : Transparent Data Encryption at Tablespace Level d) En Oracle 11g se crea el segmento en este TBS
29 Oracle 11g Recovery Manager Data Recovery AdvisorNo sólo respalda archives desde la FRA, sino también desde otras log_archive_dest_* (alternativas a posible corrupción en la FRA) RMAN 11G : Data Recovery Advisor - RMAN command line example RMAN 11G : Import Catalog Nuevo formato de compresión : ZLIB (licenciado) en vez de BZIP2
30 Oracle 11g Recovery Manager Interfile Backup ParallelismChequeo de consistencia Las políticas de retención también son aplicadas a los log_archive_dest_* , no tan sólo a la FRA RMAN 11G : Data Recovery Advisor - RMAN command line example RMAN 11G : Import Catalog Adiós UNDO (Bypass the undo committed data) sólo guarda pequeñas cantidades de UNDO (backup optimization = ON)
31 Oracle 11g Recovery Manager : Data Recovery AdvisorERROR at line 1: ORA-01116: error in opening database file 18 ORA-01110: data file 4: '/ruta produccion/PAGOS018.dbf' ORA-27041: unable to open file Linux Error: 2: No such file or directory Additional information: 3 RMAN> list failure; using target database control file instead of recovery catalog List of Database Failures ========================= Failure ID Priority Status Time Detected Summary HIGH OPEN APR One or more non-system datafiles are missing RMAN 11G : Data Recovery Advisor - RMAN command line example RMAN 11G : Import Catalog
32 Oracle 11g Recovery Manager : Data Recovery AdvisorRMAN> list failure 196 detail; Exacta causa del error RMAN> advise failure; Automated Repair Options ======================== Option Repair Description Restore and recover datafile 18 Strategy: The repair includes complete media recovery with no data loss Repair script: $ORACLE_BASE/app/diag/rdbms/
33 Oracle 11g Recovery Manager : Data Recovery AdvisorRMAN> repair failure preview; Muestra pasos a seguir Restore, recover, etc RMAN> repair failure; Aplica pasos RMAN 11G : Data Recovery Advisor - RMAN command line example RMAN 11G : Import Catalog
34 Oracle 11g Recovery Manager : Chequeo ConsistenciaRMAN> Validate database; RMAN> Validate tablespace xxxxx; RMAN> Validate datafile xxxxx; RMAN 11G : Data Recovery Advisor - RMAN command line example RMAN 11G : Import Catalog RMAN> Validate datafile xxxxx block xxxx; Se puede validar SPFILE, CONTROLFILECOPY, FRA,etc
35 Oracle 11g Recovery Manager : Chequeo ConsistenciaRMAN> validate check logical datafile 2; Starting validate at 2008/11/10 09:52:36 using target database control file instead of recovery catalog channel ORA_DISK_1: starting validation of datafile channel ORA_DISK_1: specifying datafile(s) for validation input datafile file number=00002 name=/oradata/V11/sysaux01.dbf channel ORA_DISK_1: validation complete, elapsed time: 00:00:25 List of Datafiles ================= File Status Marked Corrupt Empty Blocks Blocks Examined High SCN OK 0 28279 File Name: /oradata/V11/sysaux01.dbf Block Type Blocks Failing Blocks Processed Data 0 21440 RMAN 11G : Data Recovery Advisor - RMAN command line example RMAN 11G : Import Catalog
36 Oracle 11g FDA : Flashback Data Archive Flashback query en 9isin UNDO no hay FlashBack Flashback version query en 10g sin UNDO no hay FlashBack 11g feature: Flashback Data Archive Guide Flashback Data Archive en 11g sin UNDO , hay FlashBack
37 Mínima performance , mínimo storage (compress)Oracle 11g FDA : Flashback Data Archive Implementación : Se crea usuario administrador con privilegios FLASBACK ARCHIVE ADMINISTER Se otorgan el privilegio flashback archive a un usuario c) Se crea área de archive SQL> create flashback archive
38 Flujo proceso Background FBDA (Flashback Data Archive)Oracle 11g FDA : Flashback Data Archive Flujo proceso Background FBDA (Flashback Data Archive) Se inicia con la base de datos FBDA trabaja primero sobre el Undo en el Buffer Cache Si el dato ya no esta en el buffer cache, lo va a buscar a los UNDO Segments Toda la información capturada , es dejada en las tablas pertinentes en el FDA 11g feature: Flashback Data Archive Guide
39 Oracle 11g FTB : Flashback Transaction BackoutPermite devolver transacciones ya comiteadas y sus dependencias Mediante OEM DBMS_FLASHBACK. TRANSACTION_BACKOUT V$TRANSACTION
40 Oracle 11g DDL Lock TimeoutError recurrente al intentar modificar un objeto ORA-00054: resource busy ¿Cómo saber cuando ejecutar el comando? 11g Locking Enhancements DDL_LOCK_TIMEOUT Behavior in 11G Parámetro DDL_LOCK_TIMEOUT de 1 a 1millón de segundos (11,5 horas)
41 Oracle 11g New Alert Log El archivo de alertas es escrito en formato XML Ubicación : $ORACLE_HOME/diag/rdbms/
42 Oracle 11g New Alert Log Lo que se debe saberADR : Automatic Diagnostic Repository (Estructura de directorios): Contiene todos los trace , core files, archivos de alertas (RAC,ASM,CRS) ADR :Ubicado en el parámetro DIAGNOSTIC_DEST Finding alert.log file in 11g 11g Understanding Automatic Diagnostic Repository ADR :Se puede consultar la vista V$DIAG_INFO
43 Oracle 11g New Alert Log →diag →rdbmsNombre Directorio Descripción Todo dentro del valor del parámetro DIAGNOSTIC_DEST →diag →rdbms →
44 Oracle 11g New Alert Log : Utilitario ADRCIPara ejecutar el utilitario ADRCI $ $ORACLE_HOME/bin/adrci Para mostrar todos los HOME de las distintas instancias en el motor adrci> show homes Finding alert.log file in 11g 11g Understanding Automatic Diagnostic Repository Para visualizar el archivo de alertas de un home en particular adrci> set homepath diag/rdbms/PROD/PROD1 adrci> show alert adrci> show alert –tail 50
45 Oracle 11g Spfile and Memory values Crear spfile desde pfileCrear pfile desde spfile Crear spfile | pfile desde memoria
46 Oracle 11g Add Column with default ValuesEn Oracle 10g, añadir una columna con default values podría demorar mucho y utilizaría demasiados recursos En Oracle 11g, añadir una columna con default values es instantáneo y sólo le asigna el default, cuando se consulta el registro
47 Oracle 11g Tables Read Only En Oracle10g, se emula el READ ONLYrevocando el SELECT En Oracle11g, simplemente se ejecuta SQL> ALTER TABLE
48 Oracle 11g Dataguard Compresión de los archive logs, envíadosa la StandBy Consultas en la StandBy al mismo tiempo que se aplican los archives Snapshots Database
49 Oracle 11g Space Management Coordinator Nuevo proceso BackgroundAutoextensiones a nivel de Tablespace Solicita el espacio a nivel de segmentos temporales
50 Oracle 11g Shrinking Temporary TablespaceSiempre permanecen al 100% y creciendo Se reutiliza el espacio por consultas o usuarios Si deseo reutilizar espacio para reasignar a otro tablespace, debo recrear , siempre y cuando no haya operaciones de sort en curso How To Shrink A Temporary Tablespace in 11G ? En Oracle11g se puede hacer un Shrink
51 Oracle 11g Shrinking Temporary TablespaceSQL> alter tablespace
52 Oracle 11g Rebuild online IndexEn Oracle 10g , las DML no se veían afectadas En Oracle 11g , las DML tampoco se ven afectadas How To Shrink A Temporary Tablespace in 11G ? ¿En qué se diferencian?
53 Oracle 11g Referencias : Oracle Database 11g Top New Features : Summary : 11g New Features : Top 5 Features In 11g : 11g New Feature PL/SQL Function Result Cache : 11g New Feature : SQL Query Result Cache : 11g New Feature : Invisible Index : Sequences in PL/SQL Expressions : Data Recovery Advisor -Reference Guide. : 11g Data Recovery Advisor: How to recover from missing datafile : 11g Partitioning Enhancements : 11g R1 New Feature : Case Sensitive Passwords and Strong User Authentication : Automatic Memory Management(AMM) on 11g
54 Oracle 11g Referencias : How To Use Automatic Shared Memory Management (ASMM) In Oracle10g : 11g New Feature : Transparent Data Encryption at Tablespace Level : RMAN 11G : Data Recovery Advisor - RMAN command line example : RMAN 11G : Import Catalog : 11g feature: Flashback Data Archive Guide. : 11g Locking Enhancements : DDL_LOCK_TIMEOUT Behavior in 11G : Finding alert.log file in 11g : 11g Understanding Automatic Diagnostic Repository. : 11g New Feature: Read-Only Tables : How To Shrink A Temporary Tablespace in 11G ?
55 Preguntas
56 Muchas gracias!!! Nos vemos en Oracle 12g