This document is a collection of examples of Sqoop commands and arguments that are commonly used together. Its a good starting place for those overwhelmed by all the Sqoop configuration options and want to start exploring with something tried and true.

Importing a small table from DB2 (using one map process):

sqoop import --driver --connect jdbc:db2://db2host:50000/DBNAME 
--username USER --password passw0rd --table MYTABLE -m 1

Import from Oracle to Avro file (using 6 map processes):

Note: User name and table name must be ALL CAPS. You'll get exceptions about lack of columns or non-existent table otherwise.

sqoop import --connect "jdbc:oracle:thin:@(description=(address=(protocol=tcp)(host=orahost)(port=1521))(connect_data=(service_name=myser)))"  
--username SCOTT --password tiger --table MYTABLE -m 6 --as-avrodatafile --warehouse-dir /staging/sqoop/MYTABLE
Sqoop import from MSSql
sqoop import --driver --table MYTABLE --connect 'jdbc:sqlserver://MSSQLSeverHost;database=DBNAME;username=USER;password=PASSWORD'

  • No labels