[20170329]給oracle啟動加入baner.txt

lfree發表於2017-03-29

[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.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2136237/,如需轉載,請註明出處,否則將追究法律責任。

相關文章