Is there any table where Oracle APEX usage log is stored - oracle

I was just wondering if there is any standard table , where we can see which user has accessed which report in Oracle APEX, based on date and time. Basically the audit history ?
I can do it by inserting the needed data in a custom table but, is there any standard way, where we have all this information?
Regards,
Abha

Oracle APEX has indeed internal tables where it stores all of this information. The name of the view to have insight into this data is apex_workspace_activity_log.
select s.workspace,
s.apex_user,
s.application_id,
s.application_name,
s.page_id,
s.page_name,
s.view_date,
s.apex_session_id
from apex_workspace_activity_log s
/
Here you can see WHO accessed a page, WHAT page has been accessed and WHEN that page has been accessed (date and time). This is not on individual report level, as you asked for, but at least you can see it on page level.
Use following views to see what report exists on which page and join that information as you like.
apex_application_page_rpt
apex_application_page_ir
apex_appl_page_igs

select * from APEX_WORKSPACE_ACTIVITY_LOG
select * from APEX_ACTIVITY_LOG

Related

How to use login ID session variable in Oracle BI publisher report

I am thinking of setting user filter on report. So user can only see data related to him.
It is supposed to login to Oracle bi publisher, then open report, and the related data will show up.
Is there a way to extract login id as parameter in a data model?
Database is from DB2
There are user information stored in system variables that you can include in your data model. The folowing query would give you the user info that you can refference in your report:
select
:xdo_user_name as USER_ID,
:xdo_user_roles as USER_ROLES,
:xdo_user_report_oracle_lang as REPORT_LANGUAGE,
:xdo_user_report_locale as REPORT_LOCALE,
:xdo_user_ui_oracle_lang as UI_LANGUAGE,
:xdo_user_ui_locale as UI_LOCALE
from dual
More about it at: https://docs.oracle.com/middleware/12212/bip/BIPDM/GUID-2A6E4B9B-ABCD-4CF0-A458-59B89F2443A1.htm#BIPDM223
Regards...

Does TOAD for oracle generate logs of executed SQL?

I cannot seem to find a view which I created in one of my schemas within TOAD. Lets assume I don't know the exact schema in which I've created it, is there any way where I can find all the create statements which have been executed within a period of time, lets say the last days.
Thank you in advance.
If you created the view, just query ALL the views, and order by the date in which it was created.
select * from dba_objects
where object_type = 'VIEW'
order by created desc, last_ddl_time desc
We're hitting DBA_ views to make sure we look at EVERYTHING, not just the things you have PRIVS for. Switch to ALL_ views in case you lack access, and hope you didn't create the view in a schema in which your current logon can't see.
The other way to go is query the views themselves and key in on the table you think you included in the SQL behind the view.
SELECT *
FROM dba_views
WHERE UPPER (text_vc) LIKE '%EMPLOYEES%';
You might be looking for a feature called "SQL Recall" in Toad. Press F8 or View/SQL Recall. It will show you the SQL you ran in the last month or so.

Viewing the last edit date of a procedure in Oracle SQL Developer

In SQL Server Management Studio, there's a tab called Object Explorer Details that you can look at to see when a table or a procedure is created or last modified.
Is there something similar for Oracle SQL Developer?
View > Reports > Data Dictionary Reports
Open the All Objects Report
You can filter/sort the report to restrict to a specific schema or object type, or even filter on the last updated date (Last_DDL)
* Query way *
With Oracle, you can query the view all_objects
* GUI way *
Search for the objects that you want and the check the Details tab
Let say you want information about OE_ACKNOWLEDGMENT_PUB package body
Then you click on the object name
Then you click on Details tab

Crystal Reports displays blank (null) values for some fields from an Oracle view

Summary
We have a Crystal Report referencing a single Oracle view. There are no other tables or joins in the report. The view is composed of several selects, joins, and other data transformations (e.g., sum, case, to_date, group by).
Four columns from the view display as blank (null) in the report. These same columns display correctly in Oracle SQL Developer and via a select using the Oracle Data Provider for .NET in a C# application. All other columns display correctly in the report.
In addition the Browse Field option displays no values for the affected fields, but does display options for unaffected fields of the same type. Similarly, if I make an affected field a parameter of the report no options are presented.
We verified that in all cases we are connecting as the same read only user in Crystal Reports, Oracle SQL Developer, and in our Web Application.
Failed Resolution Attempts
We removed and replaced the view and fields in the Crystal Report.
We created a brand new report connecting to the same view.
We created a new view (from the same SQL) to be used in the same report
We verified database via Crystal Reports
We converted implicit date conversion from
score_month = '01-SEP-2017'
to
score_month = TO_DATE('01-SEP-2017', 'dd-MON-yyyy')`
per https://stackoverflow.com/a/37729175/19977
Other Oddities
Exporting the data from the view to a table works, but we want to use a view
We're at a loss as to what the cause of this issue is. Any ideas?
Several edits to the view were required to resolve this issue.
We removed Oracle specific sql per https://stackoverflow.com/a/37729175/19977. Example:
-- replace
TRUNC(sysdate, 'MONTH') AS score_month`
-- with
TO_DATE('01-SEP-2017', 'dd-MON-yyyy')
-- and replace
where score_month = '01-SEP-2017'
-- with
where score_month = TO_DATE('01-SEP-2017', 'dd-MON-yyyy')
Fully qualify all tables and views used in the Oracle view with the schema and table name. Example:
-- replace
FROM table t
-- with
FROM our_schema.table t
It remains unclear why the view would work as intended from Oracle SQL Developer and in application via the Oracle Data Provider for .NET but not from Crystal Reports. Further insight into this issue is welcome.

Oracle accessing multiple databases

I'm using Oracle SQL Developer version 4.02.15.21.
I need to write a query that accesses multiple databases. All that I'm trying to do is get a list of all the IDs present in "TableX" (There is an instance of Table1 in each of these databases, but with different values) in each database and union all of the results together into one big list.
My problem comes with accessing more than 4 databases -- I get this error: ORA-02020: too many database links in use. I cannot change the INIT.ORA file's open_links maximum limit.
So I've tried dynamically opening/closing these links:
SELECT Local.PUID FROM TableX Local
UNION ALL
----
SELECT Xdb1.PUID FROM TableX#db1 Xdb1;
ALTER SESSION CLOSE DATABASE LINK db1
UNION ALL
----
SELECT Xdb2.PUID FROM TableX#db2 Xdb2;
ALTER SESSION CLOSE DATABASE LINK db2
UNION ALL
----
SELECT Xdb3.PUID FROM TableX#db3 Xdb3;
ALTER SESSION CLOSE DATABASE LINK db3
UNION ALL
----
SELECT Xdb4.PUID FROM TableX#db4 Xdb4;
ALTER SESSION CLOSE DATABASE LINK db4
UNION ALL
----
SELECT Xdb5.PUID FROM TableX#db5 Xdb5;
ALTER SESSION CLOSE DATABASE LINK db5
However this produces 'ORA-02081: database link is not open.' On whichever db is being closed out last.
Can someone please suggest an alternative or adjustment to the above?
Please provide a small sample of your suggestion with syntactically correct SQL if possible.
If you can't change the open_links setting, you cannot have a single query that selects from all the databases you want to query.
If your requirement is to query a large number of databases via database links, it seems highly reasonable to change the open_links setting. If you have one set of people telling you that you need to do X (query data from a large number of tables) and another set of people telling you that you cannot do X, it almost always makes sense to have those two sets of people talk and figure out which imperative wins.
If we can solve the problem without writing a single query, then you have options. You can write a bit of PL/SQL, for example, that selects the data from each table in turn and does something with it. Depending on the number of database links involved, it may make sense to write a loop that generates a dynamic SQL statement for each database link, executes the SQL, and then closes the database link.
If you want need to provide a user with the ability to run a single query that returns all the data, you can write a pipelined table function that implements this sort of loop with dynamic SQL and then let the user query the pipelined table function. This isn't really a single query that fetches the data from all the tables. But it is as close as you're likely to get without modifying the open_links limit.

Resources