WEB开发网
开发学院数据库DB2 DB2建nickname导致CRASH解决方法 阅读

DB2建nickname导致CRASH解决方法

 2006-10-21 22:13:14 来源:WEB开发网   
核心提示:create alias db2admin.tables for sysstat.tables; CREATE ALIAS DB2ADMIN.VIEWS FOR SYSCAT.VIEWS create alias db2admin.columns for syscat.columns; create alias gue

create alias db2admin.tables for sysstat.tables;

CREATE ALIAS DB2ADMIN.VIEWS FOR SYSCAT.VIEWS

create alias db2admin.columns for syscat.columns;

create alias guest.columns for syscat.columns;

4. 建立表

create table zjt_tables as

(select * from tables) definition only;

create table zjt_views as

(select * from views) definition only;

5. 插入记录

insert into zjt_tables select * from tables;

insert into zjt_views select * from views;

6. 建立视图

create view V_zjt_tables as select tabschema,tabname from zjt_tables;

7. 建立触发器

CREATE TRIGGER zjt_tables_del

AFTER DELETE ON zjt_tables

REFERENCING OLD AS O

FOR EACH ROW MODE DB2SQL

Insert into zjt_tables1 values(substr(o.tabschema,1,8),substr(o.tabname,1,10))

8. 建立唯一性索引

CREATE UNIQUE INDEX I_ztables_tabname

[size=3]ON zjt_tables(tabname);

9. 查看表

select tabname from tables

where tabname='ZJT_TABLES';

10. 查看列

select SUBSTR(COLNAME,1,20) as 列名,TYPENAME as 类型,LENGTH as 长度

from columns

where tabname='ZJT_TABLES';

11. 查看表结构

db2 describe table user1.department

db2 describe select * from user.tables

12. 查看表的索引

db2 describe indexes for table user1.department

13. 查看视图

select viewname from views

where viewname='V_ZJT_TABLES';

14. 查看索引

select indname from indexes

where indname='I_ZTABLES_TABNAME';

15. 查看存贮过程

SELECT SUBSTR(PROCSCHEMA,1,15),SUBSTR(PROCNAME,1,15)

FROM SYSCAT.PROCEDURES;

16. 类型转换(cast)

ip datatype:varchar

select cast(ip as integer)+50 from log_comm_failed

17. 重新连接

connect reset

18. 中断数据库连接

disconnect db2_gcb

19. view application

LIST APPLICATION;

20. kill application

FORCE APPLICATION(0);

db2 force applications all (强迫所有应用程序从数据库断开)

21. lock table

lock table test in exclusive mode

22. 共享

lock table test in share mode

23. 显示当前用户所有表

list tables

24. 列出所有的系统表

list tables for system

25. 显示当前活动数据库

list active databases

26. 查看命令选项

list command options

27. 系统数据库目录

LIST DATABASE DIRECTORY

28. 表空间

list tablespaces

29. 表空间容器

LIST TABLESPACE CONTAINERS FOR

Example: LIST TABLESPACE CONTAINERS FOR 1

30. 显示用户数据库的存取权限

GET AUTHORIZATIONS

1 2 3 4 5 6  下一页

Tags:DB nickname 导致

编辑录入:coldstar [复制链接] [打 印]
赞助商链接