How to duplicate all codes from one Oracle schema to another

Jephe Wu  -  http://linuxtechres.blogspot.com
Objective: replicate all procedures, packages, functions, triggers from schema jephe to schema jephe2.
Environment: Oracle 11g 64bit, RHEL 5, SQL developer,


Steps:
Method 1 - SQL Developer 1.5.5
1.  export existing objects
go to tools menu, database export, choose export file name export.sql and connections

at DDL Option part, please choose Terminator, Pretty Print and tick 'include Drop Statement'
at next screeen, untick 'Toggle All', select Package Spec, Package Body, Procedures, Functions, Triggers, Types and Sequences.

at 'GO' dialog box, type in '%%', click GO to show all relevant objojects.

2. copy above exported file to database server
also convert file format from DOS to Unix

dos2unix filename


3. import objects to another schema
If you are not sure both schemas have the exact same codes, you might vi the filename, extract all the DROP commands first to drop.sql, then run this drop.sql to destinatioin scehma

sqlplus jephe2
@drop.sql

sqlplus jephe2
set define off sqlblanklines on 
@export.sql

4. compile schema
sqlplus / as sysdba
SQL> exec dbms_utility.compile_schema('JEPHE2');
SQL> exit;

Method 2 - impdp/expdp
to be continued.