我申请的vultr主机是单核CPU,15GB的ssd的硬盘,768M内存,每月1TB的流量,对于ss来说已经完成足够,目前有日本,新加坡,美国,德国,荷兰,法国等地的服务器。价格是每月5刀(每小时0.007刀),首次注册,如果用我这个Summer Promo Code,你可以额为获得20刀的费用;或 […]
解决主库报错HeartBeat failed to connect to standby Error 12154
有一个库自从上线之后,主库的alertlog中一直有如下报错:
1 2 3 |
Tue Dec 20 14:42:16 2016 Error 12154 received logging on to the standby PING[ARC2]: Heartbeat failed to connect to standby 'rmydb'. Error is 12154. |
1. 检查远端的standby库已经启动,且已经到了mount以上的状态(即在read only的模式下Real Time Apply)。 2. 检查主库到远端的tnsp […]
关于oradebug -prelim
在oracle数据库hang的情况下,我们可以用sqlplus -prelim / as sysdba登录数据库,进行一些收集信息的操作,也可以进行shutdown database的操作。这里需要注意几点: 1. process满是可以用sqlplus -prelim / as sysdba登录的 […]
查找被kill掉的session的操作系统进程号
11g之前:
1 2 3 4 5 |
select spid, program from v$process where program!= 'PSEUDO' and addr not in (select paddr from v$session) and addr not in (select paddr from v$bgprocess ) and addr not in (select paddr from v$shared_server); |
11g之后:
1 |
select * from v$process where addr=(select creator_addr from v$session where sid=140); |
参考: How To Find The Process Identifier (pid, spid) After The Correspon […]
分区索引知识点拾遗
索引是一般索引还是分区索引,可以看dba_indexes的partitioned字段。 如果partitioned字段是YES,说明是分区索引,那么,这个索引是global还是local,可以看dba_part_indexes的LOCALITY字段。 另外,我们还可以看ALIGNMENT字段,看这个 […]
Huge page使用的一些问题
12c的数据库在安装的时候,有一个检查项目,叫做Maximum locked memory check。 这是要求设置/etc/security/limits.conf中的memlock的值,官方文档在11g要求是设置比物理内存稍小的一个值,在12c中要求至少为90%的物理内存。 而memlock的 […]
再谈sharding database的一些概念
在继『Oracle sharding database的一些概念』和『sharding database的一些概念的补充』之后,我觉得还是有些概念需要谈一下。 1.shard prune(分片裁剪): 这个概念类似分区裁剪(partition prune),是指根据sql语句会到对应的分片上去。 但 […]
Mode=4的TX锁小结
1. bitmap索引
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 |
--session 1 SQL> create table t1_tx(id number,name varchar2(20)) ; Table created. SQL> insert into t1_tx select rownum,chr(97+mod(rownum,2)) from dual connect by level<=10; 10 rows created. SQL> commit; Commit complete. SQL> select * from t1_tx; ID NAME ---------- ---------------------------------------- 1 b 2 a 3 b 4 a 5 b 6 a 7 b 8 a 9 b 10 a 10 rows selected. SQL> create bitmap index idx_bitmap_name on t1_tx(name); Index created. SQL> select sid from v$mystat where rownum=1; SID ---------- 63 SQL> update t1_tx set name='tx' where id=3; 1 row updated. SQL> -- not commit -- session 2: SQL> select sid from v$mystat where rownum=1; SID ---------- 5 SQL> update t1_tx set name='bitmap' where id=5; --hang ---session 3 SQL> select sid, 2 chr(bitand(p1, -16777216) / 16777215) || 3 chr(bitand(p1, 16711680) / 65535) "Name", 4 (bitand(p1, 65535)) "Mode", 5 event, 6 sql_id, 7 FINAL_BLOCKING_SESSION 8 from v$session 9 where event like 'enq%'; SID Name Mode EVENT SQL_ID FINAL_BLOCKING_SESSION ---------- ---------------- ---------- ------------------------------ -------------------------- ---------------------- 5 TX 4 enq: TX - row lock contention 1qtvgrv88q2dj 63 SQL> |
2. 主外键关系,主键表插入数据不提交,外键表插入数据被阻塞
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 |
--session 1 SQL> create table parent(id number primary key); Table created. SQL> create table child(id number references parent,name varchar2(20)); Table created. SQL> insert into parent values(1); 1 row created. SQL>--not commit; --session 2: SQL> insert into child values(1,'a'); --hang --session 3: SQL> l 1 select sid, 2 chr(bitand(p1, -16777216) / 16777215) || 3 chr(bitand(p1, 16711680) / 65535) "Name", 4 (bitand(p1, 65535)) "Mode", 5 event, 6 sql_id, 7 FINAL_BLOCKING_SESSION 8 from v$session 9* where event like 'enq%' SQL> / SID Name Mode EVENT SQL_ID FINAL_BLOCKING_SESSION ---------- ---------------- ---------- ------------------------------ -------------------------- ---------------------- 5 TX 4 enq: TX - row lock contention d8gc19unfrcsw 63 SQL> |
3.插入主键同一值
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 |
--session 1: SQL> create table mytab(id number primary key); Table created. SQL> insert into mytab values(1); 1 row created. SQL> --session 2: SQL> insert into mytab values(1); --hang --session 3: SQL> l 1 select sid, 2 chr(bitand(p1, -16777216) / 16777215) || 3 chr(bitand(p1, 16711680) / 65535) "Name", 4 (bitand(p1, 65535)) "Mode", 5 event, 6 sql_id, 7 FINAL_BLOCKING_SESSION 8 from v$session 9* where event like 'enq%' SQL> / SID Name Mode EVENT SQL_ID FINAL_BLOCKING_SESSION ---------- ---------------- ---------- ------------------------------ -------------------------- ---------------------- 5 TX 4 enq: TX - row lock contention 2srnv7c1ummk0 63 SQL> |
关于几个工具的替代版本
最近看到由于使用盗版的PL/SQL Developer,导致PL/SQL Developer的登录脚本afterconnect.sql被注入的情况: 『针对最近黑客攻击数据库的解决方案和预防建议』 『知己知彼-关于Oracle安全比特币勒索问题揭秘和防范』 『plsql dev引起的数据库被黑勒索比 […]
shard node的outage测试
shard node的路由方式有直接路由和代理路由,之前我们已经说过,由于我没有connection pool,我们只能来测试一下,在代理路由的情况下,连接shardcat的情况下,当shard node出现意外,连接在shardcat上的操作会发生什么问题。 这里我们要注意下,查询分如下几种情况: […]
一次dataguard坏块的修复
客户有个11g的active dataguard库,mrp进程停了,看alertlog,可以看到有关ora-7445[kdxlin]的报错:
1 2 3 4 5 6 7 8 9 10 11 12 |
cat alert*.log .... Exception [type:SIGSEOV,Address not mapped to object] [ADDR:0xC] |PC:0x96504C7,kdxlin()+4153][flags: 0x0,count:1] Errors in le /aabb/app/oracle/rdbms/diag/rdbms/rmydbsid/mydbsid/trace/partsm_pr18_21343.trc (incident=70353): ORA-07445: exception encountered: core dump (kdxlin()+4153) [SIGSEGV] [ADDR:0xC] |PC:0x96504C7][Address not mapped to object][] Incident details in: /aabb/app/oracle/rdbms/diag/rdbms/rmydbsid/mydbsid/incident/incdir_70353/mydbsid_pr18_21343_i70353.trc Use ADRCI or Support Workbench to package the incident. Exception [type: SIGSEGV, Address not mapped to object] [ADDR:0xC][PC:0x96504C7,kdxlin()+4153][flags:0XO,count:1] Incidenl 70353 created, dump file/aabb/app/oracle/rdbms/diag/rdbms/rmydbsid/mydbsid/incident/incdir_70353/mydbsid_pr18_21343_i70353.trc ORA-07445: exception encountered: core dump (kdxlin()+4153) [SIGSEGV] [ADDR:0xC] |PC:0x96504C7][Address not mapped to object][] ... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
cat /aabb/app/oracle/rdbms/diag/rdbms/rmydbsid/mydbsid/incident/incdir_70353/mydbsid_pr18_21343_i70353.trc ... Error 607 in redo applicalion callback Dump of change vector Typ:2 CLS:1 APN:5 DBA0x2598d645 OBJ:3S3792 SCN:0x0960.99d2655e SEQ:1 OP:10.2 ENC:0 RBL:0 index redo(kdxlin):insert leaf row KTB Redo op:0x01 ver:0x01 compat bit:4(post-11) padding:1 op:F xid:0x0001.01a.010d8f34 uba:0x00dc8e3.6bf5.20 REDO: SINGLE/NONKEY/-- itl:3, sno:255, row size 23 insert key:(14):05 c4 02 4e 31 4f 07 78 74 0b 09 11 27 29 nonkey (length: 5): fb: --H-FL-- lb:0x0 cc:1 (2).01 80 Block after image is corrupt: buffer tsn: 5 rdba:0x2598d645(1024/630773317) scn:0x960.99d10d33 seq:0x01 flg:0x04 tail:0x0d330601 frmt:0x02 chkval:0xa1ae type:0x06=trans data Hex dump of currupt header 3=CHKVAL ... |
从trace中,我们可以看 […]
LGWR不工作在实时优先级
在solaris环境,在11.2.0.4之后(或者Patch 16387058 on top of 11.2.0.3.5),Oracle自动把LGWR进程放到_high_priority_processes中,(不管是单实例还是RAC)。在这之前,需要手工运行priocntl -s FX -m 60 […]