设为首页 收藏本站
查看: 1115|回复: 0

[经验分享] DB2 730 考试复习------问题总结

[复制链接]

尚未签到

发表于 2016-11-19 00:06:26 | 显示全部楼层 |阅读模式
  1.authorization
SYSADM:所有权限。
SYSCTRL:最高的系统控制权限级别。不允许直接访问数据。
SYSMAINT:不允吸访问数据。
SYSMON:提供快照能力,用于监控等。
DBADM:可以访问数据库中所有数据
LOAD:执行LOAD,根据操作模式,用户可能还需要LOAD操作目标上的insert 和 delete特权。
其中:
SYSCTRL:
db2start/db2stop
db2 create/drop database
db2 create/drop tablespace
db2 backup/restore/rollforward database
db2 runstats
db2 update db cfg for database dbname
SYSMAINT:
db2start/db2stop
db2 backup/restore/rollforward database
db2 runstats
db2 update db cfg for database dbname
DBADM:
db2 create/drop table
db2 grant/revoke
db2 runstats
  表和视图特权 7种:
control:授予用户在表和视图上的所有特权,以及将这些特权(除了control)授予别人
alter:允许用户在表中添加列,在表和它的列上添加或修改注释,添加主键或唯一约束,以及创建或删除表检查约束。
delete:删除行
index:允许用户在表上创建索引(注意,只有创建,没有删除,删除索引需要用户有唯一的一种索引特权control)
insert:插入数据
references:允许用户创建和删除外键,注意,这里的这个权限指的是给予parent key的权限
select:允许检索行和创建视图,以及运行export
update:允许用户跟新,但只可以在特定列上有这种特权
  对于触发器,需要下面的权限之一:
对于定义before或after触发器的表有alter权限
对于定义instead of触发器的视图有control权限
对定义instead of触发器的视图有所有权
对定义触发器的表或视图的模式有alterin权限
sysadm或dbadm
  2.routine/function/procedure
function/procedur are both routine
execute procedure need execute privillage, use call to execute procedure, if there is an out para in your procedure, use '?' instead.
3.sequence/identity
gererated always as identity(start with 1 increment by 1):you can not give a value, this just be generated by db2.
gererated by default as identity(start with 1 increment by 1):you can give a value.
you can use alter clause to change the current value of identity cloumn:
alter table XXX alter column YYY restart with 100;
  sequence is start from 1 by default
  4.view/foreign key's with grant option/delete issue
view:
with cascade check option(if you don't set cascade explictly, this the default opinion for 'with check option'):all statuments executed against the view must satisfy the conditions of the view and all underlying views--even if those views where not defined with the check option.
with local check option:statuments executed against the view need only satisfy conditions of views that have the check option specified.
  5.inner join/outer join
内连接与交叉积类似。
左外连接包括内连接和左表中未包括在内连接中的那些行。
右外连接包括内连接和右表中未包括在内连接中的那些行。
全外连接包括内连接以及左表和右表中未包括在内连接中的行。
6.xml usage
sqlquery,xmlquery,xmlexist
7.cursor:for example:delete form tab1 where current of csr1 with rr
if you do not add 'with hold', cursor will be closed after commit or rollback.
  
8.select statement when there is a column is null
?
9.data types
There are four categories of built-in data types:numeric,string,datetime,and XML
  CLOB:Character large object(Single Byte)
DBCLOB:Double Byte Character large object
BLOB:Binary large object
  User-defined distinct:create distinct type candol as decimal(10,2) with comparisons,this will automatically generate functions to perform casting between the base type and the distinct type, and comparsion operators for comparing instan ces of the distinct type.
User-defined structured:create a type that consists of serveral columns of built-in types.
User-defined reference
  10.can unique or index be null?
DB2 provide three types of constraints:unique,referential integrity,and table check.
  unique:Unique constraints are used to ensure that values in a column are unique. Unique constraints can be defined over one or more columns. Each column included in the unique constraint must be defined as NOT NULL.It can be defined either as primary key or unique.You can define only one primary key on a table, but you can define multiple unique constraints.
CREATE TABLE BOOKS (BOOKID INTEGER NOT NULL PRIMARY KEY,
BOOKNAME VARCHAR(100),
ISBN CHAR(10) NOT NULL CONSTRAINT BOOKSISBN UNIQUE )
  referential integrity:primary key <=> foreign key
CREATE TABLE AUTHORS (AUTHORID INTEGER NOT NULL PRIMARY KEY,
LNAME VARCHAR(100),
FNAME VARCHAR(100))
CREATE TABLE BOOKS (BOOKID INTEGER NOT NULL PRIMARY KEY,
BOOKNAME VARCHAR(100),
ISBN CHAR(10),
AUTHORID INTEGER REFERENCES AUTHORS)
if restrict or no action is specified, DB2 does not allow the parent row to be deleted.
if cascade is specified, thed deleting a row from the parent table automatically also deletes dependent rows in all dependent tables.
if set null is specified, then the parent row is deleted from the parent table and the foreign key value in the dependent rows is set null(if nullable)
table check:ALTER TABLE BOOKS ADD BOOKTYPE CHAR(1) CHECK (BOOKTYPE IN ('F','N') )
  Index can be defined as unique or nonunique.Nonunique indexes allow duplicate
key values; unique indexes allow only one occurrence of a key value in the list.Unique indexes do allow a single null value to be present. However, a second null value would cause a duplicate and therefore is not allowed.
DB2 does not let you create multiple indexes with the same definition.For example, because primary key will create an index implictly, you cann't create another index on it.
  clustering indexes:physical store way <==> index store way
  11.partition
use it to improve speed(分区,refer to RAID)
12.lock/isolation level
幻想读:事务T1读取一条指定where条件的语句,返回结果集。此时事务T2插入一行新记录,恰好满足T1的where条件。然后T1使用相同的条件再次查询,结果集中可以看到T2插入的记录,这条新纪录就是幻想。(select行)
脏读:读取了未提交的数据。(t1跟新数据,但未提交,t2读了,t1回滚,这时t2就读了脏数据)
不可重复读:事务T1读取一行记录,紧接着事务T2修改了T1刚刚读取的记录,然后T1再次查询,发现与第一次读取的记录不同,这称为不可重复读。(where行)
丢失更新
  可重复读RR:最严格,脏读、不可重复读、幻想读都不会发生。(锁定select扫过的所有行)
读稳定性RS:防止脏读、不可重复读。(锁定满足select where条件的行)
游标稳定性CS:防止脏读。(锁定游标当前所指定的行)
未提交读UR:都可能发生。
  13.others:
AIX=>最低要workgroup
HP-UX=>最低要enterprise
6CPUs=>最低要Enterprise
use package:connect & execute
Z/OS catalog:先catalognode,然后直接catalog DCS Database(两步)
XML column cann't be unique

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-302147-1-1.html 上篇帖子: C#.NET通用权限管理在DB2数据库上运行的脚本参考 下篇帖子: DB2(Procedure)存储过程遍历循环!
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表