I need to run a a script for the temporary table before running the report in the BI Publisher.
I would like to know the step by step procedure on how to create and populate a TEMPORARY TABLE in the Bi Publisher. I tried to search but there's no clear steps on how to do it. Please give a simple example.
Thanks in advance!
You can create table temporary
--Create table
create global temporary table XX_TEST_TMP
(
ID NUMBER,
CUSTOMER_NAME VARCHAR2(150)
)
on commit preserve rows;
--Create package with function execute insert data to table
create package xxx_test_pkg as
function insert_table_tmp.....
...
insert into XX_TEST_TMP values(....);
commit
end;
In the data source XMLP then add more to execute insert data to table temp.
<dataTrigger name="beforeReport" source="xxx_test_pkg.insert_table_tmp" />
After that select data on the table XX_TEST_TMP to show on your report.
When enabling the below Unified Auditing policies in Oracle database 12.2, a generic error ORA-07445 in the v$alert_log and ORA-03114 for each new log-on occur.
ORA-07445: exception encountered: core dump [kxes_evaopn2_setup_rpiswu_args()+73] [SIGSEGV] [ADDR:0x218] [PC:0x2DCCFA9] [Address not mapped to object] [].
ORA-03114: not connected to ORACLE.
This bug happens consistently on three tested 12.2 databases.
However, the error does not happen if the UPPER function calls in the WHEN clause are removed. Could this be a bug in 12.2? Also, wondering if this is a valid workaround to remove the UPPER function calls.
-- create policies
CREATE AUDIT POLICY sox_audit_ddl
ACTIONS
CREATE ASSEMBLY,
CREATE AUDIT POLICY,
CREATE CLUSTER,
CREATE CONTEXT,
CREATE DATABASE LINK,
CREATE DIMENSION,
CREATE DIRECTORY,
CREATE DISK GROUP,
CREATE EDITION,
CREATE FLASHBACK ARCHIVE,
CREATE FUNCTION,
CREATE INDEX,
CREATE INDEXTYPE,
CREATE JAVA,
CREATE LIBRARY,
CREATE MATERIALIZED VIEW ,
CREATE MATERIALIZED VIEW LOG,
CREATE MATERIALIZED ZONEMAP,
CREATE OPERATOR,
CREATE OUTLINE,
CREATE PACKAGE,
CREATE PACKAGE BODY,
CREATE PFILE,
CREATE PLUGGABLE DATABASE,
CREATE PROCEDURE,
CREATE PROFILE,
CREATE RESTORE POINT,
CREATE ROLE,
CREATE ROLLBACK SEGMENT,
CREATE SCHEMA,
CREATE SCHEMA SYNONYM,
CREATE SEQUENCE,
CREATE SPFILE,
CREATE SYNONYM,
CREATE TABLE,
CREATE TABLESPACE,
CREATE TRIGGER,
CREATE TYPE,
CREATE TYPE BODY,
CREATE USER,
CREATE VIEW,
ALTER ASSEMBLY,
ALTER AUDIT POLICY,
ALTER CLUSTER,
ALTER DATABASE,
ALTER DATABASE LINK,
ALTER DIMENSION,
ALTER DISK GROUP,
ALTER FLASHBACK ARCHIVE,
ALTER FUNCTION,
ALTER INDEX,
ALTER INDEXTYPE,
ALTER JAVA,
ALTER LIBRARY,
ALTER MATERIALIZED VIEW ,
ALTER MATERIALIZED VIEW LOG,
ALTER MATERIALIZED ZONEMAP,
ALTER OPERATOR,
ALTER OUTLINE,
ALTER PACKAGE,
ALTER PACKAGE BODY,
ALTER PLUGGABLE DATABASE,
ALTER PROCEDURE,
ALTER PROFILE,
ALTER RESOURCE COST,
ALTER ROLE,
ALTER ROLLBACK SEGMENT,
ALTER SEQUENCE,
ALTER SESSION,
ALTER SYNONYM,
ALTER SYSTEM,
ALTER TABLE,
ALTER TRIGGER,
ALTER TYPE,
ALTER TYPE BODY,
ALTER USER,
ALTER VIEW,
TRUNCATE CLUSTER,
TRUNCATE TABLE,
RENAME,
DROP ASSEMBLY,
DROP AUDIT POLICY,
DROP CLUSTER,
DROP CONTEXT,
DROP DATABASE LINK,
DROP DIMENSION,
DROP DIRECTORY,
DROP DISK GROUP,
DROP EDITION,
DROP FLASHBACK ARCHIVE,
DROP FUNCTION,
DROP INDEX,
DROP INDEXTYPE,
DROP JAVA,
DROP LIBRARY,
DROP MATERIALIZED VIEW ,
DROP MATERIALIZED VIEW LOG,
DROP MATERIALIZED ZONEMAP,
DROP OPERATOR,
DROP OUTLINE,
DROP PACKAGE,
DROP PACKAGE BODY,
DROP PLUGGABLE DATABASE,
DROP PROCEDURE,
DROP PROFILE,
DROP RESTORE POINT,
DROP ROLE,
DROP ROLLBACK SEGMENT,
DROP SCHEMA SYNONYM,
DROP SEQUENCE,
DROP SYNONYM,
DROP TABLE,
DROP TABLESPACE,
DROP TRIGGER,
DROP TYPE,
DROP TYPE BODY,
DROP USER,
DROP VIEW
WHEN
'UPPER(SYS_CONTEXT(''USERENV'', ''SESSION_USER'')) IN (''USER_A'', ''USER_B'') AND UPPER(SYS_CONTEXT(''USERENV'', ''OS_USER'')) != ''ORACLE'''
EVALUATE PER SESSION;
CREATE AUDIT POLICY sox_audit_dml
ACTIONS
INSERT,
UPDATE,
DELETE
WHEN
'UPPER(SYS_CONTEXT(''USERENV'', ''SESSION_USER'')) IN (''USER_A'', ''USER_B'') AND UPPER(SYS_CONTEXT(''USERENV'', ''OS_USER'')) != ''ORACLE'''
EVALUATE PER SESSION;
CREATE AUDIT POLICY sox_audit_tcl
ACTIONS
COMMIT,
ROLLBACK
WHEN
'UPPER(SYS_CONTEXT(''USERENV'', ''SESSION_USER'')) IN (''USER_A'', ''USER_B'') AND UPPER(SYS_CONTEXT(''USERENV'', ''OS_USER'')) != ''ORACLE'''
EVALUATE PER SESSION;
CREATE AUDIT POLICY sox_audit_dcl
ACTIONS
GRANT,
REVOKE
WHEN
'UPPER(SYS_CONTEXT(''USERENV'', ''SESSION_USER'')) IN (''USER_A'', ''USER_B'') AND UPPER(SYS_CONTEXT(''USERENV'', ''OS_USER'')) != ''ORACLE'''
EVALUATE PER SESSION;
CREATE AUDIT POLICY sox_audit_misc
ACTIONS
ANALYZE CLUSTER,
ANALYZE INDEX,
ANALYZE TABLE,
ASSOCIATE STATISTICS,
AUDIT,
CHANGE PASSWORD,
COMMENT,
DISASSOCIATE STATISTICS,
EXECUTE,
FLASHBACK TABLE,
LOCK TABLE,
LOGOFF,
LOGON,
NOAUDIT,
PURGE INDEX,
PURGE TABLE,
PURGE TABLESPACE,
SET ROLE,
SET TRANSACTION
WHEN
'UPPER(SYS_CONTEXT(''USERENV'', ''SESSION_USER'')) IN (''USER_A'', ''USER_B'') AND UPPER(SYS_CONTEXT(''USERENV'', ''OS_USER'')) != ''ORACLE'''
EVALUATE PER SESSION;
-- enable policies
AUDIT POLICY sox_audit_ddl;
AUDIT POLICY sox_audit_dml;
AUDIT POLICY sox_audit_tcl;
AUDIT POLICY sox_audit_dcl;
AUDIT POLICY sox_audit_misc;
I am searching for a way, to store only the tables and columns that are added in the database with the one who created it (nachine_name) in a log table.
I tried to add a trigger on sys table user_tab_cols but I cannot do that Why cannot I create triggers on objects owned by SYS?
The system table user_objects will give me the date when a table created, but I want also to know which machine created it. and I also want to track the column creation and modification and log them in a table.
Is that possible ? is there a way for that ?
you can create a database event trigger:
CREATE OR REPLACE TRIGGER log_ddl_event_trg
AFTER DDL
ON DATABASE
DECLARE
v_sql_list ora_name_list_t;
v_sql_txt VARCHAR2(2500);
BEGIN
FOR i in 1..ORA_SQL_TXT(v_sql_list) LOOP
v_sql_txt := v_sql_txt || v_sql_list(i);
EXIT WHEN length(v_sql_txt ) >= 2000;
END LOOP;
...
END;
/
in the Trigger, you can get the executed ddl-statement using the ORA_SQL_TXT() Funktion, and then log it in the table together with the other data (log_date, user etc.).
I am trying to change the trigger script for my database. My trigger name is ARCH_USER_UPD_TRG and this puts any updates or deletes on the USER table into a Z_USER table
I am dropping a column from the USER table and now need to modify the trigger script to no longer use this column.
How do I modify the PL/SQL script of an oracle trigger?
A trigger is similar to a package or a procedure, so you can simply use
create or replace trigger triggerName
...
declare
...
begin
...
end;
The easy solution would be to Drop and Create the trigger once again with the modified SQL script code.
DROP TRIGGER ARCH_USER_UPD_TRG;
CREATE TRIGGER ARCH_USER_UPD_TRG
//rest of code body
I need to create a table every morning based on overnight generated data from a massive table. This will then be accessed by a handful of users form Excel.
My initial approach was to use a materilazed view and when this was rejected (for political reasons) to used Managed XLL but this was rejected for other reasons. I don't want to get messed up with Temporary tables and so really just need to know how to schedule an Oracle Create Table statement as our DBA says it can't be done.
My faith in SO users sasy otherwise though!
I don't see why you have to create a new table every morning and not use an existing one?
This creates your table from PL/SQL. Is this what you want?
CREATE OR REPLACE PROCEDURE make_table AS
BEGIN
EXECUTE IMMEDIATE 'CREATE TABLE your_table ( column_1 INT PRIMARY KEY, column_2 VARCHAR2(10) )';
END make_table;
/
EXEC make_table;
Your user needs to have the necessary grants, grants given by role don't apply to compiled PL/SQL code.