Transform 3D to 2D Data via a Materialized View
Hi,
I'm playing with Geoserver against an Oracle Locator database. Things are starting well, but I did notice a bug where 3D points and lines are not supported. I guess this is an issue with GeoTools. Anybody have a way to transform my 3D data to 2D. Since I do use the 3rd dimension for storing elevation, I don't want to lose the data. So I was thinking that I could create materialized views to "virtually strip" the 3rd dimension. Any thoughts? I'm not very strong in PL/SQL, so any code hints would be greatly appreciated as well.
Thanks!
Jeff
I would say the compiled pl/sql would be faster (it would also depend on whether you compiled to the pl/sql virtual machine code - MP-code or the machine-dependent code of the host's C compiler if you chose native copilation): I am coding a Java version of my GEOM.SDO_CENTROID function so will be in a better position to say, categorically, one way or the other.
In my free pl/sql packages there are these functions in case anyone is interested:
-- @function To_2D
-- @precis Converts a 3D geometry to a 2D geometry
-- @version 2.0
-- @usage v_2D_geom := geom.To_2D(MDSYS.SDO_Geometry(3001,....)
-- @history Albert Godfrind, July 2006, Original Coding
-- @history Bryan Hall, July 2006, Modified to handle points
-- @history Simon Greener, July 2006, Integrated into geom with GF.
Function To_2D( p_3D_geom IN MDSYS.SDO_Geometry )
Return MDSYS.SDO_Geometry deterministic;
-- @function To_3D
-- @precis Converts a 2D geometry to a 3D geometry
-- @version 1.0
-- @usage v_3D_geom := geom.To_3D(MDSYS.SDO_Geometry(2001,....),50)
-- @history Simon Greener, May 2007 Original coding
Function To_3D( p_2D_geom IN MDSYS.SDO_Geometry,
p_default_z IN NUMBER := NULL)
Return MDSYS.SDO_Geometry deterministic;
/** @Function : FIX_3D_Z
** @Precis : Checks the Z ordinate in the SDO_GEOMETRY and if NULL changes to p_default_z value
** @Note : Needed as MapServer appears to not handle 3003/3007 polygons with NULL Z values in the sdo_ordinate_array
** @History : Simon Greener - JUNE 4th 2007 - Original Coding
Function Fix_3D_Z( p_3D_geom IN MDSYS.SDO_Geometry,
p_default_z IN NUMBER := -9999 )
Return MDSYS.SDO_Geometry Deterministic;
/** Function just to change a single point coded in sdo_ordinates to sdo_point representation
* @param p_geometry A sdo_geometry object.
Function ToSdoPoint ( p_geometry in MDSYS.SDO_Geometry )
return MDSYS.SDO_Geometry Deterministic;Simon
Similar Messages
-
Refresh/Update data in a materialized view
Hi,
I have question about the data in a materialized view and how it is refreshed. My mat view has all my dimension-ids and my (for my specialize needs) aggregated measures from my fact table. I used the mat view wizard to create my view - which works perfectly. But now I wonder if I have to create some sort of mapping(?) or some sort of trigger to refresh the data in the mat view. Or is the data automatically refreshed when I start my fact table mappings. I use OWB 11gR2
thxMVs have properties for refresh - you an refresh based on schedules or when dependent data is committed or manually.
Cheers
David -
Exporting data from a materialized view in Oracle 10g
Can anybody tell me how to export data to a remote server and import data in that remote server without using ftp utility. Actually I want to export the data from a materialized view to the remote server and import the same in the remote server.
If everything works well, I'll put the exporting and importing in a cronjob.
Please let me know how can I do that if that's possible .
Any reply would be appreciated.
Thanks.Here is what I'm trying to do.
I created materialized views using multiple base tables in my local server and the base tables got populated using a long process.
Now I want to copy those data alone to some remote server since it doesn't have any base tables in it. For now, the remote server should depends on the localserver's data. I'm going to use the remote server's data for some testing purposes.
I know it is easy to create mat.views in the remote server but it doesn't have I don't want to do that now. I just want to copy the snapshots from my local server to the remote server.
Please let me know how to do that.
Thanks. -
The data of my materialized view....in the while
Hello
We have problems with materialized views
We have one wich re-build each a short period of time
¿Can i avoid the data to dissapear in the time process of refresh?
Is so annoing to our clients to see that "from time to time" the data just dissapear for one period of time -the time while the materialized view is refreshing-
Thank you in advance
Bruno. Madrid. Spain> Is so annoing to our clients to see that "from time to time" the data just dissapear for
one period of time -the time while the materialized view is refreshing-
Have a similar problem. And dealing with large data volumes that makes the DELETE of the MV a very undesirable feature. Not as much a the resource footprint required, but the time it takes to do this - and the very tight processing windows that exist.
The solution is a self-rolled and very likely not ideal for most - but it works well enough for us in production.
No MV. Create a partition table. Create a staging table. Do a manual "full refresh" of the staging table (TRUNCATE and direct path INSERT). Follow this by a partition exchange with the partition table (no validation and including indexes). The result is that the data is replaced in the partitioned table within a second - no long running and expensive DELETE. End-users not effected by having a truncate pulling the data from beneath their reports. -
How do I figure where is the data in a materialized view coming from
Hi: when I run select NAME, OWNER from dba_mview_refresh_times, I see a number of materialized views. How do I find more details about this view i.e where is the data coming from and which fields. The source table that is in another database changed. But the view on my database where the materialized view exist has not changed. I want to confirm from where is data coming in this view
TIA
RaviSQL> select * from dict where table_name like 'ALL%MVIEW%'
TABLE_NAME COMMENTS
ALL_BASE_TABLE_MVIEWS All materialized views with log(s) in the database that the user can s
ee
ALL_MVIEWS All materialized views in the database
ALL_MVIEW_AGGREGATES Description of the materialized view aggregates accessible to the user
ALL_MVIEW_ANALYSIS Description of the materialized views accessible to the user
ALL_MVIEW_COMMENTS Comments on materialized views accessible to the user
ALL_MVIEW_DETAIL_PARTITION Freshness information of all PCT materialized views in the database
ALL_MVIEW_DETAIL_RELATIONS Description of the materialized view detail tables accessible to the u
ser
ALL_MVIEW_DETAIL_SUBPARTITION Freshness information of all PCT materialized views in the database
ALL_MVIEW_JOINS Description of a join between two columns in the
WHERE clause of a materialized view accessible to the user
ALL_MVIEW_KEYS Description of the columns that appear in the GROUP BY
list of a materialized view accessible to the user
ALL_MVIEW_LOGS All materialized view logs in the database that the user can see
ALL_MVIEW_REFRESH_TIMES Materialized views and their last refresh times for each master table
that the user can look at
ALL_REGISTERED_MVIEWS Remote materialized views of local tables that the user can see
13 rows selected. -
Problem when try to get the next refresh date of a materialized view
I have a materialized view set to auto refresh(e.g hourly), I need to query this date and display in the report. I create a procedure which return the NEXT_DATE from the ALL_REFRESH_CHILDREN table, the procedure and the view all in schema HK3XDDB.
If I login as sys, dba in the sql plus and query the procedure, it return the next date, but if I login as normal user which has permission to execute all procedures, it didn't return anything, so I change ALL_REFRESH_CHILDREN to USER_REFRESH_CHILDREN, still no luck. But the details from the USER_MVIEWS can be returned, just won't return anything in the REFRESH one. How to query the next date out?
Another strange thing is, if I login as sys dba, it return the next date, but if I use a select next_date into statement in the procedure it will throw a data not found error.
I stuck here for several hours just can't figure it out, any suggestions are welcome,
CheersThank you for the reply. It's same with USER_REFRESH_CHILDREN, I can get the result when I run the procedure in SQL PLUS login as sys dba, but if I run the procedure using normal user which has permission to run any procedure, then nothing return. It might be a permission problem but I just can't figure out why.
Let me explain in detailed:
Schema HKXDDB, this schema has procedure TestProcedure, in the procedure, I have two ref cursor return, one is for select * from USER_JOBs (or from USER_REFRESH_CHILDREN, I have tried both), one is for select * From USER_MVIEWS, this schema has the materialized view. User HKDWUser has permission to run any procedures, so when this user run the TestProcedure which is own by HKXDDB, the cursor that select from USER_MVIEWS can return results which are materialized views owned by HKXDDB, but the cursor that select form USER_JOBS or USER_REFRESH_CHILDREN always return no rows.
Any permission I need to assign to HKDWUSER to get the jobs or fresh group that owned by HKXDDB?
Cheers -
Unexpected synonym creation via a materialized view DDL statement
While I was doing some testing for a future materialized view creation I did this...
create materialized view yes as select empno, ename from emp;Oracle created a table called "YES" and a materialized view called "YES".
Then I did this...
create materialized view wow as select empno, ename from emp;Oracle created a table called "WOW" and materialized view called "WOW", and a synonym called "WOW1"...
Eh? Whats up with he synonym called "WOW1"?
SQL*Plus: Release 9.0.1.4.0 -
Oracle9i Enterprise Edition Release 9.2.0.5.0 - 64bitI'm not able to reproduce this. My version is 9.2.0.7.0
my_schema@mydb> create materialized view yes as select employee_id, salary from employees;
Materialized view created.
Elapsed: 00:00:01.00
my_schema@mydb> select object_type, owner, object_name from dba_objects where object_name = 'YES';
OBJECT_TYPE OWNER OBJECT_NAME
MATERIALIZED VIEW my_schema YES
TABLE my_schema YES
Elapsed: 00:00:00.03
my_schema@mydb> create materialized view wow as select employee_id, salary from employees;
Materialized view created.
Elapsed: 00:00:00.04
my_schema@mydb> select object_type, owner, object_name from dba_objects where object_name like 'WOW%';
OBJECT_TYPE OWNER OBJECT_NAME
MATERIALIZED VIEW my_schema WOW
TABLE my_schema WOW -
ORA-01555 when performing refresh of materialized views via DBMS_JOB
All,
With this project needing to be finished soon and an issue occuring on the local database, I am hopefuly one of you will have the answer or resolution so that I may complete this project soon....
Here is the setup..
10g database (remote)
9i database (local
DB Link from local to remote database
103 materialized views in local database that are refreshed by pulling data from dblink to remote database.
A PL/SQL procedure has been created which sets the v_failures variable = 0 and then performs a check to see if the current job has a failure and if so, inserts that value into the v_failures variable. When that reaches "1", then the procedure does nothing and closes out. If the failures are equal to "0" then it performs a DBMS_MVIEW.REFRESH procedure for each materialized view.
This worked the first time but its continually failing now with the ORA-01555 error (snapshot too old). From what I can tell, the dbms_job duration is 4 seconds and the Last_Exec is 2m 7s after it starts (8:30 PM). With that said, our DBAs working o nthe project have increased the Undo_Retention settings and assure us that shouldn't be the problem. Odd thing is, this never happened in the dev environment when we were developing/testing - only in the production environment once it got migrated.
I am looking for possible causes and possible solutions to the ORA-01555 error. A sample of the code in my procedure is below:
CREATE OR REPLACE PROCEDURE Ar_Mviews IS
V_FAILURES NUMBER := 0;
BEGIN
BEGIN
SELECT FAILURES INTO V_FAILURES FROM USER_JOBS WHERE SCHEMA_USER = 'CATEBS' AND WHAT LIKE '%DISCO_MVIEWS%';
IF V_FAILURES = 1 THEN NULL;
ELSE
DBMS_MVIEW.REFRESH ('AR_BATCH_RECEIPTS_V', 'C');
DBMS_OUTPUT.PUT_LINE(V_FAILURES); END IF;
END;
BEGIN
SELECT FAILURES INTO V_FAILURES FROM USER_JOBS WHERE SCHEMA_USER = 'CATEBS' AND WHAT LIKE '%DISCO_MVIEWS%';
IF V_FAILURES = 1 THEN NULL;
ELSE
DBMS_MVIEW.REFRESH ('AR_BATCHES_ALL_V', 'C');
DBMS_OUTPUT.PUT_LINE(V_FAILURES); END IF;
END;
END Ar_Mviews;
---------------------------------------------------------------------------------------------------------------We are doing complete refreshes and doing it that way for consistency in the data presented. Because some materialized views are dependent upon data in other materialized views, we have them ordered in a procedure so that when one finishes, the next starts and they are also in a specific order as to ensure accurate data.
The condition for v_failures is done so that the job doesn't get, lets say, 90% finished and hit an error and start over again. We do the IF statement which results in NULL (do nothing) so that the job doesn't repeat itself over and over again. If one MV fails, we have to consider the job a failure and do nothing else because the one MV that failed may have been a dependency of another MV down the line. (i.e. MV7 calls MV3 and MV3 fails, so the whole job fails because MV7 can't be accurate without the most current data from MV3).
As well, this is being performed in off-business hours after backup to tape, etc. and prior to start of business so that no one is using the system when we run this job. That won't always be the case when we move to high availability with this system for varying time-zone end-users.
I hope I have answered your question and look forward to continued feedback.
Thanks! -
Store Previous Data in Materialized Views
Hello All,
Thanks in Advance for sharing knowledge.We have a materialized view and using Oracle 10g.
Is there any way we can store previous data as well as have new data in the materialized view.
I mean it would have old as well as new data.
Regards
RahulThanks for your prompt reply.I am not looking for flashback query.
Actually i have to send the data to user and materialized view would only most recent data after refresh,but i would like to have the previous data before refresh and new data after refresh.
Regards
Rahul -
Oracle - Query taking too long (Materialized view)
Hi,
I am extracting billing informaiton and storing in 3 different tables... in order to show total billing (80 to 90 columns, 1 million rows per month), I've used a materialized view... I do not have indexes on 3 billing tables - do have 3 indexes on Materialized view...
at the moment it's taking too long to query the data (running a query via toad fails and shows "Out of Memory" error message; runing a query via APEX though is providing results but taking way too long)...
Please advice how to make the query efficient...tparvaiz,
Is it possible when building your materialized view to summarize and consolidate the data?
Out of a million rows, what would your typical user do with that amount data if they could retrieve it readily? The answer to this question may indicate if and how to summarize the data within the materialized view.
Jeff
Edited by: jwellsnh on Mar 25, 2010 7:02 AM -
Materialized view and policies
Hello,
We created an materialized view and on this view why created a policy.
SYS.DBMS_RLS.ADD_POLICY
Now we added some values to the MV via drop MV and create MV.
The policy on this MV is gone after the drop statement.
Is there away to secure this?
Thanks,
RemcoWhy are you dropping and re-creating the materialized view in the first place? That's not something that should ever happen in a live system. You should just be refreshing the data in the materialized view, in which case the privileges & policies associated with the materialized view would be retained. It's no different than dropping and re-creating a table that has a policy associated with it-- you'd have to re-apply the policy after re-creating the table.
Theoretically, I suppose you could create a DDL trigger that would throw an error if you tried to drop an object with an associated policy. Fixing your approach, though, so that you're not dropping & re-creating objects is going to be the better long-term solution.
Justin -
Error in Log file from a scheduled materialized view
Hi
Getting the following errors in the alert_xe.log file when refreshing a materialized view. The data from the materialized view seems fine.
ORA-12012: error on auto execute of job 1
ORA-12008: error in materialized view refresh path
ORA-01555: snapshot too old: rollback segment number 41 with name "_SYSSMU41$" too small
ORA-02063: preceding line from HRLIVE
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2566
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2779
ORA-06512: at "SYS.DBMS_IREFRESH", line 685
ORA-06512: at "SYS.DBMS_REFRESH", line 195
ORA-06512: at line 1
This is with XE Apex 4.1
Thanks for any suggestionsThanks - tried google and changing undo_retention but no luck.
We noticed something very odd...
TABLESPACE_NAME AUT
E:\ORACLEXE_11G\APP\ORACLE\ORADATA\XE\USERS.DBF
USERS YES
E:\ORACLEXE_11G\APP\ORACLE\ORADATA\XE\SYSAUX.DBF
UNDOTBS1 YES
E:\ORACLEXE_11G\APP\ORACLE\ORADATA\XE\UNDOTBS1.DBF
SYSAUX YES
E:\ORACLEXE_11G\APP\ORACLE\ORADATA\XE\SYSTEM.DBF
SYSTEM YES
The file SYSAUX.DBF has table space UNDOTBS1
and file UNDOTBS1.DBF has table space SYSAUX
This looks the wrong way around.
Any ideas how this could have happened and how this can be changed?
Thanks & regards
Edited by: rw on Jan 18, 2012 8:32 AM -
How to CREATE MATERIALIZED VIEW LOG (MV fast refresh) with some JOINS
Hi @ all,
i'm trying to create a MATERIALIZED VIEW LOG for a fast refresh of a MATERIALIZED VIEW.
It works fine with a simple Request in the MATERIALIZED VIEW:
CREATE MATERIALIZED VIEW MV_ZOTD43_P
TABLESPACE GDII
BUILD IMMEDIATE
REFRESH FORCE AS
SELECT * FROM ZOTD43_P;
COMMIT;
CREATE MATERIALIZED VIEW LOG ON ZOTD43_P
TABLESPACE "GDII"
WITH PRIMARY KEY, ROWID, SEQUENCE INCLUDING NEW VALUES;
call DBMS_MVIEW.REFRESH('MV_ZOTD43_P', 'f');
But when I use a complex SQL-Request with some JOINS (one of the Table with spatial Data) in the MATERIALIZED VIEW, I get an error:
CREATE MATERIALIZED VIEW MV_TEST
TABLESPACE GDII
BUILD IMMEDIATE
REFRESH FORCE AS
SELECT lptd04_p.sst_nr AS sst_nr,
lptd03_p.aaaa AS aaaa,
lptd04_geom.geom as geom
FROM lptd04_p lptd04_p
JOIN lptd01_p lptd01_p ON lptd01_p.cre_nr = lptd04_p.sst_nr
JOIN lptd04_geom ON lptd04_geom.sst_nr = lptd04_p.sst_nr
JOIN lptd03_p lptd03_p ON lptd03_p.lief_nr = lptd04_p.lief_nr;
COMMIT;
CREATE MATERIALIZED VIEW LOG ON LPTD04_P
TABLESPACE "GDII"
WITH PRIMARY KEY, ROWID, SEQUENCE INCLUDING NEW VALUES;
call DBMS_MVIEW.REFRESH('MV_TEST', 'f');
Error report:
SQL Error: ORA-12004: REFRESH FAST kann für Materialized View "GDI"."MV_GDI_SST_STAMM" nicht benutzt werden
ORA-06512: in "SYS.DBMS_SNAPSHOT", Zeile 2255
ORA-06512: in "SYS.DBMS_SNAPSHOT", Zeile 2461
ORA-06512: in "SYS.DBMS_SNAPSHOT", Zeile 2430
ORA-06512: in Zeile 1
12004. 00000 - "REFRESH FAST cannot be used for materialized view \"%s\".\"%s\""
*Cause: The materialized view log does not exist or cannot be used. PCT
refresh is also not enabled on the materialized view
*Action: Use just REFRESH, which will reinstantiate the entire table.
If a materialized view log exists and the form of the materialized
view allows the use of a materialized view log or PCT refresh is
possible after a given set of changes, REFRESH FAST will
be available starting the next time the materialized view is
refreshed.
Am I doing something wrong or is it not possible CREATE MATERIALIZED VIEW LOG when the MATERIALIZED VIEW got some JOINS?
Regards,
GreqThanks for the link Alessandro ,
the error seems something to do with the Column-Type SDO_GEOMETRY, so
i create a new thread in the Spatial Discussion forum:
FAST REFRESHing of Oracle Materialized Views containing SDO_GEOMETRY column
Regards,
Greq -
Hi All,
We had created some other materialized view with for small set of data. The materialized view name is ‘XXCA_PAGL_RECON_GL1_TRANS_MV’ and it has created a table with the same name.
What I am unable to understand is that the new table which was created by the system during the creation of materialized view is in VALID state but the materialized view is in INVALID state.
Please help me to understand this process.
Thanks in advance
VenkateshThe column dba_objects.status for mviews is set to INVALID when the base tables are updated. See Metalink note 454552.1. It is normal.
Edited by: YasinBaskan on Feb 17, 2009 2:07 PM -
Create Materialized View with Compress clause
Hi,
Oracle 9i R2 has an option to use compress clause while creating table, materialized view or etc. Just wanted some help on tips to be followed during creating a materilized view with compress clause and refresh the same.do i need to follow any special procedures ??? Any help greatly appreciated.
Thanks,
Chak.I read in the book that while inserting user /+append+/ otherwise table with compress will fail. I am doing materialized view refresh with fast mode and data will be inserted as per logs residing at master site.. while inserting into materialized view, do i have to setup specially since fast refresh is going to insert data into existing materialized view.
Thanks,
Maybe you are looking for
-
Returning Errors from a webservice using XMLBeans
I have a webservice that accepts XML as input and output parameters, and I'm using XMLBeans to handle this. I'm trying to work out how I can return error information from the webservice, so I created an Exception.xsd schema and 'include' it in the ou
-
Using Country Specific Chart of Account in addition to Operational COA
Dear Team We are implementing 16 company codes with Group COA A002 and Operational COA A001 across all companies. Out of 16 Company codes 4 company codes already went live and running successfully. We are also using one controlling area and operating
-
How can I only restore contacts to my iphone
I only want my contacts after I restore my iphone. Can anybody help. And when I backup from itunes then it gives two option backup app and do not backup apps so when I use do not backup apps then will it restore all the apps that I has before the r
-
Jobs for EEO-4&5 Report in public sector...
Hi Gurus! I am working for a public sector PA impl. The client wants EEO 4&5 reports for public sector. We have a standard report for that. But since the report is based on jobs, i wanted to know if the jobs for EEO are the same jobs w
-
I am trying to resize a photo for printing to a 8x10 as it still crops off the top and bottom when printing. I took this with my D3100. How can I do this? I have tried printing several times.