【问题标题】:ksh remote function ssh calling another remote functionksh 远程函数 ssh 调用另一个远程函数
【发布时间】:2020-02-03 15:06:31
【问题描述】:
function test_me
{
sqlplus /nolog <<EOF
connect / as sysdba
oradebug dump systemstate 266
oradebug tracefile_name
EOF
}

function check_me 
{
ssh ${HST2} "$(typeset -f); test_me"
}

ssh ${HST1} "$(typeset -f); check_me"

函数 test_me 的定义在 HST1 上看起来不错,但在 EOF 附近被截断为 HST2,因不匹配而失败

有人有解决办法吗?

【问题讨论】:

  • 能否为您的问题添加更多信息? 1. 你想达到什么目的? 2. 实际发生了什么? 3. 可能是一个失败的测试用例
  • 两台主机上的登录shell都是ksh吗?
  • 从 sath 我正在登录 Oracle RAC 集群。我登录 RAC1A 的第一个节点,然后准备此 RAC1 上的数据库列表,在各个节点 RAC1B、RAC1C、RAC1D 上......然后登录每个 RAC1B 并连接到 DB ... ksh 中的远程功能对 EOF 不满意 .. 失败,不匹配

标签: ssh ksh


【解决方案1】:

有两点可以简化:

  1. 使用ProxyJump 选项让ssh 处理通过HST1 与HST2 的连接
  2. 通过标准输入将脚本提供给sqlplus,而不是尝试嵌入函数定义。

ssh -o ProxyJump=HST1 HST2 "sqlplus /nolog" <<EOF
  connect / as sysdba
  oradebug dump system state 266
  oradebug tracefile_name
EOF

【讨论】:

  • ProxyJump 对我没有帮助......因为我必须在 HST1 上运行其他功能来准备数据库列表......基于此我必须再次登录 HST1/2/3/4。连接数据库
【解决方案2】:

解决方法是删除 EOF,但我仍然不满意为什么 EOF 不起作用..

function test_me    
{
echo "select sysdate from dual;" > /tmp/run.sql
sqlplus / @/tmp/run.sql
}

function check_me 
{
ssh ${HST2} "$(typeset -f); test_me"
}
ssh ${HST1} "$(typeset -f); check_me"

【讨论】:

    猜你喜欢
    • 2021-11-07
    • 1970-01-01
    • 1970-01-01
    • 2012-09-05
    • 2021-07-25
    • 1970-01-01
    • 1970-01-01
    • 2013-02-16
    • 1970-01-01
    相关资源
    最近更新 更多