Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows Oracle在bat文件中导入批处理文件_Windows_Oracle_Batch File_Sqlplus - Fatal编程技术网

Windows Oracle在bat文件中导入批处理文件

Windows Oracle在bat文件中导入批处理文件,windows,oracle,batch-file,sqlplus,Windows,Oracle,Batch File,Sqlplus,我必须运行几个bat文件才能将大量数据导入Oracle我只想运行一个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 cl

我必须运行几个bat文件才能将大量数据导入Oracle我只想运行一个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/password@ConnectString" 
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/tiger@db_orcl
: end 
pause

我尝试使用此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"
但是如果我直接运行第一个bat文件

G:\1>import.bat ###/###@###.##
导入开始


请给我一些建议,让我尝试一下

此批应该可以工作,只需要设置最大可能数量。 该批将评估当前的最大数量

@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
)
编辑另一个版本,该版本通过管道将一个(空)回显导入到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
)

不同之处在于,您可以从其子文件夹手动运行批处理。好吧,我想我有点误导了您:子文件夹名称中的数字只表示有许多子文件夹。他们的真名是字母数字。但我尝试了使用包含Import.bat的3个子文件夹编写脚本。g:\1\g:\2\g:\3\这就是我得到的结果:“系统找不到指定的批次标签-Cont”@为了抱歉我的错误,只需忘记(在上面更改)。是否要处理`G:``中的所有子文件夹?@STO我添加了一个版本,该版本将迭代`G:`的所有子文件夹。第二个版本运行良好,但在两个导入过程之间,我必须按任意键:),因为import.bat文件末尾的“暂停”。从每个import.bat的末尾删除暂停不是一件大事,但是您可以在脚本中添加忽略此暂停的内容。@STO很抱歉延迟了。我将添加另一个版本,该版本通过管道将(空)echo导入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
)