[20240814]sqlplus -R参数.txt

来源:这里教程网 时间:2026-03-03 20:31:47 作者:

[20240814]sqlplus -R参数.txt $ sqlplus -H ... -R <level>     Sets restricted mode to disable SQL*Plus commands                that interact with the file system.  The level can                be 1, 2 or 3.  The most restrictive is -R 3 which                disables all user commands interacting with the                file system. --//按照文档介绍,-R 3参数disables all user commands interacting with the file system. $ cat $ORACLE_HOME/sqlplus/admin/glogin.sql  | tail -4 -- @@zzlogin.sql @@128.txt $ rlsql  -s -l -r 3  / as sysdba <<<quit SP2-0738: Restricted command "@@ (START)" not available SP2-0738: Restricted command "@@ (START)" not available --//注:大小写没有影响. --//它禁止了我写在gloing.sql的两次@@调用.实际上还禁止了环境变量ORACLE_PATH,SQLPATH目录下的login.sql调用. --//可以讲是最严格的限制,但是在$ORACLE/sqlplus/admin/glogin.sql下的内容会执行,不然不会2次出现前面的提示: SP2-0738: Restricted command "@@ (START)" not available --//比如: tanel poder的tpt脚本会重新设置nls_date_format = 'YYYY-MM-DD HH24:MI:SS'; $ echo -e "$ORACLE_PATH\n$SQLPATH" /home/oracle/sqllaji:/home/oracle/sqllaji/tpt /home/oracle/sqllaji:/home/oracle/sqllaji/tpt --//我一般2个环境变量都设置. $ cat tpt/login.sql -- Copyright 2018 Tanel Poder. All rights reserved. More info at http://tanelpoder.com -- Licensed under the Apache License, Version 2.0. See LICENSE.txt for terms & conditions. -- calling init.sql which will set up sqlpus variables @init.sql -- i.sql is the "who am i" script which shows your session/instance info and -- also sets command prompt window/xterm title -- @i.sql -- you can put your own login scripts here $ grep alter tpt/init.sql   alter session set nls_date_format = 'YYYY-MM-DD HH24:MI:SS'; --//tpt的脚本初始化会重新设置nls_date_format = 'YYYY-MM-DD HH24:MI:SS'; $ export NLS_DATE_FORMAT=YYYYMMDD $ rlsql  -s -l -r 3  / as sysdba <<<'select sysdate from dual;' SP2-0738: Restricted command "@@ (START)" not available SP2-0738: Restricted command "@@ (START)" not available SYSDATE -------- 20240814 --//可以发现也没有调用tpt/login.sql,不然会重置. --//但是文档里面并没有说明1,2有什么不同. $ rlsql  -s -l -r 1  / as sysdba <<<'select sysdate from dual;' SYSDATE ------------------- 2024-08-14 11:30:06 $ rlsql  -s -l -r 2  / as sysdba <<<'select sysdate from dual;' SYSDATE ------------------- 2024-08-14 11:30:11 --//两个效果一样,并且写与不写有存在什么区别呢?感觉1,2没有区别.甚至没用.

相关推荐