Use of Sql*loader (Iostat Data Import database table)

Source: Internet
Author: User
Tags import database

Purpose: Import the data of the iostat instruction into the file Iostat.dat , and then pour the iostat data into the database by Sqlldr

Step one:u1/tiger The user to build the table Iostat

CREATE TABLE Iostat (device varchar), TPS float (mb_read_s), mb_wrtn_s float (), Mb_read float, mb_ Wrtn Float (20));

Step Two: Create a source data file

Iostat–md/dev/sda2 >/oracle/script/iostat.dat

Cat Iostat.dat

Linux 2.6.18-164.el5 (HOST2) 08/15/2014

Device:tps mb_read/s mb_wrtn/s Mb_read Mb_wrtn

Sda2 13.06 0.09 0.11 961 1194

Step three: Build a control file

Load data

InFile '/oracle/script/iostat.dat '

Append into table Iostat

Fields TERMINATED by whitespace

(DEVICE,TPS,MB_READ_S,MB_WRTN_S,MB_READ,MB_WRTN)

Note: The second line specifies the input file,

The third line specifies that the policy is appended and written to table Iostat

Line Fourth indicates that the fields of the text file are separated by spaces.

Row five specifies the correspondence between the text field and the table

Fourth step: Start importing the database

Sqlldr u1/tiger control= ' iostat.ctl ' log= '/oracle/script/iostat.log ' skip=3 bad= ' Iostat.bad '

Note:

bad file records did not successfully write to the table record.

log file records the transferred logs.

Control file when the control file is written above.

skip=3 indicates that the first three lines of the text file iostat.dat (Linux 2.6.18-164.el5 (host2) 08/15/2014 , and so on )are ignored.

Fifth step: View the results of the import

Sql> SELECT * from Iostat

DEVICE TPS mb_read_s mb_wrtn_s Mb_read Mb_wrtn

---------- ---------------------- ---------------------- ---------------------- ---------------------- ------------- ---------

sda2                     18.39                    0.18                    0.14                     877                      681

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.