Using the Bulk Loader in ORACLE
The ORACLE SQL* Loader is a facility that allows you to populate database tables from flat files. To use this facility, you need to prepare (i) your flat file(s), and (ii) a control file that tells ORACLE how to "map" fields of the flat file to columns of an RDBMS table. Furthermore, the data can also be appended at the end of the control file, making the process much simpler. Most probably, you will prepare one control file for each table that you want to bulk load to. Notice that preparing the data is part of your assignment. There are no "tools" for this. You either create them from some C program (example) that generates the data and outputs it into a file, or if you are lucky, you might find a web page that already has the data that you need with minimal text processing.
Reena Khosla has prepared the following hints and steps to help in bulk loading.
Preparing the Control File: You can create one using a text editor such as notepad and then save it with a ".ctl" extension. The instructions on how to make the control file can be found at the location:
file:////eulalia/www/oracle/database.804/a58244/ch04.htm#534.
This has several sample control files that you can use to experiment with this facility. Try experimenting with the control file specified in the first example. Notice that if you use "INFILE *" as is specified in that control file then you need to specify the data in the control file itself. Apparently, if you use "INFILE filename" then you can specify the file in which your data is located. (we haven't experimented with this).
Important: Make sure that you have a carriage return after the last tuple in your data file. Otherwise the loader doesn't like it and fails to insert the last tuple. After you have your control file and data file ready, login to ORACLE, create the table with normal SQL DDL commands, and then invoke the SQL bulk loader.
Invoking the Loader: Goto the DOS prompt and cd to "F:\software\orant\bin\". From there, invoke the SQL LOADER by typing the following:
sqlldr80 userid=pid/password@hoststring
control=drive:\path\controlfilename.ctl log=drive:\path\logfilename.log
The hoststring in our case is "default". Yes, the password has to be typed on the command line! :-) (We haven't found a way around this). If the command executed successfully, go back to ORACLE and do a "SELECT *" on that table and make sure that the data is indeed there!
Committing Transactions: We are getting ahead of the lectures here, but this is needed to understand how ORACLE does things.
- We have experienced problems when we try to bulk load into a table that already has data. This is because this is no longer considered an "INPUT" operation, rather an "APPEND" operation. So, if you have problems with this, either look into the manual for "APPEND" or delete all the tuples and load it (via INSERT) again! :-(
- In addition, notice that changes made to your database via the insert, delete, update commands can be reversed if necessary. Towards this end, ORACLE SQL provides two commands: commit, and rollback. The changes you make on the command line prompt (using insert, delete/update) can be made permanent using the commit statement. Thus, for example if you delete everything from the SQL prompt and then do a SELECT, you might find the table "empty". However, if you try to bulk load, the loader will not allow this. The reason is because what you are seeing on the screen is not "permanent". To make it permanent, type commit and try bulk loading again.
Similarly, the changes made to the database since the last commit can be reversed by using the rollback statement.
- Also notice that some commands force a commit even without the user explicitly issuing a commit statement. This is typical of ORACLE DDL commands (and also the bulk loader).
- When the user exits an SQL session, the system automatically commits all the changes.
分享到:
相关推荐
1. Oracle WebCenter Portal: 本文档是关于Oracle WebCenter Portal的使用和开发指南。Oracle WebCenter Portal是Oracle Fusion Middleware的一部分,它提供了一套完整的门户解决方案,帮助用户构建、部署和管理企业...
1. Implement a blurring filter using the equation (5.6-11,数字图像处理(第三版))in textbook, and blur the test image ‘book_cover.jpg’ using parameters a=b=0.1 and T=1. (20%) 2. Add Gaussian noise ...
Read-the-indicator-value-using-Deep-Learning-main
altera软件下载时在Quartus上软件的利用方法是谈论的。请参考硬件原理图。
本教程“Creating and Using Oracle Solaris Zones-216”是为帮助用户理解和充分利用这一技术而编写的。 首先,了解Oracle Solaris Zones的核心概念是至关重要的。每个Zone都是一个独立的计算环境,拥有自己的文件...
Oracle Products and Services 1-5 Oracle Database 10g: “g” Stands for Grid 1-6 Oracle Database Architecture 1-8 Database Structures 1-9 Oracle Memory Structures 1-10 Process Structures 1-12 Oracle ...
This book is the definitive reference on PL/SQL, considered throughout the database community to be the best Oracle programming book available. Like its predecessors, this fifth edition of Oracle PL/...
ORACLE-BASE - Oracle Database 11g Release 2 RAC On Linux Using VMware Server 2
官方资料:白皮书[英文]Oracle Database 1 2c Multitenant Snapshot Clones Using Oracle CloudFS Oracle Multitenant Architecture.;Oracle CloudFS Architecture;Oracle ASM Dynamic Volume Manager (ADVM);Oracle...
Using a Subquery in the FROM Clause 4-10 Scalar Subquery Expressions 4-11 Scalar Subqueries: Examples 4-12 Correlated Subqueries 4-14 Using Correlated Subqueries 4-16 Using the EXISTS Operator 4-18 ...
To create an optimized database for a transactional production environment using Oracle software, consider the following method: - **Using Database Configuration Assistant (DBCA) with Transaction ...
注意打開需要密碼:jmclurkin@rice.edu
综上所述,"Oracle 10g RAC On Windows 2003 Using VMware Server"涵盖了虚拟化技术、Windows集群服务、Oracle RAC架构、共享存储解决方案以及集群的管理和维护等多个IT领域的知识点。通过这样的部署,用户可以构建...