Posts

Showing posts from December, 2019

Load Utility in DB2

The load utility is capable of efficiently moving large quantities of data into tables. The utility can handle all data types, including large objects (LOBs) and user-defined types (UDTs). The load utility is faster than the import utility, because it writes formatted pages directly into the database, while the import utility performs SQL INSERTs. The load utility does not fire triggers, and does not perform referential or table constraints checking (other than validating the uniqueness of the indexes).   db2 "load from data.ixf of ixf insert into abc.data"   Syntax   Load from filename | pipename | device Of filetype Lobs from lobpath modified by filetype_mod method load_method [Savecount n] [Rowcount n] [Warningcount n] [Messages message_file] Insert | Replace | Restart | Terminate into table_name [(column {, column})]   -- Difference between Load and Import in DB2     IMPORT   1. Inserts one record at a time. 2. ...

Import Utility in DB2

Image
The Import utility inserts data from an input file into a table or view. If the table or view receiving the imported data which contains data in the existing table,you can replace or append the existing data with the data.   we can import using Insert,Insert_update,Replace and replace_create options.   The following command gives the data inserted or insert_updated to the existing table.     db2 "import from data.ixf of ixf insert into <table_name>"   db2 "import from data.ixf of ixf insert_update into <table_name> For more detail click  here

Export Utility in DB2

Image
The export utility extracts data from a table into a file.The command supports many different options and also supports SELECT statements with join. The following example of the export command exports all the rows in the Data table to the file data.ixf in IXF format db2 "export to data.ixf of ixf selct * from data" or db2 "export to data.del of del select * from data" All the keywords in this command are mandatory. that is, you have to provide theoutput file name , specify the file format, and the SELECT statement that will retrieve the rows to be exported. The exported file can be in a format of DEL, IXF, or WSF.

Creation of Database in DB2 LUW

In db2,an instance can contain several databases. When the database is created,by default 3 tablespaces will created under that database. 3 tablespaces are                            Catalog Tablespace                            Temporary Tablespace                            User tablespace When an instance is created,no databases are created by default.You need to explicitly create a database using "Create Database command" or create the database using "Control Center". Syntax to create Database: Create database <dbname> Automatic Storage Yes/No on <path> dbpath on <path> To Display the list of Databases in an instance,you can run the below command: db2 list db directory (By default it will show all databases in the system directory) db2 lis...

How to get Database Size in DB2

Image
you can run the following command to find out the DB Size in db2. Here in this example,my Database name is "Sample" db2 "call get_dbsize_info(?,?,?,-1)"