自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

DB2常用命令以及與技巧的詳細(xì)描述

數(shù)據(jù)庫(kù)
我們今天主要向大家描述的是DBase:DB2常用命令以及實(shí)際操作技巧,望大家能通以下的相關(guān)命令與操作技巧,來簡(jiǎn)化你的工作。

此文章主要向大家講述的是幾個(gè)DBase:DB2常用命令以及實(shí)際操作技巧,希望大家能通過這些命令與操作技巧,提高大家的工作效率,以下就是文章的主要內(nèi)容的詳細(xì)描述,望大家在瀏覽之后會(huì)對(duì)其有更深的了解。

1.db2里面的字符串連接可用"||"這個(gè)進(jìn)行連接

2.如何快速刪除大批量的數(shù)據(jù)表(test為數(shù)據(jù)庫(kù)表)

最常用也是最多人用的語(yǔ)句:delete from test,但這種做法,效率比較低,花費(fèi)時(shí)間太長(zhǎng),因?yàn)樵趧h除數(shù)據(jù)時(shí),要記數(shù)據(jù)庫(kù)日志。

import from /dev/null of del replace into test//先清空,再導(dǎo)入數(shù)據(jù)(由于導(dǎo)入的文件為空,故相當(dāng)于清空表數(shù)據(jù)),這種刪除的速度較快

ALTER TABLE test activate NOT LOGGED initially WITH EMPTY TABLE ;刪除表中的數(shù)據(jù),不記日志,這種處理最快

3.導(dǎo)入、導(dǎo)出數(shù)據(jù),支持的文件有ixf,del文件

db2 "export to fileName.del of del select * from tableName" //db2中把表中的數(shù)據(jù)導(dǎo)入到文件

db2 "import from fileName.del of del insert into tableName " //db2中把文件中的數(shù)據(jù)導(dǎo)入到表

4.DB2中檢查表是否已存在

 

  1. select * from "SYSIBM"."SYSTABLES" where lower(name) ='afa_maintransdtl' 

5.處理db2鎖表問題:

db2 “connect to afa”

db2 “get snapshot for locks on 實(shí)例名”

db2 “terminate”

然后查看相關(guān)信息,找到被鎖定的表,執(zhí)行以下語(yǔ)句:

db2 “force application(application handle) 注:application handle對(duì)應(yīng)的是一個(gè)整數(shù)

6.在服務(wù)器上創(chuàng)建存儲(chǔ)過程時(shí):

應(yīng)為存儲(chǔ)過程指定特定的換行符,然后執(zhí)行下面的語(yǔ)句:

db2 -td@ -vf fileName.sql (其中@為存儲(chǔ)過程中指定的換行符)

7. 查看索引是否起作用

 

  1. runstats on table afa.yj_jywtk with distribution and detailed indexes all; 

8.截取數(shù)據(jù)庫(kù)快照:

db2 "connect to 實(shí)例名"

 

  1. db2 "update monitor switches using lock ON sort ON bufferpool ON uow ON table ON statement ON" 

db2 "get snapshot for all on 實(shí)例名"

9. 查看存儲(chǔ)過程

 

  1. select procname,text from sysibm.sysprocedures; 

10.list tables 查看數(shù)據(jù)庫(kù)表

11.查找字符在字串中的位置

 

  1. locate('y','xyz') 

查找'y'在'xyz'中的位置。

12. 計(jì)算兩個(gè)日期的相差天數(shù)

 

  1. days(date('2007-03-01'))-days(date('2007-02-28')) 

days 返回的是從 0001-01-01 開始計(jì)算的天數(shù)

13. 為一個(gè)用戶訪問另一個(gè)實(shí)例創(chuàng)建表映射

create alias tableName for 實(shí)例名. tableName

14.如何查看表結(jié)構(gòu)

 

  1. describe table tableName  
  2. or  
  3. describe select * from table_name  

 

15.如何重新啟動(dòng)數(shù)據(jù)庫(kù)?

 

  1. restart database database_name 

16.如何激活數(shù)據(jù)庫(kù)?

 

  1. activate database database_name 

17.如何停止數(shù)據(jù)庫(kù)?

 

  1. deactivate database database_name 

18.如何重命名表?

 

  1. rename table_old to table_new 

19.如何DB2常用命令定義序列?

 

  1. create sequence orderseq start with 1 increment by 1 no maxvalue no cycle cache24 

20.如何查看一個(gè)表的索引

 

  1. describe indexes for table tableName show detail 

以上的相關(guān)內(nèi)容就是對(duì)DB2常用命令及技巧的介紹,望你能有所收獲。

【編輯推薦】

  1. DB2數(shù)據(jù)復(fù)制與遷移如何正確運(yùn)用?
  2. 用DB2dart恢復(fù)數(shù)據(jù)的正確操作步驟詳解
  3. IBM DB2跨平臺(tái)數(shù)據(jù)庫(kù)遷移的步驟與注意點(diǎn)
  4. DB2V8升級(jí)到DB2V95在AIX平臺(tái)上很簡(jiǎn)單
  5. IBM DB2中新手要了解的東西有哪些?

 

 

責(zé)任編輯:佚名 來源: 中文業(yè)界資訊站
相關(guān)推薦

2010-08-06 08:43:02

DB2常用命令

2011-03-11 17:52:33

DB2命令

2010-08-26 11:37:38

DB2命令

2009-05-04 14:03:39

DB2命令技巧

2010-08-04 09:50:35

DB2 9存儲(chǔ)過程

2010-09-30 10:13:35

DB2常用命令

2010-07-29 13:34:35

DB2編目

2010-08-19 15:23:14

DB2常用命令

2010-08-19 16:47:14

DB2 9.5分區(qū)管理

2010-08-03 14:05:26

DB2數(shù)據(jù)集

2010-09-07 16:34:47

DB2 XML

2010-08-03 13:29:44

DB2 9數(shù)據(jù)庫(kù)優(yōu)點(diǎn)

2010-08-04 09:45:30

2010-08-19 09:30:31

DB2 V9.7

2010-08-12 11:26:03

2010-07-28 11:13:04

DB2 Resotre

2009-12-01 18:19:41

Suse常用命令

2010-03-02 13:14:36

LinuxYUM常用命

2010-08-10 13:44:51

DB2創(chuàng)建外鍵

2010-11-04 11:07:56

DB2管理命令
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)