Pages

29/03/2014

[TIBCO BusinessEvents] Listen for ActiveSpaces events

When working with TIBCO BusinessEvents, it's possible to create a channel on which to listen for TIBCO ActiveSpaces events such as:


  • TIBAS_EVENT_PUT when a tuple is inserted, overwritten, or updated
  • TIBAS_EVENT_TAKE when a tuple is taken or removed
  • TIBAS_EVENT_EXPIRE when a tuple reaches the end of its time to live and expires from the space
  • TIBAS_EVENT_SEED when there is redistribution after a seeder joins or leaves, and the local node is seeding or unseeding. This is only applicable if the listener distribution scope is SEEDED
  • TIBAS_EVENT_UNSEED when there is redistribution after a seeder joins or leaves, and the local node is seeding or unseeding. This is only applicable if the listener’s distribution scope is SEEDED


[Oracle] Get DDL statement from SQL query

In Oracle, it's possible to get an object DDL statement via a simple SQL query, by relying on the get_ddl function in the DBMS_METADATA package.

The syntax is simple:

DBMS_METADATA.GET_DDL (
    object_type     IN VARCHAR2,
    name            IN VARCHAR2,
    schema          IN VARCHAR2 DEFAULT NULL,
    version         IN VARCHAR2 DEFAULT 'COMPATIBLE',
    model           IN VARCHAR2 DEFAULT 'ORACLE',
    transform       IN VARCHAR2 DEFAULT 'DDL')
RETURN CLOB;

For example, to get the DDL statement for all VIEWs under schema USER_SCHEMA:

SELECT DBMS_METADATA.get_ddl ('VIEW', view_name, 'USER_SCHEMA')
FROM user_views;

if you want tables, use:

SELECT DBMS_METADATA.get_ddl ('TABLE', table_name, 'USER_SCHEMA')
FROM user_tables;

while if you are interested in a specific object (eg a table) you can use:

SELECT DBMS_METADATA.get_ddl ('TABLE', MY_TABLE_NAME, 'USER_SCHEMA')
FROM DUAL;

[Windows] Force service shutdown

On Windows, if a service is hanging in the STOPPING state, it's possible to forcefully stop it by following these steps.

First, find the service name. In the service properties, on the General tab, it's the first entry: Service name
Then, open a command prompt and type:

sc queryex SERVICE_NAME

to find the service PID

Lastly, type:

taskkill /PID SERVICE_PID /F

to forcefully kill the service with PID SERVICE_PID. Note that this allows you to also kill services with the NOT_STOPPABLE and IGNORES_SHUTDOWN flags.


[Oracle] Reset/recover SYS password

In Oracle, it's possible to connect to the database without specifying a password if the user account on the machine where the DB is running is a member of the DBA group.

Then it will be possible to reset the password for any user (even SYS); this is especially useful if you forgot what your password was. First, connect to the machine where the DB is running then open a command prompt and type:

SQLPLUS / AS SYSDBA

to log in, then type

ALTER USER USER_NAME IDENTIFIED BY "NEW_PASSWORD";

to change the password for USER_NAME