title: Cleaning a SQL schema before using SQL Developer Database copy tool
body: <p>I have a database for an application and several environment (development, test and production). I would like to use the option <strong>Database copy</strong> from <strong>SQL Developer</strong> in order to retrieve data from the production and copy them in development. Thus data on both environments will be the same.</p>
  
  <p>With a previous version of the program all was working perfectly. Nevertheless with a new version (SQL Developer 18.2) imposed by our company, I obtain several error with different objects like sequences, existing table, primary key, ...) during the copy.</p>
  
  <p>Thus I would like to use a script for cleaning the objects of the Database before to use the tool in order to see if the problem will be solved. But I don't know how to do that.</p>
  
  <p>I found and updated this script:</p>
  
  <pre><code>BEGIN
     FOR cur_rec IN (SELECT object_name, object_type
                       FROM user_objects
                      WHERE object_type IN
                               ('TABLE',
                                'VIEW',
                                'PACKAGE',
                                'PROCEDURE',
                                'FUNCTION',
                                'SEQUENCE',
                                'SYNONYM'
                               ))
     LOOP
        BEGIN
           IF cur_rec.object_type = 'TABLE'
           THEN
              EXECUTE IMMEDIATE    'DROP '
                                || cur_rec.object_type
                                || ' "'
                                || cur_rec.object_name
                                || '" CASCADE CONSTRAINTS';
           ELSE
              EXECUTE IMMEDIATE    'DROP '
                                || cur_rec.object_type
                                || ' "'
                                || cur_rec.object_name
                                || '"';
           END IF;
        EXCEPTION
           WHEN OTHERS
           THEN
              DBMS_OUTPUT.put_line (   'FAILED: DROP '
                                    || cur_rec.object_type
                                    || ' "'
                                    || cur_rec.object_name
                                    || '"'
                                   );
        END;
     END LOOP;
  END;
  </code></pre>
  
  <p>Nevertheless this script Cleanup the Schema by DROPPING all objects. I would like to keep the structure and the objects but just empty the  conten.</p>
  
  <p>Could you please help me how to do for cleaning the different object without deleting them and importing again?</p>
  
  <p>Thank in advance for your help.</p>
  
  <p>Sebastien</p>