如何看懂执行计划!
The execution order in EXPLAIN PLAN output begins with the line that is the furthest indented to the right. The next step is the parent of that line. If two lines are indented equally, then the top line is normally executed first. 在doc上看到了,记录一下[@more@]SQL> select count(*) from dba_objects;COUNT(*)----------11345Execution Plan----------------------------------------------------------Plan hash value: 2598313856---------------------------------------------------------------------------
通过bbed模拟和修复corrupted block!
使用bbed需要注意:1、win下oracle不提供2、随oracle软件一起发布3、在unix/linux下使用时需要事先relink4、oracle最初使用bbed用来修复坏block,从9i开始可以通过rman的blockrecover来恢复,不过前提是事先做过备份[@more@][oracle@xys oracle]$ bbedPassword:BBED: Release 2.0.0.0.0 - Limited Production on Tue Jun 9 13:13:04 2009Copyright (c) 1982, 2005, Oracle. All rights reserved.************* !!! For Oracle Internal Use only !!! ***************BBED> help all;SET DBA [ dba | file#, block# ]SET FILENAME 'file
asm中template特性测试!
都是doc的内容:Templates are used to set redundancy (mirroring) and striping attributes of files created in an ASM disk group. When a file is created, redundancy and striping attributes are set for that file based on an explicitly named template or the system template that is the default template for the file type.When a disk group is created, ASM creates a set of default templates for that disk group. The set consists of one template for each file type (data file, control file, redo log file, a
如何为asm db中system表空间的数据文件使用别名!
问题虽小,却困扰了一段时间![@more@]SQL> create tablespace TEST datafile '+DG/asmdb/datafile/TEST.DBF' SIZE 3M;表空间已创建。SQL> SELECT FILE_NAME FROM DBA_DATA_FILES;FILE_NAME--------------------------------------------------------------------------------+DG/asmdb/datafile/users.266.688401581+DG/asmdb/datafile/sysaux.264.688401529+DG/asmdb/datafile/undotbs1.263.688401515+DG/asmdb/datafile/system01.dbf+DG/asmdb/datafile/test.dbf--=====================================ASMCMD> pwd+dg/asmdb
expdp时不能导出sys用户下的对象!
sys用户下的对象不支持导出[@more@]SQL> select owner,segment_name,tablespace_name from dba_segments where tablespace_name='USERS';OWNER SEGMENT_NAME TABLESPACE_NAME---------- -------------------- ------------------------------SYS REPAIR_TABLE USERSSYS TT USERSTEST1 TT USERSSYS T1 USERSTEST T USERSTEST TT USERS已选择6行。SQL>C:>expdp 'sys/system@test as sysdba' DIRECTORY=temp_dir dumpfile=users.dmp tablespaces=usersExport: Release 10.2.0.1.0 - Production on 星期一, 01 6月, 2009 9:47:44Copy
网络配置相关内容总结
网络问题是困扰初学者的大问题,简单的总结了一下,希望对一些人有所帮助。[@more@]1、listener首先对初学者要明确一下listener是在db server上配置,凡是在client端要连接db都需要通过listener,就像非本单位员工要想进入该单位所在的办公大楼必须去保安那里登记一下自己的信息(亮名自己的身份同时说出来要找谁、办什么事儿),之后保安打电话和你要找的人进行确认和求证。这里不打算介绍lsnrctl中的内容,这个doc上有,而且也比较简单,重点介绍一下pub上经常人们问到的一些和net相关的或者说可能是困扰初学者的一些不太容易掌握的问题,
影响flashback table的操作!
rt[@more@]14:32:24 SQL> create table tt(id int) rowdependencies tablespace users;表已创建。14:32:57 SQL> insert into tt values(1);已创建 1 行。14:33:12 SQL> insert into tt values(2);已创建 1 行。14:33:14 SQL> insert into tt values(3);已创建 1 行。14:33:16 SQL> commit;提交完成。14:33:18 SQL> select id ,ora_rowscn from tt; ID ORA_ROWSCN---------- ---------- 1 1739405 2 1739405 3 173940514:33:32 SQL> update tt set id=100;已更新3行。14:33:
sys用户不支持flashback table特性!
讲课时随手记录的flashback table大致过程[@more@]SQL> connect / as sysdbaConnected.SQL> desc tt Name Null? Type ----------------------------------------- -------- ---------------------------- ID NUMBER(38)SQL> select * from tt;no rows selectedSQL> set time on14:14:36 SQL> insert into tt values(1);1 row created.14:14:42 SQL> insert into tt values(2);1 row created.14:14:44 SQL> insert into tt
备份恢复的一个有趣现象!
讲课时发现的所以随手记录一下。[@more@]SQL> alter tablespace users offline;表空间已更改。SQL> select * from t2;select * from t2 *第 1 行出现错误:ORA-00376: 此时无法读取文件 4ORA-01110: 数据文件 4: 'C:ORADATATESTUSERS01.DBF'--备份表空间users对应的数据文件SQL> alter tablespace users online;表空间已更改。SQL> select group#,sequence#,archived,status,first_change# from v$log; GROUP# SEQUENCE# ARC STATUS FIRST_CHANGE#---------- ---------- --- ---------------- ----
remote_os_authent参数测试!
client端普通用户os验证过程[@more@]client端普通用户os验证过程:1、保证参数remote_os_authent=trueSQL> show parameter remote_os_authentNAME TYPE VALUE------------------------------------ ----------- ------------------------------remote_os_authent boolean TRUESQL>2、在server端保证sqlnet.ora中SQLNET.AUTHENTICATION_SERVICES= (none)必须是none,我测试client端SQLNET.AUTHENTICATION_SERVICES的设置无关紧要3、注意参数os_authent_prefix的值,如果os_authent_prefix有值,不为null,则创建用户时也要加上os_aut
和参数相关的一些视图!
oracle有好几个和参数相关的视图,它们之间到底有啥区别,下面通过试验以及结合doc来理解一下。[@more@] 1.v$spparameter 这里的sp就是server parameterdoc对它的解释是:This view displays the current contents of the server parameter file. The view returns FALSE values in the ISSPECIFIED column if a server parameter file is not being used by the instance.验证一下:SQL> connect / as sysdba已连接。SQL> show parameter spfileNAME TYPE VALUE--------------------------
CORE_DUMP_DEST中的文件是由谁产生的?
doc对该参数的描述根本就不清楚:CORE_DUMP_DESTPropertyDescriptionParameter typeStringSyntaxCORE_DUMP_DEST = directoryDefault valueORACLE_HOME/DBSModifiableALTER SYSTEMBasicNoCORE_DUMP_DEST is primarily a UNIX parameter and may not be supported on your platform. It specifies the directory where Oracle dumps core files.[@more@]从下面的描述来看,core dump file应该是由服务器进程产生的CORE_DUMP_DEST should point to the directory where core dumps from the Oracle server will beplaced. A core dump is a m
会引起排序的sql语句类型!
闲的无聊,看看9i 的性能优化ocp考试题,题中提到了的一点内容,记得在doc上也看到过,不过从10g开始,group by不一定会排序。[@more@]The types of SQL statements that can cause database sorts to occur include the following: ORDER BY,GROUP BY, SELECT DISTINCT, UNION, INTERSECT, MINUS, ANALYZE, CREATE INDEX, joinsbetween tables on columns that are not indexed.
audit对象权限时的not exists选项!
在审计对象权限时可以通过not existes选项可以对不存在的对象以及语句进行审计。[@more@]SQL> show userUSER 为 "XYSWCH"SQL> audit not exists;审计已成功。SQL> select * from tt7;select * from tt7 *第 1 行出现错误:ORA-00942: 表或视图不存在SQL> select action_name,obj_name from dba_audit_exists where obj_name='TT7';ACTION_NAME OBJ_NAME---------------------------- ----------SELECT TT7SQL>--审计结构会记录在视图dba_audit_exists中
对象audit时的一个有用option:ON DEFAULT
在使用对象权限审计时如果使用on default选项,有一下几个方面需要注意:1、设置on default之后,它仅对之后创建的对象生效2、on default对之后创建的对象永远生效,即使以后设置了noaudit all(或者其他)on default;除非单独对某个对象设置noaudit all(或者其他)on object_name才能彻底取消on default选项引起的审计3、使用view时,对表和view同时记录审计结果(union)[@more@]ON DEFAULT Specify ON DEFAULT to establish the specified object options as default object options for subsequently created objects. After you hav
win下外部(externally)验证测试过程
n年前测试成功过,最近至少1年一直都无法成功,尤其是讲课时成功不了很痛苦,今天把各种情况组合了一下,最后得出成功的配置步骤。[@more@]SQL> SHOW PARAMETER OSNAME TYPE VALUE------------------------------------ ----------- ------------------------------optimizer_index_cost_adj integer 100os_authent_prefix stringos_roles boolean FALSEremote_os_authent boolean FALSEremote_os_roles boolean FALSEtimed_os_statistics integer 0--注意一定要把os_authent_prefix的default值OPS$改成null(去掉)SQL> host hostnam
working with ASH and AWR
ash and awr[@more@]The ASH contains recent information on active sessions sampled every second. The AWR takes snapshots of the database every hour, so the information in the AWR could be almost an hour old and will not help in diagnosing issues that are current on the database. Typically, to resolve issues currently on the database, detailed information pertaining to the last 5 or 10 minutes is critical. Because recording session activity is expensive, ASH samples V$SESSION every second and reco
Temporary Tablespace Group
Temporary Tablespace Group[@more@]A temporary tablespace group can be thought of as a shortcut for a list of temporary tablespaces.A temporary tablespace group consists of only temporary tablespaces.A temporary tablespace group has the following properties:It contains at least one temporary tablespace. There is no explicit limit on how many tablespaces are contained in a group.It has the same namespace as tablespaces. It is not possible for a tablespace and a temporary tablespace group to have t
Base Statistics and Metrics
Base Statistics and Metrics[@more@]Base statistics represent the raw data collected. For example, counting the number of physical reads in the system since startup is a base statistic.Metrics are secondary statistics derived from base statistics. Most metrics track the rates of change of activities in the Oracle database.For example, the average physical reads in the system in the last 60 minutes is a metric. Metrics are used by internal client components forsystem health monitoring, problem det
AWR(Automatic Workload Repository)
AWR(Automatic Workload Repository)[@more@]This component is the central element of the new manageability infrastructure. It provides services to internal Oracle server components to collect, process, maintain, and access performance statistics for problem detection and self-tuning purposes.AWR is the infrastructure that provides services to Oracle Database 10g components to collect,maintain, and utilize statistics for problem detection and self-tuning purposes.The AWR infrastructure consists of