SlideShare a Scribd company logo
1 of 25
IBM PureData System
for Analytics
(Formerly known as, IBM Netezza)
- Ravi
Loading and Unloading Tables
Data Loading/Unloading Components:
• External Tables
• nzload command
• Backup and Restore
• nz_migrate utility
External Tables
In IBM Netezza environment, there are the following types of tables:
•System Tables: Stored on the host
•User tables: Stored on the disks in storage arrays
•External Tables: Stored as flat files on the host or client systems
An External table allows Netezza to treat an external file as database table
An External table has a definition (also called table schema), but the actual data exists outside of
Netezza appliance database
Netezza can treat a file on a client system as an external table using the REMOTESOURCE option
You can use INSERT INTO/SELECT FROM on external tables
EXTERNAL TABLES:Example1
External Tables: Loading data through ODBC
Managing External Tables
• You can INSERT and DROP an External Table
• You can join an external table with database tables
• You cannot DELETE, TRUNCATE, and UPDATE an External Table
• Not more than 1 External Table in a FROM/WHERE clause in a query or subquery
• No Union operation between External Tables
• Statistics are automatically generated for External Tables
External Tables: Unload data
Transient External Tables
Transient external tables (TET) provide a way to define an external table that exists only
for the duration of a single query
Export data using TET:
create external table '/tmp/customer.out' USING (DELIM '|') AS select * from customer;
Import data using TET:
truncate table customer;
INSERT INTO CUSTOMER SELECT * FROM EXTERNAL '/tmp/customer.out' USING
(DELIM '|');
Compress Binary Format External Tables
create external table ext_customer sameas customer USING (DATAOBJECT
'/tmp/customer1.out' FORMAT 'internal' COMPRESS true);
d customer
Table "CUSTOMER"
Attribute | Type | Modifier | Default Value
-----------+-----------------------+----------+---------------
CID | SMALLINT | |
CNAME | CHARACTER VARYING(30) | |
CAGE | BYTEINT | |
CADDRESS | CHARACTER VARYING(50) | |
Distributed on hash: "CID"
NZLOAD
NZLOAD
The NZLOAD command is a wrapper to the CREATE EXTERNAL TABLE/INSERT INTO commands
NZLOAD allows you to load data from the local host or a remote client
Nzload is command line interface program. You can provide inputs to nzload through command line
or through a control file
The nzload command is an ODBC client application that loads data remotely or locally. You can use
the nzload command on the Netezza host and on all the supported client platforms.
STATISTICS are generated for load operations
How the nzload command works
Sends queries
to the host to
create an
external table
definition
Processes
command-line
load options
Runs the
insert/select
query to load
data
Drops the
external table
when the load
completes
An nzload operation is treated as a single transaction. i.e., all records are loaded with a single
transaction ID
If the load fails the records are logically deleted.
The storage space allocated for those records should be recovered at some point in time using either
nzreclaim/Truncate table(If load is for first time)
Other users can run queries against the tables while they are being loaded. New data is only visible to
users when the transaction has been committed
NZLOAD important options
nzload accepts many options and arguments, but below are required:
•-host <host_name>
•-u <username>
•-pw <password>
•-db <database_name>
•-t <table_name>
Commonly used options & arguments:
•-df <filename> /* data (inputs rows to be loaded) */
•-cf <filename> /* control file name */
•-delim <char> /* delimiter. Default is t */
•-nullValue <char> /* default is NULL. You can change this to any 1 to 4 characters */
•-maxErrors
•-dateDelim
•-dateStyle
•-allowReplay /* To enable load continuation if the system paused due to a SPU reset or failover*/
nzload -db database_name -t table_name -delim “|” -maxErrors num_errors -df source_file_name
NZLOAD Example:1
NZLOAD (Example:2)
Sample NZLOG/NZBAD files
NZLOG file
When nzload is executed a nzlog file is created; It contains messages related to the load
The nzlog file by default is located in your current working directory
The file name format is <table_name>.<database_name>.nzlog
Use the -lf <file_name> option to specify a different nzlog file name
-outputDir <directory> option may be used to specify the directory for the nzlog file
Appends to the log file for every nzload process that loads to the same database table
Periodically delete log files to free disk space
For nzload operations, a return code is also issued as follows:
•0 (success)
•1 (failed, no records inserted)
•2 (Found errors in input but did not exceed maxErrors, load is deemed successful, and records are
inserted)
NZBAD file
When nzload is executed a nzbad file is created; It contains only rejected records from the load file.
The nzbad file by default is located in your current working directory
The file name format is <table_name>.<database_name>.nzbad
Use the -bf <file_name> option to specify a different nzbad file name
-outputDir <directory> option may be used to specify the directory for the nzbad file
If the file already exists, it is overwritten.
If there are no rejected records the file will be empty (0 bytes)
-maxErrors option (NZLOAD)
-maxErrors option (contd …)
NZLOAD using Control File
NZLOAD using FIXED format
So far what we have seen is text delimited loading.
However there are cases where it is difficult to define any delimiter.
For example: A column containing lengthy data having alpha numeric characters. In such cases, it will be difficult to
use text delimited loading and one has to use Fixed length loading.
Questions?

More Related Content

More from Ravikumar Nandigam

Managing user Online Training in IBM Netezza DBA Development by www.etraining...
Managing user Online Training in IBM Netezza DBA Development by www.etraining...Managing user Online Training in IBM Netezza DBA Development by www.etraining...
Managing user Online Training in IBM Netezza DBA Development by www.etraining...Ravikumar Nandigam
 
IBM DB2 LUW UDB DBA Training by www.etraining.guru
IBM DB2 LUW UDB DBA Training by www.etraining.guruIBM DB2 LUW UDB DBA Training by www.etraining.guru
IBM DB2 LUW UDB DBA Training by www.etraining.guruRavikumar Nandigam
 
online training for IBM DB2 LUW UDB DBA
online training for IBM DB2 LUW UDB DBAonline training for IBM DB2 LUW UDB DBA
online training for IBM DB2 LUW UDB DBARavikumar Nandigam
 
IBM DB2 LUW UDB DBA Online Training by Etraining Guru In Hyderabad
IBM DB2 LUW UDB DBA Online Training by Etraining Guru In HyderabadIBM DB2 LUW UDB DBA Online Training by Etraining Guru In Hyderabad
IBM DB2 LUW UDB DBA Online Training by Etraining Guru In HyderabadRavikumar Nandigam
 
IBM DB2 LUW/UDB DBA Training by www.etraining.guru
IBM DB2 LUW/UDB DBA Training by www.etraining.guruIBM DB2 LUW/UDB DBA Training by www.etraining.guru
IBM DB2 LUW/UDB DBA Training by www.etraining.guruRavikumar Nandigam
 
IBM DB2 LUW UDB DBA Training by www.etraining.guru
IBM DB2 LUW UDB DBA Training by www.etraining.guruIBM DB2 LUW UDB DBA Training by www.etraining.guru
IBM DB2 LUW UDB DBA Training by www.etraining.guruRavikumar Nandigam
 
data loading and unloading in IBM Netezza by www.etraining.guru
data loading and unloading in IBM Netezza by www.etraining.gurudata loading and unloading in IBM Netezza by www.etraining.guru
data loading and unloading in IBM Netezza by www.etraining.guruRavikumar Nandigam
 
IBM DB2 LUW UDB DBA Online Training by Etraining.guru
IBM DB2 LUW UDB DBA Online Training by Etraining.guruIBM DB2 LUW UDB DBA Online Training by Etraining.guru
IBM DB2 LUW UDB DBA Online Training by Etraining.guruRavikumar Nandigam
 
Netezza Online Training by www.etraining.guru in India
Netezza Online Training by www.etraining.guru in IndiaNetezza Online Training by www.etraining.guru in India
Netezza Online Training by www.etraining.guru in IndiaRavikumar Nandigam
 

More from Ravikumar Nandigam (11)

2 db2 instance creation
2 db2 instance creation2 db2 instance creation
2 db2 instance creation
 
Managing user Online Training in IBM Netezza DBA Development by www.etraining...
Managing user Online Training in IBM Netezza DBA Development by www.etraining...Managing user Online Training in IBM Netezza DBA Development by www.etraining...
Managing user Online Training in IBM Netezza DBA Development by www.etraining...
 
IBM DB2 LUW UDB DBA Training by www.etraining.guru
IBM DB2 LUW UDB DBA Training by www.etraining.guruIBM DB2 LUW UDB DBA Training by www.etraining.guru
IBM DB2 LUW UDB DBA Training by www.etraining.guru
 
online training for IBM DB2 LUW UDB DBA
online training for IBM DB2 LUW UDB DBAonline training for IBM DB2 LUW UDB DBA
online training for IBM DB2 LUW UDB DBA
 
Course content (netezza dba)
Course content (netezza dba)Course content (netezza dba)
Course content (netezza dba)
 
IBM DB2 LUW UDB DBA Online Training by Etraining Guru In Hyderabad
IBM DB2 LUW UDB DBA Online Training by Etraining Guru In HyderabadIBM DB2 LUW UDB DBA Online Training by Etraining Guru In Hyderabad
IBM DB2 LUW UDB DBA Online Training by Etraining Guru In Hyderabad
 
IBM DB2 LUW/UDB DBA Training by www.etraining.guru
IBM DB2 LUW/UDB DBA Training by www.etraining.guruIBM DB2 LUW/UDB DBA Training by www.etraining.guru
IBM DB2 LUW/UDB DBA Training by www.etraining.guru
 
IBM DB2 LUW UDB DBA Training by www.etraining.guru
IBM DB2 LUW UDB DBA Training by www.etraining.guruIBM DB2 LUW UDB DBA Training by www.etraining.guru
IBM DB2 LUW UDB DBA Training by www.etraining.guru
 
data loading and unloading in IBM Netezza by www.etraining.guru
data loading and unloading in IBM Netezza by www.etraining.gurudata loading and unloading in IBM Netezza by www.etraining.guru
data loading and unloading in IBM Netezza by www.etraining.guru
 
IBM DB2 LUW UDB DBA Online Training by Etraining.guru
IBM DB2 LUW UDB DBA Online Training by Etraining.guruIBM DB2 LUW UDB DBA Online Training by Etraining.guru
IBM DB2 LUW UDB DBA Online Training by Etraining.guru
 
Netezza Online Training by www.etraining.guru in India
Netezza Online Training by www.etraining.guru in IndiaNetezza Online Training by www.etraining.guru in India
Netezza Online Training by www.etraining.guru in India
 

Recently uploaded

How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17Celine George
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxUmeshTimilsina1
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxPooja Bhuva
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 

Recently uploaded (20)

How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 

Data loading and unloading in ibm netezza

  • 1. IBM PureData System for Analytics (Formerly known as, IBM Netezza) - Ravi
  • 2. Loading and Unloading Tables Data Loading/Unloading Components: • External Tables • nzload command • Backup and Restore • nz_migrate utility
  • 4. In IBM Netezza environment, there are the following types of tables: •System Tables: Stored on the host •User tables: Stored on the disks in storage arrays •External Tables: Stored as flat files on the host or client systems An External table allows Netezza to treat an external file as database table An External table has a definition (also called table schema), but the actual data exists outside of Netezza appliance database Netezza can treat a file on a client system as an external table using the REMOTESOURCE option You can use INSERT INTO/SELECT FROM on external tables
  • 6.
  • 7. External Tables: Loading data through ODBC
  • 8. Managing External Tables • You can INSERT and DROP an External Table • You can join an external table with database tables • You cannot DELETE, TRUNCATE, and UPDATE an External Table • Not more than 1 External Table in a FROM/WHERE clause in a query or subquery • No Union operation between External Tables • Statistics are automatically generated for External Tables
  • 10. Transient External Tables Transient external tables (TET) provide a way to define an external table that exists only for the duration of a single query Export data using TET: create external table '/tmp/customer.out' USING (DELIM '|') AS select * from customer; Import data using TET: truncate table customer; INSERT INTO CUSTOMER SELECT * FROM EXTERNAL '/tmp/customer.out' USING (DELIM '|');
  • 11. Compress Binary Format External Tables create external table ext_customer sameas customer USING (DATAOBJECT '/tmp/customer1.out' FORMAT 'internal' COMPRESS true); d customer Table "CUSTOMER" Attribute | Type | Modifier | Default Value -----------+-----------------------+----------+--------------- CID | SMALLINT | | CNAME | CHARACTER VARYING(30) | | CAGE | BYTEINT | | CADDRESS | CHARACTER VARYING(50) | | Distributed on hash: "CID"
  • 13. NZLOAD The NZLOAD command is a wrapper to the CREATE EXTERNAL TABLE/INSERT INTO commands NZLOAD allows you to load data from the local host or a remote client Nzload is command line interface program. You can provide inputs to nzload through command line or through a control file The nzload command is an ODBC client application that loads data remotely or locally. You can use the nzload command on the Netezza host and on all the supported client platforms. STATISTICS are generated for load operations
  • 14. How the nzload command works Sends queries to the host to create an external table definition Processes command-line load options Runs the insert/select query to load data Drops the external table when the load completes An nzload operation is treated as a single transaction. i.e., all records are loaded with a single transaction ID If the load fails the records are logically deleted. The storage space allocated for those records should be recovered at some point in time using either nzreclaim/Truncate table(If load is for first time) Other users can run queries against the tables while they are being loaded. New data is only visible to users when the transaction has been committed
  • 15. NZLOAD important options nzload accepts many options and arguments, but below are required: •-host <host_name> •-u <username> •-pw <password> •-db <database_name> •-t <table_name> Commonly used options & arguments: •-df <filename> /* data (inputs rows to be loaded) */ •-cf <filename> /* control file name */ •-delim <char> /* delimiter. Default is t */ •-nullValue <char> /* default is NULL. You can change this to any 1 to 4 characters */ •-maxErrors •-dateDelim •-dateStyle •-allowReplay /* To enable load continuation if the system paused due to a SPU reset or failover*/ nzload -db database_name -t table_name -delim “|” -maxErrors num_errors -df source_file_name
  • 19. NZLOG file When nzload is executed a nzlog file is created; It contains messages related to the load The nzlog file by default is located in your current working directory The file name format is <table_name>.<database_name>.nzlog Use the -lf <file_name> option to specify a different nzlog file name -outputDir <directory> option may be used to specify the directory for the nzlog file Appends to the log file for every nzload process that loads to the same database table Periodically delete log files to free disk space For nzload operations, a return code is also issued as follows: •0 (success) •1 (failed, no records inserted) •2 (Found errors in input but did not exceed maxErrors, load is deemed successful, and records are inserted)
  • 20. NZBAD file When nzload is executed a nzbad file is created; It contains only rejected records from the load file. The nzbad file by default is located in your current working directory The file name format is <table_name>.<database_name>.nzbad Use the -bf <file_name> option to specify a different nzbad file name -outputDir <directory> option may be used to specify the directory for the nzbad file If the file already exists, it is overwritten. If there are no rejected records the file will be empty (0 bytes)
  • 24. NZLOAD using FIXED format So far what we have seen is text delimited loading. However there are cases where it is difficult to define any delimiter. For example: A column containing lengthy data having alpha numeric characters. In such cases, it will be difficult to use text delimited loading and one has to use Fixed length loading.

Editor's Notes

  1. Data Loading Components:
  2. Data Loading Components:
  3. Data Loading Components:
  4. Data Loading Components:
  5. Data Loading Components:
  6. create external table &amp;apos;c:\ravi\student.out&amp;apos; USING (REMOTESOURCE &amp;apos;ODBC&amp;apos;)as select * from student; INSERT INTO student SELECT * FROM EXTERNAL &amp;apos;C:\RAVI\student.out&amp;apos; USING (REMOTESOURCE &amp;apos;ODBC&amp;apos;)
  7. Compressed binary == Internal Format create external table ext_student1 sameas student USING (DATAOBJECT &amp;apos;/tmp/student1.out&amp;apos; DELIMITER &amp;apos;|&amp;apos; FORMAT INTERNAL COMPRESS YES);
  8. Data Loading Components:
  9. Data Loading Components: