title: Oracle Script -Materialized View & synonym
body: <p>I've got a question about script in Oracle!</p>
  
  <p>I have a materialized view on a prebuilt table, in my BBDD, (this MV is of the user DAT_OWN, other 2 user (APP &amp; BO) have synonym on this MV)
  I have to change the MV and add a column. I know that I need to drop this MV and create a another one, but what's append with the synonym?</p>
  
  <p>I have a previous script like:</p>
  
  <pre><code>DROP SYNONYM APP.STAT_VOZ;
  CREATE SYNONYM APP.STAT_VOZ FOR DAT_OWN.STAT_VOZ;
  
  DROP SYNONYM BO.STAT_VOZ;
  CREATE SYNONYM BO.STAT_VOZ FOR DAT_OWN.STAT_VOZ;
  
  DROP MATERIALIZED VIEW DAT_OWN.STAT_VOZ;
  CREATE MATERIALIZED VIEW DAT_OWN.STAT_VOZ 
  ON PREBUILT TABLE WITH REDUCED PRECISION
  REFRESH COMPLETE
  START WITH TO_DATE('21-ene-2013 19:20:00','dd-mon-yyyy hh24:mi:ss')
  NEXT (trunc(SYSDATE,'HH')+19/72) 
  WITH PRIMARY KEY
  AS 
    SELECT           TO_CHAR (SUM (COUNT)) AS sum_count,
           start_date AS date_hour,
           input_type AS input_type
      FROM DAT_OWN.another_table
     WHERE start_date &gt; TO_CHAR (SYSDATE - 60, 'yyyymmdd')
  GROUP BY start_date
  </code></pre>
  
  <p>Why would somebody do a drop synonym APP and create synonym APP drop synonym BO and create synonym BO BEFORE dropping of the materialized View?  In my opinion, I have to do</p>
  
  <pre><code>drop synonym1
  drop synonym2
  drop Mview
  create Mview
  create Synonym1
  Create Synonym2
  </code></pre>
  
  <p>I'm sure that the programmer before me did a good job, but I can't understand why they did it  that way! Can somebody explain me this, please?</p>
  
  <p>Regards</p>