本文共 4290 字,大约阅读时间需要 14 分钟。
[20150228]启动问题.txt
--生产系统出现一个奇怪的问题,在服务器端看:
$ rlsql
SQL*Plus: Release 11.2.0.3.0 Production on Sat Feb 28 09:46:12 2015 Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected to an idle instance.SYS@test> quit
Disconnected--奇怪服务端使用直接连接看不到数据库。
--仔细询问了一下,别人使用windows client 远程启动过这个数据库。
--如果在服务端使用sqlplus scott/xxxx@tns_alias 连接可以连上。我只好在自己的测试环境做这个测试。 --发现确实存在这个问题,自己做一个测试:$ sysresv
IPC Resources for ORACLE_SID "test" : Shared Memory ID KEY No shared memory segments used Semaphores: ID KEY No semaphore resources used Oracle Instance not alive for sid "test" --没有相关信息。SYS@40> oradebug setmypid;
Statement processed. SYS@40> oradebug ipc Information written to trace file. SYS@40> oradebug tracefile_name; /u01/app/oracle11g/diag/rdbms/test/test/trace/test_ora_25317.trcHandle: 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 Area #0 `Fixed Size' containing Subareas 0-0 Total size 0000000000220230 Minimum Subarea size 00000000 Area Subarea Shmid Stable Addr Actual Addr 0 0 21889024 0x00000060000000 0x00000060000000 Subarea size Segment size 0000000000221000 0000000001000000 .... -------------- system semaphore information ------------- ------ Shared Memory Segments -------- key shmid owner perms bytes nattch status 0x00000000 21889024 oracle11g 640 4096 0 0x00000000 21921793 oracle11g 640 4096 0 0x7f1ca950 21954562 oracle11g 640 4096 0 ------ Semaphore Arrays -------- key semid owner perms nsems 0xf0052be8 47546376 oracle11g 640 126 0xf0052be9 47579145 oracle11g 640 126 0xf0052bea 47611914 oracle11g 640 126 0xf0052beb 47644683 oracle11g 640 126 0xf0052bec 47677452 oracle11g 640 126 ------ Message Queues -------- key msqid owner perms used-bytes messages*** 2015-02-28 09:58:50.420
--为什么sysres与使用oradebug ipc 看到的不同呢?--远程停止后,在服务器启动数据库:
SYS@test> oradebug setmypid
Statement processed. SYS@test> oradebug ipc Information written to trace file. SYS@test> oradebug tracefile_name /u01/app/oracle11g/diag/rdbms/test/test/trace/test_ora_26282.trc$ sysresv
IPC Resources for ORACLE_SID "test" :
Shared Memory: ID KEY 22020096 0x00000000 22052865 0x00000000 22085634 0x9e347558 Semaphores: ID KEY 48005128 0x8eb7ef30 48037897 0x8eb7ef31 48070666 0x8eb7ef32 48103435 0x8eb7ef33 48136204 0x8eb7ef34 Oracle Instance alive for sid "test"--查看转储文件,马上明白为什么?
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 Area #0 `Fixed Size' containing Subareas 0-0 Total size 0000000000220230 Minimum Subarea size 00000000 Area Subarea Shmid Stable Addr Actual Addr 0 0 22020096 0x00000060000000 0x00000060000000 Subarea size Segment size 0000000000221000 0000000001000000-------------- system semaphore information -------------
------ Shared Memory Segments -------- key shmid owner perms bytes nattch status 0x00000000 22020096 oracle11g 640 4096 0 0x00000000 22052865 oracle11g 640 4096 0 0x9e347558 22085634 oracle11g 640 4096 0 ------ Semaphore Arrays -------- key semid owner perms nsems 0x8eb7ef30 48005128 oracle11g 640 126 0x8eb7ef31 48037897 oracle11g 640 126 0x8eb7ef32 48070666 oracle11g 640 126 0x8eb7ef33 48103435 oracle11g 640 126 0x8eb7ef34 48136204 oracle11g 640 126 ------ Message Queues -------- key msqid owner perms used-bytes messages--看看Handle在db_2,test之间没有/.
--我只要修改ORACLE_HOME环境变量,加入/就可以了。重复测试看看。
$ echo $ORACLE_HOME
/u01/app/oracle11g/product/11.2.0/db_2 $ export ORACLE_HOME=/u01/app/oracle11g/product/11.2.0/db_2/ $ sysresvIPC Resources for ORACLE_SID "test" :
Shared Memory: ID KEY 22151168 0x00000000 22183937 0x00000000 22216706 0x7f1ca950 Semaphores: ID KEY 48300040 0xf0052be8 48332809 0xf0052be9 48365578 0xf0052bea 48398347 0xf0052beb 48431116 0xf0052bec Oracle Instance alive for sid "test"$ rlsql
SQL*Plus: Release 11.2.0.3.0 Production on Sat Feb 28 10:14:32 2015 Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SYS@test>总结:
1.远程启动数据库,我测试了windows,linux都存在这个问题。 2.看来要避免sys口令泄露,或者回收sys口令,避免开发自己启动数据库。 3.另外说明1下,如果数据库没有开启,远程client要连接启动数据库,监听要配置静态注册。转载地址:http://xuczl.baihongyu.com/