Skip to Main Content
Ted Struik - Oracle
Search For
Home
Home
Ted Struik - Oracle
Search
Site Map
Statistics
Page Errors
Apex
Apex
General
Autocomplete
Conditions
Errors
Items used in PL/SQL
Validations
Dynamic Actions
Logs
Version
App-wide Items
Error Handling
Apex Views
Apex Upgrade 4.2 to 5.1
Apex Upgrade 20.2 to 23.1
Database Dependencies
Show Source Code
URLs
Authorization
Modal Dialogs
Apex Office Print (AOP)
Apex-Sert
Warn on Unsaved Changes
Form Regions
Reports
Checkboxes
Download
Errors
Nowrap Columns
Substitution Strings
Use IR results in pl/sql
Clickable Row
Row Highlight
Translate Filters etc.
Bar Charts
Column Usage
Reset Pagination
Hide IR Actions menu items
Get Classic Report query
Interactive Grid
ORA-20987
ERR-1002
Copying Text
IG Info
Multiple Row Select
Read Only Options
Search
Sort and Search
Images & Fonts
Standard Icons & Fonts
WebDav
Font Awesome
Icons/image popup LOV
Lists
Hierarchy
LOVs
Definition Bug
Set 1-item LOV to Disabled
With Clause Errors
Modal LOV Plugin
HTML / CSS / JavaScript
Vertical Align
Legend CSS
Geolocation
Apex.confirm
Pie Charts
Codemirror
Theme Roller
Catching Key Strokes
Browser Cache
Locale
RequireJS
Collapsible Regions
Find JavaScript
Import / Export
Dynamic Translations
Translated Pages
APEXExport (java)
apex_export (pl/sql)
Component Settings
Charts
Translate Charts
[Reports] Bar Charts
Shuttles
Shuttle Sorting
Disable Shuttle Items
Menus
Accordion-Like
Scroll bug
Authorization
Session State
About Session State
Rollback & Commit
Performance of v()
Apex Clone Session
Request
Session State in Views
Collections
ORA-20101 & ORA-20104
ORA-00001
Max Row Count
(PL)SQL
(PL)SQL
External Tables
SQL Plus
Conditions
Long
ORDImage
Date & Timestamp
CGI environment
Sys_context
Rounding percentages
Apex_string.split in SQL
Dbms_metadata
Instr
Regular Expressions
Rollback to Savepoint
Use table aliases
(Pipelined) Bulk Collect
JSON
Source Code Search (PL/SQL)
Source Code Search (SQL)
Format Models
Pipelined Table Functions
Hint no_unnest
Listagg
DBA
DBA
Backup & Restore
Users
Export & Import
DBMS Jobs
Tablespaces
Table Size
Flush cache
Access Control List (ACL)
Locks
Java
Constraints
Object Dependencies
Package Dependencies 1
Package Dependencies 2
Grants
SQL History
Startup Errors
ORDS
Miscellaneous
Miscellaneous
Holidays
E-mail
NLExtract
Windows
VPN
VMware
Links
Google
Visualization Orgchart
Hide Search Results
Reverse Proxy
To-do List
Cytoscape
Graphics
Upscaling
Amazon Prices
Domoticz
DDoS
Hobbies
Hobbies
Motorcycles
'95 Kawasaki ZZR 600
'94 Kawasaki ZZR 1100
'91 Honda CBR 600 F2
'95 Kawasaki ZZR 1100
'99 Honda CBR 1100 XX
'00 Honda CBR 1100 XX
'02 Kawasaki ZX-12R (NL)
'05 Ducati 999 (NL)
'08 Honda Fireblade
'07 Suzuki Bandit 1250A
'18 Suzuki GSX-S 1000 F
MotoGP
Garfield
Lyrics
Skydive
Woodworking
Pantorouter
16 inch Bandsaw
Introduction
Frame
Wheels
Wheel mounts
Blade guides
Trunions and table
Enclosure
Alignment and more
Box Joint Jig
Foldable Sawhorses
Strip Sander XL
Photography
Sony RX10 IV
Yes Minister
WinAmp
Check Authorizations
When copying Apex objects (like pages) between applications, you may end up with invalid references to Authorization Schemes, for pages, buttons, processes, etc.
In those cases, in the Designer you see something like this under Security:
Authorization Scheme: !66636695904232337 (invalid)
.
Finding all these invalid references manually is quite a job. You would expect the Advisor to include a check like this, but alas.
So I created a view to find them for me - see the code below.
I have also included the query to find all Apex views that contain an authorization_scheme_id column, to build the actual view with. Not really needed here, but you may find that useful for other purposes.
Code
View
View
Name
ted_p1132_v
DDL
with app1 as ( -- the application(s) to check select app2.workspace , app2.application_id from apex_applications app2 where app2.application_id = coalesce(nv('APP_ID'), 25384) ) , aut as ( -- using this "with" is much faster than using the view directly (twice) further on in the query select a.workspace , a.application_id , trim(a.authorization_scheme_id) as authorization_scheme_id , a.authorization_scheme_name from apex_application_authorization a join apex_applications app on (app.workspace = a.workspace and app.application_id = a.application_id) ) , obj as ( -- all objects with an authorization scheme select workspace, application_id, null as page_id, 'bc_entries' as object_type, p1.breadcrumb_id as object_sequence, p1.entry_label as object_name, trim(authorization_scheme_id) as authorization_scheme_id, authorization_scheme from apex_application_bc_entries p1 where authorization_scheme is not null union all select workspace, application_id, null as page_id, 'computations' as object_type, p2.computation_sequence as object_sequence, p2.computation_item as object_name, trim(authorization_scheme_id) as authorization_scheme_id, authorization_scheme from apex_application_computations p2 where authorization_scheme is not null union all select workspace, application_id, null as page_id, 'list_entries' as object_type, p3.display_sequence as object_sequence, p3.entry_text as object_name, trim(authorization_scheme_id) as authorization_scheme_id, authorization_scheme from apex_application_list_entries p3 where authorization_scheme is not null union all select workspace, application_id, null as page_id, 'nav_bar' as object_type, p4.display_sequence as object_sequence, p4.icon_target as object_name, trim(authorization_scheme_id) as authorization_scheme_id, authorization_scheme from apex_application_nav_bar p4 where authorization_scheme is not null union all select workspace, application_id, page_id, 'pages' as object_type, p5.page_id as object_sequence, p5.page_name as object_name, trim(authorization_scheme_id) as authorization_scheme_id, authorization_scheme from apex_application_pages p5 where authorization_scheme is not null union all select workspace, application_id, page_id, 'page_branches' as object_type, p6.process_sequence as object_sequence, p6.branch_name as object_name, trim(authorization_scheme_id) as authorization_scheme_id, authorization_scheme from apex_application_page_branches p6 where authorization_scheme is not null union all select workspace, application_id, page_id, 'page_buttons' as object_type, p7.button_sequence as object_sequence, p7.button_name as object_name, trim(authorization_scheme_id) as authorization_scheme_id, authorization_scheme from apex_application_page_buttons p7 where authorization_scheme is not null union all select workspace, application_id, page_id, 'page_chart_s' as object_type, p8.series_seq as object_sequence, p8.series_name as object_name, trim(authorization_scheme_id) as authorization_scheme_id, authorization_scheme from apex_application_page_chart_s p8 where authorization_scheme is not null union all select workspace, application_id, page_id, 'page_comp' as object_type, p9.execution_sequence as object_sequence, p9.item_name as object_name, trim(authorization_scheme_id) as authorization_scheme_id, authorization_scheme from apex_application_page_comp p9 where authorization_scheme is not null union all select workspace, application_id, page_id, 'page_da' as object_type, p10.dynamic_action_sequence as object_sequence, p10.dynamic_action_name as object_name, trim(authorization_scheme_id) as authorization_scheme_id, authorization_scheme from apex_application_page_da p10 where authorization_scheme is not null union all select workspace, application_id, page_id, 'page_ir_col' as object_type, p12.display_order as object_sequence, p12.region_name || ' - ' || p12.column_alias as object_name, trim(authorization_scheme_id) as authorization_scheme_id, authorization_scheme from apex_application_page_ir_col p12 where authorization_scheme is not null union all select workspace, application_id, page_id, 'page_items' as object_type, p13.display_sequence as object_sequence, p13.item_name as object_name, trim(authorization_scheme_id) as authorization_scheme_id, authorization_scheme from apex_application_page_items p13 where authorization_scheme is not null union all select workspace, application_id, page_id, 'page_proc' as object_type, p14.execution_sequence as object_sequence, p14.process_name as object_name, trim(authorization_scheme_id) as authorization_scheme_id, authorization_scheme from apex_application_page_proc p14 where authorization_scheme is not null union all select workspace, application_id, page_id, 'page_regions' as object_type, p15.display_sequence as object_sequence, p15.region_name as object_name, trim(authorization_scheme_id) as authorization_scheme_id, authorization_scheme from apex_application_page_regions p15 where authorization_scheme is not null union all select workspace, application_id, page_id, 'page_reg_cols' as object_type, p16.display_sequence as object_sequence, p16.region_name || ' - ' || p16.name as object_name, trim(authorization_scheme_id) as authorization_scheme_id, authorization_scheme from apex_application_page_reg_cols p16 where authorization_scheme is not null union all select workspace, application_id, page_id, 'page_rpt_cols' as object_type, p17.display_sequence as object_sequence, p17.region_name || ' - ' || p17.column_alias as object_name, trim(authorization_scheme_id) as authorization_scheme_id, authorization_scheme from apex_application_page_rpt_cols p17 where authorization_scheme is not null union all select workspace, application_id, page_id, 'page_val' as object_type, p18.validation_sequence as object_sequence, p18.validation_name as object_name, trim(authorization_scheme_id) as authorization_scheme_id, authorization_scheme from apex_application_page_val p18 where authorization_scheme is not null union all select workspace, application_id, null as page_id, 'parent_tabs' as object_type, p19.display_sequence as object_sequence, p19.tab_name as object_name, trim(authorization_scheme_id) as authorization_scheme_id, authorization_scheme from apex_application_parent_tabs p19 where authorization_scheme is not null union all select workspace, application_id, null as page_id, 'processes' as object_type, p20.process_sequence as object_sequence, p20.process_name as object_name, trim(authorization_scheme_id) as authorization_scheme_id, authorization_scheme from apex_application_processes p20 where authorization_scheme is not null union all select workspace, application_id, null as page_id, 'tabs' as object_type, p21.display_sequence as object_sequence, p21.tab_name as object_name, trim(authorization_scheme_id) as authorization_scheme_id, authorization_scheme from apex_application_tabs p21 where authorization_scheme is not null union all select workspace, application_id, page_id, 'ig_columns' as object_type, p22.display_sequence as object_sequence, p22.region_name || ' - ' || p22.name as object_name, trim(authorization_scheme_id) as authorization_scheme_id, authorization_scheme from apex_appl_page_ig_columns p22 where authorization_scheme is not null union all select workspace, application_id, page_id, 'ig_rpts' as object_type, p23.report_id as object_sequence, p23.region_name as object_name, trim(authorization_scheme_id) as authorization_scheme_id, authorization_scheme from apex_appl_page_ig_rpts p23 where authorization_scheme is not null union all select workspace, application_id, null as page_id, 'web_src_operations' as object_type, p24.operation_id as object_sequence, p24.module_name as object_name, trim(authorization_scheme_id) as authorization_scheme_id, authorization_scheme from apex_appl_web_src_operations p24 where authorization_scheme is not null ) , obj_aut as ( -- all objects left joined with apex_application_authorization select obj.* , aut.authorization_scheme_id as auth_authorization_scheme_id , aut.authorization_scheme_name as auth_authorization_scheme_name from obj join apex_applications app on (app.workspace = obj.workspace and app.application_id = obj.application_id) -- limit the applications to check left join aut on ( aut.workspace = obj.workspace and aut.application_id = obj.application_id and ( trim(aut.authorization_scheme_id) = obj.authorization_scheme_id or '!' || trim(aut.authorization_scheme_id) = obj.authorization_scheme_id ) ) where obj.authorization_scheme_id not in ('MUST_NOT_BE_PUBLIC_USER') -- these are always OK ) -- all objects without a match in apex_application_authorization, -- with the authorization scheme that may be (i.e. probably is) the one we need to use select obj_aut.workspace , obj_aut.application_id , obj_aut.page_id , obj_aut.object_type , obj_aut.object_sequence , obj_aut.object_name , obj_aut.authorization_scheme_id , obj_aut.authorization_scheme , ( case when obj_aut.authorization_scheme like 'Not %' then '!' else '' end ) || aut2.authorization_scheme_id as maybe_authorization_scheme_id , ( case when obj_aut.authorization_scheme like 'Not %' then 'Not ' else '' end ) || aut2.authorization_scheme_name as maybe_authorization_scheme_name from obj_aut join app1 on (app1.workspace = obj_aut.workspace and app1.application_id = obj_aut.application_id) -- limit the applications to check left join aut aut2 on ( aut2.authorization_scheme_id = obj_aut.authorization_scheme_id or '!' || aut2.authorization_scheme_id = obj_aut.authorization_scheme_id ) where obj_aut.auth_authorization_scheme_id is null -- (optionally) also search for all pages without an authorization scheme union all select p5.workspace , p5.application_id , p5.page_id , 'pages' as object_type , p5.page_id as object_sequence , p5.page_name as object_name , null as authorization_scheme_id , null as authorization_scheme , null as maybe_authorization_scheme_id , null as maybe_authorization_scheme_name from apex_application_pages p5 join app1 on (app1.workspace = p5.workspace and app1.application_id = p5.application_id) -- limit the applications to check where p5.authorization_scheme is null and p5.page_id not in (0, 101) -- exclude pages -- order by workspace , application_id , page_id nulls last , object_type , object_sequence , object_name
View
View
Name
ted_p1132_pre_v
DDL
with a as ( select tc.* , count(*) over (order by tc.table_name) as n , count(*) over () as n2 , ( case when tc.table_name like 'APEX\_APPLICATION\_%' escape '\' then substr(tc.table_name, length('APEX_APPLICATION_')+1) --' when tc.table_name like 'APEX\_APPL\_PAGE\_%' escape '\' then substr(tc.table_name, length('APEX_APPL_PAGE_')+1) --' when tc.table_name like 'APEX\_APPL\_%' escape '\' then substr(tc.table_name, length('APEX_APPL_')+1) --' else tc.table_name end ) as object_type , ( case when tc.table_name like '%\_PAGE%' escape '\' then 'Y' else 'N' end ) as has_page_id --' from all_tab_columns tc , ( select max(u1.username) as current_apex_user from all_users u1 where u1.username like 'APEX%' and regexp_like (substr(u1.username,'6',1), '^[0-9]*$') ) u where tc.owner = u.current_apex_user and tc.table_name like 'APEX%' and tc.table_name not in ('APEX_APPLICATIONS', 'APEX_APPLICATION_AUTHORIZATION') and tc.column_name = 'AUTHORIZATION_SCHEME_ID' order by tc.table_name ) select a."OWNER",a."TABLE_NAME",a."COLUMN_NAME",a."DATA_TYPE",a."DATA_TYPE_MOD",a."DATA_TYPE_OWNER",a."DATA_LENGTH",a."DATA_PRECISION",a."DATA_SCALE",a."NULLABLE",a."COLUMN_ID",a."DEFAULT_LENGTH",a."DATA_DEFAULT",a."NUM_DISTINCT",a."LOW_VALUE",a."HIGH_VALUE",a."DENSITY",a."NUM_NULLS",a."NUM_BUCKETS",a."LAST_ANALYZED",a."SAMPLE_SIZE",a."CHARACTER_SET_NAME",a."CHAR_COL_DECL_LENGTH",a."GLOBAL_STATS",a."USER_STATS",a."AVG_COL_LEN",a."CHAR_LENGTH",a."CHAR_USED",a."V80_FMT_IMAGE",a."DATA_UPGRADED",a."HISTOGRAM",a."DEFAULT_ON_NULL",a."IDENTITY_COLUMN",a."EVALUATION_EDITION",a."UNUSABLE_BEFORE",a."UNUSABLE_BEGINNING",a."COLLATION",a."N",a."N2",a."OBJECT_TYPE",a."HAS_PAGE_ID" , 'select' || ' workspace' || ', application_id' || ', ' || (case when a.has_page_id = 'Y' then ' page_id' else 'null as page_id' end) || ', ''' || lower(a.object_type) || ''' as object_type' || ', p' || trim(a.n) || '. as object_sequence' || ', p' || trim(a.n) || '. as object_name' || ', trim(authorization_scheme_id) as authorization_scheme_id' || ', authorization_scheme' || ' from ' || lower(a.table_name) || ' p' || trim(a.n) || ' where authorization_scheme is not null' || ( case when a.n <> a.n2 then ' union all' else null end ) as x1 , 'select * from ' || lower(a.table_name) || ' p' || trim(a.n) as x2 from a order by a.n