[20181105]再论12c set feedback only.txt
[20181105]再论12c set feedback only.txt
--//前一阵子的测试,链接:http://blog.itpub.net/267265/viewspace-2216290/
--//12CR2 ,增强了set FEEDBACK功能,加入only选项可以禁止输出信息显示,仅仅显示返回几行,有利于dba集中精力调试
--//sql语句,18c还增加返回执行语句的sql_id的功能,简单测试.
--//我一直以为这种功能是针对特定版本的比如仅仅对12c有效,实际上如果你使用12c的客户端连接11g,执行set feedback only应该不支持.
--//通过测试说明问题.
1.环境:
d:\temp>sqlplus scott/book@78
SQL*Plus: Release 12.2.0.1.0 Production on 星期一 11月 5 10:47:35 2018
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Copyright (c) 1982, 2016, Oracle. All rights reserved.
连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SCOTT@78> @ 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
--//我刚刚在办法环境重新安装12cR2版本.使用sqlplus连接11g.
SCOTT@78> set feedback only
SCOTT@78> select * from emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- ---------- --------- ---------- ------------------- ---------- ---------- ----------
已选择 14 行。
--//没有多余的显示.
SCOTT@78> set feedback 6
SCOTT@78> @ dpc '' ''
PLAN_TABLE_OUTPUT
-------------------------------------
SQL_ID a2dk8bdn0ujx7, child number 0
-------------------------------------
select * from emp
Plan hash value: 3956160932
---------------------------------------------------------------------------
| Id | Operation | Name | E-Rows |E-Bytes| Cost (%CPU)| E-Time |
---------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 3 (100)| |
| 1 | TABLE ACCESS FULL| EMP | 14 | 532 | 3 (0)| 00:00:01 |
---------------------------------------------------------------------------
Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------
1 - SEL$1 / EMP@SEL$1
2.补充测试连接的http://blog.itpub.net/267265/viewspace-2216326/特性是否有效:
SCOTT@78> set history 10
SCOTT@78> select sysdate from dual ;
SYSDATE
-------------------
2018-11-05 10:51:00
SCOTT@78> select user from dual ;
USER
------------------------------
SCOTT
SCOTT@78> history
1 select sysdate from dual ;
2 select user from dual ;
--//可以发现一样有效.
SCOTT@78> variable b number = 20;
SCOTT@78> select * from dept where deptno = :b ;
DEPTNO DNAME LOC
---------- -------------- -------------
20 RESEARCH DALLAS
--//这样定义变量也没有问题.
3.最后测试Statement caching:
--//Statement caching有点像软软解析.
SCOTT@78> @ spid
SID SERIAL# PROCESS SERVER SPID PID P_SERIAL# C50
---------- ---------- ------------------------ --------- ------ ------- ---------- ----------------------------------------------
41 7 5512:516 DEDICATED 62921 27 3 alter system kill session '41,7' immediate;
variable b number = 20;
Select * from dept where deptno = :b ;
Select * from dept where deptno = :b ;
--//通过查询执行计划,确定sql_id=2b073tss4h1f3.
SCOTT@78> select sql_id,executions,parse_calls,sql_text from v$sql where sql_id='2b073tss4h1f3';
SQL_ID EXECUTIONS PARSE_CALLS SQL_TEXT
------------- ---------- ----------- ------------------------------------------------------------
2b073tss4h1f3 2 2 Select * from dept where deptno = :b
--//执行2次,分析2次.
--//如果采用Statement caching
--//sesson 1:
set statementcache 100
variable c number = 10;
select * from dept where deptno = :c ;
select * from dept where deptno = :c ;
select sysdate from dual;
--//通过查询执行计划,确定sql_id='abzxwsyzmsu8h',另外打开会话:
--//sesson 2:
SYS@book> select sql_id,executions,parse_calls,sql_text from v$sql where sql_id='abzxwsyzmsu8h';
SQL_ID EXECUTIONS PARSE_CALLS SQL_TEXT
------------- ---------- ----------- ------------------------------------------------------------
abzxwsyzmsu8h 2 1 select * from dept where deptno = :c
--//执行2次,分析1次.
SYS@book> @ sharepool/shp4 abzxwsyzmsu8h 0
TEXT KGLHDADR KGLHDPAR C40 KGLHDLMD KGLHDPMD KGLHDIVC KGLOBHD0 KGLOBHD6 KGLOBHS0 KGLOBHS6 KGLOBT16 N0_6_16 N20 KGLNAHSH KGLOBT03 KGLOBT09
-------------- ---------------- ---------------- ---------------------------------------- ---------- ---------- ---------- ---------------- ---------------- ---------- ---------- ---------- --------- ---------- ---------- ------------- ----------
子游标句柄地址 000000007E344808 000000007E0F7020 select * from dept where deptno = :c 1 0 0 000000007E373578 000000007C5D06C8 8600 12144 3086 23830 23830 3208407312 abzxwsyzmsu8h 0
父游标句柄地址 000000007E0F7020 000000007E0F7020 select * from dept where deptno = :c 1 0 0 000000007E33C8A8 00 4720 0 0 4720 4720 3208407312 abzxwsyzmsu8h 65535
--//KGLHDLMD=1.session 1最后执行的是select sysdate from dual;
SYS@book> select * from v$open_cursor where sql_id='abzxwsyzmsu8h';
SADDR SID USER_NAME ADDRESS HASH_VALUE SQL_ID SQL_TEXT LAST_SQL_ACTIVE_TIM SQL_EXEC_ID CURSOR_TYPE
---------------- --- --------- ---------------- ---------- ------------- ------------------------------------ ------------------- ----------- -----------
000000008631DDF0 41 SCOTT 000000007E0F7020 3208407312 abzxwsyzmsu8h select * from dept where deptno = :c OPEN
--//可以发现光标状态已经是open,仅仅执行2次.
--//session 1:
SCOTT@78> variable c number = 30;
SCOTT@78> select * from dept where deptno = :c ;
DEPTNO DNAME LOC
---------- -------------- -------------
30 SALES CHICAGO
SCOTT@book> select sql_id,executions,parse_calls,sql_text from v$sql where sql_id='abzxwsyzmsu8h';
SQL_ID EXECUTIONS PARSE_CALLS SQL_TEXT
------------- ---------- ----------- ------------------------------------------------------------
abzxwsyzmsu8h 3 1 select * from dept where deptno = :c
--//执行3次,分析1次.
4.支持CSV数据格式显示:
SCOTT@78> set markup csv on
SCOTT@78> select * from emp ;
"EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO"
7369,"SMITH","CLERK",7902,"1980-12-17 00:00:00",800,,20
7499,"ALLEN","SALESMAN",7698,"1981-02-20 00:00:00",1600,300,30
7521,"WARD","SALESMAN",7698,"1981-02-22 00:00:00",1250,500,30
7566,"JONES","MANAGER",7839,"1981-04-02 00:00:00",2975,,20
7654,"MARTIN","SALESMAN",7698,"1981-09-28 00:00:00",1250,1400,30
7698,"BLAKE","MANAGER",7839,"1981-05-01 00:00:00",2850,,30
7782,"CLARK","MANAGER",7839,"1981-06-09 00:00:00",2450,,10
7788,"SCOTT","ANALYST",7566,"1987-04-19 00:00:00",3000,,20
7839,"KING","PRESIDENT",,"1981-11-17 00:00:00",5000,,10
7844,"TURNER","SALESMAN",7698,"1981-09-08 00:00:00",1500,0,30
7876,"ADAMS","CLERK",7788,"1987-05-23 00:00:00",1100,,20
7900,"JAMES","CLERK",7698,"1981-12-03 00:00:00",950,,30
7902,"FORD","ANALYST",7566,"1981-12-03 00:00:00",3000,,20
7934,"MILLER","CLERK",7782,"1982-01-23 00:00:00",1300,,10
已选择 14 行。
--//ok.剩下的不在测试了,剩下大家自行测试.
set markup csv on delimiter '|'
select * from dept;
set markup csv on delimiter '|' quote off
select * from dept;
set markup csv off
select * from dept;
5.看来自己以前感觉错误,sqlplus的特性与oracle版本无关,你只要安装12cR2版本的client端,就可以使用新版本的sqlplus的特性.
也说明一点,做事情不能评感觉,还是以测试为准,当然理论的理解也很重要.
[20181105]再论12c set feedback only.txt的更多相关文章
- [20170603]12c Top Frequency histogram.txt
---恢复内容开始--- [20170603]12c Top Frequency histogram.txt --//个人对直方图了解很少,以前2种直方图类型对于目前的许多应用来讲已经足够,或者讲遇到 ...
- [20181015]12C SQL Translation Framework.txt
[20181015]12C SQL Translation Framework.txt --//12c提供一个dba改写sql语句的可能性,实际上10g,11g之前也有一个包DBMS_ADVANCED ...
- [20180914]oracle 12c 表 full_hash_value如何计算.txt
[20180914]oracle 12c 表 full_hash_value如何计算.txt --//昨天在12c下看表full_hash_value与11g的full_hash_value不同,不过 ...
- Word,PDF,PPT,TXT之间的转换方法
来源: 刘波的日志 一.把PPT转WORD形式的方法 1.利用"大纲"视图 打开PPT演示文稿,单击"大纲",在左侧"幻灯片/大纲”任务窗格的“大纲” ...
- py3 读入和写入csv,txt文件
import numpy as npimport pandas as pdimport time import datetimeimport csv http://pandas.pydata.org/ ...
- [20191127]表 full Hash Value的计算.txt
[20191127]表 full Hash Value的计算.txt --//曾经做过表full Hash Value的计算,当时我是通过建立简单的schema以及表名的形式,使用hashcat破解o ...
- 改写《python基础教程》中的一个例子
一.前言 初学python,看<python基础教程>,第20章实现了将文本转化成html的功能.由于本人之前有DIY一个markdown转html的算法,所以对这个例子有兴趣.可仔细一看 ...
- vulnhub writeup - 持续更新
目录 wakanda: 1 0. Description 1. flag1.txt 2. flag2.txt 3. flag3.txt Finished Tips Basic Pentesting: ...
- Linux内核配置选项
http://blog.csdn.net/wdsfup/article/details/52302142 http://www.manew.com/blog-166674-12962.html Gen ...
随机推荐
- Consul安装使用
安装 安装环境: Mac 我参照官网下载,然后解压,然后添加到PATH,并不能用.最终使用brew安装成功. brew install consul 安装成功后,文件位于/usr/local/Cell ...
- MyBatis源码解析(二)——Environment环境
原创作品,可以转载,但是请标注出处地址:http://www.cnblogs.com/V1haoge/p/6625612.html 本应该先开始说Configuration配置类的,但是这个类有点过于 ...
- http无状态协议,cookie和session详解(一)
1.HTTP无状态协议 首先看百度百科给出的定义: HTTP无状态协议,是指协议对于事务处理没有记忆能力.缺少状态意味着如果后续处理需要前面的信息,则它必须重传, 这样导致可能每次连接传送的数据量增大 ...
- [总结] 动态DP学习笔记
学习了一下动态DP 问题的来源: 给定一棵 \(n\) 个节点的树,点有点权,有 \(m\) 次修改单点点权的操作,回答每次操作之后的最大带权独立集大小. 首先一个显然的 \(O(nm)\) 的做法就 ...
- dotnetcore-officeaddin-toolbox : Office 365 Add-in开发人员的工具箱
在上一篇文章(.NET Core开源行动:一键创建Excel Add-in) 中我给大家展示了一套为Office 365 Add-in开发人员准备的模板库,你可以通过 dotnet new excel ...
- c# 破解谷歌翻译
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- yarn install npm install (转载)
解决 npm i 及 yarn install 都无法进行安装的问题和node-sass安装太慢的问题 2018年03月31日 19:49:07 Johnny丶me 阅读数:2906更多 所属专栏: ...
- Object类型转换成自定义类型(向下转型)
Object类型转换成自定义类型 场景: 从数据库或者别的途径接收对象的时候用Object,但是用的时候怎么object点(方法提示 | alt+'/'),都点不出自定义类型的方法. 比如,数据库查询 ...
- C#设计模式之四建造者模式(Builder Pattern)【创建型】
一.引言 今天我们要讲讲Builder模式,也就是建造者模式,当然也有叫生成器模式的,英文名称是Builder Pattern.在现实生活中,我们经常会遇到一些构成比较复杂的物品,比如:电脑,它就是一 ...
- 新浪微博登陆以及发送微博(附python源码)
原文链接(本人):https://blog.csdn.net/A5878989/article/details/76275855 说明 本文主要记录分析新浪微博登陆以及发送文字和图片微博的详细过程 分 ...