|
| 1 | + |
| 2 | +**scheme2ddl** - command line util for export oracle schema to set of ddl scripts. Provide a lot of configurations via basic command line options or advanced XML configuartion. |
| 3 | + |
| 4 | +**scheme2ddl** is part of |
| 5 | +[oracle-ddl2svn](http://code.google.com/p/oracle-ddl2svn) project. |
| 6 | + |
| 7 | +Current released version is [2.3.4] (http://scheme2ddl.googlecode.com/svn/m2/releases/com/googlecode/scheme2ddl/2.3.4/scheme2ddl-2.3.4.jar) |
| 8 | + |
| 9 | +###Benefits |
| 10 | +*scheme2ddl* give ability to filter undesirable information, separate DDL in different files, pretty format output. |
| 11 | + |
| 12 | +###How to start with minimal configuration |
| 13 | +Java must be installed on your computer. |
| 14 | + |
| 15 | +For exporting oracle scheme you must provide |
| 16 | + |
| 17 | + - DB connection string |
| 18 | + |
| 19 | + - output directory |
| 20 | + |
| 21 | +Usage example. Command |
| 22 | + |
| 23 | + java -jar scheme2ddl.jar -url scott/tiger@localhost:1521:ORCL -o C:/temp/oracle-ddl2svn/ |
| 24 | + |
| 25 | + |
| 26 | +will produce directory tree |
| 27 | + |
| 28 | + views/ |
| 29 | + view1.sql |
| 30 | + view2.sql |
| 31 | + tables/ |
| 32 | + table1.sql |
| 33 | + functions |
| 34 | + /f1.sql |
| 35 | + |
| 36 | + |
| 37 | +More command line options |
| 38 | + |
| 39 | + java -jar scheme2ddl.jar -help |
| 40 | + ... |
| 41 | + Options: |
| 42 | + -help, -h print this message |
| 43 | + -url, DB connection URL |
| 44 | + example: scott/tiger@localhost:1521:ORCL |
| 45 | + -o, --output, output dir |
| 46 | + -p, --parallel, number of parallel thread (default 4) |
| 47 | + -s, --schemas, a comma separated list of schemas for processing |
| 48 | + (works only if connected to oracle as sysdba) |
| 49 | + -c, --config, path to scheme2ddl config file (xml) |
| 50 | + --stop-on-warning, stop on getting DDL error (skip by default) |
| 51 | + -tc,--test-connection, test db connection available |
| 52 | + -version, print version info and exit |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | +###How it is work inside? |
| 57 | + |
| 58 | + 1. First, get list of all user_object to export |
| 59 | + |
| 60 | + `select * from user_objects` |
| 61 | + |
| 62 | + 2. then applying [dbms_metadata.set_transform_param](http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_metada.htm#i1000135) |
| 63 | + 3. for every user object invoke [dbms_metadata.get_ddl](http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_metada.htm#i1019414) and [dbms_metadata.get_dependent_ddl](http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_metada.htm#i1019414) |
| 64 | + 4. print every ddl to separate file grouped in folders like tables, views, procedures etc |
| 65 | + |
| 66 | +*scheme2ddl* build on top of [spring-batch](http://static.springsource.org/spring-batch/) framework. |
| 67 | + |
| 68 | + |
| 69 | +###See it in action in cloud |
| 70 | +You can see it in action as [Jenkins build](http://jenkins-ddl2svn.rhcloud.com/job/amazon-rds-oracle-schema2ddl/lastSuccessfulBuild). Look at console output and build artifacts. |
| 71 | + |
| 72 | + Jenkins hosting provided by Red Hat's OpenShift. |
| 73 | + |
| 74 | + Oracle hosting provided by Amazon's RDS. |
| 75 | + |
| 76 | + |
0 commit comments