通过厨师配方调用,SQLPLUS无法识别Windows 12R2中的Oracle_Home环境变量

时间:2018-09-07 13:44:01

标签: windows oracle chef sqlplus chef-recipe

我正在使用厨师客户端运行厨师食谱,该厨师食谱将设置ORACLE_BASE,ORACLE_HOME和ORACLE_SID环境变量,然后执行oracle sql脚本来创建数据库实例。

使用Windows批处理文件(.bat)设置环境变量

SET ORACLE_BASE=C:\<ora_base>
SET ORACLE_HOME=C:\<ora_base>product\12.2.0

然后在同一批处理文件中执行sql脚本文件。

<Dir>\path\product\12.2.0\dbhome_1\bin\sqlplus /nolog @C:\files\myscript.sql

我也将厨师资源'batch'与上面的代码一起使用,仍然抛出相同的错误。 Sqlplus无法看到oracle_home环境变量。

  

STDERR:错误6初始化SQL * Plus
  SP2-0667:找不到消息文件sp1.msb
  SP2-0750:您可能需要将ORACLE_HOME设置为Oracle软件目录

为什么主厨配方执行看不到oracle_home? 有人可以提供一种解决方案来执行sql脚本,而不会出现此错误。

1 个答案:

答案 0 :(得分:0)

您的<table class="table table-striped table-bordered" id="table"> <thead> <tr> <th scope="col">ID</th> <th scope="col">Name</th> <th scope="col">Description</th> <th scope="col">Cost</th> </tr> </thead> <tbody id="myTable"> <tr> <td scope="row">1</td> <td scope="row">2</td> <td scope="row">3</td> <td scope="row"><span>10</span></td> </tr> <tr> <td scope="row">1</td> <td scope="row">2</td> <td scope="row">3</td> <td scope="row"><span>30</span></td> </tr> </tbody> </table> <span id="val"></span>与您从中启动SQL * Plus的路径不匹配。由于您使用的是不同的简化版本,因此很难确定,但是您似乎只保留了ORACLE_HOME部分:

dbhome_1

或者可能,如果它们不同:

SET ORACLE_BASE=C:\<ora_base>
SET ORACLE_HOME=C:\<ora_base>\product\12.2.0\dbhome_1