[20141216]sqlplus的set appinfo.txt
--今天学习了sqlplus的set appinfo命令,可以设置module参数。做一个简单记录。
--会话1:
SCOTT@test> @ver
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
SCOTT@test> set appinfo test
SCOTT@test> SElect sysdate from dual ;
SYSDATE
-------------------
2014-12-16 16:07:08
SCOTT@test> select * from dept where rownum DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NEW YORK
--在另外的会话执行,会话2:
SCOTT@test> select sql_id,sql_text,child_number,executions,buffer_gets from v$sql where module='test';
SQL_ID SQL_TEXT CHILD_NUMBER EXECUTIONS BUFFER_GETS
------------- ------------------------------------------------------------ ------------ ---------- -----------
20zmcgcrnnrxs SElect sysdate from dual 0 1 0
cf2xz73hgrf81 select * from dept where rownum
--这样可以定位知道执行语句的sql_id.注意module的大小写。
SCOTT@test> select * from emp where rownum EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- ---------- --------- ---------- ------------------- ---------- ---------- ----------
7369 SMITH CLERK 7902 1980-12-17 00:00:00 800 20
--会话1执行:
SCOTT@test> select * from emp where rownum EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- ---------- --------- ---------- ------------------- ---------- ---------- ----------
7369 SMITH CLERK 7902 1980-12-17 00:00:00 800 20
--会话2执行:
SCOTT@test> select sql_id,sql_text,child_number,executions,buffer_gets from v$sql where module='test';
SQL_ID SQL_TEXT CHILD_NUMBER EXECUTIONS BUFFER_GETS
------------- ------------------------------------------------------------ ------------ ---------- -----------
20zmcgcrnnrxs SElect sysdate from dual 0 1 0
cf2xz73hgrf81 select * from dept where rownum
--看不到执行的select * from emp where rownum--改变大小写就ok了。