view red cross [message #594538] |
Thu, 29 August 2013 15:22  |
 |
anncao
Messages: 87 Registered: August 2013
|
Member |
|
|
We have a materialized view showing red cross in oralce sql developer. But it functions well, we can select on it, no errors.
I searched on web, and some tells if underlying table changed, it may be broken. and need to refresh.
So I think I need to refresh it, using alter materialized view ... compile, but it told me the table or view doesnot exist, but it exists.
What could be wrong?
Thanks
|
|
|
|
Re: view red cross [message #594542 is a reply to message #594540] |
Thu, 29 August 2013 15:38   |
 |
anncao
Messages: 87 Registered: August 2013
|
Member |
|
|
Thanks, I tried that, and I got error like below:
Also what is command to recomplie it?
Error starting at line 1 in command:
Dbms_Mview.Refresh(Prefsschoolyeardaily,'C')
Error report:
Unknown Command
Error starting at line 1 in command:
exec Dbms_Mview.Refresh(Prefsschoolyeardaily,'C')
Error report:
ORA-06550: line 1, column 26:
PLS-00357: Table,View Or Sequence reference 'PREFSSCHOOLYEARDAILY' not allowed in this context
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
[Updated on: Thu, 29 August 2013 15:39] Report message to a moderator
|
|
|
|
|
Re: view red cross [message #594545 is a reply to message #594544] |
Thu, 29 August 2013 16:08   |
Bill B
Messages: 1971 Registered: December 2004
|
Senior Member |
|
|
If it is a normal view then no, its just a stored query and needs no refresh. As for the red cross, I have no idea. I don't use sql developer.
|
|
|
|
|
|
|
|
Re: view red cross [message #594584 is a reply to message #594554] |
Fri, 30 August 2013 07:48   |
Bill B
Messages: 1971 Registered: December 2004
|
Senior Member |
|
|
You can have it automatically refresh or refresh on a schedule but like littlefoot said we need to see the script you used to make the MVIEW.
|
|
|
|
|
|
|
|
Re: view red cross [message #594611 is a reply to message #594609] |
Fri, 30 August 2013 12:55   |
 |
anncao
Messages: 87 Registered: August 2013
|
Member |
|
|
Here is the formatted code, I don't see an edit button, so repost,
-- Create a materialized view used by a number of different views for extracts.
DECLARE
v_count NUMBER;
BEGIN
SELECT Count(*)
INTO v_count
FROM user_objects
WHERE object_type = 'MATERIALIZED VIEW'
AND object_name = Upper('PrefsSchoolYearDaily');
IF v_count > 0 THEN
EXECUTE IMMEDIATE 'drop materialized view PrefsSchoolYearDaily';
END IF;
END;
/
CREATE materialized VIEW prefsschoolyeardaily
build IMMEDIATE
AS SELECT DISTINCT name,
dbms_lob.Substr(value, 5, 1) AS Value,
schoolid,
yearid
FROM prefs
WHERE Lower(name) = 'att_recordmodedaily'
AND value LIKE '1%';
CREATE INDEX idx_psyd_schoolid
ON prefsschoolyeardaily (schoolid);
CREATE INDEX idx_psyd_schoolidyearid
ON prefsschoolyeardaily (schoolid, yearid);
CREATE INDEX idx_psyd_yearid
ON prefsschoolyeardaily (yearid);
GRANT SELECT ON prefsschoolyeardaily TO PUBLIC;
|
|
|
|
Re: view red cross [message #594696 is a reply to message #594618] |
Sun, 01 September 2013 21:40   |
 |
anncao
Messages: 87 Registered: August 2013
|
Member |
|
|
I found any time DML happened on the underlying table, the MV shows a red cross next to it.
I did a query:Select * From User_Mviews, I see in the refresh Mode it is ON Demand, the staleness column is need_compile, so I run the following command:
Alter Materialized View Prefsschoolyeardaily Compile, I see compile state is Valid, and staleness column becomes unknown,
If I do
exec DBMS_MVIEW.REFRESH('PREFSSCHOOLYEARDAILY','c'); the result is the same.
What does this mean, shall I still ignore the red cross, and the table data is stale or not?
Thanks much
|
|
|
|
|