oracle
文章平均质量分 59
xiadingling
天道酬勤
展开
-
Row/Table locks in Oracle
Row/Table locks in Oracle原创 2022-06-24 12:36:50 · 319 阅读 · 0 评论 -
how to exclude table from gather_schema_stats
have two methods1. Lock the table stats for excluded from list of gather stats job.--lockexec dbms_stats.lock_table_stats('USER','TEST');exec dbms_stats.gather_schema_stats( ownname => 'USER');--unlockexec dbms_stats.unlock_table_stats('U...原创 2021-08-04 11:58:18 · 237 阅读 · 0 评论 -
Rebuild index error, max_map_count
version : 11.2.0.4Rebuild index met temp space error, in fact free temp sapce is much larger than the total size of rebuild index.尝试了各种办法,始终无解。Oracle recommended to change OS parameter vm.max_map_count=262144了解该参数定义:This file contains the maximum原创 2020-10-08 13:16:29 · 240 阅读 · 0 评论 -
LISTAGG ORA-01489: result of string concatenation is too long XMLAGG
查询的时候遇到一个错误, 查看代码后发现是 LISTAGG返回记录太长导致的。 可以使用XMLAGG函数替代SELECT name, REGEXP_REPLACE(LISTAGG(GDW.score,',') WITHIN GROUP (ORDER BY GDW.score),'([^,]+)(,\1)*(,|$)', '\1\3') AS scores--SUBSTR(XMLAGG(XMLELEMENT(GDW, ',', GDW.score) ORDER BY GDW.score).EXTR.原创 2020-10-08 10:35:56 · 1165 阅读 · 0 评论 -
ORA-39726 删除压缩表列报错 table compress OLTP vs Basic
2种方法解决这个问题前提是改变表的压缩方式 from Basic Table Compression to OLTP首先要知道表是用那种方式压缩,我的case种表是一张分区表,并且还有子分区所以,所以需要查 subpartition 。select table_name,compression,compress_for,PARTITION_NAME, SUBPARTITION_...原创 2020-03-17 11:58:28 · 996 阅读 · 0 评论 -
Force LOGGING
The FORCE LOGGING option can be set at the database level or the tablespace level. The precedence is from database to tablespace. If a tablespace is created or altered to have FORCE LOGGING enabled, a...原创 2020-01-16 17:07:12 · 286 阅读 · 0 评论 -
ORACLE 无法扩展临时表空间
项目上线时创建索引的时候遇到无法扩展临时表空间在INSTANCE2 上。 经过测试在INSTANCE1 上可以正常的运行。这个的根本原因是临时表空间的分配问题。--查看临时表空间分配情况select inst_id, tablespace_name, segment_file, total_blocks,used_blocks, free_blocks, max_used_blocks...原创 2020-01-15 15:47:54 · 723 阅读 · 0 评论 -
优化SQL日记 Oracle 执行计划使用了错误的索引
今天遇到一个SQL,跑了2小时还没有出来。查看表的驱动表数据只有228条,根据业务条件最多返回的数据在6到7万左右。不应该有如此的速度。1.查看真实的执行计划A.发现不合理的地方 驱动表明明只有228,可是在一个Left JOin的子查询里面结果集到1M,相关的其他表join结果集都上百万数据。B.单独执行这个子查询,没有这样的问题,并且速度很快,为什么放到原SQL中计划会如此不同...原创 2019-12-13 14:41:14 · 603 阅读 · 0 评论 -
Oracle parallel 如何知道有少个线程可以使用
数据库支持多少个并行线程数。cpu_count * parallel_threads_per_cpushow parameter cpu;NAME TYPE VALUE------------------------------- ------- -----cpu_count ...原创 2019-11-22 21:41:09 · 247 阅读 · 0 评论 -
how to export data with CLOB columns by using SQL developer 如何导出CLOB 字段的数据 Oracle
今天有个导出数据的任务, 发现有个CLOB字段的数据并没有出现在我的Insert脚本里。查了一下有的说是版本问题,但是我的版本升级到Version 19.1.0.094,但是正常的EXPORT操作还是没有我想要的结果。 后来发现有种方式可以。set long 100000set lines 1000spool C:\Users\ins.sqlselect /*insert*/ * ...原创 2019-11-15 11:32:24 · 1258 阅读 · 0 评论 -
ORA-01460:unimplemented or unreasonable conversion
今天运行SP的时候,居然蹦出来ORA-0460的错误。查看错误日志找到问题所在。噢, 原来是string more than 4000。顺手查看系统上的SP, 发现都有这个共同毛病,给某些变量赋值的时候用 SELECT .... INTO ..... FROM DUAL; 为避免这个错误,最好是直接赋值。总结一下这个错误会出现的机制情况, 最容易想到的就是to_char, to_date,...原创 2019-11-14 15:33:42 · 5241 阅读 · 0 评论 -
Oracle的全文检索
Oracle的全文检索技术create index INDEX_NAME on Ttable_name(column_name) INDEXTYPE IS CTXSYS.CONTEXT;select * from table_name where contains(column_name,'Search text ') >0;Oracle Text组件可以在安装数据库的时候选择,...原创 2019-11-13 16:53:25 · 1013 阅读 · 0 评论 -
index key compression 索引压缩对性能的影响
使用体验:Oracle允许指定压缩列,全压 或者advanced compress。使用压缩的目的是减少IO的消耗。所以在明确创建索引列, 已经索引顺序后可以比较不同压缩方式被检索的数据块数。 从而找到最优的索引。索引列中如果很少有重复值,就没有必要使用压缩例子:-- when table has hug rows , by using parallel option is bette...原创 2019-11-13 16:21:19 · 495 阅读 · 0 评论 -
ROLLUP and CUBE
比较rollup 和 cube的区别SELECT o.customer_id, oi.product_id, SUM(oi.uni_price*oi.quantity)"Total" FROM order_items oi JOIN orders oON oi.order_id=o.order_id GROUP BY ROLLUP (o.customer_id, oi.produ原创 2012-08-09 16:27:19 · 904 阅读 · 0 评论 -
查看SQl执行计划
SQL> explain plan for SELECT b.MACHINE, b.PROGRAM, COUNT(*) 2 FROM v$process a, v$session b 3 WHERE a.ADDR = b.PADDR 4 AND b.USERNAME IS NOT NULL 5 GROUP BY b.MACHINE, b.PROGRAM原创 2012-08-14 11:08:35 · 492 阅读 · 0 评论 -
NEXT_DAY
NEXT_DAYThe NEXT_DAY function returns the date of the first instance of a particular day of the week that follows the specified date.SyntaxDescription of the illustration next_day.原创 2012-08-17 16:09:40 · 967 阅读 · 0 评论 -
UPDATE
UPDATEPurposeUse the UPDATE statement to change existing values in a table or in the base table of a view or the master table of a materialized view.Additional TopicsPrerequisites原创 2012-08-17 16:54:44 · 621 阅读 · 0 评论 -
NATURAL JOIN
NATURAL JOIN The NATURAL keyword indicates that a natural join is being performed. A natural join is based on all columns in the two tables that have the same name. It selects rows from the two tabl原创 2012-08-17 16:33:18 · 1436 阅读 · 0 评论 -
正则表达式 匹配中文
正则表达式操作符介绍:字符簇:[[:alpha:]] 任何字母。[[:digit:]] 任何数字。[[:alnum:]] 任何字母和数字。[[:space:]] 任何白字符。[[:upper:]] 任何大写字母。[[:lower:]] 任何小写字母。[[unct:]] 任何标点符号。[[:xdigit:]] 任何16进制的数字,相当于[0-9a-fA原创 2012-08-29 12:22:35 · 667 阅读 · 0 评论 -
Regular Expressions 正则表达式(一)
Regular ExpressionsRegular expressions enable you to search for patterns in string data by using standardized syntax conventions. You specify a regular expression by means of the following types原创 2012-08-20 14:38:36 · 1693 阅读 · 0 评论 -
Synonyms 同义词
About SynonymsA synonym is an alias for a schema object. Synonyms can provide a level of security by masking the name and owner of an object and by providing location transparency for remote obj原创 2012-08-21 10:20:12 · 993 阅读 · 0 评论 -
性能顾问 About Performance Advisors
Using Advisors to Optimize Database PerformanceAdvisors are powerful tools for database management. They provide specific advice on how to address key database management challenges, covering a wi原创 2012-09-03 10:25:12 · 1193 阅读 · 0 评论 -
oracle位运算
利用utl_raw查询表t1中由那几个数组成select * from t1 where utl_raw.cast_to_binary_integer(utl_raw.bit_and(utl_raw.cast_from_binary_integer(id), utl_ra原创 2012-09-04 16:46:01 · 1120 阅读 · 0 评论 -
index rebuild
rebuild_clauseUse the rebuild_clause to re-create an existing index or one of its partitions or subpartitions. If index is marked UNUSABLE, a successful rebuild will mark itUSABLE. For a functio原创 2012-09-06 14:30:47 · 999 阅读 · 2 评论 -
Multitable INSERT 的用法
1、insert 基础用法INSERT INTO departments VALUES (departments_seq.nextval, 'Entertainment', 162, 1400); 2、conditional insert allINSERT ALL WHEN order_total < 1000000 THEN INTO sma原创 2012-10-16 11:36:30 · 2785 阅读 · 0 评论 -
指定tracefile文件大小
MAX_DUMP_FILE_SIZEPropertyDescriptionParameter typeStringSyntaxMAX_DUMP_FILE_SIZE = { integer [K | M] | UNLIMITED }Default valueUNLIMITEDModifiableA原创 2012-11-01 16:11:58 · 434 阅读 · 0 评论 -
oracle system privileges
如何查看系统权限select name from system_privilege_map;SQL> select name from system_privilege_map where name like '%TABLE%';NAME----------------------------------------FLASHBACK ANY TABLEUN原创 2012-12-04 21:34:16 · 895 阅读 · 0 评论 -
round() ,与trunc函数的比较
round(x,y) 截取返回值后四舍五入trunc(x,y) 截取后不做四舍五入select round(45.936,-1),trunc(45.936,2) from dual;原创 2012-12-03 11:13:39 · 862 阅读 · 0 评论 -
oracle SQL的HASH_VALUE 理解
To explain how this can happen: When a SQLstatement is executed, we find the matching text in the shared pool, if itexists. Then we try to reexecute an existing child cursor if possible. If allof the原创 2012-12-05 12:21:49 · 4949 阅读 · 0 评论 -
create an external table
XAMPLE: Creating an External Table and Loading DataThe file empxt1.dat contains the following sample data:360,Jane,Janus,ST_CLERK,121,17-MAY-2001,3000,0,50,jjanus361,Mark,Jasper,SA_REP,145,17-M原创 2012-11-24 19:37:26 · 1189 阅读 · 0 评论 -
数据库 中文乱码问题
1、在oracle用户下 .bash_profile 中添加:export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"原创 2012-12-19 16:32:40 · 650 阅读 · 0 评论 -
oracle 网络服务解析的5中方法
oracle网络服务解析的5种方法1、Oracle Internet Directory 2、External Naming 3、host naming 4、Oracle Easy Connect 5、local naming 下面分别介绍这五种方法: 第一种:Oracle Internet Directory管理许多Oracle服务器的复杂网络时有优势转载 2012-12-20 15:21:44 · 379 阅读 · 0 评论 -
PROFILE的管理
描述新建的oracle 11.1.0.7 RAC数据库中,当一个用户连接到数据库上以后,如果在某一段时间内没有任何动作的话,该进程就会自己中断,这样在应用程序就会因为进程超时自动断开而不能正常执行。分析原因,应该是该进程的用户的概要文件(profile)配置问题。发现用户所在的profile的IDLE_TIME为30。即30秒该进程没有任何操作,就会自动断开。PRO转载 2012-12-20 16:39:48 · 2394 阅读 · 0 评论 -
SESSIONS_PER_USER 的使用
CREATE PROFILE app_user LIMIT SESSIONS_PER_USER UNLIMITED CPU_PER_SESSION UNLIMITED CPU_PER_CALL 3000 CONNECT_TIME 45 LOGICAL_READS_原创 2012-12-20 16:41:50 · 3883 阅读 · 0 评论 -
profile specifies limitation on serveral system resources available
Profiles and Resource LimitsEach user is assigned a profile that specifies limitations on several system resources available to the user, including the following:Number of concurrent sessi原创 2013-01-15 14:16:15 · 329 阅读 · 0 评论 -
更改用户的表空间限额
1、更改用户的表空间限额:有2种方式1)不对用户做表空间限额控制: SQL> grant unlimited tablespace to anqing;Grant succeeded. 这种方式是全局性的. 即修改用户多所有表空间的配额。 2)如果我们想改某个具体的,即针对用户的某个特定的表空间,可以使用如下SQL: SQL> alter us原创 2013-03-04 10:33:49 · 823 阅读 · 0 评论 -
row_number() over(partition by ... )
row_number() 顺序号码, 也就是 行号, 比如 1,2,3,4,5 这样的顺序。over 语法需要,必须的。partition by name, kecheng,score 是按照 name, kecheng,score 分区。也就是 如果有 不同的 name, kecheng,score , 这个 序号又重新从1开始计算。order by rowid 是转载 2013-09-21 23:20:51 · 2453 阅读 · 0 评论 -
oracle 11g 联机文档下载地址
oracle 11g联机文档下载地址http://www.oracle.com/technetwork/database/enterprise-edition/documentation/index.html原创 2013-10-17 11:28:36 · 3353 阅读 · 0 评论 -
oracle emca
创建一个EM资料库 emca -repos create重建一个EM资料库 emca -repos recreate删除一个EM资料库 emca -repos drop配置数据库的 Database Control emca -config dbcontrol db删除数据库的 Database Control配置 emca -de转载 2013-10-17 11:24:46 · 820 阅读 · 0 评论 -
将US7ASCII 字符集的数据转到ZHS16GBK 字符集数据库
1、源库为US7ASCII字符集ORACLE数据库创建转换视图 viewcreate view v_tab as select utl_raw.cast_to_raw(x) x from tab;2、 目标库为ZHS16GBK字符集ORACLE数据库1)在目标库上创建链接源库的DBLINK 请参考oracle数据库创建DBLINK语句2)创建目标表cre原创 2014-02-16 12:22:06 · 3082 阅读 · 0 评论