Linux Can';t打开lib'/usr/lib/oracle/11.2/client64/lib/libsqora.so.11.1';

Linux Can';t打开lib'/usr/lib/oracle/11.2/client64/lib/libsqora.so.11.1';,linux,oracle,shiny,shiny-server,unixodbc,Linux,Oracle,Shiny,Shiny Server,Unixodbc,背景: 我将我的闪亮应用程序部署到Linux Ubuntu 16.04上的闪亮服务器。我的应用程序需要连接到Oracle DB,所以我使用ODBC从我的Ubuntu服务器进行访问 问题: 当我在浏览器中打开我的应用程序时,它显示“已断开与服务器的连接” 所以我检查我的日志文件/var/log/shinny server/*.log。错误消息如下所示: 警告:错误:nanodbc/nanodbc.cpp:950:01000:[unixODBC][Driver Manager]无法打开lib'/us

背景
我将我的闪亮应用程序部署到Linux Ubuntu 16.04上的闪亮服务器。我的应用程序需要连接到Oracle DB,所以我使用ODBC从我的Ubuntu服务器进行访问

问题
当我在浏览器中打开我的应用程序时,它显示“已断开与服务器的连接”

所以我检查我的日志文件
/var/log/shinny server/*.log
。错误消息如下所示:

警告:错误:nanodbc/nanodbc.cpp:950:01000:[unixODBC][Driver Manager]无法打开lib'/usr/lib/oracle/11.2/client64/lib/libsqora.so.11.1':找不到文件58:匿名

停止执行

信息
我不知道它是如何出错的,所以我尝试列出与错误相关的信息。请让我知道,如果有其他线索,我可以提供,这样你会更容易地帮助我

以下是我在应用程序中连接到oracle db的方式

# ui.r
library(shiny)
shinyUI(
     absolutePanel(
       tableOutput( "table" )  
    )   
)
我还检查是否所有依赖项都是使用
ldd/usr/lib/oracle/11.2/client64/lib/libsqora.so.11.1

linux-vdso.so.1 =>  (0x00007ffe103d1000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f832bdcc000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f832bac3000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f832b8a6000)
libnsl.so.1 => /lib/x86_64-linux-gnu/libnsl.so.1 (0x00007f832b68c000)
libclntsh.so.11.1 => /usr/lib/oracle/11.2/client64/lib/libclntsh.so.11.1 (0x00007f8328d1d000)
libodbcinst.so.1 => /usr/lib/x86_64-linux-gnu/libodbcinst.so.1 (0x00007f8328b0b000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8328740000)
             /lib64/ld-linux-x86-64.so.2 (0x0000556d2817c000)
libnnz11.so => /usr/lib/oracle/11.2/client64/lib/libnnz11.so (0x00007f8328373000)
libaio.so.1 => /lib/x86_64-linux-gnu/libaio.so.1 (0x00007f8328171000)
libltdl.so.7 => /usr/lib/x86_64-linux-gnu/libltdl.so.7 (0x00007f8327f66000)
下面是我对
odbcinst.ini
odbc.ini

#odbcinst.ini
[Oracle 11g ODBC driver]
Description     = Oracle ODBC driver for Oracle 11g
Driver          = /usr/lib/oracle/11.2/client64/lib/libsqora.so.11.1
Setup           =
FileUsage       =
CPTimeout       =
CPReuse         =
Driver Logging  = 7
以下是我在
$HOME/.bashrc

export ORACLE_HOME=/usr/lib/oracle/11.2/client64
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export TNS_ADMIN=$ORACLE_HOME/network/admin:$TNS_ADMIN
这是我现在的环境

XDG_SESSION_ID=1707
TERM=xterm
SHELL=/bin/bash
SSH_CLIENT=xx.xxx.xx.xx xxxxx xx
OLDPWD=/usr/lib/oracle/11.2/client64/lib
SSH_TTY=/dev/pts/0
USER=chaosheng
LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib:/usr/lib/oracle/11.2/client64/lib:
TNS_ADMIN=/usr/lib/oracle/11.2/client64/network/admin:
MAIL=/var/mail/chaosheng
PATH=/usr/lib/oracle/11.2/client64/bin:/home/chaosheng/bin:/home/chaosheng/.local/bin:/usr/lib/oracle/11.2/client64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/oracle/11.2/client64/bin
PWD=/home/chaosheng
LANG=en_HK.UTF-8
SHLVL=1
HOME=/home/chaosheng
LANGUAGE=en_HK:en
LOGNAME=chaosheng
SSH_CONNECTION=xx.xxx.xx.xx xxxxx xx.xxx.xx.xx xx
LESSOPEN=| /usr/bin/lesspipe %s
XDG_RUNTIME_DIR=/run/user/1000
ORACLE_HOME=/usr/lib/oracle/11.2/client64
LESSCLOSE=/usr/bin/lesspipe %s %s
_=/usr/bin/env

正如一些社区成员所建议的,我的问题与这个问题非常相似:

尽管这两个问题的原因几乎相同,但解决方案可能略有不同。
因此,我仍然张贴我如何解决我的问题

首先,我在配置文件中几乎没有设置错误

首先,我需要在
$HOME/.profile
中设置我的env变量(
/HOME/MyName/.profile

尽管如此,我只在
$HOME/.bashrc
中设置了它们(
/HOME/MyName/.bashrc

其次,我在开始时使用了
/etc/shinny server/shinny server.conf
中的默认设置

run_as shiny; 
preserve_logs true;
server {
  listen 3838;

  location / { 
    # Host the directory of Shiny Apps stored in this directory
    site_dir /srv/shiny-server;

    # Log all Shiny output to files in this directory
    log_dir /var/log/shiny-server;

    # When a user visits the base URL rather than a particular application,
    # an index of the applications available in this directory will be shown.
    directory_index on;
  }
}

显然,上述设置不起作用

由于我将环境变量的设置置于
/home/MyName/.profile
中,因此我需要指定
run\u为MyName
,以便
/home/MyName/.profile
中定义的任何环境变量都可用于R进程

preserve_logs true;
server {
  listen 3838;

  location / {
    run_as MyName; 
    # Host the directory of Shiny Apps stored in this directory
    site_dir /srv/shiny-server;

    # Log all Shiny output to files in this directory
    log_dir /var/log/shiny-server;

    # When a user visits the base URL rather than a particular application,
    # an index of the applications available in this directory will be shown.
    directory_index on;
  }
}

我对linux系统的了解非常有限

也许以上不是问题的全部,但它只是解决了问题

可能重复的、等。
export ORACLE_HOME=/usr/lib/oracle/11.2/client64
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export TNS_ADMIN=$ORACLE_HOME/network/admin:$TNS_ADMIN
XDG_SESSION_ID=1707
TERM=xterm
SHELL=/bin/bash
SSH_CLIENT=xx.xxx.xx.xx xxxxx xx
OLDPWD=/usr/lib/oracle/11.2/client64/lib
SSH_TTY=/dev/pts/0
USER=chaosheng
LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib:/usr/lib/oracle/11.2/client64/lib:
TNS_ADMIN=/usr/lib/oracle/11.2/client64/network/admin:
MAIL=/var/mail/chaosheng
PATH=/usr/lib/oracle/11.2/client64/bin:/home/chaosheng/bin:/home/chaosheng/.local/bin:/usr/lib/oracle/11.2/client64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/oracle/11.2/client64/bin
PWD=/home/chaosheng
LANG=en_HK.UTF-8
SHLVL=1
HOME=/home/chaosheng
LANGUAGE=en_HK:en
LOGNAME=chaosheng
SSH_CONNECTION=xx.xxx.xx.xx xxxxx xx.xxx.xx.xx xx
LESSOPEN=| /usr/bin/lesspipe %s
XDG_RUNTIME_DIR=/run/user/1000
ORACLE_HOME=/usr/lib/oracle/11.2/client64
LESSCLOSE=/usr/bin/lesspipe %s %s
_=/usr/bin/env
run_as shiny; 
preserve_logs true;
server {
  listen 3838;

  location / { 
    # Host the directory of Shiny Apps stored in this directory
    site_dir /srv/shiny-server;

    # Log all Shiny output to files in this directory
    log_dir /var/log/shiny-server;

    # When a user visits the base URL rather than a particular application,
    # an index of the applications available in this directory will be shown.
    directory_index on;
  }
}

preserve_logs true;
server {
  listen 3838;

  location / {
    run_as MyName; 
    # Host the directory of Shiny Apps stored in this directory
    site_dir /srv/shiny-server;

    # Log all Shiny output to files in this directory
    log_dir /var/log/shiny-server;

    # When a user visits the base URL rather than a particular application,
    # an index of the applications available in this directory will be shown.
    directory_index on;
  }
}