* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Blue Stack - Setting up DB2 Guideline Product(s): IBM Cognos 8
Survey
Document related concepts
Microsoft SQL Server wikipedia , lookup
Entity–attribute–value model wikipedia , lookup
Oracle Database wikipedia , lookup
Extensible Storage Engine wikipedia , lookup
Ingres (database) wikipedia , lookup
Functional Database Model wikipedia , lookup
Concurrency control wikipedia , lookup
Open Database Connectivity wikipedia , lookup
Microsoft Jet Database Engine wikipedia , lookup
Relational model wikipedia , lookup
Versant Object Database wikipedia , lookup
Clusterpoint wikipedia , lookup
Transcript
Guideline Blue Stack - Setting up DB2 Product(s): IBM Cognos 8 Area of Interest: Infrastructure Blue Stack - Setting up DB2 2 of 77 Copyright Copyright © 2008 Cognos ULC (formerly Cognos Incorporated). Cognos ULC is an IBM Company. While every attempt has been made to ensure that the information in this document is accurate and complete, some typographical errors or technical inaccuracies may exist. Cognos does not accept responsibility for any kind of loss resulting from the use of information contained in this document. This document shows the publication date. The information contained in this document is subject to change without notice. Any improvements or changes to the information contained in this document will be documented in subsequent editions. This document contains proprietary information of Cognos. All rights are reserved. No part of this document may be copied, photocopied, reproduced, stored in a retrieval system, transmitted in any form or by any means, or translated into another language without the prior written consent of Cognos. Cognos and the Cognos logo are trademarks of Cognos ULC (formerly Cognos Incorporated) in the United States and/or other countries. IBM and the IBM logo are trademarks of International Business Machines Corporation in the United States, or other countries, or both. All other names are trademarks or registered trademarks of their respective companies. Information about Cognos products can be found at www.cognos.com This document is maintained by the Best Practices, Product and Technology team. You can send comments, suggestions, and additions to [email protected] . IBM Cognos Proprietary Information Blue Stack - Setting up DB2 3 of 77 Contents 1 INTRODUCTION ............................................................................................ 4 1.1 1.2 1.3 1.4 PURPOSE .............................................................................................................. 4 APPLICABILITY ....................................................................................................... 4 EXCLUSIONS AND EXCEPTIONS .................................................................................... 4 MODIFICATION HISTORY ........................................................................................... 4 2 DB2 & UDB .................................................................................................... 6 2.1 2.1.1 2.1.2 2.1.3 2.2 2.3 2.4 CONNECTIVITY ....................................................................................................... 6 Connectivity from Windows ................................................................................. 7 Connectivity from Unix........................................................................................ 8 Bindings ...........................................................................................................11 AUTHENTICATION ................................................................................................. 12 CATALOGING ....................................................................................................... 13 SAMPLE DATA ...................................................................................................... 15 3 IBM COGNOS 8............................................................................................ 16 3.1 3.1.1 3.1.2 3.1.3 3.2 3.2.1 3.2.2 3.2.3 3.2.4 3.3 3.3.1 3.3.2 3.3.3 3.4 3.4.1 CONTENT STORE .................................................................................................. 16 Creating the Content Store database...................................................................16 Connectivity using JDBC-2..................................................................................24 Catalog the Database ........................................................................................24 SAMPLE DATA ...................................................................................................... 24 Creating the Samples database...........................................................................25 Catalog the Databases .......................................................................................31 Populating the Samples database .......................................................................32 Test the Sample Reports ....................................................................................34 METRICS SERVER .................................................................................................. 38 Create the Metrics Store database ......................................................................38 Catalog the Database ........................................................................................39 Initialise the Sample ..........................................................................................39 DATA MANAGER ................................................................................................... 40 Create a sample Catalog ....................................................................................40 4 IBM COGNOS SERIES 7 ............................................................................... 42 4.1 4.1.1 4.1.2 4.1.3 4.1.4 SAMPLE DATA ...................................................................................................... 42 Create the Samples database .............................................................................42 Catalog the Database ........................................................................................44 Populating the Samples database .......................................................................44 Test the Sample Reports ....................................................................................45 5 APPENDICES ............................................................................................... 47 5.1 5.1.1 5.1.2 5.2 5.2.1 5.2.2 5.2.3 TESTCASE ACQUISITION.......................................................................................... 47 Export/backup one or more databases ................................................................47 Generate the DDL/load scripts ............................................................................48 TROUBLESHOOTING ............................................................................................... 59 UDA Test..........................................................................................................59 UDA Trace ........................................................................................................63 DB2 Client Tracing.............................................................................................66 IBM Cognos Proprietary Information Blue Stack - Setting up DB2 5.3 5.3.1 5.3.2 5.4 4 of 77 REFERENCES ........................................................................................................ 67 IBM..................................................................................................................67 Other ...............................................................................................................67 DATABASE CREATION SCRIPTS .................................................................................. 68 1 Introduction 1.1 Purpose This document is intended to assist the Technical Architect installing and testing IBM Cognos products to interact with DB2 database(s). Content supplements the IBM Cognos and IBM Product Installation Guides. Discussion includes an outline of DB2 connectivity alternatives and how to use DB2 Connect to connect to IBM databases from Windows and Unix. Detailed instructions are provided for creation of UDB databases for use by IBM Cognos 8 components, and deployment of Sample data for IBM Cognos 8 and IBM Cognos Series 7. The "Blue Stack" label alludes to the stack of components distributed by IBM. "Big Blue" has been an industry euphemism for 'IBM" for many years. 1.2 Applicability Relevant to all IBM Cognos products implemented as DB2 or UDB client applications on Windows or Unix (AIX, Solaris-SPARC, HP-UX, Linux-x86). Note that IBM Cognos applications are 32bit, and may be supported on 64bit Operating Systems that provide a 32bit runtime environment. This is irrespective of whether the underlying hardware uses 32bit or 64bit CPUs. All content in this document was tested using UDB v9.1. 1.3 Exclusions and Exceptions Does not discuss DB2-specific data management features eg • Materialised Query Tables (MQT), • DB2 Cube Views, • Data Modelling practices. Also does not discuss licensing of IBM components. 1.4 Modification History • 3-Apr-2007 Initial Release • 14-June-2007 Further detail for iSeries Connectivity IBM Cognos Proprietary Information Blue Stack - Setting up DB2 IBM Cognos Proprietary Information 5 of 77 Blue Stack - Setting up DB2 6 of 77 2 DB2 & UDB 2.1 Connectivity IBM offers database engines under the brand "DB2" on the S/390 & zOS mainframes and AS/400 midrange servers. On Windows and Unix the database engine is branded "UDB" or Universal Database. Though these various database engines provide very similar capabilities, the implementation does vary regarding eg Character Set support and some elements of SQL syntax. Connectivity from Windows to the mainframe or midrange implementations of DB2 is often provided using "iSeries Access". All client operating systems support connectivity to all variants of DB2 or UDB using DB2 Connect. IBM Cognos uses "native" connectivity (not JDBC) from IBM Cognos 8 (Framework Manager and Report Servers) and Series 7 to DB2. IBM Cognos 8 Content Manager, Scheduling & Delivery Service, Audit and Metrics Studio use JDBC-2 (db2java.jar) for connectivity to DB2 implementations of the Content Store, Notification Store, Audit Database and Metrics Store. Refer • DB2 Connect http://www-306.ibm.com/software/data/db2/db2connect/ • iSeries Access http://www-03.ibm.com/servers/eserver/iseries/access/windows/ When using IBM Cognos 8 Framework Manager or Data Manager, or IBM Cognos Series 7 Impromptu or Transformer for modelling, all connectivity to DB2 is directly from the Windows desktop. While tempting to use ODBC [perhaps via iSeries Access] drivers for connectivity, this is discouraged because those models will not be portable to non-Windows environments (eg Unix implementation of IBM Cognos 8 Report Servers or Data Manager, or Series 7 Transformer or Impromptu Web Reports). IBM Cognos recommends always using DB2 Connect for connectivity to all forms of DB2 or UDB. Refer: • DB2 Connect – compare products http://www-306.ibm.com/software/data/db2/db2connect/hmc.html IBM Cognos Proprietary Information Blue Stack - Setting up DB2 7 of 77 2.1.1 Connectivity from Windows The DB2 Run-Time Client Lite is an installable component that makes it easier to provide access to DB2 Universal Database servers. The DB2 Run-Time Client Lite is designed to be redistributable by independent software vendors (ISVs) and to be used for application distribution in mass deployment scenarios typical of large enterprises. The DB2 Run-Time Client Lite is a smaller footprint version of the DB2 Run-Time Client, and contains support necessary for JDBC, SQLJ, ODBC, CLI, OLE DB and .NET. The software is shipped as a single executable, making it easy to redistribute and deploy. It is only available for the Windows® operating system, and supports only the TCP/IP and Named Pipes communication protocols. Refer • DB2 Run-Time Client Lite http://www-306.ibm.com/software/data/db2/runtime.html The Windows client installation adds the following folders to the PATH: C:\Program Files\IBM\SQLLIB\BIN C:\Program Files\IBM\SQLLIB\FUNCTION C:\Program Files\IBM\SQLLIB\REPL It also adds keys to the Windows Registry at HKLM\Software\IBM\DB2 Note that the Run-Time Client Lite is not licenced for connectivity to DB2 on AS/400 (iSeries). For this you require one of the full editions of DB2 Connect: • DB2 Connect Application Server Edition http://www-306.ibm.com/software/data/db2/db2connect/edition-ase.html • DB2 Connect Unlimited Edition for iSeries http://www-306.ibm.com/software/data/db2/db2connect/edition-uei.html IBM Cognos Proprietary Information Blue Stack - Setting up DB2 8 of 77 2.1.2 Connectivity from Unix Environment Variables required for connectivity to DB2 from Unix are managed using the db2profile script installed with the DB2 Client software. • DB2DIR Where the client software was installed • DB2INSTANCE default database server connection • PATH where commands are found • Library Path (as appropriate for flavour of Unix) where libraries for commands are found Optionally, also set DB2CLIINIPATH exact location of db2cli.ini configuration file DB2CODEPAGE Character Set encoding of SQL statements. IBM Cognos products require 32bit connectivity libraries. The db2profile script may specify the 64bit libraries ahead of the 32bit libraries in the Library Path. This requires modification for the IBM Cognos components to operate correctly. # # Connectivity to IBM DB2 # DB2PROFILE=/usr/IBM/db2inst1/sqllib/db2profile if [ -x ${DB2PROFILE} ] then . ${DB2PROFILE} export DB2DIR INSTHOME # Confirm presence of db2cli.ini DB2CLIINIPATH=${DB2CLIINIPATH:-${DB2DIR}/cfg/db2cli.ini} if [ -r ${DB2CLIINIPATH} ] then export DB2CLIINIPATH else echo "WARNING: DB2 Client Config ${DB2CLIINIPATH} not found" 1>&2 fi # Cognos requires Unicode character set for interaction with DB2 if [ `db2set DB2CODEPAGE` -ne 1208 ] then echo "INFO: DB2 CodePage ("`db2set DB2CODEPAGE`") overridden to support Unicode" 1>&2 DB2CODEPAGE=1208 export DB2CODEPAGE fi IBM Cognos Proprietary Information Blue Stack - Setting up DB2 9 of 77 # Ensure that 64bit libraries are AFTER 32bit case `uname` in Linux) LD_LIBRARY_PATH=`echo ${LD_LIBRARY_PATH} | sed \ "s%${INSTHOME}/sqllib/lib64:${INSTHOME}/sqllib/lib32%${INSTHOME}/sqllib/ lib32:${INSTHOME}/sqllib/lib64%g"` export LD_LIBRARY_PATH ;; AIX) LIBPATH=`echo ${LIBPATH} | sed \ "s%${INSTHOME}/sqllib/lib64:${INSTHOME}/sqllib/lib32%${INSTHOME}/sqllib/ lib32:${INSTHOME}/sqllib/lib64%g"` export LIBPATH ;; SunOS) LD_LIBRARY_PATH=`echo ${LD_LIBRARY_PATH} | sed \ "s%${INSTHOME}/sqllib/lib64:${INSTHOME}/sqllib/lib32%${INSTHOME}/sqllib/ lib32:${INSTHOME}/sqllib/lib64%g"` export LD_LIBRARY_PATH ;; HP-UX) SHLIB_PATH=`echo ${SHLIB_PATH} | sed \ "s%${INSTHOME}/sqllib/lib64:${INSTHOME}/sqllib/lib32%${INSTHOME}/sqllib/ lib32:${INSTHOME}/sqllib/lib64%g"` export SHLIB_PATH ;; *) echo "ERROR: Connectivity to DB2 not supported from `uname`." 1>&2 ;; esac else echo "WARNING: DB2 profile not found at ${DB2PROFILE}" 1>&2 fi # # # # # # # # From the Cognos Documentation ----------------------------If your Content Store is a DB2 Database and you receive an SQL1224N error on AIX, check the db2diag.log file for additional information about the error. If the error includes reason code 18, you may need to change the DB2 configuration to accept more connections. For more information, see the IBM DB2 support pages for the error SQL1224N # From the DB2 Documentation # -------------------------- IBM Cognos Proprietary Information Blue Stack - Setting up DB2 # # # # # # # # # # # # # 10 of 77 By default, 32-bit applications cannot attach more than 11 shared memory segments per process, of which a maxium of 10 can be used for local DB2 connections. Use the EXTSHM (extended shared memory) functionality to ensure that an adequate number of shared memory segments are available for DB2 connections. The EXTSHM functionality is available for DB, Version 7.2 (which is the result of installation of DB2 UDB, Version 7.1 Fix Pack 3) or later versions of DB2. If you do not provide an adequate number of shared memory segments, you might see the following error message: SQL1224N A database agent could not be started to service a request, or was terminated as a result of a database system shutdown or a force command. SQLSTATE=55032 IBM Cognos Proprietary Information Blue Stack - Setting up DB2 11 of 77 2.1.3 Bindings IBM periodically sends out fixpaks for the DB2 servers. When these fixpaks are applied to the server, the client must either: 1. Has to have the same fixpak applied, or 2. Has to be bound to the new DB2 server/fixpak. If the client and server are not at the same level (fixpak install), then intermittent errors will occur when selecting columns from tables in the database. You can check what the client version is by typing db2level at a command prompt (Windows or Unix). Example output: C:\> db2level DB21085I Instance "DB2" uses "32" bits and DB2 code release "SQL08027" with level identifier "03080106". Informational tokens are "DB2 v8.1.14.292", "s061108", "WR21377", and FixPak 14". Product is installed at "C:\PROGRA~1\IBM\SQLLIB". From the above, the client is "DB2 v8.1", and the service pack/level is 14. The DB2 server and DB2 client should be synchronized, meaning that they are both upgraded to the same fixpac level. To ensure that the server and client are synchronized, verify the fixpac level of your DB2 server and then apply the same fixpac to your DB2 client. Alternatively, you can use bind commands to synchronize the server and client: 1. Navigate to the bnd directory and invoke the DB2 Command Line Processor: CD /D DB2 2. C:\Progra~1\IBM\SQLLIB\bnd Connect to the target database as a user with database administrator privileges CONNECT TO cogsam74 USER cognos USING admin1234 3. Type the following commands: bind @db2ubind.lst BLOCKING ALL SQLERROR CONTINUE GRANT PUBLIC bind @db2cli.lst BLOCKING ALL SQLERROR CONTINUE GRANT PUBLIC IBM Cognos Proprietary Information Blue Stack - Setting up DB2 2.2 12 of 77 Authentication The DB2 security model typically leverages the Operating System Users & Groups on the Database Host. When granting rights to an account in DB2, that account and its password are managed by the Operating System. In the example below, if the DB2 database is on Unix then "cognos" must be an account on the Unix host (the account does not have to have a legitimate shell – thereby preventing access to the commandline on that host). If DB2 is on Windows then "cognos" must be a local account on the DB2 host. GRANT DBADM ON DATABASE TO USER cognos DB2 supports Authentication Plugins which allow the accounts to be managed in an alternate repository such as LDAP. Implementing this integration is outside the scope of Cognos involvement. Refer: • DB2 UDB security, Part 2 Understand the DB2 Universal Database security plug-ins http://www-128.ibm.com/developerworks/db2/library/techarticle/dm0512chong/ • Using Active Directory for authentication and authorisation in DB2 http://rc.vintela.com/topics/howto/db2/ • DB2 Authentication with Kerberos http://publib.boulder.ibm.com/infocenter/db2help/topic/com.ibm.db2.udb .doc/admin/c0011990.htm IBM Cognos Proprietary Information Blue Stack - Setting up DB2 2.3 13 of 77 Cataloging The DB2 client software uses a database "Alias" to locate the database you want to connect to. The Alias-name and where it resolves to is "cataloged" using the DB2 Command Line Interface. There are two steps to recording a database alias: 1. identify the host and port [where DB2 is located] as a "Node" CATALOG [ADMIN] TCPIP NODE node-name REMOTE hostname [SERVER service-name] [SECURITY {SOCKS}] [REMOTE_INSTANCE instance-name] [SYSTEM system-name] [OSTYPE os-type] [WITH "30 char comment string"] 2. establish an alias for a named database at the named Node above CATALOG DATABASE database-name [AS alias] [ON drive | AT NODE node-name] [AUTHENTICATION {SERVER | CLIENT | DCS | DCE SERVER PRINCIPAL principalname | KERBEROS TARGET PRINCIPAL principalname | SERVER_ENCRYPT | DCS_ENCRYPT | DATA_ENCRYPT | GSSPLUGIN}] [WITH "30 char comment-string"] You can list the currently catalogued Nodes & Databases using the DB2 CLI: DB2 LIST NODE DIRECTORY DB2 LIST DATABASE DIRECTORY If not catalogued, then you must catalog the database (and the node it is at – if necessary). Syntax: DB2 CATALOG TCPIP NODE dbnode REMOTE dbhost SERVER 50000 DB2 CATALOG DATABASE cognos AT NODE dbnode IBM Cognos Proprietary Information Blue Stack - Setting up DB2 14 of 77 For those readers who are more familiar with Oracle Aliases, these two cataloguing statements record the same detail as Oracle would for a similar database in TNSNAMES.ORA: ALIAS = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = NODE CONNECTION DETAILS ) ) (CONNECT_DATA = (SERVICE_NAME = DATABASE) GOSALES.WORLD = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = sottdmdb1)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = ORCL) ) ) The DB2 Client can also be used to access the IBM Cloudescape or Apache Derby database. An example of the catalog commands is shown below: CATALOG TCPIP NODE derby REMOTE dbhost SERVER 1527 WITH "Cognos Content Database" CATALOG DATABASE cm AT NODE derby AUTHENTICATION SERVER WITH "Derby Content Store" Cloudescape/Derby does not support the DB2 Metadata Queries fully, so some more effort is required to query Derby tables, eg: CONNECT TO cm USER cognos USING cognos -- LIST TABLES FOR SCHEMA cognos SELECT SubStr(T.TableName,1,30) "Table/View", SubStr(S.SchemaName,1,15) "Schema", T.TableType "Type" FROM sys.SysSchemas S, sys.SysTables T WHERE S.SchemaId = T.SchemaId AND S.SchemaName = 'COGNOS' ORDER BY 2,1 IBM Cognos Proprietary Information Blue Stack - Setting up DB2 2.4 15 of 77 Sample Data IBM supply a tool with DB2 to create a SAMPLE database. Invoke db2sampl from the DB2 server installation to create the DB2 sample data. Other editions of DB2 may include further sample data for [eg] Data Warehousing. Refer • db2sampl - Create sample database command http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/co m.ibm.db2.udb.admin.doc/doc/r0001934.htm • The Sample Database http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/co m.ibm.db2.udb.apdv.samptop.doc/doc/r0001094.htm The total space required for the DB2 Sample Database is approximately 128MB. IBM Cognos Proprietary Information Blue Stack - Setting up DB2 16 of 77 3 IBM Cognos 8 3.1 Content Store The IBM Cognos 8 Content Store consists of two collections of tables. These are the Notification Tables (mostly prefixed with NC_) that are managed by the Application Tier Scheduling and Delivery Service (SDS), and the Content Store Tables (prefixed with CM) that are managed by the Content Manager. It is common to store these in the same schema or database, but in the guidance below we distinguish these into two schemas that identify their purpose. The Audit Logs are also often written into the Content Store database, but IBM Cognos recommends that these are always implemented distinctly from the [OLTP] Content Store. The discussion below assumes only one database is used. 3.1.1 Creating the Content Store database The IBM Cognos Content Store requires specific BufferPools and Tablespaces. In the configuration below we assume the Audit Logs, Content Store and Notification Store are all managed in distinct schemas by distinct database accounts. Create the 'cognos' database. DB2START @ ECHO #### Creating database @ CREATE DATABASE cognos ALIAS cognos @ -- Max 30 characters: CHANGE DATABASE cognos COMMENT WITH @ CONNECT TO cognos @ UPDATE DATABASE CONFIGURATION USING @ UPDATE DATABASE CONFIGURATION USING @ CONNECT RESET @ USING CODESET UTF-8 TERRITORY AU ----+----1----+----2----+----3 'Content Store for Cognos 8' APPLHEAPSZ 1024 DEFERRED LOCKTIMEOUT 240 DEFERRED Buffer Pools Three Buffer Pools are required for Cognos. We do not assume that appropriately sized Buffer Pools already exist, so we create them and prefix them with COG to indicate they're used by Cognos tablespaces. IBM Cognos Proprietary Information Blue Stack - Setting up DB2 17 of 77 COG04KBP COG08KBP COG16KBP ECHO #### Creating Buffer Pools @ -- COG04KBP -- COG08KBP -- COG16KBP CONNECT TO cognos @ CREATE BUFFERPOOL COG04KBP IMMEDIATE SIZE 250 PAGESIZE 4 K @ CREATE BUFFERPOOL COG08KBP IMMEDIATE SIZE 250 PAGESIZE 8 K @ CREATE BUFFERPOOL COG16KBP IMMEDIATE SIZE 250 PAGESIZE 16 K @ CONNECT RESET @ Tablespaces The Audit Database and Content & Notification Store tables require different sized Buffer Pools. Multiple Tablespaces are created for this purpose. COGSYSTMP System Temporary Tablespace COGUSRTMP User Temporary Tablespace COGUSRDAT Content Store Tablespace COGUSRLOG Audit Logs Tablespace The DBA may choose to create the Tablespaces on other disks and may amend the USING parameter below. ECHO #### Creating Tablespaces @ -- COGSYSTMP - System Temporary Tablespace -- COGUSRTMP - User Temporary Tablespace -- COGUSRDAT - Content Store Tablespace -- COGUSRLOG - Audit Logs Tablespace CONNECT TO cognos @ --- COGSYSTMP - System Temporary Tablespace IBM Cognos Proprietary Information Blue Stack - Setting up DB2 -CREATE SYSTEM TEMPORARY TABLESPACE COGSYSTMP IN DATABASE PARTITION GROUP IBMTEMPGROUP PAGESIZE 16 K MANAGED BY SYSTEM USING ('D:\DB2\NODE0000\COGNOS\COGSYSTMP01') EXTENTSIZE 16 PREFETCHSIZE 16 OVERHEAD 10.5 TRANSFERRATE 0.14 BUFFERPOOL COG16KBP @ COMMENT ON TABLESPACE COGSYSTMP IS 'Cognos Sys Temp' @ --- COGUSRTMP - User Temporary Tablespace -CREATE USER TEMPORARY TABLESPACE COGUSRTMP IN DATABASE PARTITION GROUP IBMDEFAULTGROUP PAGESIZE 4 K MANAGED BY SYSTEM USING ('D:\DB2\NODE0000\COGNOS\COGUSRTMP01') EXTENTSIZE 8 PREFETCHSIZE 8 OVERHEAD 10.5 TRANSFERRATE 0.33 BUFFERPOOL COG04KBP @ COMMENT ON TABLESPACE COGUSRTMP IS 'Cognos User Temp' @ --- COGUSRDAT - Content Store Tablespace -CREATE REGULAR TABLESPACE COGUSRDAT IN DATABASE PARTITION GROUP IBMDEFAULTGROUP PAGESIZE 4 K MANAGED BY SYSTEM USING ('D:\DB2\NODE0000\COGNOS\COGUSRDAT01') EXTENTSIZE 8 PREFETCHSIZE 8 OVERHEAD 10.5 TRANSFERRATE 0.33 BUFFERPOOL COG04KBP DROPPED TABLE RECOVERY ON @ COMMENT ON TABLESPACE COGUSRDAT IS 'Cognos User Data' @ --- COGUSRLOG - Audit Logs Tablespace -- IBM Cognos Proprietary Information 18 of 77 Blue Stack - Setting up DB2 19 of 77 CREATE REGULAR TABLESPACE COGUSRLOG IN DATABASE PARTITION GROUP IBMDEFAULTGROUP PAGESIZE 8 K MANAGED BY SYSTEM USING ('D:\DB2\NODE0000\COGNOS\COGUSRLOG01') EXTENTSIZE 16 PREFETCHSIZE 16 OVERHEAD 10.5 TRANSFERRATE 0.33 BUFFERPOOL COG08KBP DROPPED TABLE RECOVERY OFF @ COMMENT ON TABLESPACE COGUSRLOG IS 'Cognos App Logs' @ --- Amend Overhead on default tablespaces -ALTER TABLESPACE TEMPSPACE1 PREFETCHSIZE 16 OVERHEAD 24.100000 TRANSFERRATE 0.900000 @ ALTER TABLESPACE USERSPACE1 PREFETCHSIZE 16 OVERHEAD 24.100000 TRANSFERRATE 0.900000 @ CONNECT RESET @ Users If the Audit Logs, Content Store and Notification Store are implemented in the same database but in different schemas, then corresponding database accounts must be created. cog8cs Cognos8 Content Store cog8ns Cognos8 Notification Store cog8al Cognos8 Audit Logs DB2 is usually configured to delegate authentication to the Operating System that the database is running on. Consequently each database account must be a local Operating System account on the database host. After creating the Users, they must be granted appropriate access to the Tablespaces and permission to login. We assume that the Cognos software is operated by a cognos account, and grant that user DBA rights to this database instance. ECHO #### Creating Schemas, Grants @ IBM Cognos Proprietary Information Blue Stack - Setting up DB2 20 of 77 -- cog8cs - Cognos8 Content Store -- cog8ns - Cognos8 Notification Store -- cog8al - Cognos8 Audit Logs CONNECT TO cognos @ --- cog8cs - Cognos8 Content Store -CREATE SCHEMA cog8cs AUTHORIZATION cog8cs @ COMMENT ON SCHEMA cog8cs IS 'Cognos 8 Content Store' @ GRANT CREATETAB,BINDADD,CONNECT,IMPLICIT_SCHEMA ON DATABASE TO USER cog8cs @ GRANT CREATEIN,DROPIN,ALTERIN ON SCHEMA cog8cs TO USER cog8cs WITH GRANT OPTION @ GRANT USE OF TABLESPACE COGUSRDAT TO USER cog8cs @ GRANT USE OF TABLESPACE COGUSRTMP TO USER cog8cs WITH GRANT OPTION @ --- cog8ns - Cognos8 Notification Store -CREATE SCHEMA cog8ns AUTHORIZATION cog8ns @ COMMENT ON SCHEMA cog8ns IS 'Cognos 8 Notification Store' @ GRANT CREATETAB,BINDADD,CONNECT,IMPLICIT_SCHEMA ON DATABASE TO USER cog8ns @ GRANT CREATEIN,DROPIN,ALTERIN ON SCHEMA cog8ns TO USER cog8ns WITH GRANT OPTION @ GRANT USE OF TABLESPACE COGUSRDAT TO USER cog8ns @ GRANT USE OF TABLESPACE COGUSRTMP TO USER cog8ns WITH GRANT OPTION @ --- cog8al - Cognos8 Audit Logs -- IBM Cognos Proprietary Information Blue Stack - Setting up DB2 21 of 77 CREATE SCHEMA cog8al AUTHORIZATION cog8al @ COMMENT ON SCHEMA cog8al IS 'Cognos 8 Audit Logs' @ GRANT CREATETAB,BINDADD,CONNECT,IMPLICIT_SCHEMA ON DATABASE TO USER cog8al @ GRANT CREATEIN,DROPIN,ALTERIN ON SCHEMA cog8al TO USER cog8al WITH GRANT OPTION @ GRANT USE OF TABLESPACE COGUSRLOG TO USER cog8al @ GRANT USE OF TABLESPACE COGUSRTMP TO USER cog8al WITH GRANT OPTION @ -- Use the 'cognos' account to administer the database GRANT DBADM ON DATABASE TO USER cognos @ CONNECT RESET @ Tuning The tuning suggestions below are rudimentary, and the advice of a DBA should be deferred to. ECHO #### Tuning database @ UPDATE @ UPDATE @ UPDATE @ UPDATE @ UPDATE @ UPDATE @ UPDATE @ UPDATE @ UPDATE DBM CFG USING intra_parallel NO DBM CFG USING federated NO DBM CFG USING fed_noauth NO DB CFG FOR cognos USING locklist 50 DB CFG FOR cognos USING dft_degree 1 DB CFG FOR cognos USING maxlocks 22 DB CFG FOR cognos USING avg_appls 1 DB CFG FOR cognos USING stmtheap 2048 DB CFG FOR cognos USING dft_queryopt 5 IBM Cognos Proprietary Information Blue Stack - Setting up DB2 @ CONNECT TO cognos @ COMMIT @ CONNECT RESET @ DB2STOP @ DB2START @ IBM Cognos Proprietary Information 22 of 77 Blue Stack - Setting up DB2 23 of 77 DOS Batch Script Ensure that you have created the folder location(s) that the Tablespaces will be created in, before you invoke the DB2 command interpreter to process the database creation script above. @ECHO OFF SETLOCAL REM -----------------------------------------------------------------REM Construct the 'COGNOS' database in DB2 REM for use with Cognos 8 REM -----------------------------------------------------------------IF NOT EXIST D:\DB2\NODE0000\COGNOS\NUL mkdir D:\DB2\NODE0000\COGNOS db2 -f cognos.sql -o -td@ -v -z cognos.log :END ENDLOCAL Unix Batch Script Ensure that you have created the folder location(s) that the Tablespaces will be created in, before you invoke the DB2 command interpreter to process the database creation script above. #! /usr/bin/ksh # -----------------------------------------------------------------# Construct the 'COGNOS' database in DB2 # for use with Cognos 8 # -----------------------------------------------------------------if [ ! –d /db2/NODE0000/COGNOS ] ; then mkdir –p /db2/NODE0000/COGNOS fi db2 -f cognos.sql -o -td@ -v -z cognos.log IBM Cognos Proprietary Information Blue Stack - Setting up DB2 24 of 77 3.1.2 Connectivity using JDBC-2 Cognos currently [April 2007] supports only 1 JDBC Type-2 connections to the Content Store, Notification Store and Audit Database. JDBC-2 requires that the Native Client is also installed locally on the client host as the JDBC driver loads the client libraries [JNI] from the Library Path. Copy the JDBC Client Driver db2java.zip from the DB2 Client ("C:\Program Files\IBM\SQLLIB\java" or ${DB2DIR}/java) to the Cognos 8 webapps/p2pd/WEB-INF/lib folder on the Content Manager and Application Tier hosts. Rename this to db2java.jar Refer • JDBC Driver http://en.wikipedia.org/wiki/JDBC_type_2_driver • An Overview of DB2 and Java Database Connectivity http://www128.ibm.com/developerworks/db2/library/techarticle/0203zikopoulos/020 3zikopoulos.html#type2 Note that the Audit Reports use the Native Client (not JDBC). IBM Cognos does not support queries directly against the Content or Notification Stores. 3.1.3 Catalog the Database Catalog the Content Store database on the Content Manager host(s). Catalog the Notification Store database on all Application Tier hosts. Catalog the Audit database on all Content and Application Tier hosts. CATALOG TCPIP NODE dbnode REMOTE dbhost SERVER 50000 CATALOG DATABASE cognos AT NODE dbnode WITH 'Content Store for Cognos 8' 3.2 Sample Data Cognos 8 includes sample data for the following schemas: 1 Cognos does not [yet as of April 2007] support IBM's JDBC-4 Universal Database Driver (jb2jcc.jar) IBM Cognos Proprietary Information Blue Stack - Setting up DB2 25 of 77 GOHR GO Human Resources GOMR GO Multilingual Retailers GORT GO Retailers GOSL GO Sales GOSLDW GO Sales Data Warehouse Cognos releases improved samples with each version of Cognos products. These improvements include more current data (timestamps), more geographic regions and non-Latin1 data, and more complexity in the relationships amongst tables to better reflect the various situations that customer testcases require. Samples supplied with Series 7 or ReportNet are not suitable for the Sample Reports supplied with IBM Cognos 8. If you want to maintain all samples concurrently, then IBM Cognos recommends that they are populated into separate databases that are named and catalogued appropriately. The total space required for the IBM Cognos 8 Sample Database is approximately 195MB. 3.2.1 Creating the Samples database Create the 'cogsam82' database. Create a Unicode (Code Set 1208) database named COGSAM82. This naming convention indicates COGnos SAMple data for v8.2 DB2START @ ECHO #### Creating database @ CREATE DATABASE cogsam82 ALIAS cogsam82 USING CODESET UTF-8 TERRITORY AU @ -- Max 30 characters: ----+----1----+----2----+----3 CHANGE DATABASE cogsam82 COMMENT WITH 'Sample Data for Cognos 8.2' @ CONNECT TO cogsam82 @ UPDATE DATABASE CONFIGURATION USING APPLHEAPSZ 1024 DEFERRED @ UPDATE DATABASE CONFIGURATION USING LOCKTIMEOUT 240 DEFERRED @ CONNECT RESET @ Buffer Pools Some of the sample data is 'wide' and requires a Tablespace with a non-standard Buffer Pool. IBM Cognos Proprietary Information Blue Stack - Setting up DB2 26 of 77 We do not assume that appropriately sized Buffer Pools already exist, so we create them and prefix them with COG to indicate they're used by Cognos tablespaces. COG04KBP COG08KBP COG16KBP ECHO #### Creating Buffer Pools @ -- COG04KBP -- COG08KBP -- COG16KBP CONNECT TO cogsam82 @ CREATE BUFFERPOOL COG04KBP IMMEDIATE SIZE 250 PAGESIZE 4 K @ CREATE BUFFERPOOL COG08KBP IMMEDIATE SIZE 250 PAGESIZE 8 K @ CREATE BUFFERPOOL COG16KBP IMMEDIATE SIZE 250 PAGESIZE 16 K @ CONNECT RESET @ Tablespaces If you do not create a tablespace with a 16K Buffer Pool then the attempt to populate the sample data using DB2MOVE will produce errors. COGSAMPLE Cognos Sample data Tablespace The DBA may choose to create the Tablespace on other disks and may amend the USING parameter below. ECHO #### Creating Tablespace(s) @ CONNECT TO cogsam82 @ -- COGSAMPLE - Cognos Sample Data (GOSL,GOSLDW,GOHR,GORT,GOMR) -CREATE REGULAR TABLESPACE COGSAMPLE PAGESIZE 16 K MANAGED BY SYSTEM USING ('D:\DB2\NODE0000\COGSAM82\COGSAMPLE01') EXTENTSIZE 16 PREFETCHSIZE 16 IBM Cognos Proprietary Information Blue Stack - Setting up DB2 OVERHEAD 10.5 TRANSFERRATE 0.33 BUFFERPOOL COG16KBP DROPPED TABLE RECOVERY OFF @ COMMENT ON TABLESPACE COGSAMPLE IS 'Cognos Samples' @ GRANT USE OF TABLESPACE COGSAMPLE TO PUBLIC @ CONNECT RESET @ IBM Cognos Proprietary Information 27 of 77 Blue Stack - Setting up DB2 28 of 77 Users The sample data is supplied in five schemas. All may be accessed using a single account with catalog & database qualification. GOHR GO Human Resources GOMR GO Multilingual Retailers GORT GO Retailers GOSL GO Sales GOSLDW GO Sales Data Warehouse If using Cognos Data Manager, then a JobStream Catalog may be created in the implicit schema of the cognos account. An additional schema should be created as a target for a sample Data Manager job. GODMT GO Data Manager Target ECHO #### Creating Schemas @ -- GOSL - GO Sales -- GOSLDW - GO Sales Data Warehouse -- GOHR - GO Human Resources -- GORT - GO Retailers -- GOMR - GO Multilingual Retailers --- GODMT - GO Data Manager Target -CONNECT TO cogsam82 @ CREATE SCHEMA GOSL @ COMMENT ON SCHEMA GOSL IS 'GO Sales' @ CREATE SCHEMA GOSLDW @ COMMENT ON SCHEMA GOSLDW IS 'GO Sales Data Warehouse' @ CREATE SCHEMA GOHR @ COMMENT ON SCHEMA GOHR IS 'GO Sales Human Resources' @ CREATE SCHEMA GORT @ COMMENT ON SCHEMA GORT IS 'GO Retailers' @ IBM Cognos Proprietary Information Blue Stack - Setting up DB2 CREATE SCHEMA GOMR @ COMMENT ON SCHEMA GOMR IS 'GO Multilingual Retailers' @ CREATE SCHEMA GODMT @ COMMENT ON SCHEMA GODMT IS 'GO Data Manager Target' @ -- Use the 'cognos' account to administer the database -- and to populate it from Sample Data using DBMOVE GRANT DBADM ON DATABASE TO USER cognos @ CONNECT RESET @ IBM Cognos Proprietary Information 29 of 77 Blue Stack - Setting up DB2 30 of 77 Tuning The tuning suggestions below are rudimentary, and the advice of a DBA should be deferred to. ECHO #### Tuning the database @ UPDATE @ UPDATE @ UPDATE @ UPDATE @ UPDATE @ UPDATE @ UPDATE @ UPDATE @ UPDATE @ DBM CFG USING intra_parallel NO DBM CFG USING federated NO DBM CFG USING fed_noauth NO DB CFG FOR cogsam82 USING locklist 50 DB CFG FOR cogsam82 USING dft_degree 1 DB CFG FOR cogsam82 USING maxlocks 22 DB CFG FOR cogsam82 USING avg_appls 1 DB CFG FOR cogsam82 USING stmtheap 2048 DB CFG FOR cogsam82 USING dft_queryopt 5 CONNECT TO cogsam82 @ COMMIT @ CONNECT RESET DB2STOP @ DB2START @ IBM Cognos Proprietary Information Blue Stack - Setting up DB2 31 of 77 DOS Batch Script Ensure that you have created the folder location(s) that the Tablespaces will be created in, before you invoke the DB2 command interpreter to process the database creation script above. @ECHO OFF SETLOCAL REM -----------------------------------------------------------------REM Construct the 'COGSAM82' database in DB2 REM for use with Cognos 8 REM -----------------------------------------------------------------:CREATE IF NOT EXIST D:\DB2\NODE0000\COGSAM82\NUL mkdir D:\DB2\NODE0000\COGSAM82 if EXIST cogsam82.log del cogsam82.log db2 -f cogsam82.sql -o -td@ -v -z cogsam82.log :END ENDLOCAL Unix Batch Script Ensure that you have created the folder location(s) that the Tablespaces will be created in, before you invoke the DB2 command interpreter to process the database creation script above. #! /usr/bin/ksh # -----------------------------------------------------------------# Construct the 'COGSAM82' database in DB2 # for use with Cognos 8 # -----------------------------------------------------------------if [ ! –d /db2/NODE0000/COGSAM82 ] then mkdir –p /db2/NODE0000/COGSAM82 fi db2 -f cogsam82.sql -o -td@ -v -z cogsam82.log 3.2.2 Catalog the Databases Catalog the Sample database on all Application Tier hosts. CATALOG TCPIP NODE dbnode REMOTE dbhost SERVER 50000 CATALOG DATABASE cogsam82 IBM Cognos Proprietary Information Blue Stack - Setting up DB2 32 of 77 AT NODE dbnode WITH 'Sample Data for Cognos 8' 3.2.3 Populating the Samples database Use a DBA account to populate the sample data using DB2MOVE. This is why we suggested granting DBADM to the cognos account above. Subsequently use the DB2 Command Line Interface to invoke the supplied SQL scripts which will create additional Views and Stored Procedures referenced by the Sample reports. Navigate to the Cognos DB2 Samples at <InstallationLocation>\webcontent\samples\datasources\db2 Unzip the compressed tar file • Unix gzip –d go_db.tar.gz tar xvf go_db.tar • Windows If using WinZip to expand this archive file, you MUST ensure that smart CR/LF conversion is disabled otherwise the expanded files will not be read by DB2MOVE correctly Open WinZip. Navigate to Options > Configuration > Miscellaneous IBM Cognos Proprietary Information Blue Stack - Setting up DB2 33 of 77 Then invoke DB2MOVE to restore the sample tables, and subsequently invoke DB2CLI to create the Views and Stored Procedures. We assume the password of the cognos account is admin1234. Amend appropriately in the scripts below. DOS Batch Script @ECHO OFF SETLOCAL REM -----------------------------------------------------------------REM Restore Cognos 8 Sample Data into 'COGSAM82' database in DB2 REM -----------------------------------------------------------------:POPULATE REM db2move REM -- Load Sample Data -cd /d %COG_ROOT%\webcontent\samples\datasources\db2\go_db if EXIST IMPORT.out del IMPORT.out db2move cogsam82 import -u cognos -p admin1234 :VIEWS REM -- Create Sample Views and Stored Procedures -cd /d %COG_ROOT%\webcontent\samples\datasources\db2 if EXIST go_db_modify.log del go_db_modify.log db2cmd -c db2 -td@ -f go_db_modify.sql -z go_db_modify.log :END ENDLOCAL Unix Batch Script #! /usr/bin/ksh # -----------------------------------------------------------------# Restore Cognos 8 Sample Data into 'COGSAM82' database in DB2 # -----------------------------------------------------------------# -- Expand Sample Data -cd ${COG_ROOT}/webcontent/samples/datasources/db2 gzip -d go_db.tar.gz tar xvf go_db.tar # -- Load Sample Data -cd ${COG_ROOT}/webcontent/samples/datasources/db2/go_db if [ -f IMPORT.out ] then IBM Cognos Proprietary Information Blue Stack - Setting up DB2 rm -f IMPORT.out fi db2move cogsam82 import 34 of 77 -u cognos -p admin1234 # -- Create Sample Views and Stored Procedures -cd ${COG_ROOT}/webcontent/samples/datasources/db2 if [ -f go_db_modify.log ] then rm -f go_db_modify.log fi db2cmd -c db2 -td@ -f go_db_modify.sql -z go_db_modify.log 3.2.4 Test the Sample Reports Before testing the reports in the sample packages, it is necessary to ensure that the Report Server(s) have connectivity to the database. Subsequently create Connection Strings in Cognos Connection. Then import the sample package(s) and test the reports. Catalog the Sample database Ensure that COGSAM82 is catalogued on the Report Server(s). You can list the currently catalogued Nodes & Databases using the DB2 CLI: DB2 LIST NODE DIRECTORY DB2 LIST DATABASE DIRECTORY If not catalogued, then you must catalog the database (and the node it is at – if necessary). Syntax: CATALOG [ADMIN] TCPIP NODE node-name REMOTE hostname [SERVER service-name] [SECURITY {SOCKS}] [REMOTE_INSTANCE instance-name] [SYSTEM system-name] [OSTYPE os-type] [WITH "30 char comment string"] CATALOG DATABASE database-name [AS alias] [ON drive | AT NODE node-name] [AUTHENTICATION {SERVER | CLIENT | DCS | DCE SERVER PRINCIPAL principalname | KERBEROS TARGET PRINCIPAL principalname | SERVER_ENCRYPT | DCS_ENCRYPT | DATA_ENCRYPT | GSSPLUGIN}] [WITH "30 char comment-string"] DB2 CATALOG TCPIP NODE dbnode REMOTE dbhost SERVER 50000 DB2 CATALOG DATABASE cogsam82 AT NODE dbnode IBM Cognos Proprietary Information Blue Stack - Setting up DB2 35 of 77 Create Connection Strings Two datasource connections are required for the sample database gosales go_data_warehouse Navigate to Tools > Directory > Data Sources within Cognos Connection. Add a new datasource called gosales. Select DB2 Datasource type: Record the database alias above as the DB2 database name. Record the cognos account and password for Everyone to use. IBM Cognos Proprietary Information Blue Stack - Setting up DB2 36 of 77 Similarly, create a datasource called go_data_warehouse The sample Packages GO Sales GO Sales and Retailers use the gosales datasource connection. The GO Data Warehouse sample package uses the go_data_warehouse datasource connection, but these reports do not locate the table objects in the sample database using schema qualification. Consequently the reports will produce a SQL error unless the default schema of the database signon refers to the gosldw schema. Amend the Open Session Command of the go_data_warehouse connection string: <commandBlock> <commands> <sqlCommand> <sql>SET CURRENT SCHEMA = GOSLDW</sql> </sqlCommand> </commands> IBM Cognos Proprietary Information Blue Stack - Setting up DB2 </commandBlock> IBM Cognos Proprietary Information 37 of 77 Blue Stack - Setting up DB2 38 of 77 Restore Sample Reports Copy Cognos_Samples.zip from <InstallationLocation>\webcontent\samples\content on the Gateway host to the Deployment folder on the Content Manager host. Use the Content Administration tool to Import the Cognos Sample packages. Test the reports in the sample packages to confirm that datasource connectivity is working, and that the sample data has been restored successfully. 3.3 Metrics Server 3.3.1 Create the Metrics Store database To use an IBM DB2 database for the IBM Cognos Metrics Manager data store, the database administrator must first create a database for the data store and set up user accounts. When an IBM DB2 database for IBM Cognos Metrics Manager is created, the buffer pools and tablespaces required by IBM Cognos Metrics Manager are also created. The IBM Cognos Metrics Manager data store must be created in its own DB2 database. This means that you cannot install multiple instances of the IBM Cognos Metrics Manager data store in different schemas within the same DB2 database. Navigate the to <InstallationLocation>\configuration\schemas\cmm\db2 folder on the Gateway. Copy this folder, and supply it to the DBA. The DBA must use these scripts to create an empty database for use as the Metrics Store. The DBA should subsequently grant DBADM to database for the cognos account so that the Metrics Store can be initialised and used from within IBM Cognos Connection. Invoke cmm_create_db from within a DB2 Command Shell. The following parameters are supported: 1. The local "instance node name" to create the database in. (see DB2 Control Centre for names) 2. User ID of a user on the named instance that has database create authority. 3. The password of the user ID that has database create authority. 4. The name of the database that is to be created. 5. The disk drive on which the database objects are to be created. 6. A database alias name. If the database name being created on the named DB2 instance matches a database name cataloged on this machine, a unique database alias must be named. IBM Cognos Proprietary Information Blue Stack - Setting up DB2 39 of 77 IBM Cognos recommends creating a database COGMET82 for use with the sample Metrics Package. This naming convention indicates COGnos METrics data for v8.2. cmm_create_db DB2 db2admin <password> COGMET82 D: Only by initialising the Metrics Store can we confirm that the Database Bulk Loader is available to the Metrics Service, and that data can be successfully loaded into the Metrics Store in future. Note that this specific database is to be used only for the IBM Cognos Sample Metrics. When establishing your own corporate scorecards, you should create another database using this command. 3.3.2 Catalog the Database Catalog the Metrics Store database on all Application Tier hosts. CATALOG TCPIP NODE dbnode REMOTE dbhost SERVER 50000 CATALOG DATABASE cogmet82 AT NODE dbnode WITH 'Metrics Store for Cognos 8' 3.3.3 Initialise the Sample Create a go_metrics Data Source Connection for the COGMET82 database (above) in Cognos Connection. The process of initialising will use a JDBC-2 connection to the database to create tables, views, stored procedures and populate with seed data. An important consideration during initialisation is the granularity and range of the Time Dimension within the Metrics Store. Copy the sample Metrics Data from <InstallationLocation>\samples\datasources\metricsdata\en folder on the Gateway into a go_metrics folder in the Deployment location on the Application Tier (not necessarily the Content Manager). Inspect the go_metrics_en_periods.cal file which contains the seed data for the Time Dimension within the Metrics Store. Note that the granularity is YearQuarter-Month and ranges from 1st January 2004 until 31st December 2006. Refer to the instructions at "Create a Metric Package" in the Cognos 8 Administration and Security Guide. Navigate into Metrics Studio within IBM Cognos Connection, and choose to initialise the go_metrics datasouce above. Note the initial settings for the Calendar as above. Observe the logs in the IBM Cognos 8 Application Tier. Define a Metrics Import Source, import the sample data, and study the imported scorecards when this has completed successfully. IBM Cognos Proprietary Information Blue Stack - Setting up DB2 3.4 40 of 77 Data Manager The scope of this document is to test connectivity to IBM Cognos 8. We are not here to rigorously test Data Manager. If you can create an empty Data Manager Catalog [which contains all the Logic of an ETL jobstream] then we consider that the Data Manager host is able to connect to DB2 successfully. Many schemas will be required for Data Manager jobstreams. The definition of the jobstream(s) should be stored in schema(s) that are not within the Content Store. No source, transitional/temporary, 'junk', structural or target data should be included in that schema. Transitional data should be stored in a schema dedicated for temporary data. The Target Data Marts should not include any unstransformed Source data, nor any JobStream (catalog) data. 3.4.1 Create a sample Catalog Data Manager includes tools for creating the schema/container for an ETL model (catmanage), Exporting/Importing a catalog (catexp/catimp), Backup/Restore (catbackup/catrestore). Refer to Data Manager User Guide The catalog tables are: • JobStream Tables o DSB_CATALOG o DSB_SEQUENCE o DSB_COMPONENT IBM Cognos Proprietary Information Blue Stack - Setting up DB2 • 41 of 77 o DSB_COMPONENT_LINE Audit Tables o DSB_COMPONENT_RUN o DSB_RUN_CONTEXT o DSB_DELIVERY_HIST o DSB_AUDIT_TRAIL o DSB_AUDIT_MSG o DSB_AUDIT_MSG_LINE o DSB_JOBNODE_RUN The syntax of the catmanage command is: Usage: catmanage <catdb_driver_name> <catdb_driver_items> {email_to} [-C] [-P] [-L<logfile>] [-M<email_profile>] [-s<email_subject>] [catalog_options] Where [catalog_options] are: -c -i -g -d -k creates the catalog tables creates indexes for the catalog tables grant public access to the catalog tables delete content of the catalog tables drop catalog tables The catdb_driver_name parameter indicates the database type. Use db2. The "catdb_driver_items" parameter should contain the IBM Cognos Connection String details for connectivity to this datasource. Use dsn=db2alias;user=user;pwd=password The Data Manager Catalog will be created in the [implicit] schema of the authenticating user. The example below will create a Data Manager Catalog in the "cognos" schema of the Cognos 8 Samples Database. catmanage db2 dsn=cogsam82;user=cognos;pwd=admin1234 -c Note that if creating the Catalog from a command-line on Unix then the semicolon ";" would be a command delimiter unless escaped. Try: catmanage db2 dsn=cogsam82\;user=cognos\;pwd=admin1234 IBM Cognos Proprietary Information -c Blue Stack - Setting up DB2 42 of 77 4 IBM Cognos Series 7 4.1 Sample Data IBM Cognos Series 7 includes 2 sample data for the following schemas: GOSALES GO Sales GOSALESDW GO Sales Data Warehouse GOVENDORS GO Vendors GOMARKET GO Market Research Cognos releases improved samples with each version of Cognos products. These improvements include more current data (timestamps), more geographic regions, and more complexity in the relationships amongst tables to better reflect the various situations that customer testcases require. Samples supplied with IBM Cognos 8 or ReportNet are not suitable for the Sample Reports supplied with IBM Cognos Series 7. If you want to maintain all samples concurrently, then IBM Cognos recommends that they are populated into separate databases that are named and catalogued appropriately The total space required for the IBM Cognos Series 7 Sample Database is approximately 160MB. 4.1.1 Create the Samples database Create the 'cogsam74' database. Unlike IBM Cognos 8, IBM Cognos Series 7 is not a Unicode product. Refer to instructions in Series 7 "Installation Testing and Samples Setup Guide". Create a database named COGSAM74. This naming convention indicates COGnos SAMple data for v7.4. DB2START @ ECHO #### Creating database @ CREATE DATABASE cogsam74 ALIAS cogsam74 USING CODESET UTF-8 TERRITORY AU @ -- Max 30 characters: ----+----1----+----2----+----3 CHANGE DATABASE cogsam82 COMMENT WITH 'Sample Data for Cognos 7.4' @ CONNECT TO cogsam74 2 go_sql_smpls_ls-win32-app-7.4.1006.0-inst.tar.gz included with IWR v7.4mr1 IBM Cognos Proprietary Information Blue Stack - Setting up DB2 43 of 77 @ UPDATE DATABASE CONFIGURATION USING APPLHEAPSZ 1024 DEFERRED @ UPDATE DATABASE CONFIGURATION USING LOCKTIMEOUT 240 DEFERRED @ CONNECT RESET @ There are no specific requirements for Buffer Pools or Tablespaces. Schemas The sample data is supplied in four schemas. All may be accessed using a single account with catalog & database qualification. GOSALES GO Sales GOSALESDW GO Sales Data Warehouse GOVENDORS GO Vendors GOMARKET GO Market Research ECHO #### Creating Schemas @ -- GOSALES - GO Sales -- GOSALESDW - GO Sales Data Warehouse -- GOVENDORS - GO Vendors -- GOMARKET - GO Market Research -CONNECT TO cogsam74 @ CREATE SCHEMA GOSALES @ COMMENT ON SCHEMA GOSALES IS 'GO Sales' @ CREATE SCHEMA GOSALESDW @ COMMENT ON SCHEMA GOSALESDW IS 'GO Sales Data Warehouse' @ CREATE SCHEMA GOVENDORS @ COMMENT ON SCHEMA GOVENDORS IS 'GO Vendors' @ CREATE SCHEMA GOMARKET IBM Cognos Proprietary Information Blue Stack - Setting up DB2 44 of 77 @ COMMENT ON SCHEMA GOMARKET IS 'GO Market Research' @ -- Use the 'cognos' account to administer the database -- and to populate it from Sample Data using DBMOVE GRANT DBADM ON DATABASE TO USER cognos @ CONNECT RESET @ 4.1.2 Catalog the Database Catalog the Metrics Store database on all Application Tier hosts. CATALOG TCPIP NODE dbnode REMOTE dbhost SERVER 50000 CATALOG DATABASE cogsam74 AT NODE dbnode WITH 'Sample Data for Cognos 7.4' 4.1.3 Populating the Samples database Navigate to cer5/samples/db/db2 where there are folders containing DDL and DML to create and populate the four schemas of sample data. Inspect the connect.sql file in each folder. This specifies the catalogued database to connect to, and the credentials to use to login. As we will use the same database and username for all sample data, we need to ensure that we control the current schema for each selection of sample tables. We assume the password of the cognos account is admin1234. Navigate into the gosales folder. Amend connect.sql: CONNECT TO cogsam74 USER cognos USING admin1234; SET CURRENT SCHEMA = gosales; Invoke gosales.bat to create the GO Sales sample data. IBM Cognos Proprietary Information Blue Stack - Setting up DB2 45 of 77 Similarly amend connect.sql in the other folders of sample DDL, DML to indicate the correct database & credentials and appropriate schema then invoke the corresponding batch files: gosalesdw.bat GO Sales Data Warehouse govendors.bat GO Vendors gomarket.bat GO Market Research NB When creating the ACCOUNT_TYPE_LOOKUP table for the GOSALESDW sample, there is a small syntax error in the script tables.sql. Remove the trailing comma for the last column before running GOSALESDW.bat. If you have already created the tables, then repair the error and simply run GOSALESDW.bat again to drop and recreate the tables & data. 4.1.4 Test the Sample Reports Add Datasources to COGNOS.INI using Impromptu (menu Catalog > Databases), or directly using an editor. The DB2 Database name will be COGSAM74 as above, and the DB2 connect string may be left blank. • GOSALES=^User ID:^Password:;LOCAL; D2;DSN=COGSAM74;UID=%s;PWD=%s@ASYNC=0@0/0@COLSEQ= • GOVENDORS=^User ID:^Password:;LOCAL; D2;DSN=COGSAM74;UID=%s;PWD=%s@ASYNC=0@0/0@COLSEQ= • GOSALESDW=^User ID:^Password:;LOCAL; D2;DSN=COGSAM74;UID=%s;PWD=%s@ASYNC=0@0/0@COLSEQ= • MARKETRESEARCH=^User ID:^Password:;LOCAL; D2;DSN=COGSAM74;UID=%s;PWD=%s@ASYNC=0@0/0@COLSEQ= Alternatively, add these datasources to Access Manager. The sample reports and catalog supplied in cer5\samples\iwr_unix\reports use only the GOSALES datasource above. Record Credentials for the GOSALES datasource. Either add credentials to the datasource in Access Manager then associate these credentials with users who are permitted access to this data; or [more appropriate for the Samples] use Impromptu to modify the Creator user profile in the sample Catalog cer5\samples\iwr_unix\reports\gosales.cat (menu Catalog > User Profiles… > Database). Test sample Reports from cer5\samples\iwr_unix\reports using this Catalog. Publish the content of cer5\samples\iwr_unix\reports to IWR as a ReportSet and test the reports via Upfront. IBM Cognos Proprietary Information Blue Stack - Setting up DB2 46 of 77 Any connectivity errors will probably be because credentials have not been properly recorded for this datasource. IBM Cognos Proprietary Information Blue Stack - Setting up DB2 47 of 77 5 Appendices 5.1 Testcase Acquisition Customers may prefer to quickly package a set of metadata/data for Cognos support/development to look at specific to the data or metadata provider they are having issues with. The route that a customer chooses to take may depend on what tools/knowledge they have or what we specifically ask them to provide. This paper outlines some of the approaches that could be taken and some of the pros and cons to each approach. 5.1.1 Export/backup one or more databases In general this provides the quickest means for someone to export and import one or more schemas between environments. The steps and limitations vary by vendor but several considerations may be common: • Clarify what version and patch release the backup was performed with. • Clarify what schema names and code pages may be required into which the schemas will be loaded. • Clarify if the backup is being exported by privileged database account • Approximately how much space will be required to load the script/data Backups/exports of database schemas may be written in a format that requires a minimum version of RDBMS products to be used at the restore location. For example, an export performed using ORACLE 9i R2 may not be loaded using ORACLE 8i tools. It is not unusual to have to create the basic empty schema into which a backup/import operation will be targeted. Further, the customer may innocently export DDL that has a dependency on optional packages in their RDBMS that are not provided in the backup and Cognos is not aware of. Hence, it is important to have the customer identify: • What code page/collation settings are used • Did the schema require specific database roles/privileges • Is their backup portable. Therefore it has no external dependencies on RDBMS features or database table/disk setups Ideally, the customer should verify this for themselves by creating a basic schema and confirming that they can import/restore the database without any special steps. It is not guaranteed to be foolproof but may shake out issues. This step also allows the customer to provide a more accurate indication of how much space your schema/database account will require. Many users may have a local database where size constraints are not imposed (quotas) but this can be true on a shared machine. IBM Cognos Proprietary Information Blue Stack - Setting up DB2 48 of 77 Some database engines apply security checks when a restore/backup is attempted. That is, the account being used to perform the action has to be set up a database operator/administrator. Generally, using the default ‘system’ user account gets around the issue but you must ensure to load the objects into the correct target schema. 5.1.2 Generate the DDL/load scripts Getting a customer to export DDL scripts and basic loader script files can be an alternative option to a backup/export. This may require more work for the user generating these scripts hence it may be more appropriate for test cases using fewer objects. The approach comes with the same caveats in terms of what gets exported must be checked in terms of external dependencies, vendor version syntax, collations etc. that may be required for the script to be processed at Cognos. One distinct advantage is that with some effort one could edit the script files to the point that they load. The DDL scripts can be loaded using the RDBMS vendors ‘isql’ tool. For more information refer to the online manuals for the vendors tools. In the case of DB2 this is performed using DB2MOVE. If the customer is using a case/modeling tool to manage schemas they may prefer to export a forward engineered DDL script. Be careful to ensure that the customer can re-create the problem from this script as often the physical database changes are applied outside the case tool so it is not in synch. Converting database scripts to work with other database vendors presumes working knowledge of the target vendor DDL syntax. While some case tools can help by importing the original syntax and forward engineering to a different target (Erwin and Sybase PowerDesigner) expect to do some manual corrections for more complex cases. DB2 UDB UNIX/Windows This section discusses DB2 UDB for UNIX and NT. IBM offers similar engines under the brand name of DB2 on the mainframe (S/390 and zOS) and midrange (AS/400) servers. The commands and steps for these environments can be different. It is better to co-ordinate with someone who knows how to use these systems if the problem cannot be replicated in the UNIX or NT versions. DB2 provides a command line tool known as db2look for DB2 UNIX and NT platforms. This tool can export DDL commands for a schema. Assuming the script does not require further corrections it can be executed from a DB2 Command window (not a regular dos window) as shown. Various command line options exist to generate additional settings (authorizations, db2 registry settings and placement features that often are not critical for a test case). IBM Cognos Proprietary Information Blue Stack - Setting up DB2 49 of 77 Example below exports the DDL for the GOSL schema from the COGSAM82 database to a file called gosl.ddl written to the %TEMP% folder: Command: db2look -d COGSAM82 -z GOSL -u cognos -w admin1234 -e -o %TEMP%\gosl.ddl Output: -- Specified SCHEMA is: GOSL -- Creating DDL for table(s) -- Schema name is ignored for the Federated Section -- Output is sent to file: c:\Windows\Temp\gosl.ddl A script file can then be loaded via the DB2 command window as shown. If the script does not contain a connect statement a connection must be established first. For example: db2 connect to mydb user myuser db2 –tvf %TEMP%\gosl.ddl using mypassword If the customer chose to export loader scripts for the tables they may provide you with an additional script file or tell you to create one to import the data. For instance, loadexample.dll might contain the following commands IMPORT FROM IMPORT FROM IMPORT FROM IMPORT FROM SALESFACT; REGION.txt OF DEL MODIFIED BY COLDEL; INSERT INTO REGION; PRODUCT.txt OF DEL MODIFIED BY COLDEL; INSERT INTO PRODUCT; TIME.txt OF DEL MODIFIED BY COLDEL; INSERT INTO TIME; SALESFACT.txt OF DEL MODIFIED BY COLDEL; INSERT INTO A fast way to move data across systems is to use the db2move utility. This will export a series of files to the current directory. The second parameter directs the db2move tool to load, export or replace data from the current directory. Command: cd /d C:\Temp\db2move db2move COGSAM82 export -sn GOSL -u cognos -p admin1234 Output: ***** DB2MOVE Action: ***** EXPORT IBM Cognos Proprietary Information Blue Stack - Setting up DB2 Start time: 50 of 77 Thu May 17 14:46:29 2007 All schema names matching: GOSL; Connecting to database COGSAM82 ... successful! Server V9.1.0 EXPORT: EXPORT: EXPORT: EXPORT: EXPORT: EXPORT: EXPORT: EXPORT: EXPORT: EXPORT: EXPORT: EXPORT: EXPORT: EXPORT: EXPORT: EXPORT: EXPORT: EXPORT: EXPORT: 468 21 483 8 3888 43063 5360 7 115 3872 5 2645 21 709 5 28 102 40172 1132 rows rows rows rows rows rows rows rows rows rows rows rows rows rows rows rows rows rows rows from from from from from from from from from from from from from from from from from from from table table table table table table table table table table table table table table table table table table table "GOSL "GOSL "GOSL "GOSL "GOSL "GOSL "GOSL "GOSL "GOSL "GOSL "GOSL "GOSL "GOSL "GOSL "GOSL "GOSL "GOSL "GOSL "GOSL "."CONVERSION_RATE" "."COUNTRY" "."COUNTRY_MULTILINGUAL" "."EURO_CONVERSION" "."INVENTORY_LEVELS" "."ORDER_DETAILS" "."ORDER_HEADER" "."ORDER_METHOD" "."PRODUCT" "."PRODUCT_FORECAST" "."PRODUCT_LINE" "."PRODUCT_MULTILINGUAL" "."PRODUCT_TYPE" "."RETURNED_ITEM" "."RETURN_REASON" "."SALES_BRANCH" "."SALES_STAFF" "."SALES_TARGET" "."TIME_DIMENSION" Disconnecting from database ... successful! End time: Thu May 17 14:46:36 2007 IBM Cognos Proprietary Information Server : DB2 Common Blue Stack - Setting up DB2 51 of 77 The Control Center UI provides a mechanism for the administrator to backup and restore databases and to generate DDL. Note that db2move will only manipulate data. Though it does export Tables, it does not export Views or their definition. You may require Table, View & Stored Procedure definitions exported using db2look, and a sample of data exported using db2move. IBM Cognos Proprietary Information Blue Stack - Setting up DB2 IBM Cognos Proprietary Information 52 of 77 Blue Stack - Setting up DB2 53 of 77 db2look DB2 Statistics and DDL Extraction Tool Refer http://publib.boulder.ibm.com/infocenter/db2luw/v9/topic/com.ibm.db2.udb.adm in.doc/doc/r0002051.htm Extracts the required DDL (data definition language) statements to reproduce the database objects of a production database on a test database. db2look generates the DDL statements by object type. This tool can generate the required UPDATE statements used to replicate the statistics on the objects in a test database. It can also be used to generate UPDATE DATABASE CONFIGURATION and UPDATE DATABASE MANAGER CONFIGURATION commands and db2set commands so that query optimizerrelated configuration parameters and registry variables on the test database match those of the production database. It is often advantageous to have a test system contain a subset of the production system's data. However, access plans selected for such a test system are not necessarily the same as those that would be selected for the production system. Both the catalog statistics and the configuration parameters for the test system must be updated to match those of the production system. Using this tool makes it possible to create a test database where access plans are similar to those that would be used on the production system. Note: The DDL generated might not exactly reproduce all characteristics of the original SQL objects. Check the DDL generated by db2look. Syntax: db2look Version 9.1 Syntax: db2look -d DBname [-e] [-xs] [-xdir Path] [-u Creator] [-z Schema] [-t Tname1 Tname2...TnameN] [-tw Tname] [-h] [-o Fname] [-a] [-m] [-c] [-r] [-l] [-x] [-xd] [-f] [-fd] [-td x] [-noview] [-i userID] [-w password] [-v Vname1 Vname2 ... VnameN] [-dp] [-ct] [-wrapper WrapperName] [-server ServerName] [-nofed] db2look [-h] -d: Database Name: This must be specified -e: Extract DDL file needed to duplicate database -xs: Export XSR objects and generate a script containing DDL IBM Cognos Proprietary Information Blue Stack - Setting up DB2 54 of 77 statements -xdir: Path name: the directory in which XSR objects will be placed -u: Creator ID: If -u and -a are both not specified then $USER will be used -z: Schema name: If -z and -a are both specified then -z will be ignored -t: Generate statistics for the specified tables -tw: Generate DDLs for tables whose names match the pattern criteria (wildcard characters) of the table name -h: More detailed help message -o: Redirects the output to the given file name -a: Generate statistics for all creators -m: Run the db2look utility in mimic mode -c: Do not generate COMMIT statements for mimic -r: Do not generate RUNSTATS statements for mimic -l: Generate Database Layout: Database partition groups, Bufferpools and Tablespaces -x: Generate Authorization statements DDL excluding the original definer of the object -xd: Generate Authorization statements DDL including the original definer of the object -f: Extract configuration parameters and environment variables -td: Specifies x to be statement delimiter (default is semicolon(;)) -i: User ID to log on to the server where the database resides -w: Password to log on to the server where the database resides -noview: Do not generate CREATE VIEW ddl statements -wrapper: Generates DDLs for federated objects that apply to this wrapper -server: Generates DDLs for federated objects that apply to this server -nofed: Do not generate Federated DDL -fd: Generates db2fopt statements for opt_buffpage and opt_sortheap along with other cfg and env parameters. -v: Generate DDL for view only, this option is ignored when -t is specified -dp: Generate DROP statement before CREATE statement -ct: Generate DDL Statements by object creation time IBM Cognos Proprietary Information Blue Stack - Setting up DB2 55 of 77 db2move Database Movement Tool Refer http://publib.boulder.ibm.com/infocenter/db2luw/v8/topic/com.ibm.db2.udb.doc/ core/r0002079.htm This tool facilitates the movement of large numbers of tables between DB2 databases located on workstations. The tool queries the system catalog tables for a particular database and compiles a list of all user tables. It then exports these tables in PC/IXF format. The PC/IXF files can be imported or loaded to another local DB2 database on the same system, or can be transferred to another workstation platform and imported or loaded to a DB2 database on that platform. Note: Tables with structured type columns are not moved when this tool is used. *** Please read the DB2 Administration Guide for more info! --------db2move - database movement tool-------Usage: "db2move <dbname> <action> [options]" <dbname> is the name of the database. <action> is one of: EXPORT - Export all tables that meet the filtering criteria in [options] (If no [options] specified, export all tables). Internal staging information is stored in file 'db2move.lst'. Messages are stored in 'EXPORT.msg'. IMPORT - Import all tables listed in the staging file 'db2move.lst'. Messages are stored in 'IMPORT.msg'.. Use the -io option for IMPORT specific actions. LOAD - Load all tables listed in the staging file db2move.lst'. Messages are stored in 'LOAD.msg'. Use the -lo option for LOAD specific actions. COPY - Duplicate a schema(s) into a target database. Use the -sn option to specify one or more schemas. See the -co option for COPY specific options. Use the -tn or -tf option to filter tables in LOAD_ONLY mode. Messages are stored in 'COPY.<timestamp>.msg' Error only messages in 'COPY.<timestamp>.err' Load messages in 'LOADTABLE.<timestamp>.msg' List of tables that failed Load in IBM Cognos Proprietary Information Blue Stack - Setting up DB2 56 of 77 LOADTABLE.<timestamp>.err' [options] are one or more of: Option Description Use for Notes Action --------------------------------------------------------------------tc <value> Table Definers EXPORT Comma separated list, Wildcard (*) allowed. -tn <value> Table Names EXPORT COPY Comma seperated list, Wildcard (*) allowed for EXPORT (not COPY). -sn <value> Schema Names EXPORT, COPY Comma seperated list, Wildcard (*) allowed for EXPORT (not COPY). -ts <value> Tablespace Names. EXPORT Comma seperated list, Wildcard (*) allowed. -tf <file> Fully qualified list of EXPORT table names in <file> COPY one table per line,like: "MYSCHEMA1"."TAB1" "MY SCHEMA2"."TAB2" -aw Allow warnings Don't disclude tables that encounter warnings. -io <value> IMPORT specific actions.IMPORT Default is REPLACE_CREATE (see docs for limitations of Import create function) One of: INSERT, INSERT_UPDATE, REPLACE, CREATE, REPLACE_CREATE -lo <value> LOAD specific options. Default is INSERT LOAD One of: INSERT,REPLACE -l <path> Path to lobfiles. Default is cwd EXPORT, IMPORT, LOAD Comma seperated list, no space characters -u <value> Userid to connect to db. Default is current user -p <value> Password to connect to db. ALL -co <opt> COPY specific options. IBM Cognos Proprietary Information EXPORT ALL COPY See options below. Blue Stack - Setting up DB2 57 of 77 TARGET_DB <dbname> [USER <userid> [USING <passwd>] This mandatory option specifies the target database (and optional user/passwd) where the schema(s) will be created. (Default user/passwd are current user/passwd). MODE <value> The mode is one of DDL_AND_LOAD (default), DDL_ONLY, or LOAD_ONLY. SCHEMA_MAP <value> To rename the schema on the target db. For example, to rename schema 'srcsch1' to 'tgtsch1', and schema 'srcsch2' to 'tgtsch2', use: "((srcsch1,tgtsch1), (scrsch2,tgtsch2))". TABLESPACE_MAP <value> To override tablespaces on the target db. For example, to recreate all tables that reside in TS1 on the source db, into TS2 on the target db, and all other tablespaces to use the default tablespace on the target, use: "((TS1,TS2), SYS_ANY)". NONRECOVERABLE To override the default Load recoverability action COPY-NO, to NONRECOVERABLE. OWNER <owner-name> To override the owner of each new object created on the target db. Examples: 1) Use db2move to Export all tables: >db2move dbname EXPORT 2) Use db2move to Export all tables, filtering on table-name with 'mytab*' and table-definer with 'USER1', and lobs in bigfs/mydir/: >db2move dbname EXPORT -tn mytab* -tc USER1 -l /bigfs/mydir/ 3) Use db2move to Import (recreate and repopulate) all previously exported tables: >db2move dbname IMPORT 4) Use db2move to Load (repopulate) all previously exported tables: >db2move dbname LOAD 5) Use db2move to Load (append) all previously exported tables, where lobfiles reside in /bigfs/mydir: >db2move dbname LOAD -lo INSERT -l /bigfs/mydir 6) Use db2move to duplicate schema 'schema1' from source database dbsrc' to target database 'dbtgt': >db2move dbsrc COPY -sn schema1 -co TARGET_DB dbtgt USER myuser1 USING mypass1 7) Use db2move to duplicate schema 'schema1' from source database 'dbsrc' to target database 'dbtgt', rename the schema to newschema1' on the target, and map source tablespace 'ts1' to IBM Cognos Proprietary Information Blue Stack - Setting up DB2 58 of 77 'ts2' on the target: >db2move dbsrc COPY -sn schema1 -co TARGET_DB dbtgt USER myuser1 USING mypass1 SCHEMA_MAP ((schema1,newschema1)) TABLESPACE_MAP ((ts1,ts2), SYS_ANY)) For more information, please see the DB2 documentation. End time: Thu May 17 15:27:39 2007 IBM Cognos Proprietary Information Blue Stack - Setting up DB2 5.2 59 of 77 Troubleshooting 5.2.1 UDA Test IBM Cognos 8 interaction with databases uses an internal component called UDA or Universal Data Access. Both Framework Manager and the Report Servers communicate with DB2 via Native Libraries loaded by the UDA. IBM Cognos SQL is converted to corresponding database SQL in this tier. A debugging utility udatest is supplied which processes IBM Cognos SQL using the same libraries. This may be used to test SQL and connectivity without having IBM Cognos 8 actually running. The text below contains UDA commands for connecting to the IBM Cognos Sample database for DB2 and querying the number of tables in each schema. Note that the Connection String must include the username and password. initialize e2 for "en" metadata callback m2, sql99datatypes; multidbattachdirect d1001 dblogicname "db2" in e2(dblogicname "db2" "DSN=COGSAM82;UID=cognos;PWD=admin1234@ASYNC=0@0/0@COLSEQ=" D2 ); updateattach d1001 dblogicname "db2" in e2 commandblock "<commandBlock> <commands> <sqlCommand> <sql>SET CURRENT SCHEMA = GOSLDW</sql> </sqlCommand> </commands> </commandBlock>"; get attribute max name length context dbname "db2" for database d1001; show features d1001 case sensitive; show features d1001 passive; start t1001 for d1001 read passive; prepare r1001 from "SELECT SUBSTR(TABLE_SCHEMA,1,10) AS TSCHEMA, COUNT(*) AS TCOUNT FROM SYSIBM.TABLES GROUP BY TABLE_SCHEMA" in t1001 macrovaluecallback, collate "en-ca", disable metadata cache, XFormClientServer, enable nagging, performance logging, all rows, flexible, avoid zero division; declare c1 cursor for r1001; open c1; IBM Cognos Proprietary Information Blue Stack - Setting up DB2 60 of 77 fetch c1 all; close c1; release cursor c1; release request r1001; rollback t1001; detach d1001; terminate e2; Invoke udatest from the Cognos 8 bin folder, and paste the text above into the [upper] Cmd Window. Invoke "Do It!" from the File Menu. Observe the output in the lower window. IBM Cognos Proprietary Information Blue Stack - Setting up DB2 61 of 77 Similarly, on Unix a command-line version of udatest is available, and can be invoked with a script like this: #! /usr/bin/ksh # # Cognos UDA Test # COG_ROOT=${COG_ROOT:-/opt/cognos/c8} case `uname` in Linux) LD_LIBRARY_PATH=$COG_ROOT/bin${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} export LD_LIBRARY_PATH ;; AIX) LIBPATH=$COG_ROOT/bin${LIBPATH:+:$LIBPATH} export LIBPATH ;; SunOS) LD_LIBRARY_PATH=$COG_ROOT/bin${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} export LD_LIBRARY_PATH ;; HP-UX) SHLIB_PATH=$COG_ROOT/bin${SHLIB_PATH:+:$SHLIB_PATH} export SHLIB_PATH ;; *) echo "ERROR: Unsupported platform `uname`." ;; esac # TRACE_FILE=${COG_ROOT}/logs/udatest.$$.trace TRACE_LAYER_DMD_SQLAPIRW=0x2 export TRACE_FILE TRACE_LAYER_DMD_SQLAPIRW # UDASCRIPT=${1:-default} if [ ! -r ${UDASCRIPT}.api ] then cat <<EOF > ${UDASCRIPT}.api initialize e1 for "en" metadata callback m1, sql99datatypes; multidbattachdirect d10001 dblogicname "oracle" in e1(dblogicname "oracle" "ORACLE@scott@orcl/tiger@COLSEQ=" OR ); show features d10001 passive; start t10001 for d10001 read; IBM Cognos Proprietary Information Blue Stack - Setting up DB2 62 of 77 prepare r10001 from "{select * from nls_database_parameters order by parameter}" in t10001 macrovaluecallback, collate "en-au", disable metadata cache, XFormClientServer, enable nagging, performance logging, all rows, flexible, avoid zero division; declare c1 cursor for r10001; open c1; fetch c1 all; close c1; release cursor c1; release request r10001; rollback t10001; detach d10001; terminate e1; EOF fi cd ${COG_ROOT}/bin # # Other options to truss that may reduce output #-t\!lwp_park \ #-t\!time \ #-t\!yield \ #-t\!poll \ #-t\!nanosleep \ # #cat ${UDASCRIPT}.api | truss -f -a -e -l -d -vall -mall -rall -wall \ #-t\!nanosleep \ # -o /tmp/udatest.$$.truss \ cat ${UDASCRIPT}.api | \ ./udatest | tee /tmp/udatest.$$.out ## EOF ## UdaTest may be useful to confirm that Database Client Connectivity Libraries are available and operate correctly with Cognos. The udatest script above has been used to capture all interactions between UDA and the the Operating System, and to distinguish core dumps caused by Database Drivers rather than by the whole Cognos 8 Report Processor (BIBusTKServerMain). This tool may also be used as a crude SQL client when no other is installed. IBM Cognos Proprietary Information Blue Stack - Setting up DB2 63 of 77 5.2.2 UDA Trace The UDA libraries (above) also support Tracing. UDA Logging is enabled using Environment Variables, and requires that IBM Cognos 8 is subsequently restarted before logging will be effective. • TRACE_FILE=<trace_file_location>/<filename>.xml • TRACE_ALL_THREADS=y (catch tracing from all threads) The rest of the environment variables are organized into trace layers with 32 trace categories within each layer Note: these environment variables apply to Cognos 8 only. • • • • • • TRACE_LAYER_COMMON= 0x0004 Trace low level initialization 0x0008 Trace loading/unloading of shared libraries. TRACE_LAYER_DMD_SQLAPIRW= 0x0001 Internal audit info. 0x0002 SQL API tracing. This is the important one. TRACE_LAYER_COGTHREAD= 0x0001 Trace threads 0x0002 Trace thread specific data 0x0004 Trace mutexes 0x0008 Trace semaphores 0x0010 Trace Condition variables 0x0020 Trace event objects 0x0040 Trace Read/Write locks 0x0080 Trace Internal structures 0x0100 Generate thread syntax logs TRACE_LAYER_DMD_LIBRARY= 0x0001 Trace Database INI file accesses. TRACE_LAYER_DMD_RDS= 0x0001 Dump SQL input tree structures. 0x0002 SQL tree after data binding phase. 0x0004 SQL tree after pre-optimization. 0x0008 SQL tree after optimization. 0x0010 Run time tree. Like an execution plan. 0x0020 SQL tree after more optimization. 0x0100 Dumps UDA generated sql to log file. 0x0200 Trace expression engine usage. 0x0400 Dump execution plans. TRACE_LAYER_DMD_SQLTOSQL= 0x0100 Trace sql sent to gateways. 0x0200 Trace native SQL in gateways. IBM Cognos Proprietary Information Blue Stack - Setting up DB2 • • • TRACE_LAYER_EXPENG= 0x000F Trace expression engine internals. TRACE_LAYER_GENERIC= 0x0001 Trace memory objects. 0x0002 Trace linked list api. 0x0004 Trace symbol object. 0x0008 Trace table objects. 0x0010 Trace function objects. 0x0020 Trace metadata cache objects. 0x0040 Trace cursor container objects. 0x0080 Trace table container objects. 0x0100 Trace ddl cache. 0x0200 Trace sort object. 0x0400 Trace sort statistics. TRACE_FORMAT= bare Removes formatting (for example XML) Windows: Or these can be set using LogConsole. IBM Cognos Proprietary Information 64 of 77 Blue Stack - Setting up DB2 65 of 77 Unix: TRACE_ALL_THREADS=y TRACE_FILE=/opt/cognos/c8/logs/udatrace.xml TRACE_LAYER_COMMON=0x004 TRACE_LAYER_DMD_SQLAPIRW=0x002 TRACE_LAYER_GENERIC=0x400 export TRACE_LAYER_THREADS TRACE_FILE TRACE_LAYER_COMMON export TRACE_LAYER_DMD_SQLAPIRW TRACE_LAYER_GENERIC All subsequent UDA activity this Cognos installation will be logged. This logging will be CPU and IO intensive, and should be disabled when not required. IBM Cognos Proprietary Information Blue Stack - Setting up DB2 66 of 77 5.2.3 DB2 Client Tracing When UDA interacts with DB2 it invokes DB2 client libraries. These also support Tracing that can be used to observe the SQL actually submitted to the database by Cognos. Refer DB2 Tracing http://www128.ibm.com/developerworks/db2/library/techarticle/0205bargas/0205bargas.ht ml To enable DB2 Client Tracing, locate db2cli.ini On Windows the db2cli.ini is in the sqllib directory at %ProgramFiles%\IBM\SQLLIB\db2cli.ini On Unix the db2cli.ini is at ${DB2DIR}/cfg/db2cli.ini} or at the location specified by ${DB2CLIINIPATH}: DB2CLIINIPATH=${DB2CLIINIPATH:-${DB2DIR}/cfg/db2cli.ini} export DB2CLIINIPATH Alter the db2cli.ini file to have the following three lines in the [COMMON] section: [COMMON] TRACE=1 TRACEFILENAME=/opt/cognos/c8/logs/db2clitrace.log TRACEFLUSH=1 TRACETIMESTAMP=3 The tracefilename specifies the trace file location and filename. The example above indicates a location for a Unix client. All subsequent interaction with DB2 from this client installation will be logged – whether by Cognos or other tools. This logging will be CPU and IO intensive, and should be disabled when not required. Used in conjunction with UDA tracing (above), the DB2 Client Tracing can help to determine how Cognos SQL is translated into Native SQL, and how metadata queries are submitted to the database. IBM Cognos Proprietary Information Blue Stack - Setting up DB2 5.3 67 of 77 References 5.3.1 IBM Connectivity • • • • • DB2 Connect http://www-306.ibm.com/software/data/db2/db2connect/ iSeries Access http://www-03.ibm.com/servers/eserver/iseries/access/windows/ An Overview of DB2 and Java Database Connectivity http://www128.ibm.com/developerworks/db2/library/techarticle/0203zikopoulos/020 3zikopoulos.html Installing and Configuring DB2 Clients https://www1.columbia.edu/sec/acis/db2/db2iy/db2iy58.htm The Universal Connectivity Guide to DB2 http://www.redbooks.ibm.com/abstracts/SG244894.html?Open Commands and Configuration • • DB2 UDB Commands by example http://www.ibm.com/developerworks/db2/library/techarticle/dm0406dang/index.html Understanding DB2 Universal Database character conversion http://www-128.ibm.com/developerworks/db2/library/techarticle/dm-0506chong/ DB2CODEPAGE http://www.thescripts.com/forum/thread484925.html • Configuring db2cli.ini http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2 .udb.doc/ad/c0007882.htm Product Family • • 5.3.2 DB2 Product Family http://www-306.ibm.com/software/data/db2/ Everything You Wanted to Know About DB2 Universal Database Processes http://www106.ibm.com/developerworks/db2/library/techarticle/0304chong/0304cho ng.html Other • DB2 eBooks http://www.ebookhost.com/search/node/DB2 • Open the Throttle: Tuning DB2 UDB http://www.ebookhost.com/node/46 Excellent • DB2 UDB v8 Handbook for Windows and UNIX/Linux http://www.amazon.com/gp/reader/0130661112/ref=sib_dp_pt/104-77823243575966#reader-link IBM Cognos Proprietary Information Blue Stack - Setting up DB2 • 5.4 68 of 77 Using Active Directory for authentication and authorisation in DB2 http://rc.vintela.com/topics/howto/db2/ Database Creation Scripts Cognos Content Store Copy body below to cognos.sql and use to Create the Cognos Content Store database. -------------------------------------------------------------------------- Create the 'cognos' database -DB2START @ ECHO #### Creating database @ CREATE DATABASE cognos ALIAS cognos USING CODESET UTF-8 TERRITORY AU@ -- Max 30 characters: ----+----1----+----2----+----3 CHANGE DATABASE cognos COMMENT WITH 'Content Store for Cognos 8' @ CONNECT TO cognos @ UPDATE DATABASE CONFIGURATION USING APPLHEAPSZ 1024 DEFERRED @ UPDATE DATABASE CONFIGURATION USING LOCKTIMEOUT 240 DEFERRED @ CONNECT RESET @ -------------------------------------------------------------------------- Custom Buffer Pools -ECHO #### Creating Buffer Pools @ -- COG04KBP -- COG08KBP -- COG16KBP CONNECT TO Cognos @ CREATE BUFFERPOOL COG04KBP IMMEDIATE SIZE 250 PAGESIZE 4 K @ CREATE BUFFERPOOL COG08KBP IMMEDIATE SIZE 250 PAGESIZE 8 K @ CREATE BUFFERPOOL COG16KBP IMMEDIATE SIZE 250 PAGESIZE 16 K @ IBM Cognos Proprietary Information Blue Stack - Setting up DB2 69 of 77 CONNECT RESET @ -------------------------------------------------------------------------- Tablespaces -ECHO #### Creating Tablespaces @ -- COGSYSTMP - System Temporary Tablespace -- COGUSRTMP - User Temporary Tablespace -- COGUSRDAT - Content Store Tablespace -- COGUSRLOG - Audit Logs Tablespace CONNECT TO Cognos @ --- COGSYSTMP - System Temporary Tablespace -CREATE SYSTEM TEMPORARY TABLESPACE COGSYSTMP IN DATABASE PARTITION GROUP IBMTEMPGROUP PAGESIZE 16 K MANAGED BY SYSTEM USING ('D:\DB2\NODE0000\COGNOS\COGSYSTMP01') EXTENTSIZE 16 PREFETCHSIZE 16 OVERHEAD 10.5 TRANSFERRATE 0.14 BUFFERPOOL COG16KBP @ COMMENT ON TABLESPACE COGSYSTMP IS 'Cognos Sys Temp' @ --- COGUSRTMP - User Temporary Tablespace -CREATE USER TEMPORARY TABLESPACE COGUSRTMP IN DATABASE PARTITION GROUP IBMDEFAULTGROUP PAGESIZE 4 K MANAGED BY SYSTEM USING ('D:\DB2\NODE0000\COGNOS\COGUSRTMP01') EXTENTSIZE 8 PREFETCHSIZE 8 OVERHEAD 10.5 TRANSFERRATE 0.33 BUFFERPOOL COG04KBP @ COMMENT ON TABLESPACE COGUSRTMP IS 'Cognos User Temp' @ -- IBM Cognos Proprietary Information Blue Stack - Setting up DB2 70 of 77 -- COGUSRDAT - Content Store Tablespace -CREATE REGULAR TABLESPACE COGUSRDAT IN DATABASE PARTITION GROUP IBMDEFAULTGROUP PAGESIZE 4 K MANAGED BY SYSTEM USING ('D:\DB2\NODE0000\COGNOS\COGUSRDAT01') EXTENTSIZE 8 PREFETCHSIZE 8 OVERHEAD 10.5 TRANSFERRATE 0.33 BUFFERPOOL COG04KBP DROPPED TABLE RECOVERY ON @ COMMENT ON TABLESPACE COGUSRDAT IS 'Cognos User Data' @ --- COGUSRLOG - Audit Logs Tablespace -CREATE REGULAR TABLESPACE COGUSRLOG IN DATABASE PARTITION GROUP IBMDEFAULTGROUP PAGESIZE 8 K MANAGED BY SYSTEM USING ('D:\DB2\NODE0000\COGNOS\COGUSRLOG01') EXTENTSIZE 16 PREFETCHSIZE 16 OVERHEAD 10.5 TRANSFERRATE 0.33 BUFFERPOOL COG08KBP DROPPED TABLE RECOVERY OFF @ COMMENT ON TABLESPACE COGUSRLOG IS 'Cognos App Logs' --- Amend Overhead on default tablespaces -ALTER TABLESPACE TEMPSPACE1 PREFETCHSIZE 16 OVERHEAD 24.100000 TRANSFERRATE 0.900000 @ ALTER TABLESPACE USERSPACE1 PREFETCHSIZE 16 OVERHEAD 24.100000 TRANSFERRATE 0.900000 @ CONNECT RESET @ -------------------------------------------------------------------------- Cognos 8 Users -- IBM Cognos Proprietary Information Blue Stack - Setting up DB2 ECHO #### Creating Schemas, Grants @ -- cog8cs - Cognos8 Content Store -- cog8ns - Cognos8 Notification Store -- cog8al - Cognos8 Audit Logs CONNECT TO Cognos @ --- cog8cs - Cognos8 Content Store -CREATE SCHEMA cog8cs AUTHORIZATION cog8cs @ COMMENT ON SCHEMA cog8cs IS 'Cognos 8 Content Store' @ GRANT CREATETAB,BINDADD,CONNECT,IMPLICIT_SCHEMA ON DATABASE TO USER cog8cs @ GRANT CREATEIN,DROPIN,ALTERIN ON SCHEMA cog8cs TO USER cog8cs WITH GRANT OPTION @ GRANT USE OF TABLESPACE COGUSRDAT TO USER cog8cs @ GRANT USE OF TABLESPACE COGUSRTMP TO USER cog8cs WITH GRANT OPTION @ --- cog8ns - Cognos8 Notification Store -CREATE SCHEMA cog8ns AUTHORIZATION cog8ns @ COMMENT ON SCHEMA cog8ns IS 'Cognos 8 Notification Store' @ GRANT CREATETAB,BINDADD,CONNECT,IMPLICIT_SCHEMA ON DATABASE TO USER cog8ns @ GRANT CREATEIN,DROPIN,ALTERIN ON SCHEMA cog8ns TO USER cog8ns WITH GRANT OPTION @ IBM Cognos Proprietary Information 71 of 77 Blue Stack - Setting up DB2 GRANT USE TO USER @ GRANT USE TO USER @ 72 of 77 OF TABLESPACE COGUSRDAT cog8ns OF TABLESPACE COGUSRTMP cog8ns WITH GRANT OPTION --- cog8al - Cognos8 Audit Logs -CREATE SCHEMA cog8al AUTHORIZATION cog8al @ COMMENT ON SCHEMA cog8al IS 'Cognos 8 Audit Logs' @ GRANT CREATETAB,BINDADD,CONNECT,IMPLICIT_SCHEMA ON DATABASE TO USER cog8al @ GRANT CREATEIN,DROPIN,ALTERIN ON SCHEMA cog8al TO USER cog8al WITH GRANT OPTION @ GRANT USE OF TABLESPACE COGUSRLOG TO USER cog8al @ GRANT USE OF TABLESPACE COGUSRTMP TO USER cog8al WITH GRANT OPTION @ -- Use the 'cognos' account to administer the database GRANT DBADM ON DATABASE TO USER Cognos @ CONNECT RESET @ --------------------------------------------------------------------------- Tuning -ECHO #### Tuning database @ UPDATE DBM CFG USING intra_parallel NO @ UPDATE DBM CFG USING federated NO @ IBM Cognos Proprietary Information Blue Stack - Setting up DB2 UPDATE @ UPDATE @ UPDATE @ UPDATE @ UPDATE @ UPDATE @ UPDATE @ 73 of 77 DBM CFG USING fed_noauth NO DB CFG FOR cognos USING locklist 50 DB CFG FOR cognos USING dft_degree 1 DB CFG FOR cognos USING maxlocks 22 DB CFG FOR cognos USING avg_appls 1 DB CFG FOR cognos USING stmtheap 2048 DB CFG FOR cognos USING dft_queryopt 5 CONNECT TO Cognos @ COMMIT @ CONNECT RESET @ DB2STOP @ DB2START @ ------------------------------------------------------------------------- Cognos Sample Database Copy body below to cogsam82.sql and use to Create the Cognos 8 Samples database. -------------------------------------------------------------------------- Create the 'cogsam82' database for Cognos Samples -DB2START @ ECHO #### Creating database @ CREATE DATABASE cogsam82 ALIAS cogsam82 USING CODESET UTF-8 TERRITORY AU @ -- Max 30 characters: ----+----1----+----2----+----3 CHANGE DATABASE cogsam82 COMMENT WITH 'Sample Data for Cognos 8.2' @ CONNECT TO cogsam82 @ IBM Cognos Proprietary Information Blue Stack - Setting up DB2 74 of 77 UPDATE DATABASE CONFIGURATION USING APPLHEAPSZ 1024 DEFERRED @ UPDATE DATABASE CONFIGURATION USING LOCKTIMEOUT 240 DEFERRED @ CONNECT RESET @ -------------------------------------------------------------------------- Custom Buffer Pools -ECHO #### Creating Buffer Pools @ -- COG04KBP -- COG08KBP -- COG16KBP CONNECT TO cogsam82 @ CREATE BUFFERPOOL COG04KBP IMMEDIATE SIZE 250 PAGESIZE 4 K @ CREATE BUFFERPOOL COG08KBP IMMEDIATE SIZE 250 PAGESIZE 8 K @ CREATE BUFFERPOOL COG16KBP IMMEDIATE SIZE 250 PAGESIZE 16 K @ CONNECT RESET @ -------------------------------------------------------------------------- Tablespaces -ECHO #### Creating Tablespace(s) @ CONNECT TO cogsam82 @ -- COGSAMPLE - Cognos Sample Data (GOSL,GOSLDW,GOHR,GORT,GOMR,GOMM) -CREATE REGULAR TABLESPACE COGSAMPLE PAGESIZE 16 K MANAGED BY SYSTEM USING ('D:\DB2\NODE0000\COGSAM82\COGSAMPLE01') EXTENTSIZE 16 PREFETCHSIZE 16 OVERHEAD 10.5 TRANSFERRATE 0.33 BUFFERPOOL COG16KBP DROPPED TABLE RECOVERY OFF @ COMMENT ON TABLESPACE COGSAMPLE IS 'Cognos Samples' IBM Cognos Proprietary Information Blue Stack - Setting up DB2 75 of 77 @ GRANT USE OF TABLESPACE COGSAMPLE TO PUBLIC @ CONNECT RESET @ -------------------------------------------------------------------------- Schemas of Cognos 8 Sample Data -ECHO #### Creating Schemas @ -- GOSL - GO Sales -- GOSLDW - GO Sales Data Warehouse -- GOHR - GO Human Resources -- GORT - GO Retailers -- GOMR - GO Multilingual Retailers --- GOCAT - GO Catalog (for Data Manager) -- GODMT - GO Data Manager Target -CONNECT TO cogsam82 @ CREATE SCHEMA GOSL @ COMMENT ON SCHEMA GOSL IS 'GO Sales' @ CREATE SCHEMA GOSLDW @ COMMENT ON SCHEMA GOSLDW IS 'GO Sales Data Warehouse' @ CREATE SCHEMA GOHR @ COMMENT ON SCHEMA GOHR IS 'GO Sales Human Resources' @ CREATE SCHEMA GORT @ COMMENT ON SCHEMA GORT IS 'GO Retailers' @ CREATE SCHEMA GOMR @ COMMENT ON SCHEMA GOMR IS 'GO Multilingual Retailers' @ IBM Cognos Proprietary Information Blue Stack - Setting up DB2 76 of 77 CREATE SCHEMA GOCAT @ COMMENT ON SCHEMA GOCAT IS 'GO Catalog (for Data Manager)' @ CREATE SCHEMA GODMT @ COMMENT ON SCHEMA GODMT IS 'GO Data Manager Target' @ -- Use the 'cognos' account to populate the database -- from Sample Data using DBMOVE GRANT DBADM ON DATABASE TO USER Cognos @ CONNECT RESET @ --------------------------------------------------------------------------- Tuning -ECHO #### Tuning the database @ UPDATE @ UPDATE @ UPDATE @ UPDATE @ UPDATE @ UPDATE @ UPDATE @ UPDATE @ UPDATE @ DBM CFG USING intra_parallel NO DBM CFG USING federated NO DBM CFG USING fed_noauth NO DB CFG FOR cogsam82 USING locklist 50 DB CFG FOR cogsam82 USING dft_degree 1 DB CFG FOR cogsam82 USING maxlocks 22 DB CFG FOR cogsam82 USING avg_appls 1 DB CFG FOR cogsam82 USING stmtheap 2048 DB CFG FOR cogsam82 USING dft_queryopt 5 CONNECT TO cogsam82 @ IBM Cognos Proprietary Information Blue Stack - Setting up DB2 77 of 77 COMMIT @ CONNECT RESET @ DB2STOP @ DB2START @ ------------------------------------------------------------------------- IBM Cognos Proprietary Information