|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<beans xmlns="http://www.springframework.org/schema/beans" |
| 3 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 4 | + xmlns:util="http://www.springframework.org/schema/util" |
| 5 | + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd |
| 6 | + http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd"> |
| 7 | + |
| 8 | + <import resource="classpath:applicationContext.xml"/> |
| 9 | + |
| 10 | + |
| 11 | + <bean id="dataSource" class="oracle.jdbc.pool.OracleDataSource"> |
| 12 | + <property name="URL" value="jdbc:oracle:thin:@MyOracleHost:1521:MyDB"/> |
| 13 | + <!-- You can choose a DBA user. For example: value="sys as sysdba" --> |
| 14 | + <property name="user" value="scott"/> |
| 15 | + <property name="password" value="tiger"/> |
| 16 | + <property name="connectionCachingEnabled" value="true"/> |
| 17 | + </bean> |
| 18 | + |
| 19 | + <!-- list of schema for processing, used only if oracle user connected as sysdba--> |
| 20 | + <util:list id="schemaList"> |
| 21 | + <value>SCOTT</value> |
| 22 | + <value>HR</value> |
| 23 | + </util:list> |
| 24 | + |
| 25 | + <bean id="reader" class="com.googlecode.scheme2ddl.UserObjectReader" scope="step"> |
| 26 | + <property name="processPublicDbLinks" value="true"/> |
| 27 | + <property name="processDmbsJobs" value="true"/> |
| 28 | + <!-- process each constraint in separate files (constraints already included to tables DDL scripts in default transformParams_for_dbms_metadata) --> |
| 29 | + <property name="processConstraint" value="true"/> |
| 30 | + </bean> |
| 31 | + |
| 32 | + <bean id="writer" class="com.googlecode.scheme2ddl.UserObjectWriter"> |
| 33 | + <property name="outputPath" value="output"/> |
| 34 | + </bean> |
| 35 | + |
| 36 | + |
| 37 | + <bean id="taskExecutor" class="org.springframework.core.task.SimpleAsyncTaskExecutor"> |
| 38 | + <property name="concurrencyLimit" value="4"/> |
| 39 | + </bean> |
| 40 | + |
| 41 | + |
| 42 | + <!-- http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_metada.htm#BGBJBFGE --> |
| 43 | + <util:map id="transformParams_for_dbms_metadata"> |
| 44 | + <entry key="SEGMENT_ATTRIBUTES" value="FALSE"/> |
| 45 | + <entry key="SQLTERMINATOR" value="TRUE"/> |
| 46 | + <entry key="CONSTRAINTS_AS_ALTER" value="TRUE"/> |
| 47 | + </util:map> |
| 48 | + |
| 49 | + |
| 50 | + <!-- format option for DDL, actually perform only trim for resulting DDL --> |
| 51 | + <bean id="ddlFormatter" class="com.googlecode.scheme2ddl.DDLFormatter"> |
| 52 | + <!-- Check it to true if you don't want apply formatting on DMBS_OUTPUT. --> |
| 53 | + <property name="noFormat" value="false"/> |
| 54 | + <property name="isMorePrettyFormat" value="true"/> |
| 55 | + </bean> |
| 56 | + |
| 57 | + <!-- rules for construct filenames --> |
| 58 | + <bean id="fileNameConstructor" class="com.googlecode.scheme2ddl.FileNameConstructor"> |
| 59 | + <!-- Construct your custom layout from keywords |
| 60 | +
|
| 61 | + schema - schema name in lower case |
| 62 | + type - type name in lower case, for example 'table' or 'index' |
| 63 | + types_plural - type name in plural form in lower case, for xample 'tables' or 'indexes' |
| 64 | + object_name - object name in lower case |
| 65 | + ext - extension in lower case |
| 66 | + SCHEMA - schema name in UPPER case |
| 67 | + TYPE - type name in UPPER case, for example 'table' or 'index' |
| 68 | + TYPES_PLURAL - type name in plural form in UPPER case, for xample 'tables' or 'indexes' |
| 69 | + OBJECT_NAME - object name in UPPER case |
| 70 | + EXT - extension in UPPER case |
| 71 | +
|
| 72 | + Keywords escaping is not supported. |
| 73 | + Word in Mixed Case is not keyword |
| 74 | + --> |
| 75 | + <property name="template" value="types_plural/object_name.ext"/> |
| 76 | + <property name="templateForSysDBA" value="SCHEMA/types_plural/object_name.ext"/> |
| 77 | + <property name="needToReplaceWindowsReservedFileNames" value="true"/> |
| 78 | + |
| 79 | + <!-- File extension map rules. |
| 80 | + Use predefined 'TOAD' or 'PL/SQL Developer' mapping or create custom mapping --> |
| 81 | + <property name="extensionMap" ref="sql_by_default"/> |
| 82 | + <!-- combine package spec and body files into one packages directory. |
| 83 | + Only use this for TOAD extensionMap, otherwise spec sql files overwrite body sql files.--> |
| 84 | + <property name="combinePackage" value="false"/> |
| 85 | + </bean> |
| 86 | + |
| 87 | + <util:map id="sql_by_default"> |
| 88 | + <entry key="DEFAULT"> |
| 89 | + <value>sql</value> |
| 90 | + </entry> |
| 91 | + </util:map> |
| 92 | + |
| 93 | + <!-- File extension map rules like TOAD --> |
| 94 | + <util:map id="toad"> |
| 95 | + <!--todo need carefully test --> |
| 96 | + <entry key="DEFAULT"> |
| 97 | + <value>sql</value> |
| 98 | + </entry> |
| 99 | + <entry key="PROCEDURE"> |
| 100 | + <value>prc</value> |
| 101 | + </entry> |
| 102 | + <entry key="FUNCTION"> |
| 103 | + <value>fnc</value> |
| 104 | + </entry> |
| 105 | + <entry key="TRIGGER"> |
| 106 | + <value>trg</value> |
| 107 | + </entry> |
| 108 | + <entry key="VIEW"> |
| 109 | + <value>vw</value> |
| 110 | + </entry> |
| 111 | + <entry key="PACKAGE"> |
| 112 | + <value>pks</value> |
| 113 | + </entry> |
| 114 | + <entry key="PACKAGE_BODY"> |
| 115 | + <value>pkb</value> |
| 116 | + </entry> |
| 117 | + </util:map> |
| 118 | + |
| 119 | + <!-- File extension map rules like PL/SQL Developer --> |
| 120 | + <util:map id="plsqldeveloper"> |
| 121 | + <!--todo need filling and carefully test --> |
| 122 | + <entry key="DEFAULT"> |
| 123 | + <value>sql</value> |
| 124 | + </entry> |
| 125 | + </util:map> |
| 126 | + |
| 127 | + |
| 128 | + <!-- |
| 129 | + Windows doesn't allow to save files with reserved file names |
| 130 | + https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx |
| 131 | + This is confugurable workaround for this limitation |
| 132 | + --> |
| 133 | + <util:map id="windowsReservedNamesReplacements" key-type="java.lang.String" value-type="java.lang.String"> |
| 134 | + <entry key="CON " value="CON_" /> |
| 135 | + <entry key="PRN" value="PRN_" /> |
| 136 | + <entry key="AUX" value="AUX_" /> |
| 137 | + <entry key="NUL" value="NUL_" /> |
| 138 | + <entry key="COM1" value="COM1_"/> |
| 139 | + <entry key="COM2" value="COM2_"/> |
| 140 | + <entry key="COM3" value="COM3_"/> |
| 141 | + <entry key="COM4" value="COM4_"/> |
| 142 | + <entry key="COM5" value="COM5_"/> |
| 143 | + <entry key="COM6" value="COM6_"/> |
| 144 | + <entry key="COM7" value="COM7_"/> |
| 145 | + <entry key="COM8" value="COM8_"/> |
| 146 | + <entry key="COM9" value="COM9_"/> |
| 147 | + <entry key="LPT1" value="LPT1_"/> |
| 148 | + <entry key="LPT2" value="LPT2_"/> |
| 149 | + <entry key="LPT3" value="LPT3_"/> |
| 150 | + <entry key="LPT4" value="LPT4_"/> |
| 151 | + <entry key="LPT5" value="LPT5_"/> |
| 152 | + <entry key="LPT6" value="LPT6_"/> |
| 153 | + <entry key="LPT7" value="LPT7_"/> |
| 154 | + <entry key="LPT8" value="LPT8_"/> |
| 155 | + <entry key="LPT9" value="LPT9_"/> |
| 156 | + </util:map> |
| 157 | + |
| 158 | + |
| 159 | + <!-- Specify dependable items for every user object type accordingly with http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_metada.htm#BGBIEDIA --> |
| 160 | + <util:map id="dependencies"> |
| 161 | + <entry key="TABLE"> |
| 162 | + <set> |
| 163 | + <value>COMMENT</value> |
| 164 | + <value>INDEX</value> |
| 165 | + <value>OBJECT_GRANT</value> |
| 166 | + <value>TRIGGER</value> |
| 167 | + </set> |
| 168 | + </entry> |
| 169 | + <entry key="VIEW"> |
| 170 | + <set> |
| 171 | + <value>COMMENT</value> |
| 172 | + <value>OBJECT_GRANT</value> |
| 173 | + </set> |
| 174 | + </entry> |
| 175 | + <entry key="MATERIALIZED VIEW"> |
| 176 | + <set> |
| 177 | + <value>COMMENT</value> |
| 178 | + <value>INDEX</value> |
| 179 | + <value>MATERIALIZED_VIEW_LOG</value> |
| 180 | + <value>OBJECT_GRANT</value> |
| 181 | + </set> |
| 182 | + </entry> |
| 183 | + <entry key="FUNCTION"> |
| 184 | + <set> |
| 185 | + <value>OBJECT_GRANT</value> |
| 186 | + </set> |
| 187 | + </entry> |
| 188 | + <entry key="PROCEDURE"> |
| 189 | + <set> |
| 190 | + <value>OBJECT_GRANT</value> |
| 191 | + </set> |
| 192 | + </entry> |
| 193 | + <entry key="PACKAGE BODY"> |
| 194 | + <set> |
| 195 | + <value>OBJECT_GRANT</value> |
| 196 | + </set> |
| 197 | + </entry> |
| 198 | + <entry key="SYNONYM"> |
| 199 | + <set> |
| 200 | + <value>OBJECT_GRANT</value> |
| 201 | + </set> |
| 202 | + </entry> |
| 203 | + <entry key="TYPE"> |
| 204 | + <set> |
| 205 | + <value>OBJECT_GRANT</value> |
| 206 | + </set> |
| 207 | + </entry> |
| 208 | + </util:map> |
| 209 | + |
| 210 | + <!-- Key is the object type, |
| 211 | + Value - is set of patterns for exlude |
| 212 | + Currently only '*' wildcard supported --> |
| 213 | + <util:map id="excludes"> |
| 214 | + <entry key="*"> |
| 215 | + <set> |
| 216 | + <value>*_*_temp_*</value> |
| 217 | + </set> |
| 218 | + </entry> |
| 219 | + <!-- |
| 220 | + <entry key="VIEW"> |
| 221 | + <set> |
| 222 | + <value>example_exlude_prefix_*</value> |
| 223 | + <value>*_example_exlude_suffix</value> |
| 224 | + </set> |
| 225 | + </entry> |
| 226 | + --> |
| 227 | + |
| 228 | + <entry key="TABLE PARTITION"><set><value>*</value></set></entry> |
| 229 | + <entry key="INDEX PARTITION"><set><value>*</value></set></entry> |
| 230 | + <entry key="LOB"><set><value>*</value></set></entry> |
| 231 | + |
| 232 | + <!--Excluded, because all them persist in PACKAGE, TYPE and TABLE --> |
| 233 | + <!--<entry key="PACKAGE BODY"><set><value>*</value></set></entry>--> |
| 234 | + <entry key="TYPE BODY"><set><value>*</value></set></entry> |
| 235 | + <entry key="INDEX"><set><value>*</value></set></entry> |
| 236 | + <!--For removing system types http://www.sql.ru/forum/actualthread.aspx?bid=3&tid=542661&hl=--> |
| 237 | + <entry key="TYPE"> |
| 238 | + <set> |
| 239 | + <value>SYSTP*</value> |
| 240 | + <value>*==</value> |
| 241 | + <!--a pipelined function that returns a PL/SQL collection type Oracle will automagically generate a compatible SQL collection type. Exclude them--> |
| 242 | + <value>SYS_PLSQL_*</value> |
| 243 | + </set> |
| 244 | + </entry> |
| 245 | + </util:map> |
| 246 | + |
| 247 | + |
| 248 | +</beans> |
0 commit comments