defgen
Definition of a table using defgen Utility (oracle golden gate) - simple script to automatically get your table definitions if you are using UserExits or if you are relying on the definition file rather than the replicat parameter file.. Do not forget to update your table definitions when the source table has been modified.
Btw, edit the home, golden gate locations accordingly to suit your environment..
script: def_gen.sh
raj@localhost > cat defgen_05-18-13-02-24-59.def
*
* Definitions created/modified 2013-05-18 02:25
*
* Field descriptions for each column entry:
*
* 1 Name
* 2 Data Type
* 3 External Length
* 4 Fetch Offset
* 5 Scale
* 6 Level
* 7 Null
* 8 Bump if Odd
* 9 Internal Length
* 10 Binary Length
* 11 Table Length
* 12 Most Significant DT
* 13 Least Significant DT
* 14 High Precision
* 15 Low Precision
* 16 Elementary Item
* 17 Occurs
* 18 Key Column
* 19 Sub Data Type
*
*
Definition for table SCOTT.VALUES_TAB
Record length: 430
Syskey: 0
Columns: 5
ID 64 50 0 0 0 1 0 50 50 50 0 0 0 0 1 0 1 2
NAME 64 200 56 0 0 1 0 200 200 0 0 0 0 0 1 0 0 0
VALUE1 64 50 262 0 0 1 0 50 50 50 0 0 0 0 1 0 0 2
VALUE2 64 50 318 0 0 1 0 50 50 50 0 0 0 0 1 0 0 2
VALUE3 64 50 374 0 0 1 0 50 50 50 0 0 0 0 1 0 0 2
End of definition
Definition of a table using defgen Utility (oracle golden gate) - simple script to automatically get your table definitions if you are using UserExits or if you are relying on the definition file rather than the replicat parameter file.. Do not forget to update your table definitions when the source table has been modified.
Btw, edit the home, golden gate locations accordingly to suit your environment..
script: def_gen.sh
Dir=/u01/orcl
gguser=/u01/orcl/goldengate/111
. /u01/orcl/.profile
cd $Dir
cd $Dir/gg
mv *.obey logs/
Obey_file=$Dir/gg/defgen_`date +"%m-%d-%y-%H-%M-%S"`.obey;
Definition_file=$Dir/gg/defgen_`date +"%m-%d-%y-%H-%M-%S"`.def
sqlplus -s / as sysdba << EOF
set echo off head off trim on feed off
spool $Obey_file
prompt --DEFSFILE
prompt DEFSFILE $Definition_file,purge
prompt USERID ggs, PASSWORD ******
select 'TABLE '||OWNER||'.'||TABLE_NAME||';' FROM DBA_TABLES WHERE OWNER IN
(
'SCOTT',
'HR'
) ;
--AND TABLE_NAME= (based on your options)
spool off
EOF
cd $gguser
pwd
#echo "obey $Obey_file"|./defgen
./defgen PARAMFILE $Obey_file
ls -ltr $Dir/gg
== run the script and you should be able to get your definition file
output will be :
*
* Definitions created/modified 2013-05-18 02:25
*
* Field descriptions for each column entry:
*
* 1 Name
* 2 Data Type
* 3 External Length
* 4 Fetch Offset
* 5 Scale
* 6 Level
* 7 Null
* 8 Bump if Odd
* 9 Internal Length
* 10 Binary Length
* 11 Table Length
* 12 Most Significant DT
* 13 Least Significant DT
* 14 High Precision
* 15 Low Precision
* 16 Elementary Item
* 17 Occurs
* 18 Key Column
* 19 Sub Data Type
*
*
Definition for table SCOTT.VALUES_TAB
Record length: 430
Syskey: 0
Columns: 5
ID 64 50 0 0 0 1 0 50 50 50 0 0 0 0 1 0 1 2
NAME 64 200 56 0 0 1 0 200 200 0 0 0 0 0 1 0 0 0
VALUE1 64 50 262 0 0 1 0 50 50 50 0 0 0 0 1 0 0 2
VALUE2 64 50 318 0 0 1 0 50 50 50 0 0 0 0 1 0 0 2
VALUE3 64 50 374 0 0 1 0 50 50 50 0 0 0 0 1 0 0 2
End of definition
No comments:
Post a Comment