![]() |
|||||||||||||||||||||||||||||||||||||||||||||
|
SQL Loader Comment se repercute un chargement des données sur le chemin direct ?
La table Oracle TSQL et son index unique (XTSQL):
SET echo ON
create table TSQL (
id number(4),
nom char(15),
prenom char(15),
salaire number(6)
);
CREATE UNIQUE INDEX xtsql ON tsql(id);
Les données (tsql.dat) 0001Bebel Jean-Paul 100000 2Tapie Nanar 199999 0007Anomalie Franck 050000 0008Ambigu Pierrot 050000 0009Andouille Jacky 000000 0010LEGWINSKI France 100000 0025Paxton Monica 250000 0025FERNANDEL TropPayé 333333 0070Jenveuxencore Plus 999999 2222Champtrop Long 000001 9999999999999999999999999999999999999999 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa Remarquons le id 25 en double !
Le fichier de contrôle (tsql.ctl) LOAD DATA INFILE 'tsql.dat' BADFILE 'tsql.bad' DISCARDFILE 'tsql.dis' REPLACE INTO TABLE tsql (ID position(01:04) DECIMAL EXTERNAL, NOM position(05:19) CHAR, PRENOM position(20:34) CHAR, SALAIRE position(35:40) DECIMAL EXTERNAL) Le chargement et quelques ordres select
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
SQL> TRUNCATE TABLE tsql;
Table truncated.
SQL> select index_name, status from user_indexes where table_name='TSQL';
INDEX_NAME STATUS
------------------------------ --------
XTSQL VALID
SQL> host sqlldr owa/owa@lib9 tsql.ctl direct=yes
SQL*Loader: Release 9.2.0.1.0 - Production on Ve Avr 25 12:43:09 2003
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Load completed - logical record count 12.
SQL> SELECT * FROM tsql;
ID NOM PRENOM SALAIRE
---------- --------------- --------------- ----------
1 Bebel Jean-Paul 100000
2 Tapie Nanar 199999
7 Anomalie Franck 50000
8 Ambigu Pierrot 50000
9 Andouille Jacky 0
10 LEGWINSKI France 100000
25 Paxton Monica 250000
25 FERNANDEL TropPayÚ 333333
70 Jenveuxencore Plus 999999
2222 Champtrop Long 1
9999 999999999999999 999999999999999 999999
11 rows selected.
SQL> select index_name, status from user_indexes where table_name='TSQL';
INDEX_NAME STATUS
------------------------------ --------
XTSQL UNUSABLE
SQL>
Remarquons que l’index est unusable !
Le log Oracle (tsql.log) SQL*Loader: Release 9.2.0.1.0 - Production on Ve Avr 25 12:29:45 2003 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. Control File: tsql.ctl Data File: tsql.dat Bad File: tsql.bad Discard File: tsql.dis (Allow all discards) Number to load: ALL Number to skip: 0 Errors allowed: 50 Continuation: none specified Path used: Direct Table TSQL, loaded from every logical record. Insert option in effect for this table: REPLACE Column Name Position Len Term Encl Datatype ------------------------------ ---------- ----- ---- ---- --------------------- ID 1:4 4 CHARACTER NOM 5:19 15 CHARACTER PRENOM 20:34 15 CHARACTER SALAIRE 35:40 6 CHARACTER Record 12: Rejected - Error on table TSQL, column ID. ORA-01722: invalid number The following index(es) on table TSQL were processed: index OWA.XTSQL rendu inutilisable pour la raison suivante : ORA-01452: CREATE UNIQUE INDEX impossible; il existe des doublons Table TSQL: 11 Rows successfully loaded. 1 Row not loaded due to data errors. 0 Rows not loaded because all WHEN clauses were failed. 0 Rows not loaded because all fields were null. Bind array size not used in direct path. Column array rows : 5000 Stream buffer bytes: 256000 Read buffer bytes: 1048576 Total logical records skipped: 0 Total logical records read: 12 Total logical records rejected: 1 Total logical records discarded: 0 Total stream buffers loaded by SQL*Loader main thread: 1 Total stream buffers loaded by SQL*Loader load thread: 0 Run began on Ve Avr 25 12:29:45 2003 Run ended on Ve Avr 25 12:29:48 2003 Elapsed time was: 00:00:02.52 CPU time was: 00:00:00.11 Oracle charge ce qu’il peut, il veut recréer l’index, pas le réarranger (rebuild), mais il ne peut pas !
|
||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||