New answers tagged db2
The db2ilist command will list the user account(s) where a DB2 server instance exists. If no instances are listed, then you'll need to create one with the db2icrt command (after setting up a couple users and groups to accommodate it). To start a DB2 instance, sign on or su - to the instance owner's account (db2inst1 by default) and run db2start.
Assuming your desired uniqueness constraint is (one,two), here is one way to do it: DELETE FROM session.test WHERE (one, two) IN ( SELECT one, two FROM session.test GROUP BY one, two HAVING COUNT(*) > 1 )
I'm going to list a different option here, having come from a development background. At one point, we had developed a client/server application, where we wanted the DDL (for the most part) to be the same between the client and the server. The challenge was the client and the server used different database engines. So what we did was use XML. We defined all ...
The best way to support multiple database types is to optimize the sql statements for each on of them. Otherwise you will one day end up with huge performance problems on one or the other database types. Additionally to that it's unfair for your customers to tell them "I support Oracle, DB2, MSSQL, etc.) and not optimizing the SQL for each one of them. Why? ...
There is a handy dandy utility in DB2 LUW (in at least version 9.7 and higher). I'm not sure when it exactly entered the product. Sizing tables! And stored procedures that help calculate size. First you need to run the stored procedure CREATE_STORAGEMGMT_TABLES, specifying the tablespace where you wish to put these (I recommend SYSTOOLSPACE). Once you have ...
Found it. You have to declare a continue handler instead of an exit handler. That way even if there is an exception, it goes into the handler and continues with the next record. DECLARE CONTINUE HANDLER FOR SQLEXCEPTION, SQLWARNING BEGIN ... Code that handles the exception/warning ... END
I ended up figuring this one out. Shrink a tablespace with DB2 9.5 is much more difficult. The reduce and resize command exist but will only work if the high water mark is low. You cannot use reduce or resize below the HWM size. You need to use DB2DART -LHWM and have the database deactivated while doing so.
Top 50 recent answers are included