[20140513]ORACLE_HOME环境变量结尾的斜杠.txt
--上午再次遇到环境变量结尾的斜杠问题,实际上我第一次遇到也感觉很奇怪。
--自己还做了一次跟踪,很难定位问题。
--正好看了链接http://www.xifenfei.com/5197.html,自己做一次测试:
$ export ORACLE_HOME=/u01/app/oracle11g/product/11.2.0/db_2/
--启动数据库:
SYS@test> startup
ORACLE instance started.
Total System Global Area 1603411968 bytes
Fixed Size 2228784 bytes
Variable Size 1006636496 bytes
Database Buffers 587202560 bytes
Redo Buffers 7344128 bytes
Database mounted.
Database opened.
--实际上以后如何进入都不会有任何问题。但是如果修改环境变量export ORACLE_HOME=/u01/app/oracle11g/product/11.2.0/db_2,问题就来了。
export ORACLE_HOME=/u01/app/oracle11g/product/11.2.0/db_2
$ sqlplus sys as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Tue May 13 15:59:11 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Enter password:
Connected to an idle instance.
--可以发现连接的idle instance。问题实际上oracle本地认证通过IPC,而ipc是直接访问共享内存段的。
$ export ORACLE_HOME=/u01/app/oracle11g/product/11.2.0/db_2/
SYS@test> oradebug setmypid
Statement processed.
SYS@test> oradebug ipc
Information written to trace file.
*** 2014-05-13 16:01:44.033
Processing Oradebug command 'ipc'
Dump of unix-generic skgm context
areaflags 000000f7
realmflags 0000001f
mapsize 00000800
protectsize 00001000
lcmsize 00001000
seglen 00200000
largestsize 0000000080000000
smallestsize 0000000001000000
stacklimit 0x7fbe07e9b0
stackdir -1
mode 640
magic acc01ade
Handle: 0x2a970040b0 `/u01/app/oracle11g/product/11.2.0/db_2/test'
Dump of unix-generic realm handle `/u01/app/oracle11g/product/11.2.0/db_2/test', flags = 00000000
--注意看看handle = `/u01/app/oracle11g/product/11.2.0/db_2/test'
--如果关闭数据库,将环境变量修改回来,再转储IPC看看。
$ export ORACLE_HOME=/u01/app/oracle11g/product/11.2.0/db_2
SYS@test> startup
ORACLE instance started.
Total System Global Area 1603411968 bytes
Fixed Size 2228784 bytes
Variable Size 1006636496 bytes
Database Buffers 587202560 bytes
Redo Buffers 7344128 bytes
Database mounted.
Database opened.
SYS@test> oradebug setmypid
Statement processed.
SYS@test> ora
ORACLE Oracle. ora_cpu ora_hash oradebug oradiag_oracle11g
SYS@test> oradebug ipc
Information written to trace file.
*** 2014-05-13 16:06:52.443
Processing Oradebug command 'ipc'
Dump of unix-generic skgm context
areaflags 000000f7
realmflags 0000001f
mapsize 00000800
protectsize 00001000
lcmsize 00001000
seglen 00200000
largestsize 0000000080000000
smallestsize 0000000001000000
stacklimit 0x7fbe07e9b0
stackdir -1
mode 640
magic acc01ade
Handle: 0x2a970040b0 `/u01/app/oracle11g/product/11.2.0/db_2test'
Dump of unix-generic realm handle `/u01/app/oracle11g/product/11.2.0/db_2test', flags = 00000000
--注意看看handle = `/u01/app/oracle11g/product/11.2.0/db_2test',可以发现db2test对比上面没有斜杠。
--说明oracle数据库的内存段是通过ORACLE_HOME和ORACLE_SID结合起来识别的,只要ORACLE_HOME或者ORACLE_SID
--不一样就不能通过IPC访问实例的内存段,也就不能登录数据库.