// *Cause: An UPDATE or INSERT statement attempted to insert a duplicate key.
// this message if a duplicate entry exists at a different level.
// *Action: Either remove the unique restriction or do not insert the key.
如果是tns的错误,比如tns-12534问题
>
oerr tns 12534 12534, 00000, "TNS:operation not supported"
// *Cause: An internal function received a request to perform an
// operation that is not supported (on this machine).
// *Action: Not normally visible to the user. For further details, turn
// on tracing and reexecute the operation. If error persists, contact
// Oracle Customer Support.
chopt 这个命令使用需要谨慎,它可以启用/禁用某些数据库选项,除非你确实需要,要不还是很有风险的。
命令的使用方法
chopt
options:
dm = Oracle Data Mining RDBMS Files
dv = Oracle Database Vault option
lbac = Oracle Label Security
olap = Oracle OLAP
partitioning = Oracle Partitioning
rat = Oracle Real Application Testing
像我们使用sqlplus登入oracle的时候,就会提示这些东西。
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
如果需要禁用,还是需要做充分的评估。这个操作不是一个很简单的过程,需要重新编译某些链接库。
我在本地测试了一把,最后发现要编译的时候,果断终止了。
> chopt disable rat
Writing to /opt/app/oracle/xxxx/product/11.2.0/install/disable_rat.log...
/usr/bin/make -f /opt/app/oracle/xxxx/product/11.2.0/rdbms/lib/ins_rdbms.mk rat_off ORACLE_HOME=/opt/app/oracle/xxxx/product/11.2.0
/usr/bin/make -f /opt/app/oracle/xxxx/product/11.2.0/rdbms/lib/ins_rdbms.mk ioracle ORACLE_HOME=/opt/app/oracle/xxxx/product/11.2.0
make: *** Deleting file `/opt/app/oracle/xxxx/product/11.2.0/rdbms/lib/oracle'
make: *** wait: No child processes. Stop.
make: *** Waiting for unfinished jobs....
make: *** wait: No child processes. Stop.
adrciadrci是11g推出的新特性,算是对日志目录的有效管理工具,其实这些工作大家也可以通过shell脚本,命令自己定制完成。个人觉得提供的功能还是比较丰富的,不过还是根据自己的喜好来使用吧。
使用方式比较简单。直接通过help命令就一览无余了。
adrci> help
HELP [topic]
Available Topics:
CREATE REPORT
ECHO
EXIT
HELP
HOST
IPS
PURGE
RUN
SET BASE
SET BROWSER
SET CONTROL
SET ECHO
SET EDITOR
SET HOMES | HOME | HOMEPATH
SET TERMOUT
SHOW ALERT
SHOW BASE
SHOW CONTROL
SHOW HM_RUN
SHOW HOMES | HOME | HOMEPATH
SHOW INCDIR
SHOW INCIDENT
SHOW PROBLEM
SHOW REPORT
SHOW TRACEFILE
SPOOL
使用比较多的可能就是show alert,show tracefile这几个功能了。
dbfsize 这个命令的使用还是有点意思,可以读取文件头部,然后做一些基本的解析。
> dbfsize /dbccbsPT1/oracle/xxxx/orasys01/system/system01.dbf
Database file: /dbccbsPT1/oracle/xxxx/orasys01/system/system01.dbf
Database file type: file system
Database file size:
384000 8192 byte blocks
如果文件不是数据文件,直接就报错了。
> dbfsize wa.sql
wa.sql: Header block size is bad
read: Success
dbv 这个命令还是一个很有用的工具,在官方文档中也有详细的解释。MOS35512.1 中也有解释。
这个命令可以检验数据文件的物理结构,校验文件是否损坏等等,在online,offline的情况下都可以校验。
命令选项有以下几个。
DBVERIFY: Release 11.2.0.2.0 - Production on Wed Jan 7 21:16:21 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Keyword Description (Default)
----------------------------------------------------
FILE File to Verify (NONE)
START Start Block (First Block of File)
END End Block (Last Block of File)
BLOCKSIZE Logical Block Size (8192)
LOGFILE Output Log (NONE)
FEEDBACK Display Progress (0)
PARFILE Parameter File (NONE)
USERID Username/Password (NONE)
SEGMENT_ID Segment ID (tsn.relfile.block) (NONE)
HIGH_SCN Highest Block SCN To Verify (NONE)
(scn_wrap.scn_base OR scn)
自己迫不及待抓取了一个数据库系统文件测试了一把。
> dbv file=/dbccbsPT1/oracle/xxxx/orasys01/system/system01.dbf logfile=a.log
DBVERIFY: Release 11.2.0.2.0 - Production on Wed Jan 7 21:16:41 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
oraccbs1@ccbdbpt3:/opt/app/oracle/xxxx/product/11.2.0/bin> less a.log
DBVERIFY: Release 11.2.0.2.0 - Production on Wed Jan 7 21:16:41 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
DBVERIFY - Verification starting : FILE = /dbccbsPT1/oracle/xxxx/orasys01/system/system01.dbf
DBVERIFY - Verification complete
Total Pages Examined : 384000
Total Pages Processed (Data) : 219646
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 108431
Total Pages Failing (Index): 0
Total Pages Processed (Other): 27414
Total Pages Processed (Seg) : 1
Total Pages Failing (Seg) : 0
Total Pages Empty : 28509
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 2617374659 (2566.2617374659)
还是可以看到很多比较细致的信息。更多的细节还需要精工细琢。