I'm trying to pin down the requirements or the optimal setup for using an Oracle View in GeoServer 2.16.2. From what I have read in various forums is that for an Oracle View to work right in GeoServer it must have the following:
- an entry for the Oracle View in user_sdo_geom_metadata
- a spatial index that is owned by the user or profile that is making the call.
- Oracle User needs privileges to MDSYS Views & Tables
My specific situation is that I cannot create a Materialized View or other Table that is rebuilt periodically.
The current setup is similar to the following example: The GeoServer has a store using USER1 that uses an Oracle View that is owned by USER1. However, the underlying tables and indexes for the Oracle View are owned by a different user, call them USER2. Currently, the performance of this setup is terrible.
I would like to push harder to having this setup conform to the 3 requirements that I listed above, but I cannot find the exact documentation that says that points 1, 2, 3 are required. It is just a theory.
With respect to item #3. I'm seeing processes in the log that seem to be stuck on queries such as the following:
SELECT SDO_INDEX_OWNER,SDO_INDEX_NAME,SDO_PARTITIONED,SDO_LAYER_GTYPE,SDO_INDEX_VERSION,SDO_INDEX_DIMS,SDO_RTREE_DIMENSIONALITY,SDO_INDEX_GEODETIC,SDO_INDEX_TYPE,SDO_LEVEL,SDO_NUMTILES,SDO_NUM_ROWS,SDO_NUM_BLKS,SDO_OPTIMIZED_NODES,SDO_MAXLEVEL,SDO_INDEX_TABLE,SDO_INDEX_PRIMARY,SDO_RTREE_HEIGHT,SDO_RTREE_NUM_NODES,SDO_RTREE_FANOUT,SDO_RTREE_ROOT,SDO_RTREE_SEQ_NAME,SDO_INDEX_PARTITION,SDO_RTREE_PCTFREE,SDO_RTREE_QUALITY,SDO_TABLESPACE,SDO_INDEX_STATUS,SDO_NL_INDEX_TABLE,SDO_DML_BATCH_SIZE,SDO_RTREE_ENT_XPND, SDO_ROOT_MBR FROM MDSYS.SDO_INDEX_METADATA_TABLE WHERE sdo_index_owner = :owner AND sdo_index_name = :iname ORDER BY SDO_INDEX_PRIMARY
When I try and query the table MDSYS.SDO_INDEX_METADATA_TABLE
with the User that I have in my GeoServer Oracle Store, it says the ORA-00942: table or view does not exist. I can see the table in the MDSYS
in Oracle Developer.
I would change the permissions myself for the User that I use if I could. Can someone tell me if the USER needs to be granted SELECT privileges for MDSYS for a GeoServer layer that connects to an Oracle database to be efficient?
I'm kind of surprised that the layer works at all since there seems to be no access to the MDSYS objects and no GEOMETRY_COLUMNS. If I select all 50,000 records in the layer it never completes. If I just change my GeoServer query to return just the first few hundred records it works which is surprising.
all_user_sdo_metadata
and because of the grant USER_B can access the row even the view is owned by USER_A. It may be necessary to grant some more rights for USER_B before the access to spatial index succeeds. You can set the GeoServer logging level into GEOTOOLS_DEVEL and see what exact SQL queries are executed.GEOMETRY_COLUMNS
table - docs.geoserver.org/latest/en/user/data/database/…