Using the shell to export data from a DB2 database

Source: Internet
Author: User
Tags db2

Export data from the DB2 database using a shell script based on the user name, database name, and password entered

(1) The a.sh script is as follows

 #!/usr/bin/"" "" "   "" EXPORT To/home/practice/data/a.del of del select * from a "

(2) Connect to Linux and execute with the following command

Su-db2inst1-c "/home/practice/a.sh"

The above code is the key, where the a.sh file is stored under the/home/practice path

[Email protected] practice]#chmod+x A.SH[email protected] data]#su-Db2inst1-c"/home/practice/a.sh"Please input your dbname:oliverdbplease input your username:db2inst1please input your password:db2inst1 Database Connection Information Database Server= db2/linuxx866410.5.5SQL Authorization ID=db2inst1 Local Database alias=oliverdbsql3104n The Export utility is beginning to export data tofile "/home/practice/data/a.del". sql3105n The Export utility has finished exporting"2"rows. Number of rows exported:2

So far, the data has been exported from the database Oiliverdb to the directory/home/practice/data.

Using the shell to export data from a DB2 database

Related Article

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.