列权限的一点总结!
oracle 部分对象权限(insert,update,references)可以控制到列![@more@]SQL> connect test5/test5已连接。SQL> grant insert(id , name) , update(sex) ,select on t to test2;授权成功。SQL> show userUSER 为 "TEST5"SQL> connect test2/test2已连接。SQL> select * from test5.t; ID NAME S---------- ---------- - 2 a 2 3 a 2SQL> insert into test5.t values(1 , 'a' , 1);insert into test5.t values(1 , 'a' , 1) *第 1 行出现错误:
oracle数据字典的一点总结!
oracle的数据字典比较多,其实也比较复杂。通过分类简单的做了一点总结。[@more@]Data Dictionary包括: 1.base table 基表 在create database时通过调用$ORACLE_HOMEsql.bsq而创建的,大致可以通过下面语句获得,当然也可以直接查看sql.bsq文件 select * from dba_tableswhere owner='SYS' AND tablespace_name='SYSTEM' 2.Data Dictionary views Data Dictionary views是通过create database之后调用脚本($ORACLE_HOMErdbmsadmincatalog.sql)创建的,如果手工创建db的话可以很容易的观查和实验。 可以通过查询dict来获得
状态为inactive的日志一定归档了吗?
inactive表示该日志在实例恢复时不再需要被用到,仅此而已,和是否归档没有任何关系,前端时间看到pub上有人问起这个问题,我们通常看到状态为inactive的日志archived=YES也就是通常都归档了,不太容易观察到archived=no,在9i下可以通过设置log_archive_start=false来控制不归档,但是10g是否不太容易控制,这里通过缩小flash_recovery_area使其没有空间从而不能实现归档来观察一下状态为inactive且archived=no的日志!SQL> select group#,sequence#,status,archived from v$log; GROUP# SEQUENCE# STATUS ARC--------
flashback table也会用到temp表空间?
无意中执行的一个简单的flashback table操作提示:SQL> flashback table t to scn 340592;flashback table t to scn 340592 *第 1 行出现错误:ORA-00604: 递归 SQL 级别 1 出现错误ORA-25153: 临时表空间为空那么到底是flashback table操作需要用到temp tbs呢还是在执行flashback table操作的其他系统操作用到temp tbs?有点疑问[@more@]SQL> desc t 名称 是否为空? 类型 ----------------------------------------- -------- ---------------------------- ID
oracle标准版和企业版的区别!
经常有人我,正好找到一个比较全面而又简洁的doc介绍,随手记录一下![@more@]http://www.oracle.com/lang/cn/database/product_editions.html
OMF和flash_recovery_area的关系!
在OMF出现之前(9i R1),oracle db的文件,主要指dbf,redo,ctl是通过os管理的,为了简化对数据库文件的管理,oracle引入了OMF,通过omf创建的dbf和redo,其default的大小都是100m,autoextend umlimited。9i R1的dbf文件格式default:ora_%t_%u.dbf,redo格式:ora_%g_%u.log;9iR2的格式发生了一些变化,把ora变成了o1_mf_%t(%g)_%u.dbf(log),其中%t表示dbf所属的tbs,%g表示redo所属的group#,%u表示唯一。[@more@]1、仅设置参数db_create_file_dest创建redoSQL> show parameter db_createNAME TYPE VALUE------------------------------
系统权限UNLIMITED TABLESPACE为什么如此特殊?
1、系统权限UNLIMITED TABLESPACE 不能被授予role,可以被授予用户!2、UNLIMITED TABLESPACE 没有被包括在resource role中,但是UNLIMITED TABLESPACE 随着resource的授出而被授予用户的。3、UNLIMITED TABLESPACE 不能伴随着resource被授予role而授予用户。[@more@]1、测试1系统权限UNLIMITED TABLESPACE 不能被授予role,可以被授予用户!SQL> create role rl1 ;角色已创建。SQL> create user test identified by test;用户已创建。SQL> grant connect , create table , unlimited tablespace to rl1;grant connect , create
那些操作会发生局部检查点(Partial checkpoint)!
Partial checkpoint– Dirty buffers belonging to the tablespace– ALTER TABLESPACE BEGIN BACKUP– ALTER TABLESPACE tablespace OFFLINE NORMAL上面2种操作会发生局部检查点!使相应的dirty buffer被写入和tablespace对应的datafile中[@more@]SQL> select name , checkpoint_change# from v$datafile;NAME CHECKPOINT_CHANGE#-------------------------------------------------- ------------------E:ORACLEPRODUCT10.2.0ORADATATESTSYSTEM01.DBF 806682E:ORACLEPRODUCT10.2.0ORADATATESTUNDOTBS01.DB 806682FE:ORACLEPRODUCT10.
How to Dump Redo Log File Information!
http://yumianfeilong.com/2007/04/02/how-to-dump-redo-log-file-information/一篇不错的文章转[@more@]http://yumianfeilong.com/2007/04/02/how-to-dump-redo-log-file-information/
Thomas Kyte 关于"unix system kernel parameters"的回答
http://www.itpub.net/thread-148366-1-2.html记录一下![@more@]http://www.itpub.net/thread-148366-1-2.html
创建同样大小的永久表空间和临时表空间速度比较!
创建同样大小的表空间,永久表空间要比临时标空间慢很多,原因就像doc所言创建数据文件时block需要被初始化为"empty",其实我觉得就是初始化成oracle可以识别的以db_block_size为大小的block格式吧;而临时文件不需要被初始化![@more@]During tablespace creation, the datafiles that make up the tablespace are initialized with special "empty" block images. TEMPFILES are not initialized.SQL> set timing onSQL> create tablespace test datafile 'C:APPWCHORADATADB11TEST01.DBF' SIZE 1G;表空间已创建
Enabled Novalidated的作用!
By placing a constraint in the enabled novalidated state, you enable the constraint without locking the table.如doc所言,把constriant由状态disable变成enable时在表上会产生lock,期间所有的DML, queries, or DDL都被阻塞(If you change a constraint from disabled to enabled, then the table must be locked. No new DML, queries, or DDL can occur, because there is no mechanism to ensure that operations on the table conform to the constraint during the enable operation.)。阻塞的原因是:because there is no
一篇介绍内部事件不错的文章!
tanfufa 上传了一些不错的东西,记录一下![@more@]http://www.itpub.net/thread-976360-1-1.html
user_tab_columns和user_tab_cols的区别!
user_tab_cols differs from "USER_TAB_COLUMNS" in that hidden columns are not filtered out。10.2版本中user_tab_cols比user_tab_columns多出下面几列:HIDDEN_COLUMN VARCHAR2(3)VIRTUAL_COLUMN VARCHAR2(3)SEGMENT_COLUMN_ID NUMBERINTERNAL_COLUMN_ID NOT NULL NUMBERQUALIFIED_COL_NAME VARCHAR2(4000)[@more@]简单的测试过程如下:SQL> desc tt名称 是否为空? 类型----------------------------------------- -------- ----------------------------ID NOT NULL NUMBER(38)NAME VARCHAR2(10)AGE NUMBER(38)COL_HIDD
Fast Full Index Scans的特点!
其实Fast Full Index Scans是针对full table scan而言的,Fast Full Index Scans的一些特点也和full table scan相似(如:多块读):Fast Full Index Scans的一些特点:1.Fast full scan is available only with the CBO2.at least one column in the index key has the NOT NULL constraint3. A fast full scan accesses the data in the index itself, without accessing the table4.It cannot be used to eliminate a sort operation, because the data is not ordered by the index key.(粗略的试验了一下发现也是排好序了,按照index_k
index和rowid的一点关系!
唯一index和非唯一index的index entry中尽管都存在rowid,但是其实有一点细微的差别,在唯一index中index_column就是index_column, 数据通过index_column排序;而在非唯一index中index_column其实是index_key+rowid,如果index_key相同,那么会使用rowid排序。[@more@]Data is returned in the ascending order of index columns. Multiple rows with identical values are sorted in ascending order by rowid.--=======================================================SQL> select /*+ index(a idx_tt) */ a.*,rowid from tt a wh
有关lock的一点测试总结!
理解oracle lock的概念,有助于理解多用户的并发执行。[@more@]测试过程1:--===========================================================================1.测试表t是一个存在200w左右数据的大表,数据完全来自dba_objectssession1:22:52:28 SQL> select count(object_id) from t;COUNT(OBJECT_ID)---------------- 2019072已用时间: 00: 00: 01.2022:21:46 SQL> create index idx_t on t(object_id);执行上面create index语句,保证能持续一段时间,以便在session2,3,4中进行其他操作session:检测在t上都加了什么类型的
权限传递的一点测试!
记得在北京讲课时曾经有学员问到过这个问题,当时没有详细测试,前几天看到pub上又有人提及这类问题,简单的测试了一下,还发现了一些问题。传递出去的对象权限可以cascade回收,而传递出去的系统权限却没有cascade回收![@more@]1.对象权限传递测试C:>sqlplus xys/managerSQL*Plus: Release 11.1.0.6.0 - Production on 星期一 4月 7 22:55:01 2008Copyright (c) 1982, 2007, Oracle. All rights reserved.连接到:Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - ProductionWith the Partitioning, OLAP, Data Mining a
使用绑定变量的一点总结!
在oltp系统中提倡使用绑定变量,使用绑定变量可以减少hard parse,避免因解析sql而过渡消耗cpu时间以及引起latch争用等一系列问题。那么到底如何使用绑定变量?可能是困扰很多人的一个问题,下面列举了一些使用绑定变量的例子或者是场合[@more@]1.sqlplus中如何使用绑定变量,可以通过variable来定义SQL> select * from tt where id=1;ID NAME---------- ----------------------------------------1 testSQL> select * from tt where id=2;ID NAME---------- ----------------------------------------2 testSQL> variable i num
如何获得server端和client端ip address和host name!
如何获得server端和client端ip address和host name![@more@]--可以通过系统提供的utl_inaddr包中的2个函数获得数据库服务器的主机名和ip地址SQL> set serveroutput onSQL> exec dbms_output.put_line(utl_inaddr.get_host_name);XYSPL/SQL 过程已成功完成。SQL> exec dbms_output.put_line(utl_inaddr.get_host_address);192.168.0.252PL/SQL 过程已成功完成。----可以通过系统提供的函数获得client端主机名和ip地址,获得client端ip地址时需要注意连接数据库时必须通过tns连接才能获得ip地址,否则不能获得SQL> select sys_