标签云
asm恢复 bbed bootstrap$ dul In Memory kcbzib_kcrsds_1 kccpb_sanity_check_2 kfed MySQL恢复 ORA-00312 ORA-00607 ORA-00704 ORA-01110 ORA-01555 ORA-01578 ORA-08103 ORA-600 2131 ORA-600 2662 ORA-600 2663 ORA-600 3020 ORA-600 4000 ORA-600 4137 ORA-600 4193 ORA-600 4194 ORA-600 16703 ORA-600 kcbzib_kcrsds_1 ORA-600 KCLCHKBLK_4 ORA-15042 ORA-15196 ORACLE 12C oracle dul ORACLE PATCH Oracle Recovery Tools oracle加密恢复 oracle勒索 oracle勒索恢复 oracle异常恢复 Oracle 恢复 ORACLE恢复 ORACLE数据库恢复 oracle 比特币 OSD-04016 YOUR FILES ARE ENCRYPTED 勒索恢复 比特币加密文章分类
- Others (2)
- 中间件 (2)
- WebLogic (2)
- 操作系统 (102)
- 数据库 (1,670)
- DB2 (22)
- MySQL (73)
- Oracle (1,532)
- Data Guard (52)
- EXADATA (8)
- GoldenGate (21)
- ORA-xxxxx (159)
- ORACLE 12C (72)
- ORACLE 18C (6)
- ORACLE 19C (14)
- ORACLE 21C (3)
- Oracle 23ai (7)
- Oracle ASM (65)
- Oracle Bug (8)
- Oracle RAC (52)
- Oracle 安全 (6)
- Oracle 开发 (28)
- Oracle 监听 (28)
- Oracle备份恢复 (560)
- Oracle安装升级 (91)
- Oracle性能优化 (62)
- 专题索引 (5)
- 勒索恢复 (78)
- PostgreSQL (18)
- PostgreSQL恢复 (6)
- SQL Server (27)
- SQL Server恢复 (8)
- TimesTen (7)
- 达梦数据库 (2)
- 生活娱乐 (2)
- 至理名言 (11)
- 虚拟化 (2)
- VMware (2)
- 软件开发 (37)
- Asp.Net (9)
- JavaScript (12)
- PHP (2)
- 小工具 (20)
-
最近发表
- ORA-600 krse_arc_complete.4
- Oracle 19c 202410补丁(RUs+OJVM)
- ntfs MFT损坏(ntfs文件系统故障)导致oracle异常恢复
- .mkp扩展名oracle数据文件加密恢复
- 清空redo,导致ORA-27048: skgfifi: file header information is invalid
- A_H_README_TO_RECOVER勒索恢复
- 通过alert日志分析客户自行对一个数据库恢复的来龙去脉和点评
- ORA-12514: TNS: 监听进程不能解析在连接描述符中给出的SERVICE_NAME
- ORA-01092 ORA-00604 ORA-01558故障处理
- ORA-65088: database open should be retried
- Oracle 19c异常恢复—ORA-01209/ORA-65088
- ORA-600 16703故障再现
- 数据库启动报ORA-27102 OSD-00026 O/S-Error: (OS 1455)
- .[metro777@cock.li].Elbie勒索病毒加密数据库恢复
- 应用连接错误,初始化mysql数据库恢复
- RAC默认服务配置优先节点
- Oracle 19c RAC 替换私网操作
- 监听报TNS-12541 TNS-12560 TNS-00511错误
- drop tablespace xxx including contents恢复
- Linux 8 修改网卡名称
标签归档:18c新特性
18c新特性:alter system cancel sql
根据18c官方描述cancel sql功能是在18c中引起,但是实测发现在oracle 12.2中已经有了cancel sql功能,可以实现终止掉某个sql的当前sql正在执行的sql语句,而不是传统的直接kill某个会话.ALTER SYSTEM CANCEL SQL语句有四个参数分别为:
--会话1 SQL> set lines 150 SQL> select * from v$version; BANNER CON_ID -------------------------------------------------------------------------------- ---------- Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production 0 PL/SQL Release 12.2.0.1.0 - Production 0 CORE 12.2.0.1.0 Production 0 TNS for Linux: Version 12.2.0.1.0 - Production 0 NLSRTL Version 12.2.0.1.0 - Production 0 SQL> select sid, serial# from v$session where sid in 2 (select sid from v$mystat where rownum=1); SID SERIAL# ---------- ---------- 278 4019 SQL> create table t_xifenfei tablespace users as select * from dba_source; Table created. SQL> insert into t_xifenfei select * from t_xifenfei; 274132 rows created. <<===没有提交 SQL> select count(*)from t_xifenfei; COUNT(*) ---------- 548264 SQL> insert into t_xifenfei select * from t_xifenfei; 548264 rows created. <<===没有提交 SQL> select count(*)from t_xifenfei; COUNT(*) ---------- 1096528 SQL> insert into t_xifenfei select * from t_xifenfei; --会话2 SQL> select count(*)from t_xifenfei; COUNT(*) ---------- 274132 SQL> alter system cancel sql '278,4019'; System altered. SQL> select count(*)from t_xifenfei; COUNT(*) ---------- 274132 --会话1 SQL> insert into t_xifenfei select * from t_xifenfei; insert into t_xifenfei select * from t_xifenfei * ERROR at line 1: ORA-01013: user requested cancel of current operation SQL> select count(*)from t_xifenfei; COUNT(*) ---------- 1096528
这里可以看到会话1的最后一个insert被cancel,但是前面两个没有提交的insert没有被回滚/提交,看到了cancel sql的功能的实现.
18c新特性:Scalable Sequences(自适应序列)
作为18c的新特性,其实在oracle 12.2 引入了Scalable Sequences作为一个隐藏特性,为了改善在高并发系统中,特别是使用seq作为index,大量插入记录导致index的争用,oracle自己实现了以前我们需要人工去自定义seq的方式(instance+sid+seq的类似算法方式),该功能将在oracle 18c中正式推出,我这里带领大家先体会下
SCALE/NOSCALE
When SCALE is specified, a numeric offset is affixed to the beginning of the sequence. This offset if of the form iii||sss||, where,
iii denotes a three digit instance offset given by (instance_id % 100) + 100,
sss denotes a three digits session offset given by (session_id % 1000), and
|| is the concatenation operator
EXTEND/NOEXTEND
When EXTEND is specified with the SCALE keyword, the generated sequence values are all of length (x+y), where x is the length of the scalable offset (default 6), and y is the maximum number of digits in the sequence maxvalue/minvalue. Thus, for an ascending sequence with maxvalue 100 and SCALABLE EXTEND specified, the generated sequence values are of the form iii||sss||001, iii||sss||002, …,iii||sss||100
The default setting for the SCALE clause is NOEXTEND. With the NOEXTEND setting, the generated sequence values are at most as wide as the maximum number of digits in the sequence maxvalue/minvalue. This setting is useful for integration with existing applications where sequences are used to populate fixed width columns. On invocation of NEXTVAL on a sequence with SCALABLE NOEXTEND specified, a user error is thrown if the generated value requires more digits of representation than the sequence’s maxvalue/minvalue.
SCALE的算法就是(instance_id % 100)(_kqdsn_instance_digits) + 100||(session_id % 1000)(_kqdsn_cpu_digits)+seq(EXTEND/NOEXTEND确定是否固定宽度)
Scalable Sequences语法
CREATE | ALTER SEQUENCE [ schema. ]sequence [ { INCREMENT BY | START WITH } integer | { MAXVALUE integer | NOMAXVALUE } | { MINVALUE integer | NOMINVALUE } | { CYCLE | NOCYCLE } | { CACHE integer | NOCACHE } | { ORDER | NOORDER } | { SCALE {EXTEND | NOEXTEND} | NOSCALE} ]
Scalable Sequences测试
[oracle@xifenfei ~]$ sqlplus / as sysdba SQL*Plus: Release 12.2.0.1.0 Production on Tue Jan 23 02:33:49 2018 Copyright (c) 1982, 2016, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production BANNER CON_ID -------------------------------------------------------------------------------- ---------- Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production 0 PL/SQL Release 12.2.0.1.0 - Production 0 CORE 12.2.0.1.0 Production 0 TNS for Linux: Version 12.2.0.1.0 - Production 0 NLSRTL Version 12.2.0.1.0 - Production 0 SQL> set line 150 SQL> col "Paramete" for a30 SQL> col "Session Value" for a20 SQL> col "Instance Value" for a20 SQL> col "Is Default?" for a20 SQL> SELECT a.ksppinm "Parameter", b.ksppstvl "Session Value", c.ksppstvl "Instance Value",c.ksppstdf "Default?" 2 FROM x$ksppi a, x$ksppcv b, x$ksppsv c WHERE a.indx = b.indx AND a.indx = c.indx AND lower(a.ksppinm) 3 in ('_kqdsn_instance_digits', '_kqdsn_cpu_digits'); Parameter Session Value Instance Value Default? -------------------------------------------------------- -------------------- -------------------- --------- _kqdsn_instance_digits 2 2 TRUE _kqdsn_cpu_digits 3 3 TRUE SQL> select instance_number from v$instance; INSTANCE_NUMBER --------------- 1 SQL> select sys_context('userenv','sid') from dual; SYS_CONTEXT('USERENV','SID') ---------------------------------------------------------------------------- 275 SQL> create sequence seq_xff start with 1 increment by 1 minvalue 1 maxvalue 100 scale extend; Sequence created. SQL> select seq_xff.nextval from dual; NEXTVAL ---------- 101275001
验证效果
--另外一个会话 [oracle@xifenfei ~]$ sqlplus / as sysdba SQL*Plus: Release 12.2.0.1.0 Production on Tue Jan 23 02:45:14 2018 Copyright (c) 1982, 2016, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production SQL> select sys_context('userenv','sid') from dual; SYS_CONTEXT('USERENV','SID') --------------------------------------------------------- 4 SQL> select instance_number from v$instance; INSTANCE_NUMBER --------------- 1 SQL> select seq_xff.nextval from dual; NEXTVAL ---------- 101004002
这里可以看出来seq的值是固定长度的.而且随着sid或者inst_id 不同而不同,从而实现减少大量数据集中在一个block而引起的各种争用
测试scale noextend
SQL> create sequence seq_xifenfei start with 1 increment by 1 minvalue 1 maxvalue 100 scale noextend; Sequence created. SQL> select seq_xifenfei.nextval from dual; select seq_xifenfei.nextval from dual * ERROR at line 1: ORA-64603: NEXTVAL cannot be instantiated for seq_xifenfei. Widen the sequence by 4 digits or alter sequence with SCALE EXTEND. SQL> drop sequence seq_xifenfei; Sequence dropped. SQL> create sequence seq_xifenfei start with 1 increment by 1 minvalue 1 maxvalue 1000000 scale noextend; Sequence created. SQL> select seq_xifenfei.nextval from dual; NEXTVAL ---------- 1010041
这里可以看出来scale noextend的长度是随着seq值的改变而改变,而且max值不能小于seq本身长度.