The IBM DB2 Enterprise Server Edition is a relational model database server developed by IBM. It primarily runs on Unix (namely AIX), Linux, IBM i (formerly OS/400), z/OS and Windows servers.

learn more… | top users | synonyms (1)

-3
votes
0answers
20 views

Catch exception in DB2 function

I want to catch exception in DB2 function and return 0 if there was an exception. I don't know how the right syntax create function is_decimal(c_data varchar(100)) RETURNS INTEGER begin select ...
4
votes
1answer
74 views

DB2 - what happens when SQL archive log file reches its maximum value (S9999999.LOG)

we have DB2 in archive mode. archive log files are created and deleted from the disk. What will happen when archive log file reaches its maximum value for the name (S9999999.LOG) will it start to ...
1
vote
1answer
5k views

Run a Stored Procedure in DB2 (which has dynamic DDL) under the Definer rights

For our Datawarehouse applications, we want to perform ALTER TABLE ALTER CONSTRAINT <constname> NOT ENFORCED, before the load. Perform the load and then ALTER TABLE ALTER CONSTRAINT ...
1
vote
1answer
244 views

DB2 connection rejected with JDBC and ODBC

Good day to all, Currently I have 4 as400 servers, with db2 installed, is the production server and development server with its two replicas. The development java team uses IBM Toolbox for Java and ...
1
vote
2answers
146 views

REPLACE INTO SELECT from table

Is there a way in DB2 to replace the entire table with just selected rows from the same table ? Something like REPLACE into tableName select * from tableName where col1='a'; (I can export the ...
1
vote
1answer
2k views

How to run DB2 export command in shell

I am trying to run the following DB2 command through the Python pyodbc module: DB2 export to C:\file.ixf of ixf select * from emp_hc I am successfully connected to the DSN using the pyodbc module in ...
1
vote
1answer
1k views

How to Start DB2 10.5 HADR on the Standby Database

I am trying to set up HADR to run on my DB2 10.5 DB2 servers. I believe I have followed the steps correctly, but I'm getting the following error: [db2insh1@rslvm20 OneView]$ db2 restore database ...
0
votes
1answer
15 views

How to know what are the necessary log files for a backup in DB2?

Is there a way to know what are the necessary log files for specific backup? Un example of backup and restore process: db2 BACKUP DATABASE TST1 ONLINE TO '/db2/backup' db2 RESTORE DATABASE TST1 FROM ...
0
votes
0answers
14 views

Create db2 alert for automatic failover

We have two servers in automated failover HADR (TSA installed and haicu configured). How can we create an alert that fires when a failover happens i.e. when the primary server goes down and the ...
2
votes
1answer
27 views

How to know db size by the backup? in DB2

I want to add validation for free space before restore a db2 database. I have the *.001 backup file (compressed). How do I check the estimate db size of that backup? I can't estimate because the ...
-1
votes
0answers
73 views

which is the cost of evaluation of the request? [closed]

I have a question I do not understand you could explain to me ? Consider a table R (K,A,B) where the attribute K is a key the (whole) values of which are uniformly distributed meanwhile [1...4000]. ...
1
vote
2answers
260 views

DB2 db2fm proccess

Server is been up for 365 days, however i got some weird repeated procceses. Are these normal? ps -fea | grep db2fm db2inst1 643284 229516 29 May 25 - 212564:06 ...
1
vote
1answer
530 views

Problem deleting detached partition in DB2 LUW V9.7

Recently in prod environment we are having problems while dropping the detached partitions its giving this error """ DB21034E The command was processed as an SQL statement because it was not a ...
3
votes
2answers
28k views

How to grant all privileges on all tables in a schema to a user in IBM DB2?

At first place, I want to export database from IBM DB2 AIX into IBM DB2 windows. Unfortunately, I can't use BACKUP and RESTORE command because of difference OS issue. So I have to resort to db2move ...
0
votes
0answers
17 views

Does DB2 for z/OS have isolation level similar to READ ONLY in Oracle?

Does DB2 for z/OS have isolation level similar to READ ONLY in Oracle? I need to implement several big selects to DB2 and also I need to retrieve consistent data which was commited on time when ...
1
vote
1answer
399 views

DB2 Materialised Query Table performance problems

I'm comparing performance on a series of tables involved in insert/updates/deletes. These tables are about to become the source tables for a Materialised Query Table so I thought getting some ...
0
votes
1answer
807 views

DB2 Linked Server on SQL Server 2012 - Grant Access to Users

I have a linked server on SQL Server 2012 instance pointing to a DB2 database and I have Sys Admin access to that instance. I am unable to test connection to that DB2OLEDB database as I get below ...
2
votes
1answer
42 views

DB2 cookbook by Graeme Birchall?

Not sure if this question is appropriate here but I believe that it is of some interest for the db2:ers of the site. Once upon a time the DB2 Cookbook by Graeme Birchall could be downloaded from: ...
1
vote
1answer
21 views

How to run db2pd -hadr in batch mode

I am trying to automate some things on DB2 and would like to use a batch file to do this. I create the following batch file test.bat: db2cmd - -w "db2 -tvf test.db2" I then try to do two commands ...
1
vote
1answer
41 views

Is it more efficient to union from sub-query or combine two outer queries?

I searched for this but couldn't find the response I needed. So my apologies if this has already been asked. I'm asking in regards to DB2 but I suppose this would apply, generally speaking, to just ...
3
votes
3answers
3k views

Transfer data from DB2 to Oracle

I want to transfer data from an old DB2 system to a new Oracle database. How should I go about doing this?
3
votes
0answers
25 views

How can I generated a list of all DB2 Objects including Last Modified Date of object on AS400?

I am going through an audit, of an AS400 application. AS400 has a DB2 database, and I need to generate a list of all DB2 Objects/Tables including their last modified date. Can anyone help me? Thanks ...
0
votes
1answer
105 views

Apply DB2 logs from production to DR

Is it possible to Apply DB2 9.5 logs files from Production site to DR site? Or do I have to do Backup/Restore and rollforward ...? I copied log files from production site to DR and issued the ...
0
votes
1answer
122 views

DB2 big strange problem - database is returned to CIRCULAR mode but archive logs keep coming to old archive location

my DB2 database (v 9.7) is in Circular mode. Current Logging Type:Circular (USEREXIT) = OFF (LOGRETAIN) = OFF (LOGARCHMETH1) = OFF (LOGARCHMETH2) = OFF (LOGPRIMARY) = 10 (LOGSECOND) = 10 Path to log ...
1
vote
2answers
29 views

Hows to make a DB2 table read-only?

We need to test how an application will fail when the DB2 database cannot be written to. What is the easiest way to make a DB2 table read-only? Is this considered locking? Thanks in advance, Bert
2
votes
1answer
33 views

How to fix DB2 Unsupported functionality: GENERATED BY DEFAULT

On IBM DB2 I try the following direct SQL: CREATE TABLE users ( user_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1), user_name VARCHAR(16) NOT NULL, email_address ...
0
votes
1answer
170 views

How to track IOPS statistics?

Is there a way to access statistics about IO operations per second in DB2 9.7? I am not interested in the buffer pool hit ratio, just IOPS.
3
votes
1answer
2k views

Split comma separated entries to rows

I have a Table like this: | ID | OtherID | Data +--------+-----------+--------------------------- | 5059 | 73831 | 5103,5107 | 5059 | 73941 | 5103,5104,5107 | 5059 | 73974 | ...
3
votes
2answers
4k views

DB2 to require password each time

I am using db2inst1 to connect to a database in DB2 which I have installed on my machine. Therefore, db2inst1 user does not require username/password authentication (borrows them from the OS). I would ...
4
votes
1answer
1k views

Adding group rights in db2 for a stored procedure

I have a list of user accounts on AIX server, where the db2 database resides in. The user accounts all belong to a specific group which I can confirm from aix shell. User accounts work in DB2. ...
2
votes
1answer
105 views

DB2 9.7, create or replace tablespace possible?

I am creating my tablespaces in the sql scripts that create the database schema. This causes a problem in continuous integration processes, where consecutive execution of the script is not possible ...
7
votes
2answers
8k views

SQL Server Express vs. Oracle Express Edition vs DB2 Express-C

I have been trying to compare the features of the SQL Server Express, Oracle XE and DB2 Express-C, but find it difficult to compile all the differences into one place. Especially the current ...
1
vote
1answer
2k views

Db2 Express doesn't start TCP/IP listener (SQL5043N)

At home, I've installed DB2 Express on my Win7 notebook, as a part of the IBM WebSphere installation. At first it was working, but then I restarted Windows and moved to the office, and since then I am ...
1
vote
1answer
143 views

DB2 critical alert “database partition availability”

I have a existing DB2 database that I'm just getting started with and I have connected IBM Data Studio (web) to it and it says that it has the alert "Database Partition Availability" but it doesn't ...
1
vote
0answers
31 views

How to archive DB2 data [closed]

The current system is going to become obsolete but we need to preserve the data as part of compliance for a few years. (P.S. The system is on a mainframe.) What are the various ways I can achieve the ...
2
votes
0answers
33 views

Options for copying data out of continuously updating tables

I work with a pretty large (O(10^1) TB) DB2 (LUW, v. 9.7) database. It's got data coming in on a continuous basis via Golden Gate replication from another DB2 database. It's used for business ...
2
votes
1answer
56 views

delete records in one table based on multiple column values in second table

I need to insert and delete records in table 1 based on the data in multiple columns in table 2 Example: Table1 and Table2 have identical columns = address, city, state, zip Table1 is the master ...
2
votes
1answer
891 views

IBM DB2 9.7, possible to temporarily disable transaction logs?

I want to clean the whole database, so I am dropping all tables and DB objects in two FOR loops, within one transaction. This makes the transaction logs become full. I could increase the transaction ...
1
vote
1answer
31 views

Database index on FK with only NULL values

We have in our database an index with table cardinality over 10.000 but full key cardinality only 1. The reason for this that all the values for the column are NULL, hence cardinality 1. Does this ...
2
votes
1answer
54 views

How to use a variable date when running a db2 command in a shell script?

I need to use a date variable in a select, like bellow, but I'm getting this error: Expected tokens may include: "". SQLSTATE=42601 How can use these variables in a shell script? ...
1
vote
1answer
22 views

Create DB2 on networked drive but managing from Windows

I'm relatively new to DB world and DB2 is very new. Below is what I'm trying to achieve: Install DB2 express C and IBM data studio on windows (with Fixed IP) create/share/host DB2 on a ...
0
votes
2answers
20 views

Application == session == connection in DB2?

Can I consider as synonyms Applications, Sessions and Connections in DB2 LUW? In db2top, I see "Sessions". There is a command "db2 force applications", views and other stuff. And from the developer ...
1
vote
1answer
61 views

Syntax error while creating DB2 Trigger

What is wrong in the below trigger syntax, I am getting this error An unexpected token "INT" was found following " DECLARE NULL_ROW_ID". Expected tokens may include: "END-OF-STATEMENT".. ...
1
vote
1answer
25 views

Named Parameter Markers in DB2 for z/OS

I have a query where I will be using the same value twice for one of the parameters. This query will be run under IBM Data Studio to see the results. Below is a sample query: SELECT * FROM ...
1
vote
1answer
90 views

How to resolve foreign key references across different databases (iSeries and SQL Server)

I've got a system that has a DB2 iSeries database. We are rewriting a portion of the system and implementing it using SQL Server and Entity Framework. Originally, I was lead to believe that there ...
1
vote
1answer
29 views

Why this statement invalid: `VALUES ( CURRENT PACKAGESET )`?

I'm on db2 luw 10.5. db2 special registers can be set with: SET CURRENT ... and retrieved with: VALUES CURRENT ... with the exception of CURRENT PACKAGESET. For some reason the following ...
0
votes
1answer
67 views

DB2 Trigger Error : An unexpected token “OR INSERT” was found following SQLCODE=-104, SQLSTATE=42601, DRIVER=3.68.61

I am getting an error while executing the following queries. As per the DB2 documentation, we can have both update and insert event in the same trigger, but when I am trying to do so I am getting an ...
1
vote
1answer
225 views

How to determine when REORG with LONGLOBDATA is required (DB2)

REORGCHK only identifies when a reorg is required for space reclamation on normal (non-LOB) data. Is there a way of determining how many pages are wasted due to LONG and LOB data that has been ...
2
votes
0answers
32 views

How to order by fields of joined table while selecting for update?

For selecting some rows of table Fwt_Chipkarte for update I use the following SQL statement (IBM DB2): SELECT o.Archiviert, o.Id, o.IdComm, o.Kartennummer, o.Konto, o.LetzteAenderung, ...
7
votes
1answer
14k views

What exactly is binding in DB2?

I recently crossed over from being a Java developer to an actual DBA in our company. I am learning the ropes, so to speak, about being a DBA (which is actually somewhat of a new position for our ...