标签云
asm恢复 bbed bootstrap$ dul In Memory kcbzib_kcrsds_1 kccpb_sanity_check_2 MySQL恢复 ORA-00312 ORA-00607 ORA-00704 ORA-00742 ORA-01110 ORA-01555 ORA-01578 ORA-01595 ORA-08103 ORA-600 2131 ORA-600 2662 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)
- 操作系统 (103)
- 数据库 (1,772)
- DB2 (22)
- MySQL (77)
- Oracle (1,612)
- Data Guard (52)
- EXADATA (8)
- GoldenGate (24)
- ORA-xxxxx (166)
- ORACLE 12C (72)
- ORACLE 18C (6)
- ORACLE 19C (15)
- ORACLE 21C (3)
- Oracle 23ai (8)
- Oracle ASM (69)
- Oracle Bug (8)
- Oracle RAC (54)
- Oracle 安全 (6)
- Oracle 开发 (28)
- Oracle 监听 (29)
- Oracle备份恢复 (593)
- Oracle安装升级 (98)
- Oracle性能优化 (62)
- 专题索引 (5)
- 勒索恢复 (86)
- PostgreSQL (31)
- pdu工具 (6)
- PostgreSQL恢复 (10)
- SQL Server (32)
- SQL Server恢复 (13)
- TimesTen (7)
- 达梦数据库 (3)
- 达梦恢复 (1)
- 生活娱乐 (2)
- 至理名言 (11)
- 虚拟化 (2)
- VMware (2)
- 软件开发 (39)
- Asp.Net (9)
- JavaScript (12)
- PHP (2)
- 小工具 (22)
-
最近发表
- 由于空间满导致PostgreSQL数据库异常处理
- 一次非常幸运的ORA-600 16703(tab$被清空)故障恢复
- Oracle 19c 202507补丁(RUs+OJVM)-19.28
- 2025年的Oracle 8.0.5数据库恢复
- ORA-600 kokiasg1故障分析(obj$中核心字典序列全部被恶意删除)
- ORA-00756 ORA-10567故障数据0丢失恢复
- 数据库文件变成32k故障恢复
- tcp连接过多导致监听TNS-12532 TNS-12560 TNS-00502错误
- 文件系统格式化MySQL数据库恢复
- .sstop勒索加密数据库恢复
- 解决一次硬件恢复之后数据文件0kb的故障恢复case
- Error in invoking target ‘libasmclntsh19.ohso libasmperl19.ohso client_sharedlib’问题处理
- ORA-01171: datafile N going offline due to error advancing checkpoint
- linux环境oracle数据库被文件系统勒索加密为.babyk扩展名溯源
- ORA-600 ksvworkmsgalloc: bad reaper
- ORA-600 krccfl_chunk故障处理
- Oracle Recovery Tools恢复案例总结—202505
- ORA-600 kddummy_blkchk 数据库循环重启
- 记录一次asm disk加入到vg通过恢复直接open库的案例
- CHECKDB 发现了 N 个分配错误和 M 个一致性错误
分类目录归档:Oracle
ORA-00001: unique constraint (PERFSTAT.STATS$SQL_SUMMARY_PK) violated
出现如下错误(ORA-00001: unique constraint (PERFSTAT.STATS$SQL_SUMMARY_PK) violated)
Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production With the Partitioning option JServer Release 9.2.0.6.0 - Production ORACLE_HOME = /oracle9/app/product/9.2.0 System name: AIX Node name: zwq_bill_1 Release: 1 Version: 6 Machine: 00F64FF34C00 Instance name: bill1 Redo thread mounted by this instance: 1 Oracle process number: 30 Unix process pid: 46531060, image: oracle@zwq_bill_1 (J000) *** SESSION ID:(218.47085) 2012-04-02 19:30:45.561 *** 2012-04-02 19:30:45.561 ORA-12012: error on auto execute of job 1 ORA-00001: unique constraint (PERFSTAT.STATS$SQL_SUMMARY_PK) violated ORA-06512: at "PERFSTAT.STATSPACK", line 1361 ORA-06512: at "PERFSTAT.STATSPACK", line 2471 ORA-06512: at "PERFSTAT.STATSPACK", line 91 ORA-06512: at line 1
这个是oracle的一个Bug 2784796,提供解决方法有
1.run the statspack at level 0
2.restart the instance
3.set cursor sharing to exact (probably not feasible)
4.禁用主键,创建合适非唯一index
ALTER TABLE PERFSTAT.STATS$SQL_SUMMARY MODIFY CONSTRAINT STATS$SQL_SUMMARY_PK DISABLE NOVALIDATE;
5.修改STATS$V_$SQLXS视图
分析思路如下:
1)根据主键冲突找到主键包含列(spctab.sql)
create table STATS$SQL_SUMMARY (snap_id number(6) not null ,dbid number not null ,instance_number number not null ,text_subset varchar2(31) not null ,sql_text varchar2(1000) ,sharable_mem number ,sorts number ,module varchar2(64) ,loaded_versions number ,fetches number ,executions number ,loads number ,invalidations number ,parse_calls number ,disk_reads number ,buffer_gets number ,rows_processed number ,command_type number ,address raw(8) ,hash_value number ,version_count number ,cpu_time number ,elapsed_time number ,outline_sid number ,outline_category varchar2(64) ,child_latch number --注意下面5列构成主键 ,constraint STATS$SQL_SUMMARY_PK primary key (snap_id, dbid, instance_number, hash_value, text_subset) using index tablespace &&tablespace_name storage (initial 1m next 1m pctincrease 0) ,constraint STATS$SQL_SUMMARY_FK foreign key (snap_id, dbid, instance_number) references STATS$SNAPSHOT on delete cascade )tablespace &&tablespace_name storage (initial 1m next 1m pctincrease 0) pctfree 5 pctused 40;
2)找到该表插入数据(spcpkg.sql)
insert into stats$sql_summary ( snap_id , dbid , instance_number , text_subset , sharable_mem , sorts , module , loaded_versions , fetches , executions , loads , invalidations , parse_calls , disk_reads , buffer_gets , rows_processed , command_type , address , hash_value , version_count , cpu_time , elapsed_time , outline_sid , outline_category , child_latch ) select l_snap_id , p_dbid , p_instance_number , substrb(sql_text,1,31) , sharable_mem , sorts , module , loaded_versions , fetches , executions , loads , invalidations , parse_calls , disk_reads , buffer_gets , rows_processed , command_type , address , hash_value , version_count , cpu_time , elapsed_time , outline_sid , outline_category , child_latch from stats$v$sqlxs where is_obsolete = 'N' and ( buffer_gets > l_buffer_gets_th or disk_reads > l_disk_reads_th or parse_calls > l_parse_calls_th or executions > l_executions_th or sharable_mem > l_sharable_mem_th or version_count > l_version_count_th );
3)找出stats$v$sqlxs对象(spcusr.sql)
create or replace view STATS$V_$SQLXS as select max(sql_text) sql_text , sum(sharable_mem) sharable_mem , sum(sorts) sorts , min(module) module , sum(loaded_versions) loaded_versions , sum(fetches) fetches , sum(executions) executions , sum(loads) loads , sum(invalidations) invalidations , sum(parse_calls) parse_calls , sum(disk_reads) disk_reads , sum(buffer_gets) buffer_gets , sum(rows_processed) rows_processed , max(command_type) command_type , address address , hash_value hash_value , count(1) version_count , sum(cpu_time) cpu_time , sum(elapsed_time) elapsed_time , max(outline_sid) outline_sid , max(outline_category) outline_category , max(is_obsolete) is_obsolete , max(child_latch) child_latch from v$sql group by hash_value, address; create or replace public synonym STATS$V$SQLXS for STATS$V_$SQLXS;
4)通过这里可以看出,要是的STATS$SQL_SUMMARY主键不重复,只要是的STATS$V_$SQLXS查询出来的记录唯一,所以解决方案就是在STATS$V_$SQLXS视图中增加下列条件,确保查询出来的记录唯一,从而不会发生主键冲突
where ( plan_hash_value > 0 or executions > 0 or parse_calls > 0 or disk_reads > 0 or buffer_gets > 0 )
该bug在10g中修复,对于不能及时升级的数据库,建议采用第五种方法解决问题,比较治标治本,对业务基本上无影响
linux中不能ping通hostname可能存在问题
不能ping通hostname
[oracle@xifenfei ~]$ hostname xifenfei [oracle@xifenfei ~]$ ping xifenfei ping: unknown host xifenfei [oracle@xifenfei ~]$ nslookup > xifenfei ;; connection timed out; no servers could be reached > exit [oracle@xifenfei ~]$ more /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 xifenfei1 localhost.localdomain localhost
10G中存在问题
[oracle@xifenfei ~]$ sqlplus / as sysdba SQL*Plus: Release 10.2.0.1.0 - Production on Tue Apr 3 01:54:22 2012 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to an idle instance. --sqlplus连接非常慢 SQL> startup ORA-00600: internal error code, arguments: [keltnfy-ldmInit], [46], [1], [], [], [], [], [] --ORA-00600[keltnfy-ldmInit]错误
11G中存在问题
[oracle@xifenfei ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.3.0 Production on Tue Apr 3 02:02:29 2012 Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected. SQL> startup ORA-00119: invalid specification for system parameter LOCAL_LISTENER ORA-00130: invalid listener address '(ADDRESS=(PROTOCOL=TCP)(HOST=xifenfei)(PORT=1521))' --因为不能ping通xifenfei,提示LOCAL_LISTENER错误 --修改pfile文件 local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))' --启动数据库 SQL> startup pfile='/tmp/pfile' ORACLE instance started. Total System Global Area 368263168 bytes Fixed Size 1345016 bytes Variable Size 306186760 bytes Database Buffers 54525952 bytes Redo Buffers 6205440 bytes Database mounted. Database opened. [oracle@xifenfei ~]$ ps -ef|grep ora_ oracle 5960 1 0 02:09 ? 00:00:00 ora_pmon_ora11g oracle 5964 1 0 02:09 ? 00:00:00 ora_psp0_ora11g oracle 5970 1 1 02:09 ? 00:00:00 ora_vktm_ora11g oracle 5976 1 0 02:09 ? 00:00:00 ora_gen0_ora11g oracle 5980 1 0 02:09 ? 00:00:00 ora_diag_ora11g oracle 5984 1 0 02:09 ? 00:00:00 ora_dbrm_ora11g oracle 5988 1 0 02:09 ? 00:00:00 ora_dia0_ora11g oracle 5992 1 0 02:09 ? 00:00:00 ora_mman_ora11g oracle 5996 1 0 02:09 ? 00:00:00 ora_dbw0_ora11g oracle 6000 1 0 02:09 ? 00:00:00 ora_lgwr_ora11g oracle 6004 1 0 02:09 ? 00:00:00 ora_ckpt_ora11g oracle 6008 1 0 02:09 ? 00:00:00 ora_smon_ora11g oracle 6012 1 0 02:09 ? 00:00:00 ora_reco_ora11g oracle 6016 1 0 02:09 ? 00:00:00 ora_mmon_ora11g oracle 6020 1 0 02:09 ? 00:00:00 ora_mmnl_ora11g oracle 6028 1 0 02:09 ? 00:00:00 ora_s000_ora11g oracle 6055 1 0 02:10 ? 00:00:00 ora_p000_ora11g oracle 6059 1 0 02:10 ? 00:00:00 ora_p001_ora11g oracle 6063 1 0 02:10 ? 00:00:00 ora_arc0_ora11g oracle 6069 1 0 02:10 ? 00:00:00 ora_arc1_ora11g oracle 6073 1 0 02:10 ? 00:00:00 ora_arc2_ora11g oracle 6077 1 0 02:10 ? 00:00:00 ora_arc3_ora11g oracle 6081 1 0 02:10 ? 00:00:00 ora_qmnc_ora11g oracle 6089 1 0 02:10 ? 00:00:00 ora_q000_ora11g oracle 6093 1 0 02:10 ? 00:00:00 ora_q001_ora11g oracle 6141 1 0 02:11 ? 00:00:00 ora_d000_ora11g oracle 6145 1 2 02:11 ? 00:00:00 ora_cjq0_ora11g --数据库启动正常 [oracle@xifenfei ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.3.0 Production on Tue Apr 3 02:10:37 2012 Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected. SQL> show parameter local_listener; ORA-01012: not logged on Process ID: 0 Session ID: 0 Serial number: 0 --sqlplus不能操作,而且sqlplus登录非常慢
监听异常
--监听配置文件 LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.10)(PORT = 1522)) (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1522)) ) ) SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = ora11g) (ORACLE_HOME = /u01/oracle/oracle/product/11.2.0/db_1) (SID_NAME = ora11g) ) ) --启动监听 [oracle@xifenfei ~]$ lsnrctl start LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 03-APR-2012 02:19:52 Copyright (c) 1991, 2011, Oracle. All rights reserved. Starting /u01/oracle/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait... TNSLSNR for Linux: Version 11.2.0.3.0 - Production System parameter file is /u01/oracle/oracle/product/11.2.0/db_1/network/admin/listener.ora Log messages written to /u01/oracle/diag/tnslsnr/xifenfei/listener/alert/log.xml Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.10)(PORT=1522))) Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1522))) Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.10)(PORT=1522))) --一直处于等待状态 --客户端登录 C:\Users\XIFENFEI>sqlplus sys/xifenfei@192.168.1.10:1522/ora11g SQL*Plus: Release 11.2.0.3.0 Production on 星期二 4月 3 12:48:15 2012 Copyright (c) 1982, 2011, Oracle. All rights reserved. --一直hang住 [root@xifenfei admin]# netstat -an|grep 1522 tcp 0 0 192.168.1.10:1522 0.0.0.0:* LISTEN tcp 260 0 192.168.1.10:1522 192.168.1.1:51977 ESTABLISHED tcp 0 0 192.168.1.10:24317 192.168.1.10:1522 ESTABLISHED tcp 198 0 192.168.1.10:1522 192.168.1.10:24317 ESTABLISHED --这里显示已经连接
建议:在修改主机名时要慎重,修改的时候要确保/etc/hosts和/etc/sysconfig/network文件都被正确修改
使用wrap加密pl/sql代码
1.测试脚本
[oracle@bas ~]$ more pkg_wrap_xff.sql create or replace package pkg_wrap_xff is procedure welcome_in(abc in varchar2); END pkg_wrap_xff; / create or replace package body pkg_wrap_xff is procedure welcome_in(abc in varchar2) as begin dbms_output.put_line('welcome ' || abc); end; END pkg_wrap_xff; /
2.创建并测试包
SQL> @pkg_wrap_xff Package created. Package body created. SQL> set serveroutput on SQL> exec pkg_wrap_xff.welcome_in('xifenfei'); welcome xifenfei PL/SQL procedure successfully completed.
3.查看包内容
SQL> SELECT TEXT FROM dba_source a WHERE a.name='PKG_WRAP_XFF'; TEXT -------------------------------------------------------------- package pkg_wrap_xff is procedure welcome_in(abc in varchar2); END pkg_wrap_xff; package body pkg_wrap_xff is procedure welcome_in(abc in varchar2) as begin dbms_output.put_line('welcome ' || abc); end; END pkg_wrap_xff; 9 rows selected.
4.使用wrap加密
[oracle@bas ~]$ wrap iname=pkg_wrap_xff.sql oname=pkg_wrap_xff.plb PL/SQL Wrapper: Release 10.2.0.1.0- 64bit Production on Tue Apr 03 11:16:52 2012 Copyright (c) 1993, 2004, Oracle. All rights reserved. Processing pkg_wrap_xff.sql to pkg_wrap_xff.plb [oracle@bas ~]$ ll pkg_wrap_xff* -rw-r--r-- 1 oracle oinstall 634 Apr 3 11:16 pkg_wrap_xff.plb -rw-r--r-- 1 oracle oinstall 273 Apr 3 10:58 pkg_wrap_xff.sql [oracle@bas ~]$ more pkg_wrap_xff.plb create or replace package pkg_wrap_xff wrapped a000000 1 abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd 9 53 85 W36vGRTVGRHdbwYRR6PgEKn/uJgwg1zZf9OpynQ2Z/aHUmNhYcN/NpFphdvMis61lthVP41T adMRoYz9KTALorx2DjxUFXms0VvEXmDignlfcQjICNxh0Rmhsp2KsCjohpTO / create or replace package body pkg_wrap_xff wrapped a000000 1 abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd b 96 ce QzGnt9RcmxQyUfes+xtqkeZypV0wg1zwqNPWfI6iCq2Ve93Dd2BzFE8hHRRYZ/LM86Rx2o0E y67F1TM7QgP9WoGRBCUelGt4QvSOmwMecLCe57PVPD5lbxyJLK26scjDS8soGPzcCDysP+WR C0zeZ9lSlyLXqNex8XpUxi7tILux/gNr1FIOWaBRhYqgTZ754pVDNlG4SXE= /
4.测试加密包
SQL> drop package PKG_WRAP_XFF; Package dropped. SQL> @pkg_wrap_xff.plb Package created. Package body created. SQL> set serveroutput on PL/SQL procedure successfully completed. SQL> exec pkg_wrap_xff.welcome_in('www.xifenfei.com'); welcome www.xifenfei.com PL/SQL procedure successfully completed.
查看加密包内容
SQL> set pagesize 1000 SQL> SELECT TEXT FROM dba_source a WHERE a.name='PKG_WRAP_XFF'; TEXT -------------------------------------------------------------------------------- package pkg_wrap_xff wrapped a000000 1 abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd 9 53 85 W36vGRTVGRHdbwYRR6PgEKn/uJgwg1zZf9OpynQ2Z/aHUmNhYcN/NpFphdvMis61lthVP41T adMRoYz9KTALorx2DjxUFXms0VvEXmDignlfcQjICNxh0Rmhsp2KsCjohpTO package body pkg_wrap_xff wrapped a000000 1 abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd b 96 ce QzGnt9RcmxQyUfes+xtqkeZypV0wg1zwqNPWfI6iCq2Ve93Dd2BzFE8hHRRYZ/LM86Rx2o0E y67F1TM7QgP9WoGRBCUelGt4QvSOmwMecLCe57PVPD5lbxyJLK26scjDS8soGPzcCDysP+WR C0zeZ9lSlyLXqNex8XpUxi7tILux/gNr1FIOWaBRhYqgTZ754pVDNlG4SXE=
原则上来说wrap加密是不可逆的过程,所以可以通过使用wrap加密,实现了屏蔽代码的作用,确保了自己的知识产权。其实oracle本身很多的系统包也是通过这种方法进行加密处理,以保护oracle的产权。