Nuevas características Oracle11g Hector Gabriel Ulloa Ligarius 13 de Abril del 2009 Hector Gabriel Ulloa Ligarius OCP Oracle 11g hulloa@inmotion.cl Oracle Database 11g Top New Features : Summary 466931.1 11g New Features : Top 5 Features In 11g 453487.1
Lanzamiento en New York , USA 11 Julio 2007
Oracle 11g Result Cache SQL Query Result Cache PL/Sql Function Result Cache 11g New Feature PL/SQL Function Result Cache 430887.1 11g New Feature : SQL Query Result Cache 453567.1
Oracle 11g Result Cache : SQL Query Result Cache Pará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 453567.1 SQL Query Result Cache Shared Pool < 75%
Oracle 11g Result Cache : SQL Query Result Cache DBMS_RESULT_CACHE.MEMORY_REPORT Restricciones : Diccionario de datos , secuencia.nextval y secuencia.currval Invalidaciones en memoria 11g New Feature : SQL Query Result Cache 453567.1
Oracle 11g Result Cache : Pl/Sql Function Result Cache Restricciones : 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 430887.1 Vistas : V$RESULT_CACHE_OBJECTS
Oracle 11g Result Cache : Pl/Sql Function Result Cache Ejemplo (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 430887.1
Oracle 11g Invisible indexes OPTIMIZER_USE_INVISIBLE_INDEXES TRUE o FALSE Para testing o índices temporales Mantenidos en DML operations, no como los UNUSABLES 11g New Feature : Invisible Index - 453295.1 Nueva columna VISIBILITY
Oracle 11g Invisible indexes Ejemplo CREATE INDEX emp_ename ON emp(ename) TABLESPACE users STORAGE (INITIAL 20K NEXT 20k PCTINCREASE 75) INVISIBLE; 11g New Feature : Invisible Index - 453295.1 ALTER INDEX index_name [VISIBLE | INVISIBLE]
Oracle 11g Sequences without Select Antes Select secuencia.nextval Into variable From dual; Sequences in PL/SQL Expressions 433068.1 Ahora variable := secuencia.nextval;
Oracle 11g Global ADDM – en RAC Antes : Sólo vistas GV$ Ahora : Database ADDM Página 49 : Oracle Press 11g : New Features for Administrators
Uso excesivo de Global Resources Oracle 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
Oracle 11g Data Recovery Advisor Herramienta 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. 466682.1 11g Data Recovery Advisor: How to recover from missing datafile 465946.1 Distintas interfaces de trabajo
Oracle 11g Data Recovery Advisor Arquitecturas 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. 466682.1 11g Data Recovery Advisor: How to recover from missing datafile 465946.1 En RMAN : RMAN> list failure all;
Oracle 11g Real Application Testing : Database Replay Creació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 .
Oracle 11g Real Application Testing : Database Replay
Oracle 11g Partitioning Reference Partitioning Transportable Tablespace Partitioning 11g Partitioning Enhancements 452447.1 Virtual Columns Partitioning
Oracle 11g Reference Partitioning Problemas 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
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
Particionar una tabla mediante una columna calculada Oracle 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 <= 10000 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
Oracle 11g Sensitive Password Por defecto habilitado Pará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 429465.1 El orapwd también permite password sensitive DBA_USERS.PASSWORD_VERSIONS
Oracle 11g Hot Patching Permite instalar parches con la base arriba Con utilitario OPatch OPatch detecta conflictos entre patchset Disponible para ambientes en RAC Restricciones : Sólo linux x86 y Solaris SPARC
Oracle 11g AMM : Automatic Memory Management En Oracle 10g : ASMM En Oracle 11g : AMM Automatic Memory Management(AMM) on 11g 443746.1 How To Use Automatic Shared Memory Management (ASMM) In Oracle10g 295626.1
Oracle 11g AMM : Automatic Memory Management Automatic Memory Management(AMM) on 11g 443746.1 How To Use Automatic Shared Memory Management (ASMM) In Oracle10g 295626.1
Oracle 11g Virtual columns No 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
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"
Se debe tener Wallet Open Oracle 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 432776.1 Se debe tener Wallet Open Exp/Imp no soportado
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 432776.1 d) En Oracle 11g se crea el segmento en este TBS
Oracle 11g Recovery Manager Data Recovery Advisor No 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 762339.1 RMAN 11G : Import Catalog 419173.1 Nuevo formato de compresión : ZLIB (licenciado) en vez de BZIP2
Oracle 11g Recovery Manager Interfile Backup Parallelism Chequeo 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 762339.1 RMAN 11G : Import Catalog 419173.1 Adiós UNDO (Bypass the undo committed data) sólo guarda pequeñas cantidades de UNDO (backup optimization = ON)
Oracle 11g Recovery Manager : Data Recovery Advisor ERROR 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 ---------- -------- --------- ------------- ------- 196 HIGH OPEN 10-APR-09 One or more non-system datafiles are missing RMAN 11G : Data Recovery Advisor - RMAN command line example 762339.1 RMAN 11G : Import Catalog 419173.1
Oracle 11g Recovery Manager : Data Recovery Advisor RMAN> list failure 196 detail; Exacta causa del error RMAN> advise failure; Automated Repair Options ======================== Option Repair Description ------ ------------------ 1 Restore and recover datafile 18 Strategy: The repair includes complete media recovery with no data loss Repair script: $ORACLE_BASE/app/diag/rdbms/<instancia>/<BD>/hm/reco_2342576112.hm RMAN 11G : Data Recovery Advisor - RMAN command line example 762339.1 RMAN 11G : Import Catalog 419173.1
Oracle 11g Recovery Manager : Data Recovery Advisor RMAN> repair failure preview; Muestra pasos a seguir Restore, recover, etc RMAN> repair failure; Aplica pasos RMAN 11G : Data Recovery Advisor - RMAN command line example 762339.1 RMAN 11G : Import Catalog 419173.1
Oracle 11g Recovery Manager : Chequeo Consistencia RMAN> Validate database; RMAN> Validate tablespace xxxxx; RMAN> Validate datafile xxxxx; RMAN 11G : Data Recovery Advisor - RMAN command line example 762339.1 RMAN 11G : Import Catalog 419173.1 RMAN> Validate datafile xxxxx block xxxx; Se puede validar SPFILE, CONTROLFILECOPY, FRA,etc
Oracle 11g Recovery Manager : Chequeo Consistencia RMAN> 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 ---- ------ -------------- ------------ --------------- ---------- 2 OK 0 28279 104896 2885460 File Name: /oradata/V11/sysaux01.dbf Block Type Blocks Failing Blocks Processed ---------- -------------- ---------------- Data 0 21440 RMAN 11G : Data Recovery Advisor - RMAN command line example 762339.1 RMAN 11G : Import Catalog 419173.1
Oracle 11g FDA : Flashback Data Archive Flashback query en 9i sin UNDO no hay FlashBack Flashback version query en 10g sin UNDO no hay FlashBack 11g feature: Flashback Data Archive Guide. 470199.1 Flashback Data Archive en 11g sin UNDO , hay FlashBack
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 <nombre> tablespace <nombre_tbs> retention xxx year; 11g feature: Flashback Data Archive Guide. 470199.1 Mínima performance , mínimo storage (compress) b) Se otorgan privilegios sobre el área de FlashBack Data Archive SQL> alter table <nombre tabla> flashback archive <nombre fbda>;
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. 470199.1
Oracle 11g FTB : Flashback Transaction Backout Permite devolver transacciones ya comiteadas y sus dependencias Mediante OEM DBMS_FLASHBACK. TRANSACTION_BACKOUT V$TRANSACTION
Oracle 11g DDL Lock Timeout Error recurrente al intentar modificar un objeto ORA-00054: resource busy ¿Cómo saber cuando ejecutar el comando? 11g Locking Enhancements 464512.1 DDL_LOCK_TIMEOUT Behavior in 11G 779569.1 Parámetro DDL_LOCK_TIMEOUT de 1 a 1millón de segundos (11,5 horas)
Oracle 11g New Alert Log El archivo de alertas es escrito en formato XML Ubicación : $ORACLE_HOME/diag/rdbms/<instancia>/<BD>/alert Se evitan los problemas de los grandes archivos de alertas pues se particiona el archivo de alertas Finding alert.log file in 11g 438148.1 11g Understanding Automatic Diagnostic Repository. 422893.1 Por compatibilidad también es escrito en txt Ubicación : $ORACLE_HOME/diag/rdbms/<instancia>/<BD>/trace
Oracle 11g New Alert Log Lo que se debe saber ADR : 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 438148.1 11g Understanding Automatic Diagnostic Repository. 422893.1 ADR :Se puede consultar la vista V$DIAG_INFO
Oracle 11g New Alert Log →diag →rdbms Nombre Directorio Descripción Todo dentro del valor del parámetro DIAGNOSTIC_DEST →diag →rdbms →<Nombre de la base de datos> →<Nombre de la instancia> →alert Archivo de alertas en formato XML →cdump Equivalente al core_dump_dest →hm Para los trace del Health Monitor →incident →trace Trace de usuario y procesos background son almacenados acá al igual que el archivo de alertas en modo texto Finding alert.log file in 11g 438148.1 11g Understanding Automatic Diagnostic Repository. 422893.1
Oracle 11g New Alert Log : Utilitario ADRCI Para 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 438148.1 11g Understanding Automatic Diagnostic Repository. 422893.1 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
Oracle 11g Spfile and Memory values Crear spfile desde pfile Crear pfile desde spfile Crear spfile | pfile desde memoria
Oracle 11g Add Column with default Values En 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
Oracle 11g Tables Read Only En Oracle10g, se emula el READ ONLY revocando el SELECT En Oracle11g, simplemente se ejecuta SQL> ALTER TABLE <tabla> READ ONLY; 11g New Feature: Read-Only Tables 747146.1 Visualizado en *_TABLE.READ_ONLY
Oracle 11g Dataguard Compresión de los archive logs, envíados a la StandBy Consultas en la StandBy al mismo tiempo que se aplican los archives Snapshots Database
Oracle 11g Space Management Coordinator Nuevo proceso Background Autoextensiones a nivel de Tablespace Solicita el espacio a nivel de segmentos temporales
Oracle 11g Shrinking Temporary Tablespace Siempre 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 ? 452697.1 En Oracle11g se puede hacer un Shrink
Oracle 11g Shrinking Temporary Tablespace SQL> alter tablespace <nombre temporal> shrink space [tempfile XXX]; SQL> alter tablespace <nombre temporal> shrink space [tempfile xxxx] keep XXXM; SQL> select * from dba_temp_free_space; How To Shrink A Temporary Tablespace in 11G ? 452697.1
Oracle 11g Rebuild online Index En 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 ? 452697.1 ¿En qué se diferencian?
Oracle 11g Referencias 466931.1 : Oracle Database 11g Top New Features : Summary 453487.1 : 11g New Features : Top 5 Features In 11g 430887.1 : 11g New Feature PL/SQL Function Result Cache 453567.1 : 11g New Feature : SQL Query Result Cache 453295.1 : 11g New Feature : Invisible Index 433068.1 : Sequences in PL/SQL Expressions 466682.1 : Data Recovery Advisor -Reference Guide. 465946.1 : 11g Data Recovery Advisor: How to recover from missing datafile 452447.1 : 11g Partitioning Enhancements 429465.1 : 11g R1 New Feature : Case Sensitive Passwords and Strong User Authentication 443746.1 : Automatic Memory Management(AMM) on 11g
Oracle 11g Referencias 295626.1 : How To Use Automatic Shared Memory Management (ASMM) In Oracle10g 432776.1 : 11g New Feature : Transparent Data Encryption at Tablespace Level 762339.1 : RMAN 11G : Data Recovery Advisor - RMAN command line example 419173.1 : RMAN 11G : Import Catalog 470199.1 : 11g feature: Flashback Data Archive Guide. 464512.1 : 11g Locking Enhancements 779569.1 : DDL_LOCK_TIMEOUT Behavior in 11G 438148.1 : Finding alert.log file in 11g 422893.1 : 11g Understanding Automatic Diagnostic Repository. 747146.1 : 11g New Feature: Read-Only Tables 452697.1 : How To Shrink A Temporary Tablespace in 11G ?
Preguntas
Muchas gracias!!! Nos vemos en Oracle 12g