O2B: Creating Trigger: How many times my DB is refreshed from planning interface
How many times my DB is refreshed from planning interface?
In order to get answer to this question you have to deploy O2B, create one additional table and a trigger on the Planning Database.
Here I am taking an example to create trigger on MS SQL Server, same can be done on the Oracle Db too.
Create an additonal table with the Name HSP_LOCK_O2B, this table should have the same set of columns including an additional one for time stamp, its name should be DateAndTime.
You can create the following trigger on the HSP_LOCK table:
CREATE TRIGGER For_DB_Refresh_delete ON HSP_LOCK
FOR INSERT
AS
declare @Object_Id int;
declare @Session_Id int;
declare @User_Id int;
declare @Server_Id int;
select @Object_Id=i.Object_Id from inserted i;
select @Session_Id=i.Session_ID from inserted i;
select @User_Id=i.User_ID from inserted i;
select @Server_Id=i.server_id from inserted i;
-- Insert record into audit table
INSERT INTO HSP_LOCK_O2B
( OBJECT_ID,
SESSION_ID,
USER_ID,
SERVER_ID, DateAndTime )
VALUES
( @Object_Id,@Session_Id,@User_ Id,@Server_Id,GETDATE());
GO
You can see the details here:
Now if you will refresh the database from Planning interface:
Here is the result you will get:
Cheers..!!
Rahul S.
Comments
Post a Comment