Wednesday, June 25, 2008

EIM : Handling EIM process failures

Imagine this scenario, you are deleting a large number of contacts and you process aborts somewhere during the process. If you are using default parameters in process IFB, you can be in a lot of trouble. Why? EIM have this 3 parameters

COMMIT EACH PASS = TRUE
COMMIT EACH TABLE = TRUE
ROLLBACK ON ERROR = FALSE
whith this defaults, this means that after deleting a table a commit is performed. And no rollback is performed. this can leave you with "orphan" records.
To avoid this, just change your parameters to
COMMIT EACH PASS = FALSE
COMMIT EACH TABLE = FALSE
ROLLBACK ON ERROR = TRUE
This ensures that EIM will either complete sucessfully or rollback the batch.

Just one note, be sure that your database resources are large enough to handle this transaction.

Friday, June 6, 2008

PL\SQL : Copy tables between databases

As you noticed, my posts run around my daily problems, and this isn't an exception. Past week I needed to copy large amount of data between production and development database to perform some tests. After some research I've found SQL*Plus COPY command, that fits like a glove in my needs.
So here's the syntax:


COPY FROM database TO database action
destination_table (column_name, column_name...) USING query

where action stands for:

  • create - if destination table doesn't exist yet;
  • replace - if destination table exists and we wish to drop and create it again;
  • append - Inserts data if table exist, otherwise it will be created;
  • insert - Insert data into an existing table.

An example could be :

SQL>copy from user/pass@DB1 
to user2/pass2@DB2
append new_emp
using select * from emp;
Enjoy!