How to your Oracle database as a multithreaded server

Filed under:3.0,axapta,oracle,system — posted by admin on April 18, 2008 @ 9:30 am

Un documento de cuando AX era Daangard

When setting up an Oracle database to work with Axapta it is often (normally) configured as a dedicated database server for the following reasons:

· Until now this has been the default behavior of an Oracle database.

· Early versions of the multithreaded server was known to be unstable and with some annoying bugs.

The backside of configuring the database as a dedicated server is:

· Each new database connection creates a process / thread on the server.

· Each new database connection allocates more memory for PGA purposes than a similar multithreaded connection.

As you increase the number of concurrent users in an Axapta system you will also increase the administrative burden of the Oracle database server, because you will start new processes / threads on the database server for each new Axapta session. At one point this task of switching between processes / threads will be so overwhelming big part of the servers activity that it will “kill performance” on the server.

Large Oracle Axapta installation with several hundred concurrent Axapta session are therefore more or less forced to configure their database as a multi threaded server.

Axapta running in 2-tier mode has in average 3-4 database connection, which is why configuring your Oracle database as multithreaded will ease the database servers tasks of administer the processes / threads and decrease the consumption of memory. Even though Axapta in 2-tier mode is more expensive database connection wise compared to 3-tier mode you will still benefit from using multithreaded server when running Axapta in 3-tier mode.

This document describes in short how to your Oracle database as a multithreaded server.


1. Oracle init.ora parameters

If you want to understand the way a multithreaded server works compared to a dedicated server, then you can read about this in the following 2 Oracle manuals:

· Oracle Concepts

· Oracle Administrator guide

The following Oracle kernel parameters must or can be specified in order to make the Oracle database server run in multithreaded server mode. A detailed description of these parameters can be found in the “Oracle Reference” manual.

Parameters  
mts_dispatchers:   Controls the protocol and number of dispatcher processes started at instance start. In the most simple way you just specify the protocol and the number of dispatcher processes stated at instance start:
·    mts_dispatcher=”(protocol=<protocol>)(dispatchers=<n>)”

<protocol> would typically be TCP and <n> is the number of dispatchers. You can specify multiple MTS_DISPATCHERS in the initialization file, but they must be adjacent to each other.

To specify that you want to start 5 dispatchers for the TCP/IP protocol at instance start you must specify as follows:
·    mts_dispatcher=”(protocol=TCP)(dispatchers=5)”

mts_max_dispatchers:  Specifies the maximum number of dispatcher processes allowed to be running simultaneously. Default: 5 or the number of dispatchers configured, whichever is greater. For most systems, a value of 200 – 250 connections per dispatcher provides good performance.
mts_servers :  Specifies the number of server processes that you want to create when an instance is started up. If system load decreases, this minimum number of servers is maintained. Therefore, you should take care not to set mts_servers too high at system startup.
mts_max_servers:   Specifies the maximum number of shared server processes allowed to be running simultaneously. If artificial deadlocks occur too frequently on your system, you should increase the value.
Default: Derived from mts_servers (either 20 or 2*mts_servers) .
Tests in out benchmark lap shows that in order to avoid artificial deadlocks in a 3-tier environment you should specify mts_max_servers as 1.2 * Number of active Axapta sessions. If you have 500 concurrent Axapta sessions, then you should specify mts_max_servers to be 600.
instance_name :  Name of the instance. Default value is the instance’s SID. NB! Due to a bug in Oracle 8.1.7 you must specify this parameter in order to run multithreaded server.

2. Start of multithreaded database environment

After you has changed the Oracle initialization parameters in your init.ora file, then you must bounce the database (shutdown and start again). This you have to do to let the dispatcher processes be registered by the listener process and thereby start the database as multithreaded. When running a multithreaded database you must always start the listener processes before you start the database. If the database is started before the listener, then the database will start the dispatcher processes, but because the listener don’t know their existence the database will run as a dedicated server.

Check in your alert log for your database that the dispatchers has started. Just after the start banners of the database and non-default system parameters you should find 2 lines looking something like this:

starting up 5 shared server(s) …

starting up 2 dispatcher(s) for network address ‘(ADDRESS=(PARTIAL=YES)(PROTOCOL=tcp))’…

To make sure that the listener has registered the dispatcher processes correctly start the listener control utility and list services supported by the listener (bold text indicates the commands you have to execute):

C:\>lsnrctl

LSNRCTL for 32-bit Windows: Version 8.1.7.0.0 – Production on 14-MAY-2001 12:37:27

(c) Copyright 1998 Oracle Corporation. All rights reserved.

Welcome to LSNRCTL, type “help” for information.

LSNRCTL> set password oracle

The command completed successfully

LSNRCTL> services

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=wk0-kma-dev-nt4)(PORT=1

21)))

Services Summary…

AXDB has 3 service handler(s)

DEDICATED SERVER established:0 refused:0

LOCAL SERVER

DISPATCHER established:0 refused:0 current:0 max:1022 state:ready

D001 <machine: WK0-KMA-DEV-NT4, pid: 338>

(ADDRESS=(PROTOCOL=tcp)(HOST=wk0-kma-dev-nt4.intern.dd.dk)(PORT=1196))

DISPATCHER established:0 refused:0 current:0 max:1022 state:ready

D000 <machine: WK0-KMA-DEV-NT4, pid: 337>

(ADDRESS=(PROTOCOL=tcp)(HOST=wk0-kma-dev-nt4.intern.dd.dk)(PORT=1195))

The command completed successfully

In the case above is the listener named “listener” (the default value) and there is no database explicit specified in the listener SID_LIST_<listener> in the listener.ora file.

To check that the connection is established in shared mode you can query services again and check if the established counter for one of the dispatchers has been increased.
The listener.ora file used in the above shown example look like:

# LISTENER.ORA Network Configuration File: D:\ORACLE\NETWORK\ADMIN\listener.ora

# Generated by Oracle configuration tools.

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = wk0-kma-dev-nt4)(PORT = 1521))

)

(DESCRIPTION =

(ADDRESS = (PROTOCOL = IPC)(KEY = WK0KMA))

)

)

PASSWORDS_LISTENER= (oracle)

From Axapta point of view you don’t have to change anything to utilize the new setup at the database unless you for some reason wants to connect to the database in dedicated mode. To do so you have make a new entry in your tnsnames.ora file where you (SERVER=DEDICATED) in your CONNECT_DATA section for that entry.

AXDBTCP.WORLD = (DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(Host = dbserver)(Port = 1521))

)

(CONNECT_DATA = (SID = AXDB)(SERVER=DEDICATED))

)

Be aware that for Oracle databases running on a Windows server is TCP/IP the only supported protocol for multithreaded connections.

Como imprimir directamente sobre la impresora desde x++

Filed under:3.0,desarrollo,x++ — posted by admin on April 15, 2008 @ 12:34 am

Uno de los principales problemas que se plantean al implementar facturas o informes es como imprimir verticalmente por regla general es imposible en impresoras matriciales ya es una odisea. Si nuestro cliente es muy pero q muy “rata” o “cicatero y no quiere entrar en la era de las nuevas tecnologías con una impresora láser o estamos atados por una ISO que nos obligue a dar formatos extraños a la factura, podemos utilizar las dll’s del sistema para acceder a los documentos e incluso voltear o girar las fuentes de impresión para imprimir el famoso registro empresarial de las facturas.

20080415090605_25.JPG

axl_gdi_2.xpo

Como contabilizar facturas de clientes o proveedores sin usar secuencias numericas

Filed under:3.0,axapta,desarrollo,x++ — posted by admin on April 7, 2008 @ 3:31 am

Buenas a todas y a todos. Por regla general las secuencias de facturación suelen configurarse y no dar problemas, pero en el caso que nos ocupa tenemos una multinacional que utiliza unos terminales de venta para generar facturas y albaranes etc, con numeraciones propias y esto hay que trasladarlo al AX con el minimo de problemas y de accesos a base de datos.

Nada de soluciones Salomónicas de update a “cholones” contra la custinvoicejour y cosas así que se os ve la pinta de “programatas” de medio pelo salidos de la vieja escuela del “clipper 5″, ahora el famoso “Delfi 6″. (jejejejej)

Bueno lo dicho aquí va el código para contabilizar facturas o albaranes con la numeración que queramos sin que el estándar de deje de chutar.

protected void insertJournal()
{;
ttsbegin;

numberSeq = this.allocateNumAndVoucher();
//axl numero de factura..
if (salesParmUpdate.invoiceid != ”)
{
number = salesParmUpdate.invoiceid;
numberSeq.parmNumberSequenceCode(”);
ttsbegin;
voucher = numberSeq.voucher();
ttscommit;
}
else
{
[number, voucher] = this.getNumAndVoucher();
}

if (this.updateNow())
{
this.postUpdate();

TransactionLog::create(this.transactionLogType(),this.transactionLogTxt());
ttscommit;
}
else
throw error(strFmt(“@SYS21533″));
}

Tan solo hay que sobre escribir el método insertjournal de la salesformletter



image: detail of installation by Bronwyn Lace