当前位置: 首页 > news >正文

查看Oracle是哪个Oracle_home 下启动的

[root@rac1 ~]# ps -ef|grep smon
root       413 24903  0 22:30 pts/0    00:00:00 grep --color=auto smon
root     27165     1  0 22:11 ?        00:00:09 /u01/app/19.0.0/grid/bin/osysmond.bin
grid     27784     1  0 22:12 ?        00:00:00 asm_smon_+ASM1
oracle   29505     1  0 22:12 ?        00:00:00 ora_smon_cdb1
[root@rac1 ~]# gdb -q -x print_environment.gdb  a.out 29505 
a.out: No such file or directory.
Attaching to process 29505
Reading symbols from /u01/app/oracle/product/19.0.0/db_1/bin/oracle...(no debugging symbols found)...done.
Reading symbols from /u01/app/oracle/product/19.0.0/db_1/lib/libodm19.so...(no debugging symbols found)...done.
Loaded symbols for /u01/app/oracle/product/19.0.0/db_1/lib/libodm19.so
Reading symbols from /u01/app/oracle/product/19.0.0/db_1/lib/libofs.so...(no debugging symbols found)...done.
Loaded symbols for /u01/app/oracle/product/19.0.0/db_1/lib/libofs.so
Reading symbols from /u01/app/oracle/product/19.0.0/db_1/lib/libcell19.so...done.
Loaded symbols for /u01/app/oracle/product/19.0.0/db_1/lib/libcell19.so
Reading symbols from /u01/app/oracle/product/19.0.0/db_1/lib/libskgxp19.so...(no debugging symbols found)...done.
Loaded symbols for /u01/app/oracle/product/19.0.0/db_1/lib/libskgxp19.so
Reading symbols from /u01/app/oracle/product/19.0.0/db_1/lib/libskjcx19.so...(no debugging symbols found)...done.
Loaded symbols for /u01/app/oracle/product/19.0.0/db_1/lib/libskjcx19.so

-- Problem Statement:
On 10.2.0.1 in Production:
When attempting to connect AS SYSDBA to an open Oracle database,
the following message is received:

MESSAGE
-------------------
Connected to an idle instance.

However, the database was indeed up, running, and open.

CAUSE

The session's $ORACLE_HOME was not the same as that the instance was started with.

The Oracle instance was started with a trailing slash in $ORACLE_HOME: /opt/oracle/10gR2/

The session's $ORACLE_HOME was: /opt/oracle/10gR2 (without the trailing slash).

SOLUTION

From Note 373303.1, "How to Check the Environment Variables for an Oracle Process":


1. Determine the pid of the process at OS level, eg for the smon process:

ps -ef | grep smon

2. Get the environment of the process:

SOLARIS:
pargs -e <pid from above> | grep ORACLE

(See Note 373303.1 for syntax on other platforms.)

3. Modify ORACLE_HOME in the session environment to match this string.

Or, restart the instance using the ORACLE_HOME that matches that of the session environment.

There are cases when a database was started from an environment that did not have all the variables set correctly and this can cause troubles afterwards. Typical examples are :

- starting a database from an environment where ORACLE_HOME has a path with a final forward slash ( "/u01/oracle/12.1.0.1/db_1/" rather than "/u01/oracle/12.1.0.1/db_1")

- starting the database from an environment that points with the TNS_ADMIN parameter to the wrong sqlnet configuration files

- starting the database with the incorrect value for LD_LIBRARY_PATH  (LIBPATH for AIX or SHLIB_PATH for HP)

- starting the database from an environment that does not have the ORACLE_UQNAME variable set, although this is used to derive the path to a TDE( or SSL ) wallet.

This note presents the methods to be used to find out the values of the environment variables used by the database processes.

SOLUTION

1. Determine the pid of the process at OS level, eg for the smon process:
ps -ef | grep smon

2. Get the environment of the process:

SOLARIS:
pargs -e <pid from above> | grep ORACLE

LINUX:
cat /proc/<pid from above>/environ

AIX:
ps eauwww <pid from above>

HP-UX:
On this Unix flavor there is no command to grasp the process environment directly. This can only be extracted using a debugger from the _environ structure. This procedure can be used on the other Unix flavors, as follows:
gdb smon <pid from above>
This attaches gdb to the pid mentioned above. The smon name is just an indication that the process we attach to is smon, but the only parameter that matters is the pid.
After attaching to the process, the following command extracts the information from the _environ list:
p ((char**)_environ)[0]@30
which would list the first 30 environment variables. If more are defined, just increase the parameter after @.
As well, the list can be extracted one item from the list at a time, using an iterator like:
p ((char**)_environ)[i]
which would extract element #i+1.

Alternatively you can do this :

1) Create the following script called print_environment.gdb:

set $v = (char**)environ
while $v[0]
  print $v[0]
  set $v = $v+1
end
detach
quit

2) Get the PID of one background server process :

ps -ef | grep smon

3) Call print_environment.gdb to display the variable ( SHLIB_PATH in this case ) :

gdb -q -x print_environment.gdb  a.out <pid from above> | grep SHLIB_PATH


Windows:
To get the information on Windows, 2 things are needed:
1. check the registry for the ORACLE_* keys used to start the Oracle process. These keys are in:
HKEY_LOCAL_MACHINE/Software/Oracle/HOME<x>
(before 10g)
HKEY_LOCAL_MACHINE/SOFTWARE/ORACLE/KEY_<home name>
from 10g on.
2. check the environment variables that were used by the oracle process at startup.
For this, one would need the process explorer utility from sysinternals, which can be found at:
www.sysinternals.com
(http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx)
After starting the procexp utility, find the oracle process you want to check in the process list, right click on it, then select Properties. The Environment tab should indicate all the environment variables used when the process was started (even if dynamically in command line).
The utility also displays the key values from registry, but being so many it's difficult to look for them.


The most used application of this document is when dealing with the "Connected to an idle instance" scenario for a bequeath sysdba connection. This error indicates that ORACLE_SID and ORACLE_HOME in the current session do not match the same environment variables that were used when the database is started (ORACLE_SID and ORACLE_HOME are the strings used to uniquely identify the shared memory segment of the instance when a connection is done). Check the ORACLE_SID and ORACLE_HOME of the background process and compare them with the ones in the current session to find the mismatch.

http://www.lryc.cn/news/389647.html

相关文章:

  • 重温react-06(初识函数组件和快速生成格式的插件使用方式)
  • 【高考志愿】仪器科学与技术
  • Elasticsearch的Mapping
  • 【vocabulary in use (elementary)】6 Health and Illness
  • 探囊取物之多形式注册页面(基于BootStrap4)
  • 【C++进阶学习】第五弹——二叉搜索树——二叉树进阶及set和map的铺垫
  • 【RabbitMQ实战】Springboot 整合RabbitMQ组件,多种编码示例,带你实践 看完这一篇就够了
  • 【你也能从零基础学会网站开发】理解DBMS数据库管理系统架构,从用户到数据到底经历了什么
  • Vue.js 中的API接口封装实战与详解
  • 职场内卷、不稳定、没前景……怎么破?
  • LeetCode 算法:将有序数组转换为二叉搜索树 c++
  • 智慧公厕系统改变了人们对服务区公厕的看法
  • 终极指南:RNNS、Transformers 和 Diffusion 模型
  • WPF UI 3D 基本概念 点线三角面 相机对象 材质对象与贴图 3D地球 光源 变形处理 动作交互 辅助交互插件 系列三
  • 分子AI预测赛Task2笔记
  • 剖析DeFi交易产品之UniswapV4:创建池子
  • 速盾:cdn内容分发服务有哪些优势?
  • 如何利用React和Python构建强大的网络爬虫应用
  • 炎黄数智人:招商局集团推出AI数字员工“招小影”
  • 【开发篇】明明配置跨域声明,为什么却仍可以发送HTTP请求
  • 单片机中有FLASH为啥还需要EEROM?
  • Qt的源码目录集合(V5.12.12版本)
  • 记因hive配置文件参数运用不当导致 sqoop MySQL导入数据到hive 失败的案例
  • 自动化邮件通知:批处理脚本的通讯增强
  • 236、二叉树的最近公共祖先
  • WebStorm 2024 for Mac JavaScript前端开发工具
  • 【Redis7】零基础篇
  • [ROS 系列学习教程] 建模与仿真 - 使用 ros_control 控制差速轮式机器人
  • Ubuntu22.04使用Systemd设置ROS 2开机自启动遇到的问题
  • AI安全研究滞后?清华专家团来支招