`

DB2移表(表空间不足后,把数据导出来,把原来的表删除重建)

    博客分类:
  • DB2
db2 
阅读更多
-- 1.导出数据
EXPORT TO SOL_T_LOGISTICSORDER20140822.DEL OF DEL SELECT LOGISTICSORDERID,SALEORDERNO,SALEORDERITEMNO,OMSITEMNO,SUPPLIERCODE,EXPRESSCOMPANYCODE,EXPRESSNO,SENDERNAME,SENDERREGIONCODE,SENDERCITYCODE,SENDERDISTRICTCODE,SENDERRCD,SENDERADDRESS,SENDERPHONE,SENDERMOBILE,RECEIVERNAME,RECEIVERRCD,RECEIVERADDRESS,RECEIVERPHONE,RECEIVERMOBILE,RETURNADDRESSCODE,TRANSPORTAREACODE,SENDSTARTTIME,SENDENDTIME,WEIGHT,GOODSNAME,GOODSVALUE,REMARK,SENDSTATUS,SENDTYPE,EXCEPTIONCODE,EXCEPTIONMSG,CREATETIME,LASTUPDATETIME,SENDERTOWNCODE,SENDERREGION,SENDERCITY,SENDERDISTRICT,SENDERTOWN,RECEIVERREGIONCODE,RECEIVERCITYCODE,RECEIVERDISTRICTCODE,RECEIVERTOWNCODE,RECEIVERREGION,RECEIVERCITY,RECEIVERDISTRICT,RECEIVERTOWN,ISCANCEL,EXPRESSCOMPANYNAME,SELFDELIVERYNAME,SELFDELIVERYMOBILE FROM SOP1ADM.SOL_T_LOGISTICSORDER WITH UR;

-- 2删除SOL_T_LOGISTICSORDER表
drop table SOP1ADM.SOL_T_LOGISTICSORDER;

-- 3.创建新表
CREATE TABLE "SOP1ADM "."SOL_T_LOGISTICSORDER"  (
		  "LOGISTICSORDERID" VARCHAR(32) NOT NULL , 
		  "SALEORDERNO" VARCHAR(25) , 
		  "SALEORDERITEMNO" VARCHAR(1200) , 
		  "OMSITEMNO" VARCHAR(1200) , 
		  "SUPPLIERCODE" VARCHAR(32) , 
		  "EXPRESSCOMPANYCODE" VARCHAR(64) , 
		  "EXPRESSNO" VARCHAR(25) , 
		  "SENDERNAME" VARCHAR(100) , 
		  "SENDERREGIONCODE" VARCHAR(25) , 
		  "SENDERCITYCODE" VARCHAR(25) , 
		  "SENDERDISTRICTCODE" VARCHAR(25) , 
		  "SENDERRCD" VARCHAR(400) , 
		  "SENDERADDRESS" VARCHAR(400) , 
		  "SENDERPHONE" VARCHAR(32) , 
		  "SENDERMOBILE" VARCHAR(25) , 
		  "RECEIVERNAME" VARCHAR(100) , 
		  "RECEIVERRCD" VARCHAR(400) , 
		  "RECEIVERADDRESS" VARCHAR(400) , 
		  "RECEIVERPHONE" VARCHAR(32) , 
		  "RECEIVERMOBILE" VARCHAR(25) , 
		  "RETURNADDRESSCODE" VARCHAR(32) , 
		  "TRANSPORTAREACODE" VARCHAR(25) , 
		  "SENDSTARTTIME" TIMESTAMP , 
		  "SENDENDTIME" TIMESTAMP , 
		  "WEIGHT" VARCHAR(25) , 
		  "GOODSNAME" VARCHAR(200) , 
		  "GOODSVALUE" VARCHAR(10) , 
		  "REMARK" VARCHAR(400) , 
		  "SENDSTATUS" VARCHAR(4) , 
		  "SENDTYPE" VARCHAR(1) , 
		  "EXCEPTIONCODE" VARCHAR(25) , 
		  "EXCEPTIONMSG" VARCHAR(400) , 
		  "CREATETIME" TIMESTAMP , 
		  "LASTUPDATETIME" TIMESTAMP , 
		  "SENDERTOWNCODE" VARCHAR(25) , 
		  "SENDERREGION" VARCHAR(50) , 
		  "SENDERCITY" VARCHAR(100) , 
		  "SENDERDISTRICT" VARCHAR(100) , 
		  "SENDERTOWN" VARCHAR(100) , 
		  "RECEIVERREGIONCODE" VARCHAR(25) , 
		  "RECEIVERCITYCODE" VARCHAR(25) , 
		  "RECEIVERDISTRICTCODE" VARCHAR(25) , 
		  "RECEIVERTOWNCODE" VARCHAR(25) , 
		  "RECEIVERREGION" VARCHAR(50) , 
		  "RECEIVERCITY" VARCHAR(100) , 
		  "RECEIVERDISTRICT" VARCHAR(100) , 
		  "RECEIVERTOWN" VARCHAR(100) , 
		  "ISCANCEL" VARCHAR(1) , 
		  "EXPRESSCOMPANYNAME" VARCHAR(100) , 
		  "SELFDELIVERYNAME" VARCHAR(30) , 
		  "SELFDELIVERYMOBILE" VARCHAR(11),
		  
		  "SENDFLAG" INTEGER DEFAULT 1,
		  "RECEIVERZIPCODE" VARCHAR(16),
		  "SENDERZIPCODE" VARCHAR(16),
		  "RETURNNAME" VARCHAR(100),
		  "RETURNREGIONCODE" VARCHAR(25),
		  "RETURNCITYCODE" VARCHAR(25),
		  "RETURNDISTRICTCODE" VARCHAR(25),
		  "RETURNTOWNCODE" VARCHAR(25),
		  "RETURNRCD" VARCHAR(400),
		  "RETURNADDRESS" VARCHAR(400),
		  "RETURNZIPCODE" VARCHAR(16),
		  "RETURNMOBILE" VARCHAR(25),
		  "RETURNPHONE" VARCHAR(32),
		  "RETURNREGION" VARCHAR(50),
		  "RETURNCITY" VARCHAR(100),
		  "RETURNDISTRICT" VARCHAR(100),
		  "RETURNTOWN" VARCHAR(100)
		 )IN "TBS_16K" INDEX IN SOP1_IX; 
	 
COMMENT ON TABLE "SOP1ADM "."SOL_T_LOGISTICSORDER" IS 'C店物流订单表';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."CREATETIME" IS '创建时间';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."EXCEPTIONCODE" IS '快递异常编码';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."EXCEPTIONMSG" IS '快递异常描述';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."EXPRESSCOMPANYCODE" IS '快递公司编码';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."EXPRESSCOMPANYNAME" IS '物流公司名称';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."EXPRESSNO" IS '运单号';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."GOODSNAME" IS '货物名称';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."GOODSVALUE" IS '货价';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."ISCANCEL" IS '取消标识';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."LASTUPDATETIME" IS '最后更新时间';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."LOGISTICSORDERID" IS '物流订单号';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."OMSITEMNO" IS 'OMS行项目号';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."RECEIVERADDRESS" IS '收件人地址';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."RECEIVERCITY" IS '收货市';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."RECEIVERCITYCODE" IS '收货市编码';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."RECEIVERDISTRICT" IS '收货区';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."RECEIVERDISTRICTCODE" IS '收货区编码';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."RECEIVERMOBILE" IS '收件人手机';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."RECEIVERNAME" IS '收件人姓名';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."RECEIVERPHONE" IS '收件人电话';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."RECEIVERRCD" IS '收件人省市区';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."RECEIVERREGION" IS '收货省';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."RECEIVERREGIONCODE" IS '收货省编码';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."RECEIVERTOWN" IS '收货镇';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."RECEIVERTOWNCODE" IS '收货镇编码';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."REMARK" IS '备注';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."RETURNADDRESSCODE" IS '退货地址编码';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."SALEORDERITEMNO" IS '销售订单行项目号(逗号隔开)';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."SALEORDERNO" IS '销售订单号';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."SELFDELIVERYMOBILE" IS '自配送送货人电话';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."SELFDELIVERYNAME" IS '自配送送货人姓名';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."SENDENDTIME" IS '取件截止时间';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."SENDERADDRESS" IS '发件人地址';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."SENDERCITY" IS '发货市';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."SENDERCITYCODE" IS '发件人市编码';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."SENDERDISTRICT" IS '发货区';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."SENDERDISTRICTCODE" IS '发件人区编码';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."SENDERMOBILE" IS '发件人手机';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."SENDERNAME" IS '发件人姓名';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."SENDERPHONE" IS '发件人电话';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."SENDERRCD" IS '发件人省市区';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."SENDERREGION" IS '发货省';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."SENDERREGIONCODE" IS '发件人省编码';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."SENDERTOWN" IS '发货镇';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."SENDERTOWNCODE" IS '发货镇编码';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."SENDSTARTTIME" IS '取件起始时间';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."SENDSTATUS" IS '发送状态(发送状态0:已发送;1:接收;2:不需要传输;3:未合作 4:下单失败)';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."SENDTYPE" IS '发货方式 0:在线下单 1:自己联系物流';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."SUPPLIERCODE" IS '商户编码';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."TRANSPORTAREACODE" IS '运输区域编码';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."WEIGHT" IS '重量';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."SENDFLAG" IS '发送标示,0代表未发送SOD,1代表已发送SOD,2代表字段校验异常';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."RECEIVERZIPCODE" IS '收件人邮编';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."SENDERZIPCODE" IS '发件人邮编';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."RETURNNAME" IS '退货人姓名';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."RETURNREGIONCODE" IS '退货人省编码';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."RETURNCITYCODE" IS '退货人市编码';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."RETURNDISTRICTCODE" IS '退货人区编码';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."RETURNTOWNCODE" IS '退货人镇编码';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."RETURNRCD" IS '退货人省市区';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."RETURNADDRESS" IS '退货人地址';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."RETURNZIPCODE" IS '退货人邮编';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."RETURNMOBILE" IS '退货人手机';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."RETURNPHONE" IS '退货人电话';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."RETURNREGION" IS '退货人省';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."RETURNCITY" IS '退货人市';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."RETURNDISTRICT" IS '退货人区';
COMMENT ON COLUMN "SOP1ADM "."SOL_T_LOGISTICSORDER"."RETURNTOWN" IS '退货人镇';



ALTER TABLE "SOP1ADM "."SOL_T_LOGISTICSORDER" 
	ADD CONSTRAINT "PK_SOL_T_LOGISTICSORDER" PRIMARY KEY
		("LOGISTICSORDERID");

GRANT SELECT ON SOP1ADM.SOL_T_LOGISTICSORDER TO USER DBAMON;

-- 4.导入数据 
LOAD FROM SOL_T_LOGISTICSORDER20140822.DEL OF DEL  INSERT INTO SOP1ADM.SOL_T_LOGISTICSORDER(LOGISTICSORDERID,SALEORDERNO,SALEORDERITEMNO,OMSITEMNO,SUPPLIERCODE,EXPRESSCOMPANYCODE,EXPRESSNO,SENDERNAME,SENDERREGIONCODE,SENDERCITYCODE,SENDERDISTRICTCODE,SENDERRCD,SENDERADDRESS,SENDERPHONE,SENDERMOBILE,RECEIVERNAME,RECEIVERRCD,RECEIVERADDRESS,RECEIVERPHONE,RECEIVERMOBILE,RETURNADDRESSCODE,TRANSPORTAREACODE,SENDSTARTTIME,SENDENDTIME,WEIGHT,GOODSNAME,GOODSVALUE,REMARK,SENDSTATUS,SENDTYPE,EXCEPTIONCODE,EXCEPTIONMSG,CREATETIME,LASTUPDATETIME,SENDERTOWNCODE,SENDERREGION,SENDERCITY,SENDERDISTRICT,SENDERTOWN,RECEIVERREGIONCODE,RECEIVERCITYCODE,RECEIVERDISTRICTCODE,RECEIVERTOWNCODE,RECEIVERREGION,RECEIVERCITY,RECEIVERDISTRICT,RECEIVERTOWN,ISCANCEL,EXPRESSCOMPANYNAME,SELFDELIVERYNAME,SELFDELIVERYMOBILE) NONRECOVERABLE;


-- 5.建立索引
CREATE INDEX "SOP1ADM "."SOL_T_LOGISTICSORDER_IDX4" ON "SOP1ADM "."SOL_T_LOGISTICSORDER" 
		("CREATETIME" ASC)COLLECT SAMPLED DETAILED STATISTICS 
		COMPRESS NO ALLOW REVERSE SCANS;

CREATE INDEX "SOP1ADM "."SOL_T_LOGISTICSORDER_INDEX1" ON "SOP1ADM "."SOL_T_LOGISTICSORDER" 
		("SALEORDERNO" ASC,"SUPPLIERCODE" ASC)
		COMPRESS NO ALLOW REVERSE SCANS;

CREATE INDEX "SOP1ADM "."SOL_T_LOGISTICSORDER_INDEX2" ON "SOP1ADM "."SOL_T_LOGISTICSORDER" 
		("SUPPLIERCODE" ASC,"EXPRESSNO" ASC,"EXPRESSCOMPANYCODE" ASC)
		COMPRESS NO ALLOW REVERSE SCANS;

CREATE INDEX "SOP1ADM "."SOL_T_LOGISTICSORDER_INDEX3" ON "SOP1ADM "."SOL_T_LOGISTICSORDER" 
		("SENDTYPE" ASC,"CREATETIME" ASC)
		COLLECT SAMPLED DETAILED STATISTICS 
		COMPRESS NO ALLOW REVERSE SCANS;
CREATE INDEX "SOP1ADM "."SOL_T_LOGISTICSORDER_INDEX5" ON "SOP1ADM "."SOL_T_LOGISTICSORDER" 
	   ("SENDFLAG" ASC)COLLECT SAMPLED DETAILED STATISTICS 
	   COMPRESS NO ALLOW REVERSE SCANS;

--6 runstats
RUNSTATS ON TABLE SOP1ADM.SOL_T_LOGISTICSORDER ON ALL COLUMNS WITH DISTRIBUTION AND DETAILED INDEXES ALL;

分享到:
评论

相关推荐

    数据业务工程师DB2入门指南

    - Oracle的表空间数据文件通常较小且数量较多,而DB2则倾向于使用较大的数据文件。 - **1.5.3 数据库使用内存的差异** - Oracle和DB2在内存管理机制上有明显的区别,Oracle更侧重于动态调整内存使用量,而DB2则...

    DB2如何评估索引碎片是否是缓慢的RUNSTATS根

    在DB2中,索引用于加速数据检索操作,但随着时间推移,由于频繁的插入、更新和删除操作,索引可能会变得碎片化,这会对数据库性能造成负面影响。本知识点将详细介绍DB2中索引碎片问题以及如何评估和处理索引碎片对...

    DB2新手入门命令记录

    - 说明: 从表`tb1`中删除id为1的数据行。 3. **创建索引** - 命令: `db2createindex idx1 ontb1(id);` - 说明: 在表`tb1`的`id`字段上创建名为`idx1`的索引。 4. **创建视图** - 命令: `db2createview view1 ...

    DB2 731培训认证

    8. **数据库维护**:学习如何进行DB2的日常维护,包括空间管理、统计信息收集、表和索引的重组和重建,以及DB2实例的重启和升级。 9. **故障诊断与问题解决**:掌握DB2错误日志的解读,了解如何使用DB2诊断工具进行...

    DB2 SQL性能调优秘笈

    3. **临时表空间优化**:合理规划临时表空间的配置和位置,可以减少I/O操作,提高临时表的创建和删除速度。 #### 五、并发控制与锁管理 在多用户环境中,合理的并发控制策略对于防止死锁和提高事务处理能力非常...

    DB2应急手册V1.0.doc

    删除日志文件后,应立即停止数据库,并通过恢复操作来修复,或者根据日志备份重建数据。 2. **交易日志存储空间满的处理**:在循环日志模式下,DB2会自动覆盖旧的日志文件。但在归档日志模式下,需要手动或自动归档...

    db2应用基础学习笔记

    定期的数据库维护,如统计信息更新、表空间管理、索引重建等,有助于保持数据库的高效运行。 8. **故障排查**:学习如何读取DB2错误消息,理解SQLSTATE和SQLCODE的含义,以及使用DB2诊断工具(如db2pd、db2trace等...

    DB2 基本概念

    视图是DB2中的另一个重要概念,它可以视为从一个或多个表中选择出来的数据的一种虚拟表示形式。通过视图,用户可以查看到表中的部分或全部列或行,而无需知道底层数据的具体存储位置。 - **视图的功能**: - **...

    DB2认证730&731资料汇总

    1. **DB2架构**:理解DB2的数据存储结构,包括表空间、段、页等概念,以及如何配置和优化这些组件。 2. **SQL语言**:熟练掌握SQL语句,包括DML(插入、更新、删除)、DDL(创建、修改、删除表)和DCL(权限管理)...

    DB2性能调优资料,解决SQL执行慢的问题

    DB2是一款强大的关系型数据库管理系统,广泛应用于企业级的数据存储和处理。在实际操作中,DB2的性能调优是确保系统高效运行的关键步骤。针对SQL执行慢的问题,本资料集合了DB2存储过程调优的方法和实例,旨在提供...

    DB2基础入门(参考文档)

    - **回收空间**: 导出数据 -> 删除表 -> 重建表 -> 装入数据。 - **逻辑去除**: 创建视图,将不再需要的列排除在外。 - **修改列宽度**: VARCHAR列支持加宽,其他类型不支持修改列属性。 **3. 更换列名** - **...

    DB2错误代码对照表

    ### DB2错误代码对照表详解 #### 引言 在数据库管理与开发过程中,遇到错误是在所难免的。为了能够快速定位并解决问题,理解错误代码的含义至关重要。本文将对DB2错误代码对照表进行详细解析,帮助读者深入理解每...

    db2中的常用命令及使用方法

    - **列出表空间容器**:`db2=listtablespacecontainers for tablespacename` - **功能**:列出特定表空间的所有容器。 - **参数**:`tablespacename`是表空间的名称。 - **示例**:`db2=listtablespacecontainers...

    DB2缓冲池和索引调优的方法.doc

    一般来说,缓冲池的大小应该根据表空间的大小和数据表的记录数来确定。缓冲池的大小可以通过 DB2 的命令行工具来查看和修改。 在 Unix 下,可以使用以下命令来查看缓冲池相关信息: * 切换到 db2inst1 账号:su –...

    db2通用数据库自学教程

    4. 更新与删除:通过UPDATE和DELETE语句修改或删除表中的数据。 五、索引与性能优化 1. 索引概念:理解索引的作用,包括唯一索引、非唯一索引和复合索引。 2. 创建索引:学习CREATE INDEX语句,为表添加索引。 3. ...

    DB2数据库基础

    - **DB2提供哪些关系扩展器:** 提供了诸如XML支持、空间数据类型、全文搜索等功能,增强了传统关系型数据库的能力。 **1.1.6 Journal** - DB2支持Journal功能,主要用于事务的日志记录,确保数据的一致性,在故障...

    IBM DB2 数据库使用小技巧

    在DB2中,模式是一个命名空间,用于组织和隔离数据。通过设置当前模式,可以确保后续的数据操作都在指定的模式下进行,避免了模式冲突和权限问题。 #### 10. 创建数据库 `createdatabase<db_name>usingcodeset...

    db2代码错误大全

    42. **SQLCODE +625**: 因为主键索引被删除,表定义标记为不完整,可能需要重建索引。 43. **SQLCODE +626**: 增强的UNIQUE约束的索引被删除,唯一性不再有效,可能影响数据完整性。 44. **SQLCODE +645**: 建立的...

    db2使用经验积累.rar

    8. **维护与升级**:定期的数据库维护任务,如统计信息更新、表空间管理、索引重建等,以及如何平稳地进行DB2版本升级,都是可能涵盖的话题。 9. **备份与恢复策略**:有效的备份策略是防止数据丢失的关键。作者...

    db2编程技巧

    需要注意的是,当创建表时可以指定表空间,如用户临时表空间 (`USERTEMP`) 或系统临时表空间 (`SYSTEMTEMP`)。这些表空间主要用于存储临时数据或中间结果。 **1.2 使用临时表** 临时表在DB2中非常重要,尤其是在...

Global site tag (gtag.js) - Google Analytics