Tracing using triggers

Hi All
I have used tracing by creating 'AFTER LOGON on schema' clause and i was able to generate logs for same schema in UDUMP directory successfully. These sessions were created by Tomcat application server. I created triggers and started the application (using tomcat) which established around 100 session with database for which traces generated successfully. Now the issue here is that when i want to stop this tracing from further going on, i have two options...
1. stop the tomcat and drop the trigger
2. continue running existing sessions and disable the trigger.
3. disable the triggers and kill all running sessions from sql plus
Now the problem here is that i testing this thing with option 1 in testing environment however i am not allowed to stop and start production environment twice. For testing environment, i created triggers and started the application then stopped the application and dropped the triggers. again i started the application. But in production i am not allowed to restart application twice. so i am seeking some alternate or some suggestions by which i can generate traces for my perticular application and can disable that tracing from further going on without shutting down the application one more time. I will really appreciate any help/comment/suggestion for this problem. I can not restart production application twice because it recovers some stuff which took around 4 Hours and if i will restart application twice it will take 8 Hours which is not accepted. Now, the problem with step 2 mentioned above is that though new tracing will be disabled but existing sessions will keep on generating logs in existing files for long time. And problem with option 3 is that if i will kill all sessions from sqlplus, i will loose lot of important transactions happening during that time.
Therefore, i am really stuck in an situation where i can not do much things. Please help.
Sun 10
Oracle 10G 10.2.0.3.0
Thanks
aps

What user id is used to start each session? Does the application connect to the db with a single username, on behalf of all human users? I've done stuff like this before, and the trigger code also checked for username and only enabled trace for a pre-selected user - one that we knew we would be doing tracing on. You might look at all of the identifiable info available to the trigger code and see if there is anything you can discriminate on to limit the traces to a small subset of all sessions.
In the case where I did this keying off of username, we would identify what username we were going to use for the trace (you could even create a quasi-dummy account just for this purpose), then I would code that into the trigger, compile the trigger, run the test/trace, then disable the trigger until needed again.

Similar Messages

  • Adding multiple 100% width slideshows to the top of a page and using triggers to select.  Is it possible???

    Hi!
    I am looking to create a changeable slideshow at the top of a webpage. I want to be able to select different slideshows to view at the top of the page and use triggers/buttons to select the relevant slideshow. This is for a catering site, so I would like that if the user clicks 'canapes' button the slideshow images at the top of the page will show canapes and the caption will show text about them, if they select the 'cocktails' button then a new slideshow will appear showing images of cocktails together with a relevant caption. 
    I thought this might be possible by placing slideshows within a lightbox or composition widget but seem to be banging my head against the wall! Can someone help?
    Is it possible?
    If yes, is there a youtube video to show how its done?
    Any help much appreciated.
    Martin

    Is it possible? Yes... I wouldn't do it because having all those images sitting on the one (first) page will slow the page loading times down and just piss people off but thats your main answeer.
    The compositions widgets allow you to build more complex ideas and is what I'd use to make this sort of thing in Muse...
    p.s. if you just want something fast then have a look at what some people have already made to get ideas;
    1. Templates – MuseLayers
    2. iChef | Culinary Arts Adobe Muse Template | museGrid.com
    3. RESOURCES | Adobe Muse CC

  • Solved: ADF BC and primary keys - how to implement without using triggers

    Using the following OBE as an example:
    http://www.oracle.com/technology/obe/obe9051jdev/ADFWorkshop/BuildingADFApplicationsWorkshop.htm
    There is just one view that has CustomerId defined as a primary key, where the value for the primary key comes from the customer_seq sequence.
    How do you create the model using ADF BC entity to create an entity object that has a primary key that needs to be populated by a sequence table when inserted WITHOUT using a trigger?
    Basically I want to just use ADF BC instead of toplink in the OBE. We do not use triggers to insert primary keys, so this example is a good match for what I need.
    Can someone help me out. How do I adjust the model to use just ADF BC - how do I define the entity object to use a sequence. Do I just override the create method in the impl? Is it that simple? Or is there a way to do this point and click in the entity tool.
    Thanks!

    I'm not the dba (or one of several) - so don't shoot the messenger... the dba's do not like to use triggers in the code. I have been told that this has caused too many problems in application development.
    I don't ask why, just deal with the fallout.
    I did try using the following code in a create method:
    protected void create(AttributeList attributeList)
    super.create(attributeList);
    SequenceImpl s = new SequenceImpl("customers_seq", getDBTransaction());
    // this.setCustId(s.getSequenceNumber());
    this.createPrimaryKey(s.getSequenceNumber());
    When I run the test program for the module, I get a new entry with the id empty and greyed out. I was hoping that this would be filled in on the actual insert, but no joy. As soon as I try to commit, I get an error:
    (oracle.jbo.AttrValException) JBO-27014: Attribute CustId in CustomersWSView is required)
    So what needs to be done?
    Message was edited by:
    klee

  • USE triggers in Oracle OBI PUBLISHER 10g

    hi guys,
    i´m not able to use 11g to use trigger events, so i have to use triggers in 10g version...
    How can i do that???
    Can u give me example please....?
    Tks u all..
    KR
    FC

    No option is provided for such action.
    If you really want the user to enter a value then you need to capture the NULL value from parameter and pass it to template and display a text message accordingly for this case.
    regards
    Jorge Anicama
    p.s. If this answers your question then please mark the answer as "correct" else as "helpful"

  • How can I call unix shell script from database using triggers

    Hi everyone,
    can anybody help me to solve my problem.
    we have one table and records are getting inserted into table.
    when the record is inserted with 'C',I need to fetch that record-id which is primary key and then by passing that id as an argument I need to execute a shell script which is there in Unix using triggers.
    please note DB and Scripts are in different servers.

    4159efc6-cffb-4496-bd1a-68859f6ce776 wrote:
    Hi everyone,
    can anybody help me to solve my problem.
    we have one table and records are getting inserted into table.
    when the record is inserted with 'C',I need to fetch that record-id which is primary key and then by passing that id as an argument I need to execute a shell script which is there in Unix using triggers.
    please note DB and Scripts are in different servers.
    PL/SQL can only interact with objects on the local DB Server.
    PL/SQL can initiate OS local script via any of the following mechanisms: EXTERNAL PROCEDURE, JAVA, DBMS_SCHEDULER
    The local script then will need to launch the remote script.

  • How Can I Use Triggers to Pre-Populate a Table

    I've given up on using collections, time to move on to plan B.
    I'm working on building a training database and I have 3 tables, one which houses employee information (A), one which houses training courses (B) and a third what stores the results of completed training (C). What I'd like to do is store all possible combinations of A*B (M:M) in table C and throw a tabular form on table C to provide for mass updates.
    This is easy enough if my employee base (A) and my training courses (B) weren't changing throughout the year. What I'd like to accomplish is to place a trigger on each table so that when it is updated the new record is copied to table C along with all combinations of the other table.
    For example:
    If I add a new employee A, a trigger on that table will run which takes the new employee and creates records in table C, with all possible combinations of courses in table B. (1:M)
    or
    If I add a new course B, a trigger on that table will run which takes the new course and creates records in table C, with all possible combinations of employees in table A. (M:1)
    Let's just say the tables look like the following:
    A
    employee_num (PK)
    employee_name
    password
    active
    B
    course_ID (PK)
    course_name
    Course_code
    Course_hours
    C
    ID (PK)
    employee_num (FK)
    course_ID (FK)
    approved_status
    approved_by
    date_taken
    Does anyone have any pseudo code, links, sample applications, encouraging words I could leverage to get started?
    Thanks much.

    I've never created a trigger to do what your asking. I personally try to limit my use of triggers to surrogate keys.
    That being said I have done something similar to your situation. If you are managing the employees and the courses in apex just make that page process create your new records in your other tables.
    Ex. Add new employee
    Declare
    v_id number;
    Begin
    If creating
    v_id := what ever your next employee_id
    Issue your create on the employee table specifying v_id as the value of the employee_id
    Create an insert from select for the "c" table something like:
    Insert into c (employee_id,course_id)
    Select v_id, course_id from b ;
    End if;
    End;
    I would do something similar on the courses page to solve ex 2.

  • How to track changes on the table not using triggers

    Hi,
    I would like to track DML changes on the tables. As I have many tables it is not efficient to write triggers.
    Is there any setup I can do at database level.
    I am using 11g R2.
    Thanks

    thanks fran.
    I would like to know old and new data in case of updates. This method will not show me.are you sure??
    SQL> sho parameter audit_trail
    NAME                                 TYPE        VALUE
    audit_trail                          string      DB, EXTENDED
    SQL> audit select, insert, update on fran.test1;
    AuditorÝa terminada correctamente.
    SQL> conn fran/fran
    Conectado.
    SQL> select * from test1;
    ninguna fila seleccionada
    SQL> insert into fran.test1 values('EX',2);
    1 fila creada.
    SQL> update fran.test1 set object_id=3 where object_id=2;
    1 fila actualizada.
    SQL> commit;
    Confirmaci¾n terminada.
    SQL> conn / as sysdba
    Conectado.
    SQL> select sqltext from aud$ where sqltext is not null;
    SQLTEXT
    select * from test1
    insert into fran.test1 values('EX',2)
    update fran.test1 set object_id=3 where object_id=2If you want more data, FGA is your goal
    I have read some where on flashback database ..
    would this create a replica table with old changesflashback database is to set the current data like in the past. I mean:
    SQL> conn / as sysdba
    Conectado.
    SQL> alter table fran.test1 enable row movement;
    Tabla modificada.
    SQL> drop table fran.test1;
    Tabla borrada.
    SQL> select * from fran.test1;
    select * from fran.test1
    ERROR en lÝnea 1:
    ORA-00942: la tabla o vista no existe
    SQL> flashback table fran.test1 to before drop;
    Flashback terminado.
    SQL> select * from fran.test1;
    OBJECT_NAME                    OBJECT_ID
    EX                             3

  • How to track personal details changes in the report without using triggers on the database tables

    Hi There,
    I'm having a requirement to track the oracle HRMS Personal details changes in the report not using the triggers.
    ex: if some changes the address of the person, then that changed values should be populated in the report.
    Please find below query:
    If any of the following columns data is updated, the new value should be populated in the report.
    SELECT PAPF.PERSON_ID                                                       PAPF_PERSON_ID
    ,      PAPF.EMPLOYEE_NUMBER                                               EMPLOYEE_NUMBER        
    ,      PAPF.FIRST_NAME                                                            FIRST_NAME   
    ,      PAPF.LAST_NAME                                                            LAST_NAME
    ,      TO_CHAR(PAPF.DATE_OF_BIRTH ,'DD-MON-YYYY')     DATE_OF_BIRTH
    ,      ADDR.ADDRESS_LINE1                                                   ADDRESS_1
    ,      ADDR.ADDRESS_LINE2                                                   ADDRESS_2
    ,      ADDR.ADDRESS_LINE3                                                   ADDRESS_3
    ,      ADDR.TOWN_OR_CITY                                                    TOWN
    ,      ADDR.REGION_1                                                              COUNTY
    ,      ADDR.POSTAL_CODE                                                     POST_CODE
    ,      ADDR.COUNTRY                                                              COUNTRY
    ,      PAY.PAYROLL_NAME                                                     PAYROLL_NAME
    ,      PLN_TYP.NAME                                                              PLAN_TYP
    ,      PLN.NAME                                                                     PRODUCT_NAME
    ,      BOF.NAME                                                                     COVERAGE
    FROM   PER_ALL_PEOPLE_F                                                PAPF
    ,      PER_ALL_ASSIGNMENTS_F                                          PAF
    ,      PER_ADDRESSES                                                        ADDR
    ,      PAY_PAYROLLS_F                                                       PAY
    ,      BEN_PRTT_ENRT_RSLT_F                                                 PEN
    ,      BEN_PL_TYP_F                                                         PLN_TYP
    ,      BEN_PL_F                                                             PLN
    ,      BEN_OIPL_F                                                           BOIPF
    ,      BEN_OPT_F                                                            BOF
    WHERE 1                                     = 1
    AND PAPF.PERSON_ID                          = PAF.PERSON_ID
    AND TRUNC(SYSDATE)                          BETWEEN PAPF.EFFECTIVE_START_DATE AND PAPF.EFFECTIVE_END_DATE
    AND TRUNC(SYSDATE)                          BETWEEN PAF.EFFECTIVE_START_DATE AND PAF.EFFECTIVE_END_DATE
    AND PAPF.PERSON_ID                          = ADDR.PERSON_ID
    AND ADDR.PRIMARY_FLAG                       = 'Y'
    AND ADDR.DATE_TO                            IS NULL
    AND PAF.PAYROLL_ID                          = PAY.PAYROLL_ID(+)
    AND PEN.PERSON_ID                           = PAPF.PERSON_ID
    AND PEN.BUSINESS_GROUP_ID                   = PAPF.BUSINESS_GROUP_ID
    AND TRUNC(SYSDATE)                          BETWEEN TRUNC(PEN.EFFECTIVE_START_DATE) AND TRUNC(PEN.EFFECTIVE_END_DATE)
    AND PEN.PRTT_ENRT_RSLT_STAT_CD              IS NULL
    AND PEN.SSPNDD_FLAG                         = 'N'
    AND ( PEN.ENRT_CVG_THRU_DT                  >= TRUNC(SYSDATE)
    OR    PEN.ENRT_OVRIDN_FLAG                  = 'Y')
    AND EXISTS(SELECT PIL.PER_IN_LER_ID
               FROM   BEN_PER_IN_LER PIL
               WHERE  PIL.PER_IN_LER_ID         = PEN.PER_IN_LER_ID
               AND    PIL.BUSINESS_GROUP_ID     = PEN.BUSINESS_GROUP_ID
               AND    PIL.PER_IN_LER_STAT_CD    NOT IN ('VOIDD','BCKDT'))
    AND PEN.PL_TYP_ID                           = PLN_TYP.PL_TYP_ID  
    AND TRUNC(SYSDATE)                          BETWEEN PLN_TYP.EFFECTIVE_START_DATE AND PLN_TYP.EFFECTIVE_END_DATE  
    AND PLN_TYP.PL_TYP_ID                       = PLN.PL_TYP_ID 
    AND TRUNC(SYSDATE)                          BETWEEN PLN.EFFECTIVE_START_DATE AND PLN.EFFECTIVE_END_DATE
    AND PLN.PL_ID                               = PEN.PL_ID
    AND PEN.OIPL_ID                             = BOIPF.OIPL_ID(+)
    AND TRUNC(SYSDATE)                          BETWEEN NVL(BOIPF.EFFECTIVE_START_DATE,HR_GENERAL.START_OF_TIME) AND NVL(BOIPF.EFFECTIVE_END_DATE,HR_GENERAL.END_OF_TIME)
    AND BOIPF.OPT_ID                            = BOF.OPT_ID(+)
    AND TRUNC(SYSDATE)                          BETWEEN NVL(BOF.EFFECTIVE_START_DATE,HR_GENERAL.START_OF_TIME) AND NVL(BOF.EFFECTIVE_END_DATE,HR_GENERAL.END_OF_TIME)
    AND (:P_SYSDATE)                            BETWEEN TRUNC(PEN.ENRT_CVG_STRT_DT) AND TRUNC(PEN.ENRT_CVG_THRU_DT)
    AND (CASE WHEN :P_PAYROLL_ID IS NULL THEN 'Y' ELSE NVL((SELECT 'Y' FROM DUAL WHERE PAY.PAYROLL_ID  = :P_PAYROLL_ID), 'N') END) = 'Y'
    AND PAPF.LAST_UPDATE_DATE                   = (:P_SYSDATE) ;
    --AND PAPF.LAST_UPDATE_DATE                   BETWEEN to_date(:P_SYSDATE) and (to_date(:p_sysdate) + INTERVAL '31' Day);
    --AND (:P_SYSDATE)                           = PAPF.LAST_UPDATE_DATE ;
    Thanks

    check this -
    Re: Best Event-Based notifications for Sox Complience?

  • Using triggers with software timing

    Hello
    I'm using the PCI-6259  M
    series multifunction DQ board on a linux box (SLES 10.2) and am using
    the ansi_c api and the driver is NI KAL 1.4.  My application requires
    10 analog inputs, 8 digital inputs 8 digital outputs and all 4 analog
    outputs to interface with a piece of HW in real-time.  Currently I am
    doing straight software timing meaning I am not using the
    DAQmxCfgSampTiming call but am doing "on demand" sampling at a external hw
    controlled 1 ms interval using the NI read/write api calls.  I use 4
    NIDaq tasks (analog input/output,digital input/output).   I was
    attempting to add a analog input trigger to my system to mark a specifi
    event.  Here's what I want to do and after reading the NI documentation
    I'm not sure I can accomplish this with the NI ansi_c API
    I
    want to keep the software timing mentioned above in place which is making simple DAQmxRead/Write calls at that above specified 1 ms interval.  I want to ADD to my analog input task a trigger event for APFI1 and assign to it
    a callback function when the trigger condition occurs.  From the examples that
    comes with the driver (Acq-IntClk-AnlgStart) it looks like the event callbacks are tied to the TASK NOT the trigger.   I don't see how I tie the event callbacks in the API to a specific trigger not the whole task.  I need to be able to access my other anlog inputs "on demand" but want my trigger to fire a callback when the trigger condition occurs.  Also if this is possible what is the latency between the hw event and the execution of the callback?
    Kevin

    This is a cross-post. See my reply here:
    triggers using nidaq-mx
    http://forums.ni.com/ni/board/message?board.id=250​&view=by_date_ascending&message.id=54949#M54949
    Joe Friedchicken
    NI VirtualBench Application Software
    Get with your fellow hardware users :: [ NI's VirtualBench User Group ]
    Get with your fellow OS users :: [ NI's Linux User Group ] [ NI's OS X User Group ]
    Get with your fellow developers :: [ NI's DAQmx Base User Group ] [ NI's DDK User Group ]
    Senior Software Engineer :: Multifunction Instruments Applications Group
    Software Engineer :: Measurements RLP Group (until Mar 2014)
    Applications Engineer :: High Speed Product Group (until Sep 2008)

  • Update a table using triggers

    Hi All,
    I am new to oracle database triggers. How can I make a automatic updation of the table columns on every tuesday.
    Thanks
    sandhya

    Personally, (assuming unix OS) I would use a cron job, although dbms_job should also be suitable.
    However...
    Your requirement to do so suggests perhaps your data model might not be well thought out. As oracle is perfectly able to do queries involving date calculations, are you sure you cannot achieve what you want using appropriate functions in your queries and avoid the need for the updates ?
    An example I saw on this forum was someone who insisted on storing peoples ages in the database and updating them annually. What they should be doing is storing the date of birth and calculating the age when they need it. The age calculation could also be defined in a VIEW.

  • Strange counter reading on NI 6602 using triggered acquisition

    I'm using the 6602 connected to a Pulse generator going at about 100Hz. This goes to PFI 35.
    An APD (photon counter) is connected to PFI 39.
    I want synchronous acquisition at PFI39, after the falling edge of the pulse on PFI 35. I also count PFI 35 to see the falling edge.
    This needs to happen at a rate of 100kHz. Note that I've coded all of this and it's working and it is synchronous but there is one problem.
    Every 100th acquisition or so I get a strange spike. This spike can happen at any point and even at low counts so it does not seem to be an overflow problem.
    It can also happen at low acquisition rates so there has to be something wrong with my code.
    I have attached the normal response and the strange response. The waveform graph shows the output of the acuisition at PFI39 (photon counter).
    Any ideas what could be causing this?
    I also attach the VI. Sorry it is a bit messy.
    Note that the problem is not specific to looping, it can happen at the first iteration.
    It seems to happen more often if the acuisition duration is low (say 10kHz sampling, 10 samples, rather than 10kHz sampling nad 10ksamples).
    Attachments:
    counterVI_triggered_single_shot_sampling_version2.vi ‏77 KB
    normal_response.jpg ‏456 KB
    problem_response.jpg ‏454 KB

    Hello
    I guess you could do that!
    I would like to see if I could come up with a better solution but I am struggling to understand your code. I see that you are acquiring on 2 channels synchronously, both triggered by you 100Hz source. However, I do not understand how you are detecting the falling edge and using this as a trigger?
    This aside, from your code, it seems that you are effectively doing a finite acquisition because you stop the tasks immediately after you read the first set of samples. You will probably avoid the buffer overflow by changing the task type to 'finite samples'. The program will then effectively be performing repeated finite acquisitions.
    I hope this helps.
    Nick C.
    Cardiff University

  • NI PCI 6225: How to start and stop an acquisition using triggers

    Hi,
    Hi already spent two days reading the previous post on start/stop trigger and end up with just a complet breakdown....
    I'm using a NI PCI 6225 for a project on brain activity.
    I want to start the aquisition of 10 channels at 1Khz on a first trigger (i.e. portline 0) and stop it on a second trigger (i.e. portline 1). The duration of the recording should not exceed 5min.
    Any help will really be apreciated as well as some explanations. I'm not an expert but I do can understand if I'm being explained...slowly. I hope this post will not contribute additionally to the/my confusion on this topic....
    Thanks for your attention and help,
    OD

    Hi,
    Unfortunately, it is not possible to stop the acquisition with a second trigger (just start the task). There are some approaches to what you need, but not exactly the same. Please take a look to the next example.
    http://zone.ni.com/devzone/cda/epd/p/id/5028
    I think the only way to perform what you need will be by software and with all the consideration about timing that you should already know.
    Regards,
    Richard.

  • Tracing used EBJs

    Hi,
    We have an external "tracer" that needs to track which EJBs are used in an J2EE application to satisfy each individual client request. This "tracer" is an external program, which means that it runs in a different machine than the application server machine. What we need to do is to instrument/modify the middleware and/or communications layer between EJBs so that it sends a packet to the "tracer" indicating the EJBs used in a request. We think that we have to modify the EJB container to do this (but not sure). For example, when a client enters to the Welcome page, the application runs EJB1, EJB2 and EJB3. For this request, the "tracer" needs to receive a packet indicating that these three EJBs where used.
    Any suggestion/idea?

    There are actually two ways to do this in GlassFish using the Callflow Mechanism. The Callflow layer tracks multiple events like RequestStart, RequestEnd, MethodStart and Method End. You will need to look at the MethodStart events to determine if the call is for an EJB. The Callflow layer will give you detailed information about the EJB.
    The first mechanism has been used by our self management infrastructure whereby they implement a listener with the Callflow Agent. Once the callflow method is hit an event is thrown to the listener that they capture and process.
    The Pro: the Listener can easily be registered with the agent and is exposed as an external interface.
    The Con: The event is thrown when the call is being is executed, so essentially the processing time that your handler takes is added to the call processing time.
    The relevant files are
    http://fisheye5.cenqua.com/browse/glassfish/appserv-core/src/java/com/sun/enterprise/admin/selfmanagement/event/CallflowEventListener.java
    The public interfaces are at
    http://fisheye5.cenqua.com/browse/glassfish/appserv-commons/src/java/com/sun/enterprise/admin/monitor/callflow
    The second mechanism that I have just added about 3-4 weeks back sends events asynchronously to a different handler. The biggest advantage is that your method call does not have pay for your handler processing code time. It takes advantage of the efficient asynchronous code that we have added to decouple our database writing from the call processing times.
    The con: Since we have just added this code, I have not yet exposed this in the appserv-commons directory but we can easily work that out if this is something that satisfies your needs.
    You will need to implement a Handler and register it with the handler chain
    http://fisheye5.cenqua.com/browse/glassfish/admin/monitor/src/java/com/sun/enterprise/admin/monitor/callflow
    and implement the handle method. The handle method gets a bulk of TransferObjects (since this is handled asynchronously - we bullk them up). You will need to see if a particular TO is a type of MethodStartTO and extract the relevant information from there.
    Once you have implemented either of these, you can start callflow monitoring using asadmin start-callflow-monitoring server and stop using asadmin stop-callfow-monitoring server commands and you are good to go.
    I would believe it should not take you more than couple of hours to code this up. What do I know ? ;-) I implemented some of this :-).
    For details on the callflow layer and mechanism, you can look at the following doc
    https://glassfish.dev.java.net/javaee5/monitoring/callflow/callflow.html . My email is at the bottom - feel free to email me if you have further questions.
    Thanks
    Harpreet

  • Returning primary from creation - using triggers

    Evening,
    I currently have an entity bean that has its' primary key value defined by a Trigger on my Oracle database.
    So I have a situation where the key is always initialy set to Zero however, the trigger re-assigns the key on the databases INSERT method.
    So my question is two fold then. Firstly does the entity bean assume that its' key value is still Zero or should the get method return the new key?
    Secondly, how can I pass the new key value back to the entity beans container(each entity is wrapped in a session bean). At present I recieve an error when attempting to return the key value imediately after creating the entity bean so I presume I am going about the problem the wrong way.
    Any ideas?
    ~~~~

    Not to butt in, but why are you guys not using an identity column in
    the db? That seems to be the logical solution if you have a truely
    unique, db assigned pk.Unfortunately Oracle does not have identity columns. You can simulate an identity column to some extend by using a sequence and an insert trigger for each table.
    Example (note I am not an Oracle guru):
    CREATE SEQUENCE SQ_Logs MINVALUE 1 MAXVALUE 2147483647 NOCYCLE NOCACHE;
    CREATE TABLE Logs
    LogId NUMBER(10) NOT NULL,
    LogDateTime DATE NOT NULL,
    Severity CHAR(1) NOT NULL,
    Message VARCHAR2(250) NOT NULL,
    CONSTRAINT PK_Logs PRIMARY KEY (LogId),
    CONSTRAINT UK_Logs UNIQUE (LogDateTime, Severity, Message)
    CREATE TRIGGER TR_Insert_Logs BEFORE INSERT ON Logs
    FOR EACH ROW
    BEGIN
    SELECT SQ_Logs.NEXTVAL INTO :NEW.LogId FROM DUAL;
    END;
    In the BMP-bean ejbCreate() method you insert the LogDateTime, Severity and Message values. The primary keyis set by the trigger. Then you lookup the primary key by using based on the alternate key (LogDateTime, Severity, Message).
    The advantage of this solution is that your EJBs are database independent. The bad news is that each table requires an alternative unique key to locate the auto-generated primary key.
    I have never implemented this for CMP-beans (I have read somewhere that EJB 2.1 solves this issue).
    Ronald Maas

  • Should we use triggers to deny alter access to views?

    hello all - the requirement is let a group access all the views in the schema but not be able to alter, delete views or stored procedures or functions. what is the best way to do this? thanks in advance...

    It is three step process
    --Step 1 Create database role
    CREATE
    ROLE [view_access]
    GO
    --Step2 Write a store procedure to grant all the views to that role, in this example I gave for Stored Procedure
    --You can change appropriately
    USE
    [master]
    GO
    CREATE
    PROCEDURE [dbo].[sp_GrantAllviews]
    @user sysname,
    @DB varchar(30)
    AS
    SET
    NOCOUNT ON
    -- 1 - Variable declarations
    DECLARE
    @CMD1 varchar(8000)
    DECLARE
    @MAXOID int
    DECLARE
    @OwnerName varchar(128)
    DECLARE
    @ObjectName varchar(128)
    -- 2 - Create temporary table
    CREATE
    TABLE #StoredProcedures
    (OID
    int IDENTITY (1,1),
    StoredProcOwner
    varchar(128)
    NOT NULL,
    StoredProcName
    varchar(128)
    NOT NULL)
    SET
    @CMD1 =
    'SELECT ROUTINE_SCHEMA, ROUTINE_NAME FROM [' +
    @DB +
    '].INFORMATION_SCHEMA.ROUTINES WHERE NOT(ISNULL(ROUTINE_TYPE,'''') = ''FUNCTION'' AND ISNULL(DATA_TYPE,'''') = ''TABLE'') AND ROUTINE_NAME NOT LIKE ''dt_%'''
    INSERT
    INTO #StoredProcedures
    (StoredProcOwner,
    StoredProcName)
    EXEC(@CMD1)
    -- 4 - Capture the @MAXOID value
    SELECT
    @MAXOID =
    MAX(OID)
    FROM #StoredProcedures
    -- 5 - WHILE loop
    WHILE
    @MAXOID > 0
    BEGIN
    -- 6 - Initialize the variables
    SELECT
    @OwnerName =
    StoredProcOwner,
    @ObjectName
    = StoredProcName
    FROM
    #StoredProcedures
    WHERE
    OID =
    @MAXOID AND StoredProcName
    not like
    'sp_%' AND StoredProcName
    not like
    'xp_%'
    -- 7 - Build the string
    SELECT @CMD1
    = 'USE ['
    + @DB +
    '];GRANT EXEC ON ' +
    '[' +
    @OwnerName + ']'
    + '.'
    + '[' +
    @ObjectName +
    ']' +
    ' TO ' + @user
    SELECT @CMD1
    -- 8 - Execute the string
    SELECT @CMD1
    EXEC(@CMD1)
    -- 9 - Decrement @MAXOID
    SET
    @MAXOID =
    @MAXOID - 1
    END
    -- 10 - Drop the temporary table
    DROP
    TABLE #StoredProcedures
    SET
    NOCOUNT OFF
    GO
    --Step 3 Assign the user to this role.

Maybe you are looking for

  • I CAN'T EDIT MY MUSIC LIBRARY IN iTunes WITH WINDOWS VISTA!!!!

    I add my music carpets to iTunes and when I tried to edit any song, all data were in gray color and disabled. What happened? Does anbody know? I've already change many options in the Edition/Preferences menu, but nothing happened. Thank you very much

  • Does BEA Tuxedo 8.0 work on SuSe Linux 9.1?

    How do I get Tuxedo 8.0 running on SuSe Linux 9.1? Rgds. S. Message was edited by sstarke at Oct 3, 2004 5:31 AM

  • Lion starts in 'set up' mode after installing Parallelsn safe mode

    Big problem. I couldn't get on with VMWare Fusion as it was piling up huge files (106 Gb) and using up half of my hard drive. I had always had problems with it since installation so i decided to take up the transfer offer from Parallels and installed

  • AS3 coding - movie in swf file doesn't show

    I would be so greatful if someone can help with this. I've been sitting for days to find my mistake but my inexperience really holds me back here In my spelling game I have letters falling out of the sky - players have to click on them. I tested one

  • Can't import MPEG4//video blackout in YouTube upload?

    Two issues: 1) I can't import a QT/MPEG4 .mov file to work on as an event. Ideas? It's 4.3 GB... 2) Have a 1:30 video finished in iMovie, looks great in preview... but when uploaded to YouTube account, all video is gone; audio is fine, and intro and