IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

SQL*Loader Oracle Discussion :

intégration sql loader en ksh?


Sujet :

SQL*Loader Oracle

  1. #1
    Membre confirmé
    Inscrit en
    Juin 2005
    Messages
    73
    Détails du profil
    Informations forums :
    Inscription : Juin 2005
    Messages : 73
    Par défaut intégration sql loader en ksh?
    Bonjour je souhaite intégrer mon sql loader en KSH .
    j'ai réussi en .bat mais KSH je sèche...

    voilà ce que j'ai fait en .bat
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    REM -- Connection Oracle (user/pass@connection)
    REM -- ----------------------------------------
     
           SET CONNECT_STRING=%1
     
    REM --
    REM -- Fichier à traiter (chemin complet)
    REM -- ----------------------------------
     
           SET INFILE=%~2
     
    REM --
    REM -- Répertoire de l'exécutable sql*loader
    REM -- -------------------------------------
     
           SET CHEMIN_SQLOADER=%~3
     
     
    REM -- 
    REM -- Répertoire racine du traitement ( ./LOG ; ./SCRIPT ; ./SQL )
    REM -- ------------------------------------------------------------
     
           SET DIR_TRT=%~4
     
     
    REM --
    REM -- Fichier de controle
    REM -- -------------------
     
           SET CONTROL_FILE=%DIR_TRT%\SCRIPT\FL0852_OSS310.ctl
     
    REM --
    REM -- Fichier log sql*loader 
    REM -- ----------------------       
     
           SET LOG_FILE=%DIR_TRT%\LOG\OSS310.LOG
     
    REM --
    REM -- Fichier bad sql*loader
    REM -- ----------------------
     
           SET BAD_FILE=%DIR_TRT%\LOG\OSS310.BAD
     
    REM --
    REM -- Fichier discard sql*loader
    REM -- --------------------------
     
           SET DSC_FILE=%DIR_TRT%\LOG\OSS310.DSC
     
    REM --
    REM -- Chemin des scripts SQL
    REM -- ----------------------
     
    REM       SET SQL_DIR=%DIR_TRT%\SQL
     
     
     
           SET TRT_OSS310_852=TRT_OSS310_852
     
     
     
    REM
    REM --------------------------------------------------------------------------------------
    REM --------------------------------------------------------------------------------------
    REM                           TEST DES PARAMETRES D'ENTREE
    REM --------------------------------------------------------------------------------------
     
        if '%1'=='' echo Usage 1: INTERFACE_PXL_060 connectString dataFile repLoader repTrt   & exit -100
        if '%2'=='' echo Usage 2: INTERFACE_PXL_060 connectString dataFile repLoader repTrt   & exit -101
        if '%3'=='' echo Usage 3: INTERFACE_PXL_060 connectString dataFile repLoader repTrt   & exit -102
        if '%4'=='' echo Usage 4: INTERFACE_PXL_060 connectString dataFile repLoader repTrt   & exit -103
     
    REM
    REM --------------------------------------------------------------------------------------
    REM --------------------------------------------------------------------------------------
    REM                           Supression des fichiers intermédiaires 
    REM --------------------------------------------------------------------------------------
     
        if exist %DSC_FILE% DEL %DSC_FILE% 
     
        if exist %LOG_FILE% DEL %LOG_FILE%
     
        IF exist %BAD_FILE% DEL %BAD_FILE%
     
        IF exist %DIR_TRT%\LOG\ERROR.TXT DEL %DIR_TRT%\LOG\ERROR.TXT
     
        IF exist %DIR_TRT%\LOG\%DELTA_SQL_FILE%.log del %DIR_TRT%\LOG\%DELTA_SQL_FILE%.log
     
        IF exist %DIR_TRT%\LOG\%INTEGRATION_SQL_EXECUTE%.log del %DIR_TRT%\LOG\%INTEGRATION_SQL_EXECUTE%.log
     
    REM
    REM --------------------------------------------------------------------------------------
    REM --------------------------------------------------------------------------------------
    REM                           CONTROLE DU FICHIER DE DONNEES
    REM --------------------------------------------------------------------------------------
     
    REM ----------------------------------------------------  s:
     
        chdir %DIR_TRT%\SCRIPT
     
    rem    ECHO %DIR_TRT%\..\BIN\ControlePXL.EXE userid=%CONNECT_STRING% -f %INFILE% -l %DIR_TRT%\LOG\Controle.log >.\SCRIPT\param.txt
     
    rem    CALL %DIR_TRT%\..\BIN\ControlePXL.EXE userid=%CONNECT_STRING% -f %INFILE% -l %DIR_TRT%\LOG\Controle.log
     
        if errorlevel 20 echo Erreur 0 : Echec lors de l'ouverture du fichier de donnee %INFILE% >>%DIR_TRT%\LOG\error.txt & exit -1
        if errorlevel 10 echo Erreur 1 : Fichier %INFILE% invalide : Nb d'enregistrements incorrect !>>%DIR_TRT%\LOG\error.txt  & exit -2
        if errorlevel 5  echo Erreur 2 : Arguments absents lors de l'appel ! >>%DIR_TRT%\LOG\error.txt  & exit -3
     
     
     
    REM
    REM --------------------------------------------------------------------------------------
    REM --------------------------------------------------------------------------------------
    REM                           Lancement de SQLOADER
    REM --------------------------------------------------------------------------------------
    REM --------------------------------------------------------------------------------------
     
     
        echo userid=%CONNECT_STRING% > param.par
     
        echo control="%CONTROL_FILE%" >> param.par
     
        echo log="%LOG_FILE%" >> param.par
     
        echo bad="%BAD_FILE%" >> param.par
     
        echo data="%INFILE%" >> param.par
     
        echo discard="%DSC_FILE%" >> param.par
     echo errors="100" >> param.par
     
     
    REM --------------------------------------------------------------------------------------
    REM --------------------------------------------------------------------------------------
    echo %DIR_TRT%
        CALL SQLLDR.EXE PARFILE=%DIR_TRT%\SCRIPT\param.par
    REM --------------------------------------------------------------------------------------
    REM --------------------------------------------------------------------------------------
     
        if exist %BAD_FILE% echo Erreur 2 : Présence d'enregistrements invalides. >> %DIR_TRT%\LOG\error.txt & exit -4    
     
        CALL sqlplus %CONNECT_STRING% @"..\SQL\%TRT_OSS310_852%.sql"
     
        if errorlevel 20 echo Warning 1 : La mise à jour de certains matricules a échoué. >>%DIR_TRT%\LOG\error.txt  & exit 1
     
        if errorlevel 10 echo Erreur 4 : Echec du script de Mise à jour automatique des variables de paie >>%DIR_TRT%\LOG\error.txt  & exit -6
     
    :fin
    exit 0

  2. #2
    Expert confirmé
    Avatar de laurentschneider
    Homme Profil pro
    Administrateur de base de données
    Inscrit en
    Décembre 2005
    Messages
    2 944
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Suisse

    Informations professionnelles :
    Activité : Administrateur de base de données
    Secteur : Finance

    Informations forums :
    Inscription : Décembre 2005
    Messages : 2 944
    Par défaut
    attentions, les systèmes de fichier unix sont case-sensitive, error.txt != ERROR.TXT

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
     
    CONNECT_STRING=$1
    INFILE=$2
    CHEMIN_SQLOADER=$3
    DIR_TRT=$4
    CONTROL_FILE=$DIR_TRT/SCRIPT/FL0852_OSS310.ctl
    LOG_FILE=$DIR_TRT/LOG/OSS310.LOG
    BAD_FILE=$DIR_TRT/LOG/OSS310.BAD
    DSC_FILE=$DIR_TRT/LOG/OSS310.DSC
    SQL_DIR=$DIR_TRT/SQL
    TRT_OSS310_852=TRT_OSS310_852
     
    if [ "$1" = "" ]
    then
      echo Usage 1: INTERFACE_PXL_060 connectString dataFile repLoader repTrt
      exit -100
    fi
     
    if [ "$2" = "" ]
    then
      echo Usage 2: INTERFACE_PXL_060 connectString dataFile repLoader repTrt
      exit -101
    fi 
    if [ "$3" = "" ]
    then
      echo Usage 3: INTERFACE_PXL_060 connectString dataFile repLoader repTrt   
      exit -102
    fi 
    if [ "$4" = "" ]
    then
      echo Usage 4: INTERFACE_PXL_060 connectString dataFile repLoader repTrt
      exit -103
    fi 
     
    if [ -f "$DSC_FILE" ]
    then 
      rm $DSC_FILE
    fi
    if [ -f "$LOG_FILE" ]
    then 
      rm $LOG_FILE
    fi
    if [ -f "$BAD_FILE" ]
    then 
      rm $BAD_FILE
    fi
    if [ -f "$DIR_TRT/LOG/ERROR.TXT" ]
    then 
      rm $DIR_TRT/LOG/ERROR.TXT
    fi
    if [ -f "$DIR_TRT/LOG/$DELTA_SQL_FILE.log" ]
    then 
      rm $DIR_TRT/LOG/$DELTA_SQL_FILE.log 
    fi
    if [ -f "$DIR_TRT/LOG/$INTEGRATION_SQL_EXECUTE.log" ]
    then
      rm  $DIR_TRT/LOG/$INTEGRATION_SQL_EXECUTE.log
    fi
     
    cd $DIR_TRT/SCRIPT
     
    ### ??? ###  
    # rem    ECHO %DIR_TRT%\..\BIN\ControlePXL.EXE userid=%CONNECT_STRING% -f %INFILE% -l %DIR_TRT%\LOG\Controle.log >.\SCRIPT\param.txt
    # rem    CALL %DIR_TRT%\..\BIN\ControlePXL.EXE userid=%CONNECT_STRING% -f %INFILE% -l %DIR_TRT%\LOG\Controle.log
    #    if errorlevel 20 echo Erreur 0 : Echec lors de l'ouverture du fichier de donnee %INFILE% >>%DIR_TRT%\LOG\error.txt & exit -1
    #    IF errorlevel 10 echo Erreur 1 : Fichier %INFILE% invalide : Nb d'enregistrements incorrect !>>%DIR_TRT%\LOG\error.txt  & exit -2
    #    if errorlevel 5  echo Erreur 2 : Arguments absents lors de l'appel ! >>%DIR_TRT%\LOG\error.txt  & exit -3
    ### ??? ###
     
    echo userid=$CONNECT_STRING > param.par
    echo control=$CONTROL_FILE >> param.par
    echo log=$LOG_FILE >> param.par
    echo bad=$BAD_FILE >> param.par
    echo DATA=$INFILE >> param.par
    echo discard=$DSC_FILE >> param.par
    echo errors="100" >> param.par
     
    echo $DIR_TRT
     
    sqlldr PARFILE=$DIR_TRT/SCRIPT/param.par
     
    IF [ -f "$BAD_FILE" ]
    then
      echo "Erreur 2 : Présence d'enregistrements invalides." >> $DIR_TRT/LOG/error.txt   
      exit -4    
    fi  
     
    sqlplus $CONNECT_STRING @../SQL/$TRT_OSS310_852.sql
     
    if [ $? != 0 ]
    then
      echo "Warning 1 : La mise à jour de certains matricules a échoué. ">>%DIR_TRT%\LOG\error.txt
      exit 1
    fi
     
    # ???
    #     if errorlevel 10 echo Erreur 4 : Echec du script de Mise à jour automatique des variables de paie >>%DIR_TRT%\LOG\error.txt  & exit -6
     
    exit 0

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. équivalent SQL*Loader pour FB / IB
    Par djeant dans le forum Outils
    Réponses: 9
    Dernier message: 10/01/2005, 21h26
  2. Chargement de fichier par SQL LOADER
    Par davy.g dans le forum SQL*Loader
    Réponses: 17
    Dernier message: 15/11/2004, 13h08
  3. SQL LOADER
    Par velo83 dans le forum SQL*Loader
    Réponses: 2
    Dernier message: 25/10/2004, 08h24
  4. Réponses: 4
    Dernier message: 10/06/2004, 18h05
  5. erreur sql loader et performance
    Par mobisky dans le forum SQL*Loader
    Réponses: 14
    Dernier message: 20/08/2003, 12h27

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo