[20160310]神奇的斜线.txt

[20160310]神奇的斜线.txt

--今天发现同事配置的数据库服务器,没有配置NLS_DATE_FORMAT环境变量,当打开.bash_profile时发现同事配置的-ORACLE_HOME环境变
--量结尾带有/,忍不住想说一番,还好我测试以下,发现11.2.0.4版本,ORACLE_HOME最后有没有/都可以正常进入连上数据库(当执行
--sqlplus / as sysdba).

--相关链接可以看我以前写的blog:

[20140513]ORACLE_HOME环境变量结尾的斜杠
http://blog.itpub.net/267265/viewspace-1160328/
[20150911]关于远程启动数据库问题.txt
http://blog.itpub.net/267265/viewspace-1797866/

1.测试1:

$ export ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/dbhome_1/
$ rlsql
SQL*Plus: Release 11.2.0.4.0 Production on Thu Mar 10 14:57:44 2016
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SYS@book> @ &r/ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

--正常,可以登录。

2.测试2:
[oracle@gxqyydg4 IP=100.78 ~/gdul 6]$ export ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/dbhome_1
[oracle@gxqyydg4 IP=100.78 ~/gdul 7]$ rlsql
SQL*Plus: Release 11.2.0.4.0 Production on Thu Mar 10 14:58:48 2016
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SYS@book> @ &r/ver1

PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

--正常,可以登录。也就是将从11.2.0.4,环境变量ORACLE_HOME无论后面有没有/,都不影响进入数据库。

3.我启动数据库是设置ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/dbhome_1(没有斜线的)。
--设置ORACLE_HOME结尾带斜线。
$ export ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/dbhome_1/
SYS@book> @ &r/spid

       SID    SERIAL# SPID       PID  P_SERIAL# C50
---------- ---------- ------ ------- ---------- --------------------------------------------------
       112        519 1030        34        244 alter system kill session '112,519' immediate;

$ cat /proc/1030/environ | tr '=' '\n'|strings | grep -A1 ORACLE_HOME
ORACLE_HOME
/u01/app/oracle/product/11.2.0.4/dbhome_1/

$ ps -ef | grep ora_pmo[n]
oracle   53188     1  0 Mar08 ?        00:00:22 ora_pmon_book

$ cat /proc/53188/environ | tr '=' '\n'|strings | grep -A1 ORACLE_HOME
ORACLE_HOME
/u01/app/oracle/product/11.2.0.4/dbhome_1

--可以发现ORACLE_HOME不一样,但是都可以正常连接数据库。

4.看看ipc信息:

SYS@book> oradebug setmypid
Statement processed.
SYS@book> oradebug ipc
IPC information written to the trace file
*** 2016-03-10 15:10:31.001
Processing Oradebug command 'ipc'
Dump of unix-generic skgm context
areaflags            000000f7
realmflags           0000001f
mapsize              00000800
protectsize          00001000
lcmsize              00001000
seglen               00200000
largestsize  0000000480000000
smallestsize 0000000000400000
stacklimit     0x7fff5659d250
stackdir                   -1
mode                      640
magic                acc01ade
Handle:        0x7fd033e7e0b0 `/u01/app/oracle/product/11.2.0.4/dbhome_1book'

--注意看Handle:        0x7fd033e7e0b0 `/u01/app/oracle/product/11.2.0.4/dbhome_1book'。

5.设置ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/dbhome_1/
SYS@book> shutdown immediate ;
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@book> exit

$ export ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/dbhome_1/
SYS@book> startup
ORACLE instance started.
Total System Global Area  634732544 bytes
Fixed Size                  2255792 bytes
Variable Size             197133392 bytes
Database Buffers          427819008 bytes
Redo Buffers                7524352 bytes
Database mounted.
Database opened.

SYS@book> oradebug setmypid
Statement processed.
SYS@book> oradebug ipc
IPC information written to the trace file

Processing Oradebug command 'ipc'
Dump of unix-generic skgm context
areaflags            000000f7
realmflags           0000001f
mapsize              00000800
protectsize          00001000
lcmsize              00001000
seglen               00200000
largestsize  0000000480000000
smallestsize 0000000000400000
stacklimit     0x7fff6e19ad40
stackdir                   -1
mode                      640
magic                acc01ade
Handle:        0x7f51a90520b0 `/u01/app/oracle/product/11.2.0.4/dbhome_1book'
--可以发现无论设置ORACLE_HOME带与不带结尾的斜线,ipc看到的Handle 都是一样的。

5.再看看看监听:
--注当前设置的 ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/dbhome_1/

$ ps -ef | grep tnslsn[r]
oracle   53211     1  0 Feb28 ?        00:00:21 /u01/app/oracle/product/11.2.0.4/dbhome_1/bin/tnslsnr LISTENER -inherit

$ cat /proc/53211/environ | tr '=' '\n'|strings | grep -A1 ORACLE_HOME
ORACLE_HOME
/u01/app/oracle/product/11.2.0.4/dbhome_1

--可以发现监听的ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/dbhome_1

--从远程使用sys用户连上数据库

d:\tools\rlwrap>sqlplus sys/xxxxxx@78 as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Thu Mar 10 15:25:24 2016
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SYS@78> shutdown immediate ;
Database closed.
Database dismounted.
ORACLE instance shut down.

SYS@78> startup
ORACLE instance started.
Total System Global Area  634732544 bytes
Fixed Size                  2255792 bytes
Variable Size             197133392 bytes
Database Buffers          427819008 bytes
Redo Buffers                7524352 bytes
Database mounted.
Database opened.

--注要远程连接关闭后启动数据库一定要配置静态监听。注意这个时候实际上因为监听进程的ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/dbhome_1
--这样远程启动的数据库环境变量ORACLE=/u01/app/oracle/product/11.2.0.4/dbhome_1,在服务器上看看。

$ ps -ef | grep dbw[0]
oracle    1559     1  0 15:35 ?        00:00:00 ora_dbw0_book

$ cat /proc/1559/environ | tr '=' '\n'|strings | grep -A1 ORACLE_HOME
ORACLE_HOME
/u01/app/oracle/product/11.2.0.4/dbhome_1

--可以发现ORACLE启动的进程已经是环境变量ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/dbhome_1.

$ export ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/dbhome_1/

[oracle@gxqyydg4 IP=100.78 ~/gdul 19]$ rlsql
SQL*Plus: Release 11.2.0.4.0 Production on Thu Mar 10 15:39:50 2016
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SYS@book> @ &r/spid

       SID    SERIAL# SPID       PID  P_SERIAL# C50
---------- ---------- ------ ------- ---------- --------------------------------------------------
        80          3 1638        31          2 alter system kill session '80,3' immediate;

SYS@book> host  cat /proc/1638/environ | tr '=' '\n'|strings | grep -A1 ORACLE_HOME
ORACLE_HOME
/u01/app/oracle/product/11.2.0.4/dbhome_1/

--可以发现现在ORACLE_HOME已经没有任何影响。换一句话讲从11.2.0.4开始,无论ORACLE_HOME结尾是否带/.

--ipc 看到的handle都是Handle:        0x7f51a90520b0 `/u01/app/oracle/product/11.2.0.4/dbhome_1book'.
--也就是 最后的连接就是没有斜线的。

6.补充11.2.0.3情况看看:

$ 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             973082064 bytes
Database Buffers          620756992 bytes
Redo Buffers                7344128 bytes
Database mounted.
Database opened.
SYS@test> oradebug setmypid
Statement processed.
SYS@test> oradebug ipc
Information written to trace file.

*** 2016-03-10 15:47:35.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       0x7fbe07e840
stackdir                   -1
mode                      640
magic                acc01ade
Handle:          0x2a970040b0 `/u01/app/oracle11g/product/11.2.0/db_2/test'

--最后的连接存在斜线。如果这个时候设置ORACLE_HOME没有斜线.

$ export ORACLE_HOME=/u01/app/oracle11g/product/11.2.0/db_2
$ rlsql
SQL*Plus: Release 11.2.0.3.0 Production on Thu Mar 10 15:51:00 2016
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
Connected to an idle instance.

--无法连接上打开的数据库。如果启动数据库:

SYS@test> startup
ORACLE instance started.
Total System Global Area 1603411968 bytes
Fixed Size                  2228784 bytes
Variable Size             973082064 bytes
Database Buffers          620756992 bytes
Redo Buffers                7344128 bytes
ORA-01102: cannot mount database in EXCLUSIVE mode

SYS@test> shutdown immediate ;
ORA-01507: database not mounted

总结:
当然从这些小细节,可以看出oracle一直不断的改进进步。从管理角度讲最好不要结尾的斜线。

时间: 2024-08-20 15:04:59

[20160310]神奇的斜线.txt的相关文章

[20150924]tnsnames.ora是否可以带斜线.txt

[20150924]tnsnames.ora是否可以带斜线.txt --10g开始oracle支持ezconnect简单连接方式建立与数据库的连接. d:\tools\sqltemp>sqlplus scott/xxxxxx@192.168.100.40:1521/test.com SQL*Plus: Release 12.1.0.1.0 Production on Thu Sep 24 08:32:43 2015 Copyright (c) 1982, 2013, Oracle.  All r

Word,PDF,PPT,TXT之间的转换方法

一.把PPT转WORD形式的方法 1.利用"大纲"视图 打开PPT演示文稿,单击"大纲",在左侧"幻灯片/大纲"任务窗格的"大纲"选项卡里单击一下鼠标,按"Ctrl+A"组合健全选内容,然后使用"Ctrl+C"组合键或右键单击在快捷菜单中选择"复制"命令,然后粘贴到Word里. 提示:这种方法会把原来幻灯片中的行标.各种符号原封不动的复制下来. 2.利用"发

在android使用HttpClient get()方法 从网络下载txt文件 下载不完全

问题描述 情况1: HttpResponse httpResponses = new DefaultHttpClient().execute(get);if (httpResponses.getStatusLine().getStatusCode() == 200) {final InputStream is = httpResponses.getEntity().getContent();BufferedReader buReader=new BufferedReader(new InputS

站长要孰知搜索协议 小心栽倒在robots.txt文件上

中介交易 http://www.aliyun.com/zixun/aggregation/6858.html">SEO诊断 淘宝客 云主机 技术大厅 俗话说:懂技术的不一定懂SEO,懂SEO的不定懂技术,但是对于站长们来说,必选要孰知最基本的技术,不要求懂得高深的语言,但是基本的搜索引擎协议是需要孰知的.跟站长们交流的时候发现,很多站长都无法正确抓握搜素协议,特别是在robots.txt文件上,北京兼职吧给大家说说此协议到底深奥在何处. robots.txt文件是网站根目录下面的纯文本文件

[20171120]关于find 软连接问题.txt

[20171120]关于find 软连接问题.txt --//上个星期为了测试oracle参数filesystemio_options,将数据库做了一次移动.但是我使用find对软链接目录查询时 --//遇到一些问题做一个记录 1.建立软链接: $ cp -a  /mnt/ramdisk/book /home/oracle/backup/ $ cd /mnt/ramdisk $ mv book book_20171117 $ ln -s /home/oracle/backup/book --//

[20170112]为什么提示不一样.txt

[20170112]为什么提示不一样.txt --问题链接:http://www.itpub.net/thread-2074643-1-1.html --自己也测试看看: 1.环境: SYS@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER ------------------------------ -------------- -------------------------------------

[20151109]提升scn号11g测试.txt

[20151109]提升scn号11g测试.txt --以前的测试都在10g下进行的,在11.2.0.4下重复测试. 1.测试环境: SCOTT@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER ------------------------------ -------------- ------------------------------------------------------------

[20130105]expdp的include和exclude参数.txt

[20130105]expdp的include和exclude参数.txt http://www.itpub.net/thread-1754104-1-1.html 如果include,exclude参数很长,可以通过建立一张表来实现.自己做一些测试(注直接在命令行输入语法加入斜线,很烦!): 1.使用include参数:$ cat par.txtDIRECTORY=DATA_PUMP_DIRDUMPFILE=scott.dmpINCLUDE=TABLE:"IN (Select table_na

[20140627]rman下catalog的使用.txt

[20140627]rman下catalog的使用.txt 前几天有人问rman的catalog的使用问题,主要是后面的/.自己做一些记录: --我建立一个目录testtes # ls -l | grep testtes drwxr-x---  2 root      root      4096 2014-06-26 02:14:28 testtes drwxr-xr-x  3 oracle11g oinstall 20480 2014-06-26 02:04:51 testtest RMAN