Friday, November 14, 2008

Loading data in Excel Sheet Using escript

var ExcelApp = COMCreateObject("Excel.Application");
var bb = ExcelApp.visible = true;
//Make Excel visible through the Application object.
// Place some text in the first cell of the sheet
ExcelApp.ActiveSheet.Cells(1,1).Value = "Column A, Row 1";
// Save the sheet
var fileName = "C:\\demo.xls";
ExcelApp.SaveAs (fileName);
// Close Excel with the Quit method on the Application object
ExcelApp.Application.Quit();
// Clear the object from memory
ExcelApp = null;

Wednesday, August 20, 2008

EIM Performance tunning

EIM performance tuning
A quick look at the various strategies available for tuning EIM on Oracle.
EIM is the mechanism used to load large data volumes into a Siebel database.
EIM can also be used for ongoing data loads where data is processed (typically from an external system) to create, update, merge or delete records.
Data quality
EIM can load data fast. Very fast. However, if the data is missing key fields from the source system, the entire data load will have to be repeated. Exhaustive, thorough checking, testing and validation of all data will have significant benefits. EIM performance degrades in direct proportion to the number of rejected records.
Consider using a staging table with multiple check constraints to validate the data and enforce integrity as much as possible.
Testing
Test, test, check and double check the load procedure. Check that data is actually visible in the Siebel application. Failure to populate a single primary column may mean data will not be visible to the end user.
Profiling
Analyse the SQL statements issue by EIM and the performance profile. The IFB parameter SQLPROFILE may be specified to generate a detailed breakdown of each EIM step together with the most resource intensive SQL statements.
Gathering statspack snapshots at the start/end of EIM processing may be used to report on general Oracle performance metrics.
Disable Transaction Logging
Siebel supports mobile web clients (remote users who work in a discinnected mode and synchronise with the Siebel server). For large scale data loads,the Siebel System Preference 'Docking: Transaction Logging' should be set to 'FALSE'. When the data load is complete, mobile web clients should be extracted.
Tune the IFB
ONLY BASE COLUMNS
The parameters 'ONLY BASE TABLES and, in particular, 'ONLY BASE COLUMNS' limit the amount of processing done by EIM. In addition, the resulting IFB documents the data mappings.
DEFAULT/FIXED COLUMNS
The EIM parameter 'DEFAULT COLUMN' and 'FIXED COLUMN' are relatively inefficient. EIM generates an UPFDATE statement for each such column for each batch processed. It is preferable to populate constant values prior to the EIM load either using SQL*Loader or updating the data.
Index hints
Two IFB parameters USE ESSENTIAL INDEX HINTS (default=TRUE) and USE INDEX HINTS (default=FALSE) should usually both be set to TRUE on Oracle. The parameters issue additional index hints to choose the appropriate indexes.
Direct path inserts
EIM also supports direct path inserts. The IFB parameter 'ORACLE INSERT APPEND MODE = TRUE' should be specified. This will add the /*+ APPEND */ hint to all insert statements.
Direct path load locks the target table. However, this isn't an issue here as the insert operation is the last part of EIM processing and is followed by a commit.
Tune the batch size
EIM processes data in batches. The size of each batch is determined by the IF_BATCH_NUM column in the EIM interface table. It is worth experimenting with batch size between 2,500 and 25,000 to determine the optimal value. There isn't a massive difference and 5,000 or 10,000 is normally a decent choice (and helps makes the sums easier).
Index monitoring
Maintaining all those indexes is expensive. Oracle provides a feature to monitor index usage. This technique can be used to enable index monitoring, execute an EIM data load. Any non-unique indexes that were not used during EIM processing may be dropped.
The necessary DDL to re-create the indexes should be captured. This allows the indexes to be reinstated when data loading is complete. Parallel index creation may be used to create the indexes quickly. The Siebel DDLSYNC utility will also recreate any missing indexes but is sequential (and relatively slow).
Tune Oracle
Siebel is an OLTP application with users connecting using a web browser. EIM is a batch application. Consequently, there is scope to reconfigure the SGA. The size of the shared pool may be reduced and the memory allocated to the buffer cache.
Pre-allocate tablespace
For large data loads, it is recommended to pre-allocate the necessary tablespace. Dynamic extent allocation is expensive and should be avoided.
Redo logs
EIM generates large volumes of redo information. In addition to the actual insert's of new records into the target tables, EIM performs updates on the EIM interface tables to set and modify status values. In addition, some primary columns will also result in update statements.
Parallelism
The final step of EIM tuning should be to run multiple EIM processes in parallel. EIM is database intensive and consumes relatively few resources on the Siebel application server. With modern disk storage technologies, the limiting factor for EIM throughput should be the CPU resources on the database server.

Tuesday, August 5, 2008

About Runtime Events

What is it? Siebel allows you to detect events on the Application, Applet or BusComp Objects. You can take an action or multiple actions on these events. For instance you can set profile attributes, or you can call a Business service or a workflow. When do you use it? Say when the Effective Start Date is set on the Service Agreement, On the pre write record of Business Component, You want to call a Business Service to validate a lot of different conditions... That is when you will define an action set to SetProfileAttribute for Account Id and then call the Business Service or a workflow. Siebel Version Runtime events is available in Siebel v7.5 onwards. The instructions/example in this blog is from siebel 7.8. to access siebel runtime events screen login to Siebel Client. Go to Sitemap --> Runtime Events Administration. Some common RuntimeEvents: Listed below are some commonly used events for each object Applet: InvokeMethod PreInvokeMethod DisplayApplet BusComp: PreSetFieldValue SetFieldValue PreWriteRecord WriteRecord Query PreQuery NewRecord PreNewRecord Application Login Logout Timeout ViewActivated Some Sample Actionsets: To create an actionset 1.Login to siebel client 2.go to Sitemap --> Administration - Runtime Events --> Action Sets 3.Click New, and enter Name = Test Actionset Start Date = Yesterday's date Active = Y Enable Export = Y 4. Create a New Record in the child applet, and enter Name = SetProfileAttr1 Action Type = Attribute Set Sequence = 1 Profile Attribute = SetOperator = Set Value = 5. Create another New Record, and enter Name = Effective Date Validation Action Type = BusService Sequence = 3 Business Service Name = Workflow Process Manager Business Service Method = RunProcess Business Service Context = "ProcessName", "Contract Validation Workflow" Example of Events Now lets say you want to call this actionset Before Write record event of "Service Agreement". Here is what you will do to achieve this: Go to Events View and create a New Record: Sequence = 1 Object = BusComp Object Name = Service Agreement Event = PreWriteRecord Action Set Name = Contract Start Date Validation Actionset How to know what events are called when your application is running? Now In Order to know what is the Sequence of Events which is called when you do a certain operation in Siebel, do the following: To know the sequence of events that are fired, enable the personalization log in your thick client by setting the following 2 parameters in your cfg file: EnablePersonalization = TRUE PersonalizationLog = C:\Personal.log

Siebel Integration with Java and C++ - Java Business Service

Siebel Java Business Service in fact is a very powerful feature that allows easy integration with any Java packages and provides functionality within Siebel environment. Try to imagine that you'll able to:
Perform asynchronous operations using thread paradigm
Create mechanism of effective callback without context
Create additional graphic elements using SWING or anything else
Implement effective client/server mechanism etc...Example of implementation:package com.mycompany.jbs;import com.siebel.data.SiebelPropertySet;import com.siebel.eai.SiebelBusinessServiceException;public class AddBusinessService extends com.siebel.eai.SiebelBusinessService {public void doInvokeMethod(String methodName, SiebelPropertySet input,SiebelPropertySet output) throws SiebelBusinessServiceException {String a = input.getProperty("a");String b = input.getProperty("b");if (a == null a.equals("") (b == null) b.equals(""))throw new SiebelBusinessServiceException("NO_PAR", "Missing param");if (!methodName.equals ("GetSum"))throw new SiebelBusinessServiceException("NO_SUCH_METHOD", "No such method");else {int a = 0;int b = 0;try {a = Integer.parseInt(X);b = Integer.parseInt(Y);}catch (NumberFormatException e) {throw new SiebelBusinessServiceException("NOT_INT", "Non-integer passed");}int result = a + b;output.setProperty("result", new Integer(result).toString());}}}Due to actual neediness of Java runtime in Siebel environment, the usage of such an ability becomes to be relatively easy. Maybe the main drawback is managing of Java sub-system in distributed Siebel environment.

Monday, August 4, 2008

Server Script Run for Each Client

Scripting on server side events, also known as server script, runs inside the Siebel Object Manager. This means where the server script runs depends upon where the Siebel Object Manager runs. This varies for different types of architecture, as follows:
Siebel Web Client
In both High Interactivity and Standard Interactivity modes, the Siebel Web Client connects to the Siebel Web Server, then to the Siebel Server. The Siebel Web Client uses the Object Manager residing in the Siebel Server to support its functionality. In this circumstance, the server script runs on the Siebel Server.
Siebel Dedicated Web Client and Siebel Mobile Web Client
The Siebel Dedicated Web Client and Siebel Mobile Web Client run a local version of the Application Object Manager on the machine where the client resides. In this circumstance, the server script runs in the client machine.
Impact on Scripting
The awareness of the above differences is critical for scripting, especially when the script accesses environment-specific references, components, or data sources. For example:
If the server is on a UNIX operating system, the server script running on it must be written in eScript, because there is no Siebel VB script engine on the UNIX environment.
When using server script to directly access files, the awareness of your local file system is very important, since different machines may have a different file system hierarchy and different file access permissions.
Using COM objects to access external applications is a common practice on server script, but it is not possible if the server script runs on a UNIX platform.

Thursday, July 31, 2008

Index

Although the best performance improvement can be seen when a column has an index created on it. However, care must be taken while deciding whether to create an index or not. Below are some of the tips to decide,
When To Create an Index
When you have large table
When the table is mainly used for queries
When you generally query the table for one or few distinct values
When large number of NULLs are in the column
When Not To Create An Index
When you have small table
When users make DML (Data Manipulation Language) changes to the table frequently
When your query results contain substantial portions of the data the table actually stores
When table is updated frequently