data loading sybase database to oracle database

Upload: moenycka-delc

Post on 07-Jul-2018

252 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/18/2019 Data Loading Sybase Database to Oracle Database

    1/33

    Data Conversion

    Sybase Database to Oracle

    Database

    Authors: Sandeep Arsid, Balwinder Saini, Kartik

    Josyula

    Date: 20 February 2012

  • 8/18/2019 Data Loading Sybase Database to Oracle Database

    2/33

    Contents

    Introduction 1

    Problem Definition 2

    High Level Solution 4

    Implementation 5

    BCP !port "

    bcp#table$#nm%&$h "

    bcp#table$#m%&$h "

    S'L Loader Load into (racle )

    Benefit$ 1*

    Conclu$ion 11

     +ppendi! +, bcp#table$%&$h $cript 12

     +ppendi! B, $etup%env nvironment $etup file 1-

     +ppendi! C, bcp#table$#nm%&$h $cript 1"

     +ppendi! D, bcp#table$#m%&$h $cript 1.

     +ppendi! , &e/0ord$%l$t 21

     +ppendi! , $lldr#table$#trim%&$h $cript 24

    Data conersion success Siebel batch $cripting and I3 automation

  • 8/18/2019 Data Loading Sybase Database to Oracle Database

    3/33

    Problem Definition

    Introduction

    Data 3igration i$ an important part of application migration% Some of the common driver$ for datamigration$ are,

    • 3ovement of legac/ $/$tem$ to a ne0 and improved platform

    • Con$olidation of application$ and data $ource$ after 3erger$ and +cui$ition$

    • Implement ne0 application functionalit/

    • Data load acro$$ variou$ application$ 0ith different data $ource reuirement$

    Data migration goe$ through the follo0ing lifec/cle

     +fter bu$ine$$ impact anal/$i$ and $etting up data mapping$ and DDL conver$ion the ne!t $tep i$

    to convert the data definition$ from one platform to another% Data migration$ can be ver/

    challenging particularl/ if data i$ migrated from heterogeneou$ data $ource$ and large amount of table$ are involved%

    hi$ 0hitepaper 0ill tal& about the proce$$ and ta$&$ involved to $implif/ the data migration from

    S/ba$e to (racle%

    Data Loading, S/ba$e Databa$e to (racle Databa$e 1

  • 8/18/2019 Data Loading Sybase Database to Oracle Database

    4/33

    Problem Definition

    Problem Definition

    !here are "any ways to per#or" a data load, includin$ e%ternal endor tools&But, there could be issues with endor tools such as

    • Data $tructure incompatibilit/

    • Licen$ing Co$t

    • In$ufficient $upport bet0een the e!ternal tool vendor and the databa$e vendor etc%

    If the internal databa$e tool$ are u$ed for data load then the aforementioned problem$ do not ari$e%But another ma6or i$$ue could be the compatibilit/ and coherence bet0een the data load tool$ ofthe $ource and target databa$e vendor$% (ne of the option$ in $uch ca$e$ i$ to follo0 the belo0$tep$ during data load,

    1.Extract the data from the source database using the corresponding data load utility and export it into a

    data file.

    2.Load the data from the data file into the target database using the corresponding data load utility

    For data loads #ro" Sybase to 'racle, the sa"e steps translate as below:

    1.Extract data from a Sybase table using BCP utility in a pre-defined format.

    2.Make control file for the corresponding table in Oracle as per the desired load conditions, format of the

    data file created from BCP utility, and table structure details.3.Run SQL Loader to load the data from the data file using the control file into the target table in Oracle.

    So"e o# the "a(or challen$es obsered in the aboe process are as statedbelow:

    1.Defining the format of the flat file which can be written by the BCP utility and read by SQL Loader

    utility.

    • It should be kept in mind that the format, especially the row and column delimiters, are not mixed up

    with the data itself and remain unique.

    2.Defining the parameters for the BCP extract so that the load on the Sybase server is optimized.

    3.Sybase database stores trailing white spaces at the end of character data if the character fields have

    additional bytes than the actual data. Sometimes, applications also insert records with leading and

    trailing spaces along with the character data. But, when character data is queried, Sybase ignores the

    trailing white spaces and includes the records with the trailing spaces in its result set; while Oracle

    expects the data to be exact to be included in the query results. It is important to note that leading

    white spaces are treated the same way both in Sybase and Oracle.

    Data Loading, S/ba$e Databa$e to (racle Databa$e 2

  • 8/18/2019 Data Loading Sybase Database to Oracle Database

    5/33

    Problem Definition

    4.When BCP utility exports data with MONEY, SMALLMONEY and MONEYN data types from

    Sybase tables, it extracts data till 2 decimal places only and rounds off any extra decimals present.

    Since data is extracted only till 2 decimal places, SQL Loader loads only 2 decimal places. But, while

    querying on Sybase, the data is accurate to 4 decimal spaces. Hence, there is a discrepancy in the data

    between Sybase and Oracle.

    5.The Sybase user which is used to extract data might have a timeout limit on the duration for which a

    query can run. This could lead to sudden disconnect between BCP utility and database when extracting

    data.

    6.Defining the column formats and loading conditions in the control file.

    7.Automation of the complete data load process with minimal manual intervention.

    8.Identifying and resolving ad hoc errors due to difference in data storage and data formats. These could

    be rare since data structure issues are assumed to be resolved beforehand.

    Data Loading, S/ba$e Databa$e to (racle Databa$e 7

  • 8/18/2019 Data Loading Sybase Database to Oracle Database

    6/33

    Problem Definition

    High Level Solution

    All the challen$es presented in the preious section re)uire a deep analysis on

    1.The server load capabilities of Sybase and Oracle

    2.Format of the data file

    3.Loading parameters and Column formats for Oracle

    o come to a conclu$ion on the above parameter$ it i$ imperative to get the approval of the$ta&eholder$ on $ome i$$ue$ and to do $ome proof of concept for other$%

    It i$ recommended to $trive for automation of data load becau$e the data load proce$$ i$ in generala ver/ routine proce$$% he more the manual intervention the more the chance$ of error$ in the dataload proce$$% But to achieve automation a clear logic $hould be in place for re$olving mo$t of thehighl/ freuent i$$ue$% urther the automation can be done at variou$ level$ depending on thenumber of table$ and $chema$ to be loaded and the freuenc/ of i$$ue$ that need manualintervention%

    1.If the number of tables to load is less, then the automation can be at the table level wherein the load

    parameters are pre-established and the load is run for each table.

    2.If the number of tables to load is very high, then the automation can be at database or schema level

    wherein the BCP runs in parallel with the SQL Loader and SQL Loader kicks off as soon as BCP is

    complete for a table.

    • In this case, if an export through BCP takes long for a particular table, then it does not hold the SQL

    Loader from starting the load for tables with less data, thereby, releasing burden on the user to sortthe BCP exports as per the tables’ data.

    Data Loading, S/ba$e Databa$e to (racle Databa$e 4

  • 8/18/2019 Data Loading Sybase Database to Oracle Database

    7/33

    Problem Definition

    Implementation

    In thi$ paper the di$cu$$ion i$ mainl/ ba$ed on automating the data load$ from S/ba$e to(racle 0hen the number of table$ i$ e!tremel/ high to the e!tent of migrating databa$e$ ofS/ba$e it$elf% he ba$ic anal/$i$ around the data load$ culminated in the belo0 deci$ion$ onS/ba$e $ide,

    1.Regarding the format of the data file, it was deemed preferable to use character format for BCP export

    (-c option in the BCP command) since the native format is not in readable form and cannot be

    understood by SQL Loader or BCP itself in case of importing data back to Sybase.

    2.The default delimiters of BCP are “\t” (TAB) for column delimiter and “\n” (New Line) for row

    delimiter. Both of the characters interfered with the actual data present in Sybase database. Since this

    could result in error prone and sometimes invalid data loads, the delimiters, “” and“” were used as column (-t option) and row (-r option) delimiters for BCP export.

    • The same were used in the Control file definition of Oracle Loads.

    3.The batch size option (-b) of BCP command offers an option to specify commit intervals while

    inserting data into a tables in Sybase. Though this has no effect on the exporting of data using BCP, a

    value of 50000 was decided on the option value so as to maintain a common BCP command for export

    and import.

    4.In order to help the Sybase server handle parallel exports of tables from Sybase, it was decided to run

    25-50 BCP exports at a point of time for a given database. Depending on the size of tables in a

    particular database, the number can be changed to suite the need.

    5.In the case of tables having more than 1 billion records or having more than 10 million records with

    over 30 -40 columns, the use of one BCP thread to export the whole data into a single data file seemed

    very load intensive. Hence, in such cases the use of Parallel BCP threads to export data into multiple

    data files was implemented.

    • In this scenario, it is necessary to specify the –F (the number of the first row in the table to start the

    export) and –L options (the number of the last row in the table which is to be exported). This helps

    in quicker export and reduces the chances of large sizes of data files.

    • Further, the multiple data files thus created can be again loaded in parallel into Oracle.

    6. In order to counter the issue of data with MONEY, SMALLMONEY, and MONEYN data types, such

    tables were initially found out by querying the system tables of Sybase. Since it is known that the data

    in columns with these data types is accurate up to 4 decimals, views were created over these tables

    while converting the data type of the corresponding columns to NUMERIC (19, 4). After creating the

    views, the data was exported from the views and this made it possible to get the data till 4 decimal

    values from the Sybase tables, thereby eliminating the data validation issues.

    7.There is also an option to specify the interfaces file and the Sybase server name from which the BCP

    export is to take place.

    • The interfaces file contains the connection information for various Sybase servers and the Sybase

    server name should be specified exactly as present in the interfaces file for the BCP utility to make

    the connection.

    'n the 'racle side, the #ollowin$ decisions were "ade:

    Data Loading, S/ba$e Databa$e to (racle Databa$e 5

  • 8/18/2019 Data Loading Sybase Database to Oracle Database

    8/33

    Problem Definition

    1.The Direct Path Load option is used to load data into Oracle. Since this requires setting up the NLS

    parameter, the NLS_LANG environment variable is also set. The load is run in unrecoverable mode to

    speed up the data load.

    2.The commit point for data load is set at 1000000. This would reduce the load on the server as it need

    not put the whole incoming data in buffer before a commit.

    3.Since the data load is performed at database level with lot of tables being loaded, the index

    maintenance is skipped during the data load into Oracle. It is performed after the completion of all data

    loads at the database or index level as per convenience.

    4.During the data load, several constraints are disabled so as to aid in faster loads. These constraints are

    re-enabled at the end of the data load. The success/failure of the enabling process depends on the data

    consistency and the status is indicated in the SQL Loader log file.

    5.The field and row delimiters are specified as “” and “” to remain consistent with the

    Sybase specifications.

    6.Column formatting for various data types is listed below:

    ColumnData type Column Format

     TIMESTAMP(3)

     TIMESTAMP "Mon dd yyyyHH12:MI:SS:FF3AM"

    NUMBER TRANSLATE (:

  • 8/18/2019 Data Loading Sybase Database to Oracle Database

    9/33

    Problem Definition

    B*+ %port

    he e!port of data from S/ba$e table$ to data file u$ing BCP utilit/ i$ primaril/ &ic&ed off b/ u$ingthe bcp#table$%&$h $cript% he $cript ta&e$ the name of the databa$e for 0hich the e!port i$ to bedone a$ a parameter% he detailed $cript i$ given in +ppendi! +% It further u$e$ the table$#$/b%l$t a$the li$t of table$ for 0hich data $hould be e!ported% It further u$e$ $etup%env file to loo& up theenvironment $etting$ the t/pical e!ample of 0hich i$ pre$ent in +ppendi! B% +$ far a$ BCP utilit/ i$concerned the variable$ of importance in the environment $etup file are,

    a8 uid, he u$er u$ing 0hich the BCP utilit/ log$ into S/ba$e databa$e

    b8 pa$$0d, he pa$$0ord for the u$er%

    c8 $erver, he S/ba$e $erver the BCP utilit/ connect$ to%

    d8 interface$#file, he interface$ file location for the BCP utilit/%

    e8 data#dir, he director/ 0here the data file and BCP log i$ $tored% or each databa$e a director/

    b/ the databa$e name i$ made in thi$ location and the data file$ and BCP log$ for the particular

    databa$e are pre$ent in the corre$ponding folder%

    f8 ma!#proc#$/b, he number of parallel BCP e!port$ per databa$e%

    he $/nta! for running the bcp#table$%&$h command i$ a$ follo0$,

    nohup &-bcp.tables&ksh /Sybase DB na"e

    he bcp#table$%&$h $cript divide$ the table$ into t0o part$ depending on the pre$ence of 3(9:S3+LL3(9: and 3(9:9 data t/pe$% he table$ not having the$e data t/pe$ are over 0rittenon the table$#$/b%l$t file 0hile the one$ 0ith the$e data t/pe$ are 0ritten into table$#m%l$t andproce$$ed further% o $tart the BCP e!port of the table$ 0ithout the above data t/pe$ thi$ $cript call$bcp#table$#nm%&$h $cript% he detail$ of thi$ $cript are pre$ent in +ppendi! C%

    or the table$ 0ith 3(9: S3+LL3(9: and 3(9:9 data t/pe$ the bcp#table$%&$h create$ a

    vie0 0ith the above data t/pe column$ converted a$ 9;3

  • 8/18/2019 Data Loading Sybase Database to Oracle Database

    10/33

    Problem Definition

    bcp.tables."&ksh

    he bcp#table$#m%&$h create$ one BCP e!port file for each of the vie0$ created b/ thebcp#table$%&$h $cript% If the vie0 i$ created in a databa$e called vie0db the data file and the BCPlog file for the e!port are created in @>data#dir?A>vie0db?#>S/ba$e db? a$ >I 9+3?%dat and@bcp#>I 9+3?%log% Depending on the $ucce$$ or failure of the BCP e!port$ the BCP e!portlog file i$ renamed a$ >I 9+3?%read/ and >I 9+3?%error a$ $pecified earlier%

     +$ $oon a$ the BCP e!port i$ complete for the vie0 and the @%read/ or @%error file i$created the bcp#table$%&$h $cript move$ the data file and the log file to @>data#dir?A>S/ba$e DB?director/ a$ >+BL 9+3?%dat and >+BL 9+3?%EerrorFread/G b/ u$ing the mapping created inchange#tname$%l$t file%

    S3 3oader 3oad into 'racle

     +t the time 0hen the BCP e!port$ are $tarted the S'L Loader $cript i$ al$o $tarted% he S'LLoader $cript i$ &ic&ed off u$ing the $lldr#table$#trim%&$h $cript% he $cript u$e$ the li$t of table$pre$ent in table$#ora%l$t to create the control file and the S'L Loader $cript% he $cript ta&e$ the$chema name a$ a mandator/ parameter% urther the u$er ha$ the option to $pecif/,

    1.Only create control files and SQL Loader scripts. The syntax for running the SQL Loader with this

    option is as follows:

    nohup ./sqlldr_tables_trim.ksh –s -C &

    2.Only run the SQL Loader scripts. The syntax for running the SQL Loader with this option is as

    follows:

    nohup ./sqlldr_tables_trim.ksh –s -L &

    3.Create the control file and SQL Loader scripts and then run the SQL Loader scripts. The syntax for

    running the SQL Loader with this option is as follows:

    nohup ./sqlldr_tables_trim.ksh –s &

     he $cript u$e$ $etup%env the environment $etting$ file for the follo0ing parameter$,

    a8 (

  • 8/18/2019 Data Loading Sybase Database to Oracle Database

    11/33

    Problem Definition

    h8 9LS#L+9, he 9LS#L+9 parameter for the S'L Loader i$ $pecified here%

    i8 9S#+D3I9, he location of the 9S9+3S%(

  • 8/18/2019 Data Loading Sybase Database to Oracle Database

    12/33

    Problem Definition

    hi$ 0ill ma&e the $lldr#table$#trim%&$h to automaticall/ pic& up the table again for the load and thetable i$ loaded%

    But thi$ i$ onl/ po$$ible a$ long a$ the main $cript $lldr#table$#trim%&$h i$ $till running% In ca$eb/ the time the i$$ue i$ re$olved and the target table i$ truncated the main $cript i$ completed thenit i$ enough run the $cript $lldr#table$#trim%&$h in the Load(nl/ mode =0ith @L option8 $ince thecontrol file$ and S'L Loader $cript$ are alread/ created in the fir$t round%

    Data Loading, S/ba$e Databa$e to (racle Databa$e 1*

  • 8/18/2019 Data Loading Sybase Database to Oracle Database

    13/33

    Problem Definition

    Benefits

    he follo0ing benefit$ can be realiKed after follo0ing the proce$$ mentioned above,

    Improves Accuracy: As it is evident, the process requires a lot of routine checks file manipulations to

    be performed for each Table’s load. If taken up manually, there would be lot of issues like skipping

    few checks to be performed, mistakes in performing the file manipulations etc. By performing all the

    tasks in an automated script, the accuracy is improved.

      Reduces Complexity: In the cases when performing the checks or file manipulations involves a

    complex process, the result could be error prone, if handled manually. By using the automated script,

    such complexities are handled automatically and accurately.

      4educes ti"e and e##ort: In ca$e of a manual effort the variou$ chec&$ their re$olution trac&ing

    the completion of the numerou$ BCP or S'LLD< proce$$e$ and a final chec& on the complete

    data load 0ould ta&e a lot of time and effort of the re$ource$% he automation of the proce$$

    ma&e$ it po$$ible for the re$ource$ to utiliKe their time and effort on more innovative and

    challenging problem$%

      Scalable: As the whole process is being performed on UNIX based scripts, the same can be used with

    some minimal changes for Data Load processes across various Sybase and Oracle versions.

    Data Loading, S/ba$e Databa$e to (racle Databa$e 11

  • 8/18/2019 Data Loading Sybase Database to Oracle Database

    14/33

    Problem Definition

    Conclusion

    hough there are $ome client $pecific part$ in the BCP e!port and S'L Loader load $cript$ the/ arever/ ea$/ to under$tand b/ a per$on 0ith introductor/ &no0ledge in ;9I S/ba$e and (racle%he$e can be changed ver/ ea$il/ a$ per the clientM$ reuirement$ or can further be $ugge$ted tothe client$ a$ a po$$ible $olution%

    In conclu$ion the BCP e!port and S'L Loader load of data from S/ba$e to (racle are handled in;9I $cript$ 0hich $tart the BCP e!port$ a$ per the load bearing capabilit/ of S/ba$e and $tart theS'L Loader a$ and 0hen the BCP e!port i$ completed% he e!ten$ion$ of the log file$ of BCP andS'L Loader provide a $imple 0a/ for the u$er to under$tand the $tatu$ of the load of a table% he$cript al$o provide$ the u$er the chance to rectif/ the S'L Loader i$$ue$ and reload the table0ithout the need to re$tart the load% In the event that a re$tart i$ nece$$ar/ the u$er ha$ the optionto directl/ $tart the load 0ith e!i$ting control file$ and S'L Loader $cript$ rather than recreating themever/ time%

    Data Loading, S/ba$e Databa$e to (racle Databa$e 12

  • 8/18/2019 Data Loading Sybase Database to Oracle Database

    15/33

    Problem Definition

    Appendi A! bcp"tables#$sh script

    NOAbinA&$h

    pathQp0dQ

    % REpathGA$etup%env

    dbR1

    if e REpathGAchange#tname$%l$t TUthen rm f REpathGAchange#tname$%l$tUfi

    NN ind out if table$ contain 3(9: or S3+LL 3(9: Column$

    tabQcat REpathGAtable$#$/b%l$tF$ed V$AWA XAgU$ARAX AgVF$ed V$ARAAgVFtr XY*12X X,XFga0& XEg$ub=V , VVV

    R*8UprintGXF$ed V$A,AAgVQi$l ; REuidG P VREpa$$0dGV SRE$erverG I REinterface$#fileG>>(?REpathGAtable$#m%l$t

    u$e REdbG

    go

    $elect di$tinct b%name a$ tablename

    from $/$column$ a 6oin $/$ob6ect$ b on =a%id b%id8

     6oin $/$t/pe$ c on =a%t/pec%t/pe8

    and b%name in =REtabG8

    and b%t/pe in =X;XXX8

    and c%name in =Xmone/nXXmone/XX$mallmone/X8

    go

    (cat REpathGAtable$#m%l$tF$ed n V7R pVFgrep i0v Vro0$ affectedVFgrep iv0 Vro0 affectedVFga0&XEg$ub=V VVVR*8UprintGXFgrep %?REpathGAtable$#m%l$t#tmp

    mv REpathGAtable$#m%l$t#tmp REpathGAtable$#m%l$t

    NN et the table$ 0ithout the 3(9: column$

    cat REpathGAtable$#$/b%l$tF$ort u?REpathGAt#tmp

    cat REpathGAtable$#m%l$tF$ort u?REpathGAm#tmp

    diff REpathGAt#tmp REpathGAm#tmpFgrep i WY>Fga0& XEg$ub=V> VVVR*8UprintGX?table$#nm%l$t

    rm f REpathGAt#tmp

    rm f REpathGAm#tmp

    mv REpathGAtable$#$/b%l$t REpathGAmain#table$%l$t

    mv REpathGAtable$#nm%l$t REpathGAtable$#$/b%l$t

    NN a&e out table$ greater than 2) character$ from 9on3one/ able$

    if e REpathGAtable$#nm%l$t TUthen rm f REpathGAtable$#nm%l$tUfi

    for tab in Qcat REpathGAtable$#$/b%l$tQ

    do

    if Qecho REtabGF0c cQ gt 2. T

    then

    Data Loading, S/ba$e Databa$e to (racle Databa$e 17

  • 8/18/2019 Data Loading Sybase Database to Oracle Database

    16/33

    Problem Definition

    echo REtabG??REpathGAtable$#m%l$t

    el$e

    echo REtabG??REpathGAtable$#nm%l$t

    fi

    done

    if O e REpathGAtable$#nm%l$t TUthen touch REpathGAtable$#nm%l$tUfi

    if O e REpathGAtable$#m%l$t TUthen touch REpathGAtable$#m%l$tUfi

    chmod """ REpathGAtable$#m%l$t

    chmod """ REpathGAtable$#nm%l$t

    mv REpathGAtable$#nm%l$t REpathGAtable$#$/b%l$t

    NN Zic& off BCP for 9on#mone/ able$

     nohup %Abcp#table$#nm%&$h REdbG [

    NNN Create ie0$ for the 3one/ able$

    cnt1

    for tab in Qcat REpathGAtable$#m%l$tQ

    do

    if Qecho REdbG#REtabG#v0F0c cQ gt 2. T

    then

    tnameREdbG#Qecho REtabGFcut c11*Q#v0

    if O e REpathGAchange#tname$%l$t TUthen touch REpathGAchange#tname$%l$tUfi

    chmod """ REpathGAchange#tname$%l$t

    if Qcat REpathGAchange#tname$%l$tFgrep i0 VREtnameGVF0c lQ e * T

    then

    echo REtabGREtnameG??REpathGAchange#tname$%l$t

    el$e

    tnameREdbG#Qecho REtabGFcut c11*QREcntG#v0

    echo REtabGREtnameG??REpathGAchange#tname$%l$t

    cntQe!pr REcntG \ 1Q

    fi

    el$e

    tnameREdbG#REtabG#v0

    echo REtabGREtnameG??REpathGAchange#tname$%l$t

    fi

    if d REpathGAlog$ TUthen rm rf REpathGAlog$Ufi

    m&dir REpathGAlog$

    chmod < """ log$

    NN et the Column$ to build the vie0

    i$l ; REuidG P VREpa$$0dGV 0 )** SRE$erverG I REinterface$#fileG>>(?REpathGAlog$AREtnameG%log

    u$e REdbG

    go

    $elect columnname from =

    $elect di$tinct ca$e 0hen a%colid>?d%cid then ca$e 0hen c%name in =Xmone/nXXmone/XX$mallmone/X8then Xconvert=numeric=1.48XFFa%nameFFX8 a$ XFFa%nameFFXX el$e a%nameFFXX end

    el$e

    Data Loading, S/ba$e Databa$e to (racle Databa$e 14

  • 8/18/2019 Data Loading Sybase Database to Oracle Database

    17/33

    Problem Definition

    ca$e 0hen c%name in =Xmone/nXXmone/XX$mallmone/X8 then Xconvert=numeric=1.48XFFa%nameFFX8 a$ XFFa%name el$e a%name end

    end

    a$ columnnamea%colid

    from $/$column$ a 6oin $/$ob6ect$ b on =a%id b%id8

     6oin $/$t/pe$ c on =a%t/pec%t/pe8

    =$elect ma!=colid8 cid from $/$column$ a 6oin $/$ob6ect$ b on =a%id b%id8

    0here b%nameXREtabGXand b%t/pe in =X;XXX88d

    0here b%nameXREtabGX

    and b%t/pe in =X;XXX8

    8a

    order b/ colid

    go

    (

    cat REpathGAlog$AREtnameG%logF$ed n V7R pVFgrep iv0 Vro0$ affectedVFgrep iv0 Vro0 affectedVFtr XY*12XX XFgrep %?REpathGAlog$AREtnameG#tmp

    echo V V??REpathGAlog$AREtnameG#tmpcol$Qcat REpathGAlog$AREtnameG#tmpQ

    NN Create the vie0 0ith the above column$

    i$l ; REuidG P VREpa$$0dGV SRE$erverG I REinterface$#fileG>>( ? REpathGAlog$AREtabG%log

    u$e $cratchdb

    go

    I (B]C#ID=XREtnameGX8 IS 9( 9;LL

    BI9

      D

  • 8/18/2019 Data Loading Sybase Database to Oracle Database

    18/33

    Problem Definition

    0hile REcnG le REtotalG TT

    do

    if Ql$ REdata#dirGA$cratchdb#REdbGAJ%read/ 2?AdevAnullF0c lQ gt * T

    then

    fileQl$ REdata#dirGA$cratchdb#REdbGAJ%read/Fhead 1Fcut dV%V f1Fga0& VAV XEprint R9GXQ

    nmQcat REpathGAtempAchange#tname$%l$tFgrep i0 VREfileGVFcut dVV f1Ftr X+^TX XaKTXQ

    mv REdata#dirGA$cratchdb#REdbGAREfileG%dat REdata#dirGAREdbGAREnmG%dat

    mv REdata#dirGA$cratchdb#REdbGAREfileG%read/ REdata#dirGAREdbGAREnmG%read/

    cnQe!pr REcnG \ 1Q

    elif Ql$ REdata#dirGA$cratchdb#REdbGAJ%error 2?AdevAnullF0c lQ gt * T

    then

    fileQl$ REdata#dirGA$cratchdb#REdbGAJ%errorFhead 1Fcut dV%V f1Fga0& VAV XEprint R9GXQ

    nmQcat REpathGAtempAchange#tname$%l$tFgrep i0 VREfileGVFcut dVV f1Ftr X+^TX XaKTXQ

    mv REdata#dirGA$cratchdb#REdbGAREfileG%error REdata#dirGAREdbGAREnmG%error 

    cnQe!pr REcnG \ 1Q

    el$e

    $leep 7*

    fi

    done

    Data Loading, S/ba$e Databa$e to (racle Databa$e 1-

  • 8/18/2019 Data Loading Sybase Database to Oracle Database

    19/33

    Problem Definition

    Appendi B! setup#env

    %nvironment setup file

    uid$vc#deloitte

    pa$$0dX$vc#deloitteX

    $erverS:B

  • 8/18/2019 Data Loading Sybase Database to Oracle Database

    20/33

    Problem Definition

    Appendi C! bcp"tables"nm#$sh

    script

    NOAbinA&$h

    pathQp0dQ

    $chemaR1

    % REpathGA$etup%env

    table#li$ttable$#$/b%l$t

    data#dir#ne0REdata#dirGARE$chemaG

    if O d REdata#dir#ne0G TUthen m&dir REdata#dir#ne0GUchmod < """ REdata#dir#ne0GUfi

    Nif ^ RE$chemaG TTUthen echo V;$age , bcp#table$%&$h $chemaVUe!it 1Ufi

    NNNCreating the BCP $tandard file

    if e REpathGAbcp#$tandard%t!t TUthen rm f REpathGAbcp#$tandard%t!tUfi

    if RE$erverG O DL+2P3C:C1 T

    then

    echo Vbcp YVRE$chemaGT%dboT%+BLTYV out YVREdata#dir#ne0GAL+B%datYV b 5**** c t YV>(D?YVr YV>((D?YVr YV>(

  • 8/18/2019 Data Loading Sybase Database to Oracle Database

    21/33

    Problem Definition

    if Qecho REtabGF0c cQ gt 2. T

    then

    echo Vable name greater than 2) character$ not $upported b/ BCPV?REdata#dir#ne0GAREtabG%error 

    touch REpathGAtemp#$/bAbcp#REtabG%&$h

    chmod """ REpathGAtemp#$/bAbcp#REtabG%&$h

    chmod """ REdata#dir#ne0GAREtabG%error 

    el$e

    ltab#tmpQecho REtabGFtr X+^TX XaKTXQ

    if Qcat REpathGA&e/0ord$%l$tFgrep i0 REltab#tmpGF0c lQ e 1 T

    then

    ltabREltab#tmpG#1

    el$e

    ltabREltab#tmpG

    fi

    cat REpathGAbcp#$tandard%t!tF$ed V$A+BLAREtabGAgU$AL+BAREltabGAgV ? REpathGAtemp#$/bAbcp#R

    EtabG%&$h

    chmod """ REpathGAtemp#$/bAbcp#REtabG%&$h

    echo Vif YR_ e * TUthen mv REdata#dir#ne0GAbcp#REtabG%log REdata#dir#ne0GAREltabG%read/Uel$e mvREdata#dir#ne0GAbcp#REtabG%log REdata#dir#ne0GAREltabG%errorUfiV??REpathGAtemp#$/bAbcp#REtabG%&$h

    echo Vchmod < """ REdata#dir#ne0GAJREtabGJV??REpathGAtemp#$/bAbcp#REtabG%&$h

    echo Vchmod < """ REdata#dir#ne0GAJREltabGJV??REpathGAtemp#$/bAbcp#REtabG%&$h

    fi

    done

    NNNN

  • 8/18/2019 Data Loading Sybase Database to Oracle Database

    22/33

    Problem Definition

    Appendi D! bcp"tables"m#$sh

    script

    NOAbinA&$h

    pathQp0dQAtemp

    $chemaR1

    dbR2

    % REpathGA$etup%env

    table#li$ttable$#$/b%l$t

    data#dir#ne0REdata#dirGARE$chemaG#REdbG

    if O d REdata#dir#ne0G TUthen m&dir REdata#dir#ne0GUchmod < """ REdata#dir#ne0GUfi

    Nif ^ RE$chemaG TTUthen echo V;$age , bcp#table$%&$h $chemaVUe!it 1Ufi

    NNNCreating the BCP $tandard file

    if e REpathGAbcp#$tandard%t!t TUthen rm f REpathGAbcp#$tandard%t!tUfi

    if RE$erverG O DL+2P3C:C1 T

    then

    echo Vbcp YVRE$chemaGT%%+BLTYV out YVREdata#dir#ne0GAL+B%datYV b 5**** c t YV>(D?YVr YV>((D?YVr YV>(

  • 8/18/2019 Data Loading Sybase Database to Oracle Database

    23/33

    Problem Definition

    if Qecho REtabGF0c cQ gt 2. T

    then

    echo Vable name greater than 2) character$ not $upported b/ BCPV?REdata#dir#ne0GAREtabG%error 

    touch REpathGAtemp#$/bAbcp#REtabG%&$h

    chmod """ REpathGAtemp#$/bAbcp#REtabG%&$h

    chmod """ REdata#dir#ne0GAREtabG%error 

    el$e

    ltab#tmpQecho REtabGFtr X+^TX XaKTXQ

    if Qcat REpathGA&e/0ord$%l$tFgrep i0 REltab#tmpGF0c lQ e 1 T

    then

    ltabREltab#tmpG#1

    el$e

    ltabREltab#tmpG

    fi

    cat REpathGAbcp#$tandard%t!tF$ed V$A+BLAREtabGAgU$AL+BAREltabGAgV ? REpathGAtemp#$/bAbcp#REtabG%&$h

    chmod """ REpathGAtemp#$/bAbcp#REtabG%&$h

    echo Vif YR_ e * TUthen mv REdata#dir#ne0GAbcp#REtabG%log REdata#dir#ne0GAREltabG%read/Uel$e mvREdata#dir#ne0GAbcp#REtabG%log REdata#dir#ne0GAREltabG%errorUfiV??REpathGAtemp#$/bAbcp#REtabG%&$h

    echo Vchmod < """ REdata#dir#ne0GAJREtabGJV??REpathGAtemp#$/bAbcp#REtabG%&$h

    echo Vchmod < """ REdata#dir#ne0GAJREltabGJV??REpathGAtemp#$/bAbcp#REtabG%&$h

    fi

    done

    NNNN

  • 8/18/2019 Data Loading Sybase Database to Oracle Database

    24/33

    Problem Definition

    Appendi %! $ey&ords#lst

    acce$$ commit e!ternal li&e4 numeric

    a committed

    e!ternall/

    li&ec ob6ect

    add compile fetch limit ocicoll

    admin compiled file limited ocidate

    after compre$$

    final lin& ocidatetime

    agent connect fi!ed li$t$ ociduration

    aggregate

    con$tant float local ociinterval

    all con$traint

    flu$h loc& ociloblocator 

    allocate con$traint$

    for logfile ocinumber  

    alter con$tructor 

    forall long ocira0

    anal/Ke content$ force loop ociref  

    and conte!t foreign manage ocirefcur$o

    r an/ continue fortran manual ociro0id

    archive controlfile found map oci$tring

    archivelog

    convert freeli$t ma! ocit/pe

    arra/ count freeli$t$ ma!datafile$ of  

    a$ cra$h from ma!e!tent$ off  

    a$c create function ma!in$tance$

    offline

    at create general ma!len old

    attribute current go ma!logfile$ on

    audit cur$or goto ma!loghi$tor  /

    online

    authid cu$tomdatum

    grant ma!logmember$

    onl/

    authoriKation

    c/cle group ma!tran$ opaue

    avg dangling group$ ma!value open

    bac&up data ha$h member operator  

    Data Loading, S/ba$e Databa$e to (racle Databa$e 22

  • 8/18/2019 Data Loading Sybase Database to Oracle Database

    25/33

    Problem Definition

    become databa$e having merge optimal

    before datafile heap min option

    begin date hidden mine!tent$ or  

    bet0een date#ba$e

    hour minu$ oracle

    bfile#ba$e

    da/ identified minute oradata

    binar/ dba if minvalue order  

    blob#ba$e

    dec immediate

    ml$label organiKation

    bloc& decimal in mod orlan/

    bod/ declare including mode orlvar/

    both default increment

    modif/ other$

    bound define inde! module out

    bul& delete inde!e$ month overlap$b/ de$c indicator mount overriding

    b/te determini$tic

    indice$ multi$et o0n

    c di$able infinite name pac&age

    cache di$mount initial nan parallel

    call di$tinct initran$ national parallel#enable

    calling double in$ert native parameter  

    cancel drop in$tance nchar parameter$

    ca$cade dump in$tantiable

    ne0 parent

    ca$e duration int ne!t partition

    change each integer nnect pa$cal

    char element interface noarchivelog pctfree

    char#ba$e

    el$e inter$ect noaudit pctincrea$e

    character 

    el$if interval nocache pctu$ed

    char$et empt/ into nocompre$$ pipe

    char$etf orm

    enable invalidate

    nocop/ pipelined

    char$etid

    end i$ noc/cle plan

    chec& e$cape i$olation noma!value pli

    chec&point

    event$ 6ava nominvalue pragma

    clob#ba$e

    e!cept &e/ none preci$ion

    Data Loading, S/ba$e Databa$e to (racle Databa$e 27

  • 8/18/2019 Data Loading Sybase Database to Oracle Database

    26/33

    Problem Definition

    clo$e e!ception language

    noorder primar/

    clu$ter e!ception$

    large nore$etlog$ prior  

    clu$ter$ e!clu$ive la/er normal private

    cobol e!ec leading no$ort privilege$

    colauth e!ecute length not procedure

    collect e!i$t$ level no0ait profile

    column e!it librar/ null public

    column$ e!plain li&e number uota

    comment

    e!tent li&e2 number#ba$e

    rai$e

    range ro0$ $l table$ unlimited

    ra0 r$or $lcode table$pace un$igned

    read $ample $ldata tdo until

    real $ave $lerror temporar/ untru$ted

    record $avepoint $lname the update

    recover $b1 $l$tate then u$e

    ref $b2 $tandard thread u$er  

    reference

    $b4 $tart time u$ing

    reference$

    $chema $tatement#id

    time$tamp validate

    referencing

    $cn $tatic timeKone#abbr 

    vali$t

    relie$#on

    $econd $tati$tic$ timeKone#hour 

    value

    rem $ection $tddev timeKone#minute

    value$

    remainder 

    $egment $top timeKone#region

    varchar 

    rename $elect $torage to varchar2

    re$etlog$

    $elf $tored tracing variable

    re$ource $eparate $tring trailing variance

    re$tricted

    $euence

    $truct tran$action varra/

    re$ult $erialiKable

    $t/le tran$actional var/ing

    re$ult#cache

    $e$$ion $ubmulti$et

    trigger vie0

    return $et $ubpartition

    trigger$ vie0$

    returning $hare $ub$titutable

    truncate void

    Data Loading, S/ba$e Databa$e to (racle Databa$e 24

  • 8/18/2019 Data Loading Sybase Database to Oracle Database

    27/33

    Problem Definition

    reu$e $hared $ubt/pe tru$ted 0hen

    rever$e $hort $ucce$$f  ul

    t/pe 0henever  

    revo&e $iKe $um ub1 0here

    role $iKe#t $0itch ub2 0hile

    role$ $mallint $/non/m ub4 0ith

    rollbac& $nap$hot $/$date uid 0or&

    ro0 $ome $/$tem under 0rapped

    ro0id $ort tabauth union 0rite

    ro0num $par$e table uniue /ear  

    Kone

    Data Loading, S/ba$e Databa$e to (racle Databa$e 25

  • 8/18/2019 Data Loading Sybase Database to Oracle Database

    28/33

    Problem Definition

    Appendi '!

    s(lldr"tables"trim#$sh script

    NOAbinA&$h

    NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

    NNN $lldr#table$%&$h $ $chema o create the control file$ and run $lldr NNN

    NNN $lldr#table$%&$h $ $chema L o avoid creation of Control ile$ again NNN

    NNN $lldr#table$%&$h $ $chema C o 6u$t create the control file$ NNN

    NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

    pathQp0dQ

    % REpathGA$etup%env

    table#li$ttable$#ora%l$t

    NNN 3a&ing $ure that the table$ are in lo0er ca$e

    cat REpathGAREtable#li$tGFtr X+^TX XaKTX?REpathGAREtable#li$tG#temp

    mv REpathGAREtable#li$tG#temp REpathGAREtable#li$tG

    NNNCHCZ (< C(

  • 8/18/2019 Data Loading Sybase Database to Oracle Database

    29/33

    Problem Definition

    if O d RECL#IL#DI

  • 8/18/2019 Data Loading Sybase Database to Oracle Database

    30/33

    Problem Definition

      H9 D++#:PXCL(BX +9D column#idb%cid H9 XCH+

  • 8/18/2019 Data Loading Sybase Database to Oracle Database

    31/33

    Problem Definition

    echo Vif YR_ e * TUthen mv REL(#IL#DI

  • 8/18/2019 Data Loading Sybase Database to Oracle Database

    32/33

    Problem Definition

    echo V$leepingV

    el$e

    !*

    fi

    done

    echo VLooping e!ternalV

    done

    done

    fi

    Data Loading, S/ba$e Databa$e to (racle Databa$e 7*

  • 8/18/2019 Data Loading Sybase Database to Oracle Database

    33/33