Posts

Showing posts with the label dba_indexes

SQLLoader DIRECT=TRUE y INDEX UNIQUE (caso practico)

Problema:   Luego de una carga de datos realizada con sqlloader DIRECT=TRUE los índices se invalidan y muestran  estatus "UNUSABLE". Caso de Prueba: Creamos una tabla con un índice que no permita valores duplicados; SQL> create table hr.test_loader (id number, field01 varchar2(12)) tablespace USERS; Table created. SQL> create unique index hr.pk_test_loader on hr.test_loader(id) tablespace USERS; Index created. Verificamos el estatus del índice. SQL> select status from dba_indexes where index_name='PK_TEST_LOADER'; STATUS -------- VALID Realizamos la primera carga de datos con el SQLLOADER. sqlldr system/********* direct=true control=control.ctl log=mylogfile.log bad=mybadlog.bad data=mydatafile.txt Archivo:       control.ctl  load data infile * into table hr.test_loader fields terminated '|' (id,field01) Archivo:       mydatafile.txt 1|AAAAA 2|BBBBB 3|CCCCC 4|DDDD

Indexes and Functions - 01

The user said me that the table has a index in the date column that he used in his query SQL but is too slow. That is true, this table ( TB_EVENTS ) has an index in date type column ( EVNT_PK ).  SQL> SELECT TABLE_NAME , COLUMN_NAME , DATA_TYPE FROM DBA_TAB_COLUMNS WHERE TABLE_NAME = 'TB_EVENTS' AND COLUMN_NAME = 'EVENT_DATE' ; TABLE_NAME                     COLUMN_NAME                      DATA_TYPE ------------------------------ -------------------------------- ------------ TB_EVENTS                      EVENT_DATE                       DATE SQL> SELECT COL . INDEX_NAME ,    COL . COLUMN_NAME   FROM SYS . DBA_IND_COLUMNS COL   WHERE OWNER = 'PSP' AND INDEX_NAME = 'EVNT_PK' ; INDEX_NAME                     COLUMN_NAME ------------------------------ -------------------------------- EVNT_PK                        EVENT_DATE Ok, He use EVENT_DATE column in the WHERE but also use TO_CHAR function in