Recently used a lot of views, mainly statistical data used, built more than 10 materialized views, set in every night to perform the refresh task, but more than 10 of which four are always unable to automatically refresh, manual compilation will be wrong, the implementation of the task will be reported as follows error:
Will not be a permission problem, it is not possible to set the time problem, otherwise it can not be normal to refresh only these few errors. Later, by looking at the diagnostic file found that the statement is too long to establish a view, it is said that Oracle vision statement limit is 65K, more than although it is normal to create, but can not compile, of course, timed refresh is not possible. The query steps are as follows: 1. To find the location of the diagnostic file, the statement is as follows: Select value from V$diag_info where name= ' diag Trace '; Results: 2, go to the server on the modified time to view the most recently modified documents and view: Through LS view: Found files: Open File View: 3, the reason for the failure is clear, the statement too long to cause the job can not be properly executed. The reason is found, then to solve it. Because the statements we create are written in a way that we usually read conveniently, since it is too long, then the SQL compression, remove unnecessary space, command, line, etc., so I wrote a regular expression, in turn, the replacement can achieve only one line, the effect of high compression, After the processing of four statements can not be too long three has been compressed into the 50K, the other is too large, only split into two views to resolve. The exact replacement of the regular expression is as follows, in order to perform a lookup replacement. I used the EmEditor, wrote a macro command, run directly on it, the command is as follows:
Document.selection.Replace ("^-(. +)", "", Eefindnext | eereplaceall | eefindreplaceregexp); Document.selection.Replace ("\\s+", "" ", Eefindnext | Eereplaceall |
EEFINDREPLACEREGEXP);
Document.selection.Replace ("^\\s", "" ", Eefindnext | eereplaceall | eefindreplaceregexp);
Document.selection.Replace ("\\s,", ",", Eefindnext | eereplaceall | eefindreplaceregexp);
Document.selection.Replace (", \\n", ",", Eefindnext | eereplaceall | eefindreplaceregexp);
Document.selection.Replace ("^-(. +)", "", Eefindnext | eereplaceall | eefindreplaceregexp);
Document.selection.Replace ("^\\n", "" ", Eefindnext | eereplaceall | eefindreplaceregexp); Document.selection.Replace ("\\n", "" ", Eefindnext | Eereplaceall |
EEFINDREPLACEREGEXP);
Document.selection.Replace (",", ",", Eefindnext | eereplaceall | eefindreplaceregexp);
Document.selection.Replace (",", ",", Eefindnext | eereplaceall | eefindreplaceregexp);
Document.selection.Replace ("--\\w+", "" ", Eefindnext | eereplaceall | eefindreplaceregexp); Document.selection.Replace (",", ",",Eefindnext | Eereplaceall |
EEFINDREPLACEREGEXP); Document.selection.Replace (",", ",", Eefindnext | eereplaceall | eefindreplaceregexp);
If you replace it with a regular replacement, you'll be in trouble. as follows: Find the regular (excluding the left and right double quotes): "^-(. +)" is replaced with (excluding the left and right double quotes): "" Find the regular (excluding the double quotes): "\\s+" replace with (excluding left and right double quotes): "" Find the regular (excluding the left and right double quotes): "^\\s" Replace with (excluding the left and right double quotes): "" Find the regular (excluding the double quotes): "\\s," Replace with (excluding the left and right double quotes): "," Find the regular (excluding the left and right double quotes): ", \\n" Replace with (excluding double quotes): ", find the regular (excluding the left and right double quotes):" ^-(. +) "is replaced with (excluding the left and right double quotes):" "Find the regular (excluding the double quotes):" ^\\n " Replace with (excluding the left and right double quotes): "" Find the regular (excluding the double quotation marks): "\\n" Replace with (excluding the left and right double quotes): "" "Find the regular (excluding the double quotes):", " Replace with (excluding the left and right double quotes): "," find the regular (excluding the double quotes): "," Replace with (excluding the left and right double quotes): "," find the regular (excluding the double quotes): " --\\w+ "Instead of the left and right double quotes:" "Find the regular (excluding the double quotes):", " Replace with (excluding the left and right double quotes):", "find the regular (excluding the double quotes):", " Replace with (excluding left and right double quotes): ","