WPS: Migrando para o DB2 - Preparando o DB2

Nosso ambiente é o DB2 Versão 9.1 em uma máquina remota.

Para a documentação detalhada veja

http://publib.boulder.ibm.com/infocenter/wpdoc/v6r1m0/topic/com.ibm.wp.ent.doc/config/stdalone_unix_db2_create_remote.html

Sobre Database Member Manager (wmmdb)

O wmmdb não existe mais no portal 6.1. Ele passa a utilizar o VMM do WAS 6.1

1. Realizando um backup da instalação do Portal via Tar
Vá para o diretório

cd /opt/IBM/WebSphere/

fazendo um backup com o tar

tar -czvf portal6_1.tgz PortalServer/

2. Configurando a instância do DB2
Entre com o usuário db2inst1 no servidor onde está instalando o DB2

su - db2inst1

e digite os seguintes comandos

db2set DB2_RR_TO_RS=yes db2set DB2_EVALUNCOMMITTED=YES db2set DB2_INLIST_TO_NLJN=YES db2 "UPDATE DBM CFG USING query_heap_sz 32768" db2 "UPDATE DBM CFG USING maxagents 500" db2 "UPDATE DBM CFG USING sheapthres 0"

3. Criando as databases necessárias

 * Database Release = release

db2 "CREATE DB release using codeset UTF-8 territory us PAGESIZE 8192" db2 "UPDATE DB CFG FOR release USING applheapsz 4096" db2 "UPDATE DB CFG FOR release USING app_ctl_heap_sz 1024" db2 "UPDATE DB CFG FOR release USING stmtheap 16384" db2 "UPDATE DB CFG FOR release USING dbheap 2400" db2 "UPDATE DB CFG FOR release USING locklist 1000" db2 "UPDATE DB CFG FOR release USING logfilsiz 4000" db2 "UPDATE DB CFG FOR release USING logprimary 12" db2 "UPDATE DB CFG FOR release USING logsecond 20" db2 "UPDATE DB CFG FOR release USING logbufsz 32" db2 "UPDATE DB CFG FOR release USING avg_appls 5" db2 "UPDATE DB CFG FOR release USING locktimeout 30" db2 "UPDATE DB CFG FOR release using AUTO_MAINT off"


 * Database Community = commdb

db2 "CREATE DB commdb using codeset UTF-8 territory us PAGESIZE 8192" db2 "UPDATE DB CFG FOR commdb USING applheapsz 4096" db2 "UPDATE DB CFG FOR commdb USING app_ctl_heap_sz 1024" db2 "UPDATE DB CFG FOR commdb USING stmtheap 16384" db2 "UPDATE DB CFG FOR commdb USING dbheap 2400" db2 "UPDATE DB CFG FOR commdb USING locklist 1000" db2 "UPDATE DB CFG FOR commdb USING logfilsiz 4000" db2 "UPDATE DB CFG FOR commdb USING logprimary 12" db2 "UPDATE DB CFG FOR commdb USING logsecond 20" db2 "UPDATE DB CFG FOR commdb USING logbufsz 32" db2 "UPDATE DB CFG FOR commdb USING avg_appls 5" db2 "UPDATE DB CFG FOR commdb USING locktimeout 30" db2 "UPDATE DB CFG FOR commdb using AUTO_MAINT off"


 * Database Customization = custdb

db2 "CREATE DB custdb using codeset UTF-8 territory us PAGESIZE 8192" db2 "UPDATE DB CFG FOR custdb USING applheapsz 4096" db2 "UPDATE DB CFG FOR custdb USING app_ctl_heap_sz 1024" db2 "UPDATE DB CFG FOR custdb USING stmtheap 16384" db2 "UPDATE DB CFG FOR custdb USING dbheap 2400" db2 "UPDATE DB CFG FOR custdb USING locklist 1000" db2 "UPDATE DB CFG FOR custdb USING logfilsiz 4000" db2 "UPDATE DB CFG FOR custdb USING logprimary 12" db2 "UPDATE DB CFG FOR custdb USING logsecond 20" db2 "UPDATE DB CFG FOR custdb USING logbufsz 32" db2 "UPDATE DB CFG FOR custdb USING avg_appls 5" db2 "UPDATE DB CFG FOR custdb USING locktimeout 30" db2 "UPDATE DB CFG FOR custdb using AUTO_MAINT off"


 * Database Document Manager, Personalization, Web Content Management = jcrdb

db2 "CREATE DB jcrdb using codeset UTF-8 territory us PAGESIZE 8192" db2 "UPDATE DB CFG FOR jcrdb USING applheapsz 4096" db2 "UPDATE DB CFG FOR jcrdb USING app_ctl_heap_sz 1024" db2 "UPDATE DB CFG FOR jcrdb USING stmtheap 16384" db2 "UPDATE DB CFG FOR jcrdb USING dbheap 2400" db2 "UPDATE DB CFG FOR jcrdb USING locklist 1000" db2 "UPDATE DB CFG FOR jcrdb USING logfilsiz 4000" db2 "UPDATE DB CFG FOR jcrdb USING logprimary 12" db2 "UPDATE DB CFG FOR jcrdb USING logsecond 20" db2 "UPDATE DB CFG FOR jcrdb USING logbufsz 32" db2 "UPDATE DB CFG FOR jcrdb USING avg_appls 5" db2 "UPDATE DB CFG FOR jcrdb USING locktimeout 30" db2 "UPDATE DB CFG FOR jcrdb using AUTO_MAINT off"


 * Database Feedback = fdbkdb

db2 "CREATE DB fdbkdb using codeset UTF-8 territory us PAGESIZE 8192" db2 "UPDATE DB CFG FOR fdbkdb USING applheapsz 4096" db2 "UPDATE DB CFG FOR fdbkdb USING app_ctl_heap_sz 1024" db2 "UPDATE DB CFG FOR fdbkdb USING stmtheap 16384" db2 "UPDATE DB CFG FOR fdbkdb USING dbheap 2400" db2 "UPDATE DB CFG FOR fdbkdb USING locklist 1000" db2 "UPDATE DB CFG FOR fdbkdb USING logfilsiz 4000" db2 "UPDATE DB CFG FOR fdbkdb USING logprimary 12" db2 "UPDATE DB CFG FOR fdbkdb USING logsecond 20" db2 "UPDATE DB CFG FOR fdbkdb USING logbufsz 32" db2 "UPDATE DB CFG FOR fdbkdb USING avg_appls 5" db2 "UPDATE DB CFG FOR fdbkdb USING locktimeout 30" db2 "UPDATE DB CFG FOR fdbkdb using AUTO_MAINT off"


 * Database Likeminds = lmdb

db2 "CREATE DB lmdb using codeset UTF-8 territory us PAGESIZE 8192" db2 "UPDATE DB CFG FOR lmdb USING applheapsz 4096" db2 "UPDATE DB CFG FOR lmdb USING app_ctl_heap_sz 1024" db2 "UPDATE DB CFG FOR lmdb USING stmtheap 16384" db2 "UPDATE DB CFG FOR lmdb USING dbheap 2400" db2 "UPDATE DB CFG FOR lmdb USING locklist 1000" db2 "UPDATE DB CFG FOR lmdb USING logfilsiz 4000" db2 "UPDATE DB CFG FOR lmdb USING logprimary 12" db2 "UPDATE DB CFG FOR lmdb USING logsecond 20" db2 "UPDATE DB CFG FOR lmdb USING logbufsz 32" db2 "UPDATE DB CFG FOR lmdb USING avg_appls 5" db2 "UPDATE DB CFG FOR lmdb USING locktimeout 30" db2 "UPDATE DB CFG FOR lmdb using AUTO_MAINT off"

4. Ajustando DB2 Content Manager Runtime Edition (jcrdb)
Atenção para Trocar a senha abaixo

db2 "CONNECT TO jcrdb USER db2inst1 USING ChangeYourPasswordHere"

db2 "CREATE BUFFERPOOL ICMLSFREQBP4 SIZE 1000 PAGESIZE 4 K" db2 "CREATE BUFFERPOOL ICMLSVOLATILEBP4 SIZE 8000 PAGESIZE 4 K" db2 "CREATE BUFFERPOOL ICMLSMAINBP32 SIZE 8000 PAGESIZE 32 K" db2 "CREATE BUFFERPOOL CMBMAIN4 SIZE 1000 PAGESIZE 4 K" db2 "CREATE REGULAR TABLESPACE ICMLFQ32 PAGESIZE 32 K MANAGED BY SYSTEM USING ('ICMLFQ32') BUFFERPOOL ICMLSMAINBP32" db2 "CREATE REGULAR TABLESPACE ICMLNF32 PAGESIZE 32 K MANAGED BY SYSTEM USING ('ICMLNF32') BUFFERPOOL ICMLSMAINBP32" db2 "CREATE REGULAR TABLESPACE ICMVFQ04 PAGESIZE 4 K MANAGED BY SYSTEM USING ('ICMVFQ04') BUFFERPOOL ICMLSVOLATILEBP4" db2 "CREATE REGULAR TABLESPACE ICMSFQ04 PAGESIZE 4 K MANAGED BY SYSTEM USING ('ICMSFQ04') BUFFERPOOL ICMLSFREQBP4" db2 "CREATE REGULAR TABLESPACE CMBINV04 PAGESIZE 4 K MANAGED BY SYSTEM USING ('CMBINV04') BUFFERPOOL CMBMAIN4" db2 "CREATE SYSTEM TEMPORARY TABLESPACE ICMLSSYSTSPACE32 PAGESIZE 32 K MANAGED BY SYSTEM USING ('icmlssystspace32') BUFFERPOOL ICMLSMAINBP32" db2 "CREATE SYSTEM TEMPORARY TABLESPACE ICMLSSYSTSPACE4 PAGESIZE 4 K MANAGED BY SYSTEM USING ('icmlssystspace4') BUFFERPOOL ICMLSVOLATILEBP4" db2 "DISCONNECT jcrdb" db2 "TERMINATE"

(Opcional) 5. Configurando suporte a JCR collation
Antes realizar os passos baixe o servidor do Portal

Detalhes: http://publib.boulder.ibm.com/infocenter/wpdoc/v6r1m0/topic/com.ibm.wp.ent.doc/config/stdalone_unix_db2_cfg_collation.html

Descompactando o collation.jar
Na máquina do Portal, vá para o diretório

[root@wps1 ~]# cd /opt/IBM/WebSphere/PortalServer/jcr/prereq.jcr/config

faça a cópia do arquivo collation.jar, para o servidor do DB2

[root@wps1 config]# scp collation.jar db2inst1@db2server:/home/db2inst1/sqllib/function/.

Agora na máquina do DB2, vá para o diretório

[root@db2server ~]# cd /home/db2inst1/sqllib/function/

Descompacte o jar

[root@db2server function]# /opt/ibm/db2/V9.1/java/jdk32/bin/jar -xvf collation.jar

Criando a função SORTKEYJ
Na máquina do Portal, vá para o diretório

[root@wps1 ~]# cd /opt/IBM/WebSphere/PortalServer/jcr/prereq.jcr/config

faça a cópia do arquivo registerCollationUDFTemplate.sql, para o servidor do DB2

[root@wps1 config]# scp registerCollationUDFTemplate.sql db2inst1@db2server:/home/db2inst1

Agora na máquina do DB2, com o usuário db2inst1, vá para o diretório

[db2inst1@db2server ~]# cd /home/db2inst1/

Edite o arquivo registerCollationUDFTemplate.sql e altere todas as referências SCHEMA para o valor do jcr.DbSchema, no nosso caso:

CREATE FUNCTION JCRDB.SORTKEYJ (   VALUE        VARCHAR(32672),    LOCALEID     VARCHAR(50) ) RETURNS VARCHAR(5000) FOR BIT DATA FENCED THREADSAFE DETERMINISTIC NO SQL NO EXTERNAL ACTION LANGUAGE JAVA PARAMETER STYLE JAVA EXTERNAL NAME 'icm.CollationUDF!generateKey' ALLOW PARALLEL RETURNS NULL ON NULL INPUT; GRANT EXECUTE ON FUNCTION JCRDB.SORTKEYJ TO PUBLIC; UPDATE DBM CFG USING JAVA_HEAP_SZ 4096;

Em ambientes clusterizados, modifique as seguintes entradas:

* Change "VALUE VARCHAR(32672)," to "VALUE VARCHAR(100)," * Change "RETURNS VARCHAR(32672) FOR BIT DATA" to "RETURNS VARCHAR(100) FOR BIT DATA".

Salve e Feche o arquivo.

Agora conecte-se no banco

[db2isnt1@db2server ~]# db2 connect to jcrdb;

Rode o script

[db2isnt1@db2server ~]# db2 -tvf registerCollationUDFTemplate.sql

Desconecte-se do banco e reinicie o mesmo.

Testando

[db2isnt1@db2server ~]# db2 connect to jcrdb; [db2isnt1@db2server ~]# db2 "values jcrdb.sortkeyj('abc','en')";

Alterando o arquivo icm.properties
Na máquina do Portal, vá para o diretório

[root@wps1 icm]# cd /opt/IBM/WebSphere/wp_profile/PortalServer/jcr/lib/com/ibm/icm/

Edite o arquivo icm.properties e adicione/altere:

jcr.query.collation.db2.enabled = true jcr.query.collation.en = en jcr.query.collation.sv = sv jcr.query.collation.zh = zh jcr.query.collation.de = de jcr.query.collation.da = da jcr.query.collation.hu = hu jcr.query.collation.jp = jp
 * 1) Enable/Disable collation support for all DB2 platforms
 * 2) Disabled by default
 * 1) Database specific collation mappings
 * 2) These mappings apply map a Java locale name into a collation name
 * 3) supported by the underlying database.
 * 4) Example mappings for DB2 platform
 * 1) English
 * 1) Swedish

Salve e Feche.

Agora inicie o portal

(Opcional) 6. Definindo TableSpaces customizadas
http://publib.boulder.ibm.com/infocenter/wpdoc/v6r1m0/topic/com.ibm.wp.ent.doc/config/stdalone_db2_custom_tablespaces.html

Ver também

 * WPS: Facilitando o acesso a diretorios do Portal
 * WPS: Colocar WPS/Quickr como Serviço no Windows
 * Habilitando Trace e Logs no Websphere Portal Server


 * Mais Artigos sobre WebSphere Portal Server