2017-01-24 10 views
-1

오라클에 대량 데이터를 가져 오려면 여러 박쥐 파일을 실행해야합니다. 하나의 박쥐 파일 만 실행하고 싶습니다.
오라클은 bat 파일 내의 배치 파일을 가져옵니다.

g:\1\import.bat 
g:\2\import.bat 
... 
g:\n\import.bat 

그리고 그들은 다음과 같습니다 :

배치 파일는 다음과 같이, 분리하고 하위 폴더에있는

@echo off 
REM Copyright (c) 1999-2004 by Intergraph Corporation. All Rights Reserved. 
REM Use this script to create feature class tables via SQL and populate tables with SQL*Loader. 
REM The GDOSYS schema is no longer created via this script. If you want metadata to be loaded, 
REM GDOSYS needs to exist prior to running import. You may use Database Utilities to create GDOSYS. 
REM If you are using a comma for a decimal separator, set the NLS_NUMERIC_CHARACTERS parameter: 
REM SET NLS_NUMERIC_CHARACTERS=,. 
if "%1"=="" goto usage 
SQLPLUS %1> @"kat_ki_vectors_epulet_i_pre.sql" 
SQLLDR %1 CONTROL='kat_ki_vectors_epulet_i' 
SQLPLUS %1 @"kat_ki_vectors_epulet_i_post.sql" 
goto end 
: usage 
echo SYNTAX: "Import username/[email protected]" 
echo WHERE: 
echo - username/password is the Oracle user account where the data will be loaded. 
echo - ConnectString is the Oracle NET string used to connect to the Oracle server. 
echo See the document "Working with GeoMedia Professional" for more 
information. 
echo EXAMPLES: 
echo Import scott/[email protected]_orcl 
: end 
pause 

내가이 방망이 그들 모두를 실행하려고 파일 (적절한 인증 포함) :

call g:\1\import.bat ###/###@###.## 
call g:\2\import.bat ###/###@###.## 
... 
call g:\n\import.bat ###/###@###.## 

는 그러나 이것은 내가 가진 것입니다 : 그러나

G:\>do_the_trick.bat 
G:\>call g:\1\import.bat ###/###@###.## 
SQL*Plus: Release 11.1.0.6.0 - Production on K. Jan. 24 15:35:08 2017 
Copyright (c) 1982, 2007, Oracle. All rights reserved. 
Kapcsolódási cél: 
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options 
SP2-0310: nem lehet megnyitni a(z) "kat_ki_vectors_epulet_i_pre.sql" fájlt 

"Kapcsolódási cél" ---> "Connecting target" 
"nem lehet megnyitni a(z) " ---> "Can not be opened" 

내가 가져 오기가 시작 직접

G:\1>import.bat ###/###@###.## 

최초의 박쥐 파일을 실행합니다.

시험해보기위한 팁을주세요.

+0

차이점은 수동으로 하위 디렉토리에서 배치를 실행한다는 것입니다. – LotPings

답변

1

이 배치는 작동해야하며 가능한 최대 숫자 만 설정하면됩니다. 일괄 처리는 현재 가장 높은 번호를 평가합니다.

@Echo off 
CD /D "G:\" 
:: first get the highest number increase if max > 1000 
For /L %%N in (1,1,1000) Do If Exist "G:\%%N" (Set Max=%%N) Else Goto :Cont 
:Cont 
:: iterate through all numbered subdirs 
For /L %%N in (1,1,%Max%) Do (
    Pushd "G:\%%N" 
    Call import.bat ###/###@###.## 
    PopD 
) 

G:\모든 하위 디렉토리는

@Echo off 
For /D %%A in (G:\*) Do (
    Pushd "%%~fA" 
    Call import.bat ###/###@###.## 
    PopD 
) 

편집 파이프 (빈) 수동으로 acknowlede 할 필요를 import.bat 없습니다 에코 또 다른 버전을 사용할 수 얻으려면. 또한 import.bat의 존재 여부를 검사합니다.

@Echo off 
Set App=Import.bat 
Set Cred=###/###@###.## 
For /D %%A in (G:\*) Do (
    Pushd "%%~fA" 
    If Exist %APP% Echo:|Call %App% %Cred% 
    PopD 
) 
+0

좋아, 나는 약간 추측했다 : 하위 폴더의 이름에있는 숫자는 많은 하위 폴더 만 나타냅니다. 실제 이름은 영숫자입니다. 그러나 Import.bat가 포함 된 3 개의 하위 폴더로 스크립트를 시도했습니다. g : \ 1 \ g : \ 2 \ g : \ 3 \ 그리고 즉 내가 무엇을 가지고 : "일괄 라벨 지정을 찾을 수 없습니다 - 계속" – STO

+0

@STO 죄송 내 잘못이 단순히 잊어 (위에서 변경됨). 'G : \ '에있는 모든 하위 폴더를 처리 하시겠습니까? – LotPings

+0

@STO'G : \ '의 ** ALL ** subdirs를 반복 할 버전을 추가했습니다. – LotPings