Home » Database

Category Archives: Database

How to run commands/scripts in db2?

  • You can write multiple sql statements in the file and can call in db2 to run in script mode. These sql statements will then execute one by one.
  • You can call commands/scripts using interactive mode from Command Line Processor (CLP) also to do this make sure you type ! before db2. “!” is used to run opertating system commands in interactive mode. Example.
    • CLP1
  • Else you can directly call the commands/scripts using non-interactive mode.
  • If you are calling sql statements in unix which contains aestrix (*) please make sure you add double quotes to complete sql statement.
example : db2 "select * from employee"
  • If you are calling sql statements in windows which contains less than or greater than sign, >,< then also add double quotes to complete the sql statement.
example : db2 "select * from employee where salary > 20000"
  • You can run below script in both interactive and non-inetractive mode. Please notice I have used $ as line terminator character, you can use any special characters. Default line terminator is ;
-- script1.txt 
------------------------------------- 
connect to sample$
create table test_table(id int)$
insert into test_table values (1),(2),(3),(4)$
select * from test_table$
update test_table set id=20 where id > 2$
select * from test_table$
  • to run above script pass the line terminator character, in this it is $ so parmeter will be -td$, you can also do verbose mode with -v to see what is the script executing, and -f <abolute_path\file_name>. example
!db2 -td$ -v -f /sapcommon/script/script1.txt

 

Why organization prefer DB2?

Lower Total Cost of Ownership

  • In transactional processing db2 saves 28-34% of TCO as compared to competition
  • In Analytical processing db2 saves 54-63% of TCO as compared to competition

Faster Deployment

  • DB2 offers average 57 days faster deployment time than the competition

Faster Value to Time

  • As we get faster time to deploy the project becomes live very soon and we get faster time to value

Less complexity

Need less FTE to work with db2. In general

  • Manufacturing require 0.15 DB2 FTE as compared to 0.5 competition FTE
  • Retail require 0.25 DB2 FTE as compared to 0.75 competition FTE
  • Financial services require 0.5 FTE as compared to 1.25 copetition FTE

Higher compression rate

This save a lot of money on the storage cost.

  • On average db2 compression rate is of 12.6x
  • Whereas competition has an average of 7.3x

Moving to DB2 is easy

  • PL/Sql native support is present for DB2
  • Existing db skills work with db2 as well.

Source :

Download :

hybrid-cloud-analytics-platform-im-research-report

Categories

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

000webhost logo