问题: 11g的一个库,启库时,报错shared pool不够。由于我是在一个测试的机器上,我不需要那么多的share pool,我只需800M的shared pool就够了。 但指定shared pool的大小为800M在初始化文件中,起库就报错: SQL> startup ORA-00371: […]
data file init write等待
发生data file init write的等待是数据文件正在发生扩展,在11g中,这往往和SMCO和Wnnn进程的自动预扩展有关。 在生产环境中,如果在生产高峰期出现预扩展,可能会造成短暂的hang住,或者CPU突然的升高,或者查询dba_free_space的hang住。但是,预扩展这个功能是 […]
删除分区缓慢的一次分析
在客户处遇到个问题,客户昨晚清理数据,删除一些表的分区,第一个表跑了20多分钟,但是差不多数据量的另外一个表,跑了好几个小时才完成。为何类似的数据在drop 分区的时候,有那么大的差异? 检查了改删除分区的语句,发现是update了global索引,并且,还用到了parallel 8的并行。 [cr […]
收集统计信息degree不生效的问题
在10.2以上的版本,收集统计信息,如使用dbms_stats.gather_table_stats,还是在ebs中调用fnd_stats.GATHER_TABLE_STATS,有的时候虽然用了degree的参数,如degree=8,但是会发现仍然不使用并行。在10046的trace中,我们可以看到 […]
ORA-00000 normal, successful completion
当hosts文件配置错误时,用sqlplus登录后startup nomount,就会报错ORA-00000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
[oracle11g@testdb2 dbs]$ sqlplus "/ as sysdba" SQL*Plus: Release 11.2.0.4.0 Production on Mon Apr 21 13:48:32 2014 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected. SQL> startup nomount ORA-00000: normal, successful completion SQL> alter database mount; ERROR: ORA-01012: not logged on SQL> [root@testdb2 etc]# cat hosts # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.56.250 wrong_server #192.168.56.132 testdb2 |
修改host文件后:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
[root@testdb2 etc]# cat hosts # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 #192.168.56.250 wrong_server 192.168.56.132 testdb2 再次启动: SQL> startup nomount ORACLE instance started. Total System Global Area 1052274688 bytes Fixed Size 2259840 bytes Variable Size 1023411328 bytes Database Buffers 20971520 bytes Redo Buffers 5632000 bytes SQL> 正常。 |
另外,除了写错,如果丢失hosts文 […]
当Parallel DML遇到分布式事务、分区表和LOB时
今天遇到一个问题,某sql的并发度虽然已经全部获得但是只有少数几个slave干活。
1 2 3 4 |
alter session enable parallel dml; insert /*+ parallel(t 16)*/一个本地分区表t select /*+ full(a parallel(a 32))*/* from 远程分区表a@dblink where 时间>=xxxx and 时间<xxxxx; |
insert要求有16个并发,虽然在v$PX_SESSION看到其获得的degree是16,但是并不是这16个slave都在干活,从sqlmonito […]
current_timestamp在job中不准的问题
有些job中跑应用程序,希望记下时间戳,但是取了current_timestamp之后,发现时间和实际的时间不准,查了几个小时。这是因为在job中跑的时候,current_timestamp是GMT格林尼治时间。 见下面的testcase,我们设置数据库服务器的时区是东八区的北京时间;客户端plsq […]
在跨年时出现执行计划的突变
遇到这样一个问题,客户的某系统在进入2014年后,某sql执行就非常慢,看到这个sql的执行计划发生了改变,原来很好的走hash连接的执行计划变成了走索引的nest loop的执行计划。在收集统计信息后,恢复正常。 这个故障的测试案例,我们可以这样模拟: [crayon-678b8c18cf3cb5 […]
增量分区统计信息收集的一点研究
Oracle在11g中能增量收集分区表的统计信息。在11g之前,收集global的统计信息时,oracle需要扫描每个分区的统计信息,才能得出global的统计信息。而在11g中,Oracle会简单记录分区的概要信息,(synopsis,记录在WRI$_OPTSTAT_SYNOPSIS_HEAD$ […]
11g的reference partition的一个bug
在11g上有个新特性,叫reference partition table,但是有时候在查询reference partition的时候,会报错ORA-00600 [6305] 我们可以看下面的testcase:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
TestCase: SQL> CREATE TABLE BILL_DATA_T ("BILLID" CHAR(10 BYTE) NOT NULL ENABLE, -----<<<<<<< 4.BILLID是char 10 "COGCODE" CHAR(7 BYTE), CONSTRAINT "PK_BILL_DATA_T" PRIMARY KEY ("BILLID")) PARTITION BY RANGE ("COGCODE") (PARTITION "BILLS_2012" VALUES LESS THAN ('X'), PARTITION "BILLS_OPEN" VALUES LESS THAN (MAXVALUE)); 2 3 4 5 6 7 8 Table created. SQL> SQL> CREATE TABLE FREIGHT_ITEM_T ("BILLID" CHAR(10 BYTE) NOT NULL ENABLE, "FRTITEMID" CHAR(3 BYTE) NOT NULL ENABLE, CONSTRAINT PK_FREIGHT_ITEM_T PRIMARY KEY ("BILLID"), CONSTRAINT FK_FREIGHT_ITEM_T FOREIGN KEY ("BILLID") REFERENCES ---<<<<<<< 3.外键是参考BILL_DATA_T表的BILLED字段 BILL_DATA_T ("BILLID")) PARTITION BY REFERENCE ----<<<<<<<<<<<<< 1.是partition by reference ("FK_FREIGHT_ITEM_T") ----<<<<<<<<<<< 2.参考了FK_FREIGHT_ITEM_T (PARTITION "BILLS_2012", PARTITION "BILLS_OPEN"); 2 3 4 5 6 7 8 9 10 Table created. SQL> SQL> SQL> select * from freight_item_t where billid='123456789000000'; ----<<<<< 5.超过char 10,就报错 select * from freight_item_t where billid='123456789000000' * ERROR at line 1: ORA-00600: internal error code, arguments: [6305], [16], [12], [1], [], [], [], [], [], [], [], [] SQL> SQL> SQL> SQL> c/123456789000000/123456789 1* select * from freight_item_t where billid='123456789' -----<<<<<< 6.不超过char 10,就不会报错。 SQL> / no rows selected SQL> |
这其实是bug 13 […]
SQL执行时间受游标影响不准
sql的执行时间,我们往往可以通过ash中的sample时间,减去sql exec start,得出该sql执行的时间。有一个很不错的sql,可以看某个sql的历次执行时间,历次执行计划。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
SELECT T.SQL_ID, T.SQL_EXEC_ID, CAST(MAX(T.SAMPLE_TIME) AS DATE) EXEC_END_TIME, T.SQL_EXEC_START EXEC_START_TIME, ROUND((CAST(MAX(T.SAMPLE_TIME) AS DATE) - T.SQL_EXEC_START) * 1440, 2) RUN_MINS, T.SQL_PLAN_HASH_VALUE, T.MODULE FROM v$active_session_history T WHERE T.SQL_ID = '&SQL_ID' AND T.SAMPLE_TIME > SYSDATE - 36 GROUP BY T.SQL_ID, T.SQL_EXEC_ID, T.SQL_EXEC_START, T.SQL_PLAN_HASH_VALUE, T.MODULE ORDER BY EXEC_END_TIME DESC; 或者 SELECT T.SQL_ID, T.SQL_EXEC_ID, CAST(MAX(T.SAMPLE_TIME) AS DATE) EXEC_END_TIME, T.SQL_EXEC_START EXEC_START_TIME, ROUND((CAST(MAX(T.SAMPLE_TIME) AS DATE) - T.SQL_EXEC_START) * 1440, 2) RUN_MINS, T.SQL_PLAN_HASH_VALUE, T.MODULE FROM sys.WRH$_ACTIVE_SESSION_HISTORY T WHERE T.SQL_ID = '&SQL_ID' AND T.SAMPLE_TIME > SYSDATE - 36 GROUP BY T.SQL_ID, T.SQL_EXEC_ID, T.SQL_EXEC_START, T.SQL_PLAN_HASH_VALUE, T.MODULE ORDER BY EXEC_END_TIME DESC; |
但是在使用游标的时候,如,在某个proced […]
9i catalog的一个bug
一个rman的catalog库,是9i的版本。在连接这个库做backup的时候,能正常完成,但是在做restore的时候,就报错了:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
ecovery Manager: Release 9.2.0.8.0 - 64bit Production Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved. RMAN> executing command: SET DBID RMAN> connected to target database: (not mounted) RMAN> connected to recovery catalog database RMAN> 2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13> 14> 15> 16> 17> 18> 19> 20> 21> 22> allocated channel: ch1 channel ch1: sid=11 devtype=SBT_TAPE channel ch1: Veritas NetBackup for Oracle - Release 7.1 (2011120716) allocated channel: ch2 channel ch2: sid=12 devtype=SBT_TAPE channel ch2: Veritas NetBackup for Oracle - Release 7.1 (2011120716) allocated channel: ch3 channel ch3: sid=13 devtype=SBT_TAPE channel ch3: Veritas NetBackup for Oracle - Release 7.1 (2011120716) allocated channel: ch4 channel ch4: sid=14 devtype=SBT_TAPE channel ch4: Veritas NetBackup for Oracle - Release 7.1 (2011120716) allocated channel: ch5 channel ch5: sid=15 devtype=SBT_TAPE channel ch5: Veritas NetBackup for Oracle - Release 7.1 (2011120716) allocated channel: ch6 channel ch6: sid=16 devtype=SBT_TAPE channel ch6: Veritas NetBackup for Oracle - Release 7.1 (2011120716) allocated channel: ch7 channel ch7: sid=17 devtype=SBT_TAPE channel ch7: Veritas NetBackup for Oracle - Release 7.1 (2011120716) allocated channel: ch8 channel ch8: sid=18 devtype=SBT_TAPE channel ch8: Veritas NetBackup for Oracle - Release 7.1 (2011120716) sent command to channel: ch1 sent command to channel: ch2 sent command to channel: ch3 sent command to channel: ch4 sent command to channel: ch5 sent command to channel: ch6 sent command to channel: ch7 sent command to channel: ch8 Starting restore at 2013-10-28 18:35:47 released channel: ch1 released channel: ch2 released channel: ch3 released channel: ch4 released channel: ch5 released channel: ch6 released channel: ch7 released channel: ch8 RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of restore command at 10/28/2013 18:35:48 RMAN-06004: ORACLE error from recovery catalog database: ORA-01455: converting column overflows integer datat ype RMAN> Recovery Manager complete. |
根据RMAN-06004和ORA-01455,我们很容易就能发现9i catalog库的一个bug: […]