WPS: Migrando para o DB2 - Preparando o DB2

From Wiki

Nova versão:

  • WebSphere Portal 8.X
  • DB2 Enterprise Server 10.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 portal_server.tgz PortalServer/


Configurando a instância do DB2

Entre com o usuário db2iwp8 no servidor onde está instalando o DB2

su - db2iwp8

e digite os seguintes comandos

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 = RELDB
db2 "create db RELDB using codeset UTF-8 territory us PAGESIZE 8192"
db2 "update db cfg for RELDB using applheapsz 4096"
db2 "update db cfg for RELDB using app_ctl_heap_sz 1024"
db2 "update db cfg for RELDB using stmtheap 16384"
db2 "update db cfg for RELDB using dbheap 2400"
db2 "update db cfg for RELDB using locklist 1000"
db2 "update db cfg for RELDB using logfilsiz 4000"
db2 "update db cfg for RELDB using logprimary 12"
db2 "update db cfg for RELDB using logsecond 20"
db2 "update db cfg for RELDB using logbufsz 32"
db2 "update db cfg for RELDB using avg_appls 5"
db2 "update db cfg for RELDB using locktimeout 30"
db2 "update db cfg for RELDB 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"

Ajustando DB2 Content Manager Runtime Edition (jcrdb)

Atenção para Trocar a senha abaixo

db2 "connect to JCRDB user db2iwp8 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"

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 CollationUDF.class

Na máquina do Portal, vá para o diretório

[root@wps1 ~]# cd /opt/IBM/WebSphere/PortalServer/jcr/wp.content.repository.install/


faça a cópia do arquivo lib/wp.content.repository.install.jar, para o servidor do DB2

[root@wps1 config]# scp lib/wp.content.repository.install.jar db2iwp8@db2server:/home/db2iwp8/sqllib/function/.


Vá para o diretório

[root@wps1 ~]# cd <wp_profile>/PortalServer/jcr/config/registerCollationUDFTemplate.sql


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

[root@wps1 config]# scp config/registerCollationUDFTemplate.sql db2iwp8@db2server:/home/db2iwp8/sqllib/function/.


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

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

Descompacte o jar

[root@db2server function]# /opt/ibm/db2/V10.1/java/jdk64/bin/jar -xvf wp.content.repository.install.jar icm/CollationUDF.class
inflated: icm/CollationUDF.class

Criando a função SORTKEYJ

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;

Salve e Feche o arquivo.


Alterne para o usuário da instancia do DB2 e vá para o diretório:

[root@db2server function]# su - db2iwp8
[db2iwp8@db2server ~]$ cd /home/db2iwp8/sqllib/function


Agora conecte-se no banco

[db2iwp8@db2server ~]# db2 connect to JCRDB;

Rode o script

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

Desconecte-se do banco e reinicie o mesmo.

[db2iwp8@db2server ~]# db2 terminate

[db2iwp8@db2server ~]# db2stop

[db2iwp8@db2server ~]# db2start

Testando

[db2iwp8@db2server ~]# db2 connect to JCRDB;
[db2iwp8@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:

# Enable/Disable collation support for all DB2 platforms
# Disabled by default
jcr.query.collation.db2.enabled = true

# Database specific collation mappings
# These mappings apply map a Java locale name into a collation name
# supported by the underlying database.
# Example mappings for DB2 platform

# English
jcr.query.collation.en = en

# Swedish
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

Salve e Feche.

Agora inicie o portal


Continuar no artigo WPS: Instalando o Websphere Portal Server

Ver também