ITPub博客

首页 > 数据库 > Oracle > 我对于ORACLE_SID的理解

我对于ORACLE_SID的理解

原创 Oracle 作者:jayklx 时间:2011-01-01 17:19:57 0 删除 编辑

ORACLE_SID和ORACLE_HOME是最基本的必须设置的两个环境变量。

Tom大师如是说

If you’re unfamiliar with the term SID or ORACLE_SID, a full definition is called for. The SID is a site identifier. It and ORACLE_HOME (where the Oracle software is installed) are hashed together in UNIX to create a unique key name for attaching an SGA. If your ORACLE_SID or ORACLE_HOME is not set correctly, you’ll get the ORACLE NOT AVAILABLE error, since you can’t attach to a shared memory segment that is identified by this unique key. On Windows, shared memory isn’t used in the same fashion as UNIX, but the SID is stillimportant. You can have more than one database on the same ORACLE_HOME, so you need a way to uniquely identify each one, along with their configuration files.
根据Tom大师所说的,在Unix/Linux下,Oracle的实例是有一块共享内存(SGA)和一组后台进程组成的,

Oracle使用ORACLE_HOME和ORACLE_SID进行hash,得到一个key,
Oracle根据这个key来寻找SGA,如果不设置这两个环境变量,oracle就无法找到分配的SGA,
也就无法连接到实例。这也是这两个环境变量为什么必须设置的原因。

[@more@]我们可以利用oracle自带的sysresv工具查看到

oracle@solaris:~$ sysresv

IPC Resources for ORACLE_SID "test" :
Shared Memory:
ID KEY
58 0xdced621c
Semaphores:
ID KEY
5 0xf52cedb8
Oracle Instance alive for sid "test"

另外,使用ipcs也可以看到共享内存的情况
oracle@solaris:~$ ipcs -m | grep ora
m 58 0xdced621c --rw-rw---- oracle dba
可以看到,两者是对应的。

由上面的结论可知,在相同的ORACLE_HOME下,必须使用不同ORACLE_SID来区分不同的实例,
在不同的ORACLE_HOME下,可以有相同的ORACLE_SID,Oracle照样可以区分不同的实例,
这点在盖国强先生的《深入解析Oracle》中也得到了验证。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/10896118/viewspace-1044094/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: RMAN基础
请登录后发表评论 登录
全部评论

注册时间:2010-12-26

  • 博文量
    15
  • 访问量
    17964