[20170329]给oracle启动加入baner.txt
--//测试一下给oracle 启动加入一个banner,没有什么意思,仅仅为了玩.
1.环境:
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.修改sqlnet.ora文件加入:
SEC_USER_AUDIT_ACTION_BANNER=/u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/banner.txt
--//建立banner.txt文件:
$ cat /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/banner.txt
welcome test oracle!!
3.测试:
--//重启启动数据库:
SYS@book> startup nomount
welcome test oracle!!
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
--//注意看前面提示!!继续:
SYS@book> alter database mount ;
Database altered.
SYS@book> alter database mount ;
Database altered.
SYS@book> alter database open ;
Database altered.
--//很奇怪如果我直接startup:
SYS@book> startup
welcome test oracle!!
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.
welcome test oracle!!
Database opened.
--//这样会出现2次,不知道为什么?
4.登录数据库测试:
$ rlsql
SQL*Plus: Release 11.2.0.4.0 Production on Wed Mar 29 10:23:54 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
welcome test oracle!!
~~~~~~~~~~~~~~~~~~~~~~
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
--//修改文件banner.txt
$ cat banner.txt
*******************************
* welcome test oracle!! *
*******************************
d:\tools\sqltemp>sqlplus scott/book@78
SQL*Plus: Release 12.1.0.1.0 Production on Wed Mar 29 10:25:33 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
welcome test oracle!!
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
--//奇怪并不是每次登录读这个文件.
# lsof | grep -i banner
--//也没有那个进程打开这个文件,做一个跟踪:
$ strace -o /tmp/aa.txt -f sqlplus scott/book
37816 close(9) = 0
37816 write(1, "welcome test oracle!!\n", 22) = 22
37816 write(1, "\n", 1)
--//跟踪文件里面也没有打开banner.txt文件的句柄.重启监听看看:
$ lsnrctl stop ; sleep 1 ; lsnrctl start
$ rlsql
SQL*Plus: Release 11.2.0.4.0 Production on Wed Mar 29 10:34:53 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
welcome test oracle!!
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> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@book> startup
*******************************
* welcome test oracle!! *
*******************************
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.
*******************************
* welcome test oracle!! *
*******************************
Database opened.