Setp-1 to generate data files:
Getobject. SQL
[SQL]
- SELECTA. owner |',"'| A. object_name |'",'| A. object_id |','| To_char (a. created,'Yyyy-mm-dd hh24: mi: ss') |','| A. status
- FROMDba_objects ,(SELECTRownum rnFROMDualConnect BYRownum <= 23) B;
Call. SQL
[SQL]
- SETEchoOff
- SETTermOff
- SETLine 100 pages 0
- SETFeedbackOff
- SETHeadingOff
- Spool C: \ Oracle \ script \ ldr_object.csv
- @ C: \ oracle \ script \ getobject. SQL
- SpoolOff
- SETHeadingOn
- SETFeedbackOn
- SETTermOn
- SETEchoOn
Step 0 initialize the environment:
Createobject. SQL
[SQL]
- CREATE TABLEObjects (
- OwnerVarchar(30 ),
- Object_nameVarchar(50 ),
- Object_id NUMBER,
- CreatedDate,
- Status VARCHAR2 (10)
- );
- CREATE INDEXIdx_obj_owner_nameOnObjects (owner, object_name );
Step 1: import for the first time
Ldr_object.ctl
[SQL]
- LoadData
- Infile ldr_object.csv
- Truncate Into TableObjects
- Fields terminatedBy ","Optionally enclosedBy '"'
- (
- Owner,
- Object_name,
- Object_id,
- CreatedDate 'Yyyy-mm-dd hh24: mi: ss',
- Status"Substr (: status, 1, 5 )"
- )
C: \ oracle \ script> sqlldr scott/tiger control = ldr_object.ctl errors = 10
Ldr_object.log
[SQL]
- SQL * Loader: Release 10.2.0.1.0-ProductionOnFriday January 20 02:16:56 2012
- Copyright (c) 1982,200 5, Oracle.AllRights reserved.
- Control File: ldr_object.ctl
- Data File: ldr_object.csv
- Error file: ldr_object.bad
- Obsolete file: Not specified
- (All records can be discarded)
- Number of objects to be loaded:ALL
- Number of to be skipped: 0
- Allowed error: 10
- Bound array: 64 rows, up to 256000 bytes
- Continue: Unspecified
- Path used: General
- Table OBJECTS, loaded from each logical record
- Insert option for this tableTRUNCATEEffective
- Column name location length abort packaging Data Type
- --------------------------------------------------------------------------
- OWNERFIRST*, O (")CHARACTER
- OBJECT_NAMENEXT*, O (")CHARACTER
- OBJECT_IDNEXT*, O (")CHARACTER
- CREATEDNEXT*, O (")DATEYyyy-mm-dd hh24: mi: ss
- STATUSNEXT*, O (")CHARACTER
- Column SQL string:"Substr (: status, 1, 5 )"
- Table OBJECTS:
- 1033298 rows are loaded successfully.
- Zero rows are not loaded due to data errors.
- Since allWHENClause failed. 0 rows are not loaded.
- Because all fields are empty, 0 rows are not loaded.
- Space allocated to the bound array: 82560 bytes (64 rows)
- Number of bytes read from the buffer: 1048576
- Total number of skipped logical records: 0
- Total number of logical records read: 1033298
- Total number of rejected logical records: 0
- Total number of discarded logical records: 0
- Started running from Friday January 20 02:16:56 2012
- The operation ended at 02:19:02, January 1, 2012 at on Friday.
- Elapsed time: 00: 02: 05.55
- CPU time: 00: 00: 10.38