【问题标题】:Install Oracle Client from command line without user-interaction从命令行安装 Oracle 客户端,无需用户交互
【发布时间】:2019-11-09 13:48:30
【问题描述】:

我正在寻找一种在 Windows 上安装 Oracle 客户端但从命令行运行的方法。为了自动运行它,应该没有用户交互

Oracle 文档对于 Oracle Universal Installer 的命令行选项非常少。即使以setup.exe -silent -responseFile filename.rsp 身份运行设置,用户也必须在某个点按 ENTER。

【问题讨论】:

  • 为什么不用即时客户端? “安装”就像解压 zip 档案一样简单。
  • @a_horse_with_no_name,如果您需要 SQLplus 或 ODBC 驱动程序或 ODP.NET 提供程序或 tnsping 等工具,那么即时客户端是不够的。
  • SQLPlus 和 ODBC 有额外的包,但你是对的,它不适用于 .Net
  • 是的,SQLPlus 和 ODBC 可能不是很好的例子,但您可能需要许多组件,这些组件不是由其他软件包提供的。

标签: windows oracle command-line installation build-automation


【解决方案1】:

经过一番调查,我发现了如何获得完整的命令行选项:

setup.exe -help

这适用于版本 11.2、12.1 和 12.2。在 18c 和 19c 版本中,这不再起作用,而是您必须执行:

setup.exe -help -silent

这里是 18c 设置的示例输出:

Usage:  setup.exe [<flag>] [<option>]
Following are the possible flags:
    -help - display help.
    -silent - run in silent mode. The inputs can be a response file or a list of command line variable value pairs.
            [-ignorePrereqFailure - ignore all prerequisite checks failures.]
            [-lenientInstallMode - perform the best effort installation by automatically ignoring invalid data in input parameters.]
            [-showProgress - show the installation progress on the console. This option is supported for silent mode installation only.]
    -responseFile - specify the complete path of the response file to use.
    -invPtrLoc - point to a different inventory location. The orainst.loc file contains the location of the central inventory (inventory_loc) and the inventory group (inst_group).
    -jreLoc - specify the location for the jre used in the installation.
    -logLevel - enable the log of messages up to the priority level provided in this argument. Valid options are: severe, warning, info, config, fine, finer, finest.
    -paramFile - specify the location of the oraparam.ini file to be used in the installation.
    -executePrereqs | -executeConfigTools | -deinstall
    -executePrereqs - execute the prerequisite checks only.
    -executeConfigTools - execute the config tools for an installed home.
            [-all - execute all the config tools for an installed home, including the config tools that have already succeeded.]
    -deinstall - uninstall the specified home.
    -debug - run in debug mode.
    -executeSysPrereqs - execute the system prerequisite checks and exit.
    -ignoreSysPrereqs - ignore the results of the system prerequisite checks.
    -printdiskusage - log the debug information for the disk usage.
    -printmemory - log the debug information for the memory usage.
    -printtime - log the debug information for the time usage.
    -waitForCompletion - wait for the completion of the installation, instead of spawning the installer and returning the console prompt.
    -suppressPreCopyScript - suppress the execution of the precopy script.
    -acceptUntrustedCertificates - accept untrusted certificates from a secure site.
    -suppressPostCopyScript - suppress the execution of the postcopy script.
    -noconfig - do not execute the config tools.
    -noconsole - suppress the display of messages in the console. The console is not allocated.
    -ignoreInternalDriverError - ignore any internal driver errors.
    -promptForPassword - provide the passwords on the console during a silent installation of an Oracle database.
    -remotecp - specify the path to the remote copy program on the local cluster node. Used only for cluster installs.
    -remoteshell - specify the path to the remote shell program on the local cluster node. Used only for cluster installs.

最后,即使没有可以由软件部署系统执行的响应文件,我也设法使用单个命令运行完整设置。以下是一些示例(需要在一行中):

setup.exe -silent -nowait -ignoreSysPrereqs -ignorePrereq -waitforcompletion -force \
   "INVENTORY_LOCATION=C:\Program Files\Oracle\Inventory" \
   "ORACLE_BASE=c:\oracle\product" \
   "ORACLE_HOME=c:\oracle\product\12.1\Client_x64" \
   "SELECTED_LANGUAGES=de,en,fr,it" \
   "oracle.install.IsBuiltInAccount=true" \
   "oracle.install.client.installType=Custom" \
   "oracle.install.client.customComponents=oracle.rdbms.util:12.1.0.2.0,oracle.sqlplus:12.1.0.2.0,oracle.odbc:12.1.0.2.0"


setup.exe -silent -nowait -ignoreSysPrereqs -ignorePrereqFailure -skipPrereqs -waitForCompletion -force \
   "INVENTORY_LOCATION=C:\Program Files\Oracle\Inventory" \
   "ORACLE_BASE=c:\oracle\product" \
   "ORACLE_HOME=c:\oracle\product\12.2\Client_x64" \
   "oracle.install.IsBuiltInAccount=true" \
   "oracle.install.client.installType=Custom" \
   "oracle.install.client.customComponents=oracle.rdbms.util:12.2.0.1.0,oracle.sqlplus:12.2.0.1.0,oracle.odbc:12.2.0.1.0"


setup.exe -silent -nowait -ignoreSysPrereqs -ignorePrereqFailure -waitForCompletion -force \
   "ORACLE_BASE=c:\oracle\product" \
   "ORACLE_HOME=c:\oracle\product\18c\Client_x86" \
   "oracle.install.IsBuiltInAccount=true" \
   "oracle.install.client.installType=Custom" \
   "oracle.install.client.customComponents=oracle.rdbms.util:18.0.0.0.0,oracle.sqlplus:18.0.0.0.0,oracle.odbc:18.0.0.0.0"

注意,选项-nowait 没有在帮助中提及,但需要取消提示“Press ENTER to close the program”。

选项 -force 未在 12.2 及更高版本的帮助中提及,但似乎仍然有效强制安装在非空目录中

显然 18c 32 位安装程序不喜欢选项 "INVENTORY_LOCATION=C:\Program Files (x86)\Oracle\Inventory",请跳过此条目。使用"INVENTORY_LOCATION=C:\PROGRA~2\Oracle\Inventory" 会导致c:\Program Files (x86)\Oracle\Inventory\locks\ 中的锁定文件异常

【讨论】:

    【解决方案2】:
    setup.exe -silent -nowait -ignoreSysPrereqs -ignorePrereq -waitForCompletion \
    -force "INVENTORY_LOCATION=C:\Program Files\Oracle\Inventory" \
    "ORACLE_BASE=c:\oracle\product" "ORACLE_HOME=c:\oracle\product\12.2\Client_x64" \
    "oracle.install.IsBuiltInAccount=true" \
    "oracle.install.client.installType=Administrator" \
    "oracle.install.client.customComponents=oracle.rdbms.util:12.2.0.1.0,oracle.sqlplus:12.2.0.1.0,oracle.odbc:12.2.0.1.0"
    

    这对我有用。这将从 Windows 10 中的命令提示符安装 Oracle Client Admin 版本{正如我所使用的}。感谢之前的帖子。

    【讨论】:

    • 我不确定,但我认为当您安装“管理员”版本时,您无法指定任何自定义组件(它们可能会被忽略)
    • 我怎样才能将光标保持在同一行直到安装完成。就我而言,在命令提示符中给出语句后,我需要按 Enter。然后它开始安装并且光标移动到下一行。 Offcourse 安装程序正在运行。但是如何控制光标而不是移动到下一行?
    • 你真的关心光标位置吗?我认为你无法控制。
    • 我正在尝试“在 Windows 容器中安装 Oracle 客户端”,但没有发生。我想到了指挥位置的问题。光标一到新位置,Setup.exe 就会运行一分钟然后停止。
    • 也许可以试试-force
    猜你喜欢
    • 2019-10-19
    • 1970-01-01
    • 2021-08-08
    • 2019-06-24
    • 2011-12-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-08
    相关资源
    最近更新 更多