The method of introducing excel Oracle Data Summary

http://blog.csdn.net/47522341/archive/2008/03/21/2203487.aspx
The method of introducing excel Oracle Data Summary
Abstract: In the programming process and exchange data collection process, often encounter the need to file the data content of other staffing in the office working environment in the import situation oracle. Current methods used by program developers often are summarized as follows: 1, using the import tool provided oracle sql * loader; 2, using plsql developer tools; 3 do other data transfer tool transfer station. Here we use the example embodiment described advantages and disadvantages of each mode and introducing steps. Suppose 'e: /test.xls' file exists in three data representing the customer number, customer name and contact phone number. Which reads as follows:
10001
zjaxi01
13562485246
10002
zjaxi02
13562485247
10003
zjaxi03
13562485248
10004
zjaxi04
13562485249
10005
zjaxi05
13562485250
10006
zjaxi06
13562485251
10007
zjaxi07
13562485252
10008
zjaxi08
13562485253
10009
zjaxi09
13562485254
10010
zjaxi10
13562485255
10011
zjaxi11
13562485256
10012
zjaxi12
13562485257
10013
zjaxi13
13562485258
10014
zjaxi14
13562485259
Use sql * loader
SQL * LOADER is the oracle data loading tool in the NT under sql * loader command to SQLLDR, under UNIX generally SQLLDR / SQLLOAD. Usually used to migrate operating system files to the oracle database. It is a large selection data warehouse loading method to use, because it provides the fastest way (direct, parallel). However, this method requires oracle table storing data already exist.
Using this method of introducing the contents excel Oracle, first need to excel file as a text format, the file type or a text type selected from Type csv soon e: /test.xls saved as e: /test.csv.
If there is no corresponding oracle table structure for storing data, create a table test (id, name, telphone).
This created with Notepad sql * loader control file test.ctl (ctl suffix is ​​an attempt to prove that this is a control file, but in fact the file extension is not important, users are free to choose, but it must be a text file format), reads as follows:
Load data
INFILE 'E: /test.csv'           - data source file name
The append | INSERT | the replace        --append after additional table, insert an empty table insert, replace to replace the original content
The Table the Test INTO             - database table name to be imported
[When ID = id_memo]      - Filter Condition
Fields terminated by X'09 '- field delimiter
(the above mentioned id, name, Cellphone)         - list of field names
Finally, in the command window sqlldr command line import Sqlldr userid = system / manager control = 'e: /test.ctl'
Sqlldr function key explanation:
Userid    --oracle 用户名 userid = username/password
Control - the control file name control = 'e: /insert.ctl'
Log      - log file name log = 'e: /insert.log'
Bad      - corrupted file name
Data      --data file name
Discard     --discard file name
Discardmax --number of discards to allow (default all)
Skip        - Number of rows skipped import (default 0)
The Load        - the number of rows introduced import (default all)
Errors     - the number of rows to allow the error (default 50)
Use plsql developer
PL / SQL Developer is a specialized for developing, testing, debugging, and optimization oracle PL / SQL stored program units, such as triggers, stored procedures, functions, and packages like integrated development environment.
Much data in a single file (less than 10w line), and the case where the object table structure existing tools may be used plsql developer excel content directly through a simple copy, paste oracle import database operation. DETAILED operates as follows:
l         input select * from test for update in sql window plsql developer's, wherein the test data is to be imported oracle table name;
l         execute the query (can be achieved by clicking a button or shortcut F8);
l         Click the above query result shaped lock button, such that the content query is in edit mode.
l         from excel data table copy (ctrl + C) data to import the oracle, if a single data import can check the above results, the "Add (+)" press plsql developer buttons, so that the data table is to add data state, then move the mouse over a column name plsql developer of click, and finally use the shortcut ctrl + v to complete the data import, and click "submit (check mark)" plsql developer of the button to submit your changes.
l         If all the columns are simultaneously introduced, first select copy all the data, then increase (+) and click the row edit foremost asterisk are such that the entire row of data in a selected state, to import the data into the final paste.
l         If disaggregated import data is required by the column is completed, first select copy the data to be imported, and then increase (+) and tap edit the name of that column, so that the entire column in a selected state, and finally paste can be data import.
Use PLSQL developer to perform data import and export operations main problem is Chinese data that can go wrong in a large amount of data, it is estimated will receive the data type definition table for the type nvarchar2 would be a little better. In addition, this method requires manual is more involved, can not achieve the effect of automatic import.
Use sql server transit
    When this operation is performed, with the need to export import tools sqlserver sqlserver content into the excel database, and then use the same tools sqlserver transfer content into oracle database, where the data copy and two IO operations relative efficiency is relatively low. And the description of jkflyfox csdn users, this approach requires the name of the file oracle of all caps, or an error occurs.
Published 18 original articles · won praise 16 · views 390 000 +

Guess you like

Origin blog.csdn.net/f_zongjian/article/details/5707642