Tag Info

Hot answers tagged

5

This is completely normal. Each of these directories are for each unique log chain. If you are familiar with software version control, each log chain is like a branch. A new log chain is created each time you restore a database and roll forward to a point in time other than end of logs. Here is why: You have a database, SAMPLE. It has reached the log ...


3

Chances are that the reason your script runs from the command line but fails from cron is that your DB2 environment is already initialized (i.e. via your .profile) for the interactive session, where it is not when called by cron. Here's a suggested modification: #!/bin/bash # # Setup DB2 Environment . $HOME/sqllib/db2profile # Back up Database db2 ...


3

Yes, you can issue ROLLFORWARD after restoring an offline backup. The ROLLFORWARD command syntax remains the same, regardless of the type of restored backup image.


2

If you implement the process as a stored procedure, it can generate the dynamic SQL based on the rules in your base tables and then execute that dynamic statement. From the DB2 CLP, it's possible to write a query (probably containing one or more CTEs) that generates the SQL. The EXPORT utility can write the results of that query to a text file whose name is ...


1

For an Update to the existing table, one solution would be: UPDATE t SET t.New_Column = CASE WHEN types.mintype = 'F' and types.maxtype = 'F' THEN 'FTW' WHEN types.mintype = 'N' and types.maxtype = 'N' THEN 'Non-FTW' WHEN types.mintype = 'F' AND types.maxtype = 'N' THEN 'Mixed' END FROM tbl t INNER JOIN ...


1

Indexes essentially duplicate data on disk. The idea though is the tradeoff in performance. Extra disk used, but faster response looking up data. But since indexes do cost extra disk, one should weigh carefully whether or not the index is actually needed. If not needed, it will cost that extra disk and may even cost you in terms of performance (especially ...


1

AUTO_DB_BACKUP means DB2 will take a backup based on when it feels it should do so. The things that influence the taking of a backup are: Never completed a full backup Time elapsed since the last full backup was a specified number of hours Transaction log space consumed (with archival logging enabled), since the last full backup is a specified size. In ...


1

There are two ways to determine which logs to keep. One you write yourself. You would need to issue a db2 list history backup all for <db name>. This will show you the history file and locate the last backup and the last needed archive log. Anything prior to that can be deleted. Now you can add in automation. First step set db2 update db cfg using ...


1

When you restore an offline backup, you are not required to roll forward (although the database will be in ROLLFORWARD PENDING state at the end of the backup, which you can avoid by using the WITHOUT ROLLING FORWARD option for RESTORE DATABASE). This means that you can remove any archived log files. However, keep in mind that you may want to be careful ...


1

You can use LIST TABLESPACES SHOW DETAIL to check the High Water Mark. If it still appears high, you can always issue an ALTER TABLESPACE <tablespace> REDUCE MAX (assuming you are on automatic storage). The commands for old-style DMS are a litte different. I have another answer where I list that information


1

I'm not familiar DB2, but if it allows using count as analytic function you can do select * from (select b.Store,b.order, rownumber() over (partition by b.store order by b.order) AS RNK , count(*) over (partition by b.store) cnt from Library.Table1 b ) tmp where tmp.cnt > 1 order by tmp.Store If not, the query ...


1

I believe you are correct on the syntax. A few points to note. You cannot grant to yourself or revoke from yourself, so someone else may need to grant you the privileges you are after. You may need the DB level privileges CREATE_EXTERNAL_ROUTINE and/or CREATE_NOT_FENCED_ROUTINE granted to you. May may also need BINDADD granted to you as well. These ...



Only top voted, non community-wiki answers of a minimum length are eligible