| 订阅 | 在线投稿
分享
 
 
当前位置: 王朝网络 >> php >> ji yu DB2 ji PHP de ying yong xi tong kua ping tai qian yi xiang xi bu zhou ( yi )

ji yu DB2 ji PHP de ying yong xi tong kua ping tai qian yi xiang xi bu zhou ( yi )

2008-12-22 08:07:42 编辑來源:互联网 评论
 
 
 
本文为【基于DB2及PHP的应用系统跨平台迁移详细步骤(一)】的拼音翻译版
  ben wen zhu yao jie shao ru he wan cheng ji yu DB2 de PHP ying yong xi tong cong AIX ping tai dao Linux ping tai de yi zhi guo cheng 。 wen zhong bao han le di ceng de DB2 shu ju ku yi zhi 、 shang ceng de PHP ying yong xi tong yi zhi de xiang xi bu zhou yi ji yi zhi guo cheng zhong ke neng yu dao de wen ti he jie jue fang fa 。
  ren wu gai shu
  xi tong qian yi de gong zuo zhu yao fen wei yi xia ji ge fang mian :
  1.DB2 shu ju ku xi tong de kua ping tai qian yi
  2.Apache fu wu qi yu php ying yong xi tong de an zhuang he pei zhi
  xia mian wo men jiu fen 2 ge fang mian fen bie jie shao qian yi he pei zhi de ju ti bu zhou 。
  DB2 shu ju ku xi tong de kua ping tai qian yi
  shu ju ku huan jing
  yuan huan jing :AIX+DB2 v8.1
  mu biao huan jing :Linux+DB2 v8.1
  qi zhong yuan shu ju ku zhong bao han le 2 ge shu ju ku Instance:SRCDB1 yu SRCDB2。 zai SRCDB1/SRCDB2 shu ju ku zhong , yun bao han le shang bai zhang shu ju ku biao , bing you hen duo de suo yin 、 wai jian yue shu 、 chu fa qi 、 cun chu guo cheng yi ji yi xie han you zi zeng zi duan de biao ( han you GENERATED ALWAYS AS IDENTITY ding yi zi duan de biao )。 geng wei kun nan de shi , wo men bing mei you guan yu zhe xie shu ju ku dui xiang de zhun que chuang jian jiao ben 。
  qian yi fang an de xuan ze
  ru guo qian yi de yuan xi tong yu mu de xi tong shu yu tong yi lei xing cao zuo xi tong , li ru Linux zhi jian de qian yi , huo zhe AIX xi tong zhi jian de qian yi , ze qing kuang xiang dui jian dan ,DB2 ben shen yi jing ti gong xiang guan de shi yong gong ju lai shi xian zhe zhong tong lei xing ping tai zhi jian de shu ju ku yi zhi , ru : BACKUP he RESTORE ming ling 。 dang ran , gen ju bu tong de qing kuang huan xu yao dui shi yong gong ju suo ti gong de shen shu you bi jiao qing chu de le jie , pi ru yuan xi tong yu mu biao xi tong shi yong bu tong de biao kong jian , jiu hui she ji dao biao kong jian chong ding xiang de wen ti 。 you yu ben wen de chong dian zai yu kua ping tai de yi zhi , zhe zhong fang an xian ran wu fa man zu xu qiu , zai ci bu zai ao shu 。
  na me , ru he chu li kua ping tai de shu ju ku qian yi wen ti ? shi bu shi ke yi shi yong shi yong gong ju db2move ne ? db2move zhi neng qian yi biao zhong de shu ju , er wu fa dui suo yin 、 wai jian yue shu 、 chu fa qi he cun chu guo cheng deng shu ju ku dui xiang ye shi xian qian yi cao zuo , er qie dui yu bao han zi zeng zi duan shu ju de biao lai shuo ,db2move ye you yi ding de xian zhi 。 bing qie db2move zhi neng ba shu ju dao ru dao yi cun zai de shu ju ku de biao zhong , wu fa xian shi zhi ding biao kong jian de wei zhi 。 you yu zai shu ju ku de xi tong qian yi guo cheng zhong , bu jin xu yao qian yi biao zhong de shu ju , huan you suo yin 、 wai jian yue shu 、 chu fa qi he cun chu guo cheng deng shu ju ku dui xiang , yu ben wen suo xuan fang an xiang bi , huan shi hou zhe geng ju you shi 。 ke yi jiang db2move jin zuo wei qian yi biao shu ju de yi zhong bei yong fang an 。
  er dui yu export he import lai shuo , yi ci zhi neng zhen dui yi zhang biao jin xing dao chu dao ru cao zuo , bing qie xu yao shou dong shu ru export he import de ming ling yi ji xu yao dao ru dao chu de shu ju biao ming , zai shu ju ku biao de shu liang bu duo de qing kuang xia , zhe zhong fang an ye xu huan ke yi kao lv , dan ye bu bing shi zui jia de fang an 。 er zai shu ju ku zhong biao shu liang zhong duo de qing kuang xia , zhe zhong zuo fa ze shi ji ben bu xian shi de , er qie import ming ling bing bu neng bao zheng zi zeng zi duan de shu ju yu yuan lai de biao shu ju bao chi yi zhi 。
  ben wen gen ju DB2 dui shu ju ku dui xiang de chu li ji zhi , cai yong jiang db2look yu DDL、DML jiao ben xiang jie he de fang shi , bing zhen dui yuan shu ju ku zhong de chu fa qi 、 cun chu guo cheng yi ji wai jian yue shu deng fen bie chu li , gei chu le yi zhong kua ping tai DB2 shu ju ku xi tong yi zhi de ke xing fang an 。
  xia mian wo men yi SRCDB1 wei li jie shao yi xia zhe zhong qing kuang xia de shu ju ku zheng ti qian yi guo cheng 。SRCDB1 shu ju ku zhong you SRCDB1、ASN、DB2DBG he SQLDBA zhe si ge shu ju ku mo shi 。 jia she SRCDB1 shu ju ku de yong hu ming wei user_srcdb1, mi ma :pw_srcdb1。
  zai yuan xi tong (AIX) shang de xiang guan cao zuo
  1. shi yong db2look ming ling chou qu sheng cheng shu ju ku dui xiang de DDL jiao ben
  qing dan 1. db2look ming ling ji shen shu
  # db2look -d SRCDB1 -e -o srcdb1.ddl -a -i user_srcdb1 -w pw_srcdb1
  db2look : sheng cheng DDL yi bian chong xin chuang jian zai shu ju ku zhong ding yi de dui xiang
  yu fa : db2look -d DBname [-e] [-u Creator] [-z Schema]
  [-t Tname1 Tname2...TnameN] [-tw Tname] [-h] [-o Fname] [-a]
  [-m] [-c] [-r] [-l] [-x] [-xd] [-f] [-fd] [-td x]
  [-noview] [-i userID] [-w password]
  [-v Vname1 Vname2 ... VnameN] [-wrapper WrapperName]
  [-server ServerName] [-nofed]
  -d : shu ju ku ming cheng , bi xuan shen shu
  -e : chou qu fu zhi shu ju ku suo xu yao de DDL wen jian , ci xuan xiang jiang sheng cheng bao han DDL yu ju de jiao ben
  -o : jiang shu chu chong ding xiang dao gei ding de wen jian ming , ru guo wei zhi ding -o xuan xiang , ze shu chu mo ren zhuan dao stdout
  -a : wei suo you chuang jian cheng xu sheng cheng tong ji xin xi , ru guo zhi ding le ci xuan xiang , ze jiang hu lue -u xuan xiang
  -i : zhi ding deng lu dao shu ju ku suo zai fu wu qi shi suo shi yong de yong hu biao shi
  -w : zhi ding deng lu dao shu ju ku suo zai fu wu qi shi suo shi yong de mi ma
  2. gen ju bu tong lei xing dui xiang , fen hua shu ju ku dui xiang DDL jiao ben
  you yu yuan shu ju ku zhong de ge ge biao shu ju yi jing shi jing guo chu fa qi 、 cun chu guo cheng deng shu ju ku dui xiang chu li guo de shu ju , wei bao zheng shu ju ku zhong shu ju de yi zhi xing he wan zheng xing , zhe xie shu ju ku dui xiang ying gai zai dao ru shu ju hou zai chuang jian , yi fang zhi zai dao ru biao shu ju shi chong fu zhi xing chu fa qi he cun chu guo cheng deng shu ju ku dui xiang sheng cheng cuo wu shu ju 。 shi yong wen ben bian ji qi bian ji you db2look sheng cheng de srcdb1.ddl, jiang chuang jian biao ji suo yin de DDL yu ju , chuang jian wai jian yue shu de DDL yu ju yi ji chuang jian chu fa qi he chuang jian cun chu guo cheng de yu ju fen wei si zu , fen bie bao cun wei xia mian si ge DDL jiao ben :
  srcdb1_tables.ddl srcdb1_foriegnkeys.ddl
  srcdb1_triggers.ddl srcdb1_procedures.ddl
  srcdb1_tables.ddl : bao han chuang jian SEQUENCE,UDF,TABLE,VIEW deng shu ju ku dui xiang de ddl yu ju 。
  qing dan 2. srcdb1_tables.ddl yu ju
  CREATE SEQUENCE "SRCDB1"."SAMPLE_SEQ_1" AS INTEGER
  MINVALUE 1 MAXVALUE 9999999999
  START WITH 1 INCREMENT BY 1;
  CREATE FUNCTION " SRCDB1"." SAMPLE _FUNC_1" (
  VARCHAR(254),
  VARCHAR(254),
  VARCHAR(254)
  ) RETURNS VARCHAR(254)
  SPECIFIC SAMPLE _FUNC_1 ……;
  CREATE TABLE " SRCDB1"." SAMPLE _TAB_1" (
  "TAB_COL1" CHAR(20) NOT NULL ,
  "TAB_COL2" VARCHAR(70) NOT NULL ) ;
  CREATE TABLE " SRCDB1"." SAMPLE _TAB_2" (……);
  ……
  CREATE TABLE " SRCDB1"." SAMPLE _TAB_N" (……);
  CREATE VIEW SRCDB1.SAMPLE_VIEW_1 (VIEW_COL1,VIEW_COL2) AS SELECT distinct
  COL1 , COL2 FROM SAMPLE_TAB WHERE ……;
  CREATE VIEW SRCDB1.SAMPLE_VIEW_2 ……;
  ……
  CREATE VIEW SRCDB1.SAMPLE_VIEW_N ……;
  srcdb1_foriegnkeys.ddl : bao han chuang jian wai jian yue shu de ddl yu ju 。
  qing dan 3. srcdb1_foriegnkeys.ddl yu ju
  ALTER TABLE " SRCDB1"."SAMPLE_FK_1"
  ADD CONSTRAINT "SQL030903143850120" FOREIGN KEY
  ("FK_COL1")
  REFERENCES " SRCDB1"."SAMPLE_TABLE"
  ("COL1");
  ALTER TABLE " SRCDB1"."SAMPLE_FK_2" ADD ……;
  ……
  ALTER TABLE " SRCDB1"."SAMPLE_FK_N" ADD ……;
  srcdb1_triggers.ddl : bao han chuang jian chu fa qi de ddl yu ju 。
  qing dan 4. srcdb1_triggers.ddl yu ju
  CREATE TRIGGER SRCDB1.SAMPLE_TRIG_1 AFTER UPDATE OF col1 ON SRCDB1.SAMPLE_TAB
  REFERENCING NEW AS n FOR EACH ROW MODE DB2SQL WHEN ( n.col1 > 3)
  BEGIN ATOMIC
  update SAMPLE_TAB
  set(col2) = 'anotherValue' where col1 = n.col1 ;--
  END;
  CREATE TRIGGER SRCDB1. SAMPLE_TRIG_2 ……;
  ……
  CREATE TRIGGER SRCDB1. SAMPLE_TRIG_N ……;
  srcdb1_procedures.ddl : bao han chuang jian SQL cun chu guo cheng yi ji java cun chu guo cheng de ddl yu ju 。
  qing dan 5. srcdb1_procedures.ddl yu ju
  CREATE PROCEDURE " SRCDB1"." JAVA_PROCEDURE_1" (
  OUT SQLSTATE CHARACTER(5),
  OUT ROWS_SUBMITED INTEGER,
  IN BATCH_ID INTEGER,
  IN LEVEL VARCHAR(4000)
  )
  DYNAMIC RESULT SETS 0
  SPECIFIC SUBMIT_BATCH
  EXTERNAL NAME 'Submit_batch!submit_batch'
  LANGUAGE JAVA
  PARAMETER STYLE JAVA
  NOT DETERMINISTIC
  FENCED THREADSAFE
  MODIFIES SQL DATA
  NO DBINFO;
  CREATE PROCEDURE " SRCDB1"."JAVA_PROCEDURE_2" ……;
  ……
  CREATE PROCEDURE " SRCDB1"."JAVA_PROCEDURE_N" ……;
  SET CURRENT SCHEMA = " SRCDB1";
  SET CURRENT PATH = "SYSIBM","SYSFUN"," SRCDB1";
  CREATE PROCEDURE SRCDB1.SQL_PROCEDURE_1 (
  IN hostname varchar(4000),
  IN username varchar(4000),
  OUT SQLCODE_OUT int )
  SPECIFIC SRCDB1.SQL_PROCEDURE_1
  LANGUAGE SQL
  -------------------------------------------------
  -- SQL Stored Procedure
  -------------------------------------------------
  P1: BEGIN
  ……
  END P1 ;
  CREATE PROCEDURE SRCDB1.SQL_PROCEDURE_2 ……;
  ……
  CREATE PROCEDURE SRCDB1.SQL_PROCEDURE_N ……;
  xu yao zhu yi de shi ,db2 v6 ban ben de db2look shang wei shi xian chou qu ru UDF,TRIGGER,UserSpace,NodeGroup,BufferPool deng shu ju ku dui xiang de ddl yu ju 。 cong db2 v7 kai shi ,db2look ke yi chou qu shang shu dui xiang de DDL, dan shi yi ran wu fa chou qu chuang jian cun chu guo cheng dui xiang de ddl yu ju 。 cong db2 v8.2 kai shi , wan shan le dui db2look gong neng de zhi chi , shi xian le cun chu guo cheng ddl yu ju de chou qu gong neng 。 you yu ben wen suo she ji de yuan shu ju ku xi tong de ban ben jiao di (DB2 v8.1), yin ci xu yao cai qu shang shu fang an huo qu suo you shu ju ku dui xiang de DDL xin xi :
  1). cong mou ge DB2 v8.2 xi tong dui SRCDB1(DB2 v8.1 ban ben ) zhi xing CATALOG cao zuo :
  db2 catalog db SRCDB1 as SRCDB1;
  2). cong DB2 v8.2 xi tong dui SRCDB1 jin xing db2look chou qu guo cheng :
  db2look -d SRCDB1 -e -o srcdb1.ddl -a -i user_srcdb1 -w pw_srcdb1;
  zhe yang jiu ke yi huo qu wan zheng de shu ju ku dui xiang DDL xin xi 。
  3. sheng cheng shu ju dao chu export jiao ben
  shi yong shell jiao ben sheng cheng bing dao chu suo you shu ju de DML jiao ben , bing jiang qi chong ding xiang dao srcdb1_export.sql wen jian zhong 。 dui yu shu xi DB2 de yong hu lai shuo , ying gai zhi dao shu ju ku zhong chuang jian de mei ge biao 、 shi tu 、 bie ming yun dui ying SYSCAT.TABLES zhong yi xing ji lu 。 yin ci ke yi tong guo xiang ying de shu ju ku select yu ju jiu ke yi huo qu suo you xu yao de shu ju ku biao xin xi 。 gen ju xu yao , xia shu shell jiao ben jiang cong xi tong biao SYSCAT.TABLES zhong gen ju tabname zi duan xuan chu SRCDB1 zhong suo you tabschema biao mo shi shi SRCDB1,ASN,SQLDBA,DB2DBG de biao ming zi , bing gen ju ta men de ming zi sheng cheng xiang ying de export dao chu yu ju , dao da pi liang dao chu de mu de 。rtrim han shu yong yu qu chu tabname zi duan shu ju de you bian de kong ge 。
  qing dan 6. sheng cheng export jiao ben
  # db2 "select 'export to ' rtrim(tabname) '.ixf of ixf select * from '
  rtrim(tabname) ';' from syscat.tables
  where tabschema in('SRCDB1', 'ASN', 'SQLDBA', 'DB2DBG')" > srcdb1_export.sql ;
  bian ji sheng cheng de srcdb1_export.sql, shan chu tou bu he yi bu suo xian shi de tong ji xin xi , zhi bao liu bi yao de export yu ju 。 tong guo xiu gai shang shu jiao ben zhong suo bao han de tabschema xin xi , ke yi zhi ding xu yao dao chu de biao de fan wei , ye ji qian yi guo cheng zhong xu yao de suo you biao ming 。 suo sheng cheng de export dao chu yu ju ju you ru xia de ming ling xing shi :
  db2 export to tablename.ixf of ixf select * from tablename;
  4. sheng cheng shu ju dao ru load jiao ben
  shi yong shell jiao ben sheng cheng load jiao ben yong yu jiang shu ju dao ru mu biao xi tong :srcdb1_load.sql
  qing dan 7. sheng cheng load jiao ben
  # db2 "select 'load from ' rtrim(tabname) '.ixf of ixf insert into '
  rtrim(tabname) ';' from syscat.tables
  where tabschema in ('SRCDB1', 'ASN', 'SQLDBA', 'DB2DBG')" > srcdb1_load.sql;
  bian ji sheng cheng de srcdb1_load.sql, shan chu tou bu he yi bu de tong ji xin xi , zhi bao liu bi yao de load yu ju 。 yu export dao chu yu ju lei si , shang shu shell jiao ben cong xi tong biao zhong xuan chu SRCDB1 zhong suo you biao de ming zi , bing gen ju ta men de ming zi sheng cheng xiang ying de import dao ru yu ju , dao da pi liang dao ru de mu de 。 suo sheng cheng de import dao ru yu ju ming ling xing shi ru xia :
  db2 load from tablename.ixf of ixf insert into tablename;【原文】【汉音对照
 
 
 
 
 
 
 
 
 
日版宠物情人插曲《Winding Road》歌词

日版宠物情人2017的插曲,很带节奏感,日语的,女生唱的。 最后听见是在第8集的时候女主手割伤了,然后男主用嘴帮她吸了一下,插曲就出来了。 歌手:Def...

兄弟共妻,我成了他们夜里的美食

老钟家的两个儿子很特别,就是跟其他的人不太一样,魔一般的执着。兄弟俩都到了要结婚的年龄了,不管自家老爹怎么磨破嘴皮子,兄弟俩说不娶就不娶,老父母为兄弟两操碎了心...

如何磨出破洞牛仔裤?牛仔裤怎么剪破洞?

把牛仔裤磨出有线的破洞 1、具体工具就是磨脚石,下面垫一个硬物,然后用磨脚石一直磨一直磨,到把那块磨薄了,用手撕开就好了。出来的洞啊很自然的。需要猫须的话调几...

我就是扫描下图得到了敬业福和爱国福

先来看下敬业福和爱国福 今年春节,支付宝再次推出了“五福红包”活动,表示要“把欠大家的敬业福都还给大家”。 今天该活动正式启动,和去年一样,需要收集“五福”...

冰箱异味产生的原因和臭味去除的方法

有时候我们打开冰箱就会闻到一股异味,冰箱里的这种异味是因为一些物质发出的气味的混合体,闻起来让人恶心。 产生这些异味的主要原因有以下几点。 1、很多人有这种习...

 
 
ben wen zhu yao jie shao ru he wan cheng ji yu DB2 de PHP ying yong xi tong cong AIX ping tai dao Linux ping tai de yi zhi guo cheng 。 wen zhong bao han le di ceng de DB2 shu ju ku yi zhi 、 shang ceng de PHP ying yong xi tong yi zhi de xiang xi bu zhou yi ji yi zhi guo cheng zhong ke neng yu dao de wen ti he jie jue fang fa 。 ren wu gai shu xi tong qian yi de gong zuo zhu yao fen wei yi xia ji ge fang mian : 1.DB2 shu ju ku xi tong de kua ping tai qian yi 2.Apache fu wu qi yu php ying yong xi tong de an zhuang he pei zhi xia mian wo men jiu fen 2 ge fang mian fen bie jie shao qian yi he pei zhi de ju ti bu zhou 。 DB2 shu ju ku xi tong de kua ping tai qian yi shu ju ku huan jing yuan huan jing :AIX+DB2 v8.1 mu biao huan jing :Linux+DB2 v8.1 qi zhong yuan shu ju ku zhong bao han le 2 ge shu ju ku Instance:SRCDB1 yu SRCDB2。 zai SRCDB1/SRCDB2 shu ju ku zhong , yun bao han le shang bai zhang shu ju ku biao , bing you hen duo de suo yin 、 wai jian yue shu 、 chu fa qi 、 cun chu guo cheng yi ji yi xie han you zi zeng zi duan de biao ( han you GENERATED ALWAYS AS IDENTITY ding yi zi duan de biao )。 geng wei kun nan de shi , wo men bing mei you guan yu zhe xie shu ju ku dui xiang de zhun que chuang jian jiao ben 。 qian yi fang an de xuan ze ru guo qian yi de yuan xi tong yu mu de xi tong shu yu tong yi lei xing cao zuo xi tong , li ru Linux zhi jian de qian yi , huo zhe AIX xi tong zhi jian de qian yi , ze qing kuang xiang dui jian dan ,DB2 ben shen yi jing ti gong xiang guan de shi yong gong ju lai shi xian zhe zhong tong lei xing ping tai zhi jian de shu ju ku yi zhi , ru : BACKUP he RESTORE ming ling 。 dang ran , gen ju bu tong de qing kuang huan xu yao dui shi yong gong ju suo ti gong de shen shu you bi jiao qing chu de le jie , pi ru yuan xi tong yu mu biao xi tong shi yong bu tong de biao kong jian , jiu hui she ji dao biao kong jian chong ding xiang de wen ti 。 you yu ben wen de chong dian zai yu kua ping tai de yi zhi , zhe zhong fang an xian ran wu fa man zu xu qiu , zai ci bu zai ao shu 。 na me , ru he chu li kua ping tai de shu ju ku qian yi wen ti ? shi bu shi ke yi shi yong shi yong gong ju db2move ne ? db2move zhi neng qian yi biao zhong de shu ju , er wu fa dui suo yin 、 wai jian yue shu 、 chu fa qi he cun chu guo cheng deng shu ju ku dui xiang ye shi xian qian yi cao zuo , er qie dui yu bao han zi zeng zi duan shu ju de biao lai shuo ,db2move ye you yi ding de xian zhi 。 bing qie db2move zhi neng ba shu ju dao ru dao yi cun zai de shu ju ku de biao zhong , wu fa xian shi zhi ding biao kong jian de wei zhi 。 you yu zai shu ju ku de xi tong qian yi guo cheng zhong , bu jin xu yao qian yi biao zhong de shu ju , huan you suo yin 、 wai jian yue shu 、 chu fa qi he cun chu guo cheng deng shu ju ku dui xiang , yu ben wen suo xuan fang an xiang bi , huan shi hou zhe geng ju you shi 。 ke yi jiang db2move jin zuo wei qian yi biao shu ju de yi zhong bei yong fang an 。 er dui yu export he import lai shuo , yi ci zhi neng zhen dui yi zhang biao jin xing dao chu dao ru cao zuo , bing qie xu yao shou dong shu ru export he import de ming ling yi ji xu yao dao ru dao chu de shu ju biao ming , zai shu ju ku biao de shu liang bu duo de qing kuang xia , zhe zhong fang an ye xu huan ke yi kao lv , dan ye bu bing shi zui jia de fang an 。 er zai shu ju ku zhong biao shu liang zhong duo de qing kuang xia , zhe zhong zuo fa ze shi ji ben bu xian shi de , er qie import ming ling bing bu neng bao zheng zi zeng zi duan de shu ju yu yuan lai de biao shu ju bao chi yi zhi 。 ben wen gen ju DB2 dui shu ju ku dui xiang de chu li ji zhi , cai yong jiang db2look yu DDL、DML jiao ben xiang jie he de fang shi , bing zhen dui yuan shu ju ku zhong de chu fa qi 、 cun chu guo cheng yi ji wai jian yue shu deng fen bie chu li , gei chu le yi zhong kua ping tai DB2 shu ju ku xi tong yi zhi de ke xing fang an 。 xia mian wo men yi SRCDB1 wei li jie shao yi xia zhe zhong qing kuang xia de shu ju ku zheng ti qian yi guo cheng 。SRCDB1 shu ju ku zhong you SRCDB1、ASN、DB2DBG he SQLDBA zhe si ge shu ju ku mo shi 。 jia she SRCDB1 shu ju ku de yong hu ming wei user_srcdb1, mi ma :pw_srcdb1。 zai yuan xi tong (AIX) shang de xiang guan cao zuo 1. shi yong db2look ming ling chou qu sheng cheng shu ju ku dui xiang de DDL jiao ben qing dan 1. db2look ming ling ji shen shu # db2look -d SRCDB1 -e -o srcdb1.ddl -a -i user_srcdb1 -w pw_srcdb1 db2look : sheng cheng DDL yi bian chong xin chuang jian zai shu ju ku zhong ding yi de dui xiang yu fa : db2look -d DBname [-e] [-u Creator] [-z Schema] [-t Tname1 Tname2...TnameN] [-tw Tname] [-h] [-o Fname] [-a] [-m] [-c] [-r] [-l] [-x] [-xd] [-f] [-fd] [-td x] [-noview] [-i userID] [-w password] [-v Vname1 Vname2 ... VnameN] [-wrapper WrapperName] [-server ServerName] [-nofed] -d : shu ju ku ming cheng , bi xuan shen shu -e : chou qu fu zhi shu ju ku suo xu yao de DDL wen jian , ci xuan xiang jiang sheng cheng bao han DDL yu ju de jiao ben -o : jiang shu chu chong ding xiang dao gei ding de wen jian ming , ru guo wei zhi ding -o xuan xiang , ze shu chu mo ren zhuan dao stdout -a : wei suo you chuang jian cheng xu sheng cheng tong ji xin xi , ru guo zhi ding le ci xuan xiang , ze jiang hu lue -u xuan xiang -i : zhi ding deng lu dao shu ju ku suo zai fu wu qi shi suo shi yong de yong hu biao shi -w : zhi ding deng lu dao shu ju ku suo zai fu wu qi shi suo shi yong de mi ma 2. gen ju bu tong lei xing dui xiang , fen hua shu ju ku dui xiang DDL jiao ben you yu yuan shu ju ku zhong de ge ge biao shu ju yi jing shi jing guo chu fa qi 、 cun chu guo cheng deng shu ju ku dui xiang chu li guo de shu ju , wei bao zheng shu ju ku zhong shu ju de yi zhi xing he wan zheng xing , zhe xie shu ju ku dui xiang ying gai zai dao ru shu ju hou zai chuang jian , yi fang zhi zai dao ru biao shu ju shi chong fu zhi xing chu fa qi he cun chu guo cheng deng shu ju ku dui xiang sheng cheng cuo wu shu ju 。 shi yong wen ben bian ji qi bian ji you db2look sheng cheng de srcdb1.ddl, jiang chuang jian biao ji suo yin de DDL yu ju , chuang jian wai jian yue shu de DDL yu ju yi ji chuang jian chu fa qi he chuang jian cun chu guo cheng de yu ju fen wei si zu , fen bie bao cun wei xia mian si ge DDL jiao ben : srcdb1_tables.ddl srcdb1_foriegnkeys.ddl srcdb1_triggers.ddl srcdb1_procedures.ddl srcdb1_tables.ddl : bao han chuang jian SEQUENCE,UDF,TABLE,VIEW deng shu ju ku dui xiang de ddl yu ju 。 qing dan 2. srcdb1_tables.ddl yu ju CREATE SEQUENCE "SRCDB1"."SAMPLE_SEQ_1" AS INTEGER MINVALUE 1 MAXVALUE 9999999999 START WITH 1 INCREMENT BY 1; CREATE FUNCTION " SRCDB1"." SAMPLE _FUNC_1" ( VARCHAR(254), VARCHAR(254), VARCHAR(254) ) RETURNS VARCHAR(254) SPECIFIC SAMPLE _FUNC_1 ……; CREATE TABLE " SRCDB1"." SAMPLE _TAB_1" ( "TAB_COL1" CHAR(20) NOT NULL , "TAB_COL2" VARCHAR(70) NOT NULL ) ; CREATE TABLE " SRCDB1"." SAMPLE _TAB_2" (……); …… CREATE TABLE " SRCDB1"." SAMPLE _TAB_N" (……); CREATE VIEW SRCDB1.SAMPLE_VIEW_1 (VIEW_COL1,VIEW_COL2) AS SELECT distinct COL1 , COL2 FROM SAMPLE_TAB WHERE ……; CREATE VIEW SRCDB1.SAMPLE_VIEW_2 ……; …… CREATE VIEW SRCDB1.SAMPLE_VIEW_N ……; srcdb1_foriegnkeys.ddl : bao han chuang jian wai jian yue shu de ddl yu ju 。 qing dan 3. srcdb1_foriegnkeys.ddl yu ju ALTER TABLE " SRCDB1"."SAMPLE_FK_1" ADD CONSTRAINT "SQL030903143850120" FOREIGN KEY ("FK_COL1") REFERENCES " SRCDB1"."SAMPLE_TABLE" ("COL1"); ALTER TABLE " SRCDB1"."SAMPLE_FK_2" ADD ……; …… ALTER TABLE " SRCDB1"."SAMPLE_FK_N" ADD ……; srcdb1_triggers.ddl : bao han chuang jian chu fa qi de ddl yu ju 。 qing dan 4. srcdb1_triggers.ddl yu ju CREATE TRIGGER SRCDB1.SAMPLE_TRIG_1 AFTER UPDATE OF col1 ON SRCDB1.SAMPLE_TAB REFERENCING NEW AS n FOR EACH ROW MODE DB2SQL WHEN ( n.col1 > 3) BEGIN ATOMIC update SAMPLE_TAB set(col2) = 'anotherValue' where col1 = n.col1 ;-- END; CREATE TRIGGER SRCDB1. SAMPLE_TRIG_2 ……; …… CREATE TRIGGER SRCDB1. SAMPLE_TRIG_N ……; srcdb1_procedures.ddl : bao han chuang jian SQL cun chu guo cheng yi ji java cun chu guo cheng de ddl yu ju 。 qing dan 5. srcdb1_procedures.ddl yu ju CREATE PROCEDURE " SRCDB1"." JAVA_PROCEDURE_1" ( OUT SQLSTATE CHARACTER(5), OUT ROWS_SUBMITED INTEGER, IN BATCH_ID INTEGER, IN LEVEL VARCHAR(4000) ) DYNAMIC RESULT SETS 0 SPECIFIC SUBMIT_BATCH EXTERNAL NAME 'Submit_batch!submit_batch' LANGUAGE JAVA PARAMETER STYLE JAVA NOT DETERMINISTIC FENCED THREADSAFE MODIFIES SQL DATA NO DBINFO; CREATE PROCEDURE " SRCDB1"."JAVA_PROCEDURE_2" ……; …… CREATE PROCEDURE " SRCDB1"."JAVA_PROCEDURE_N" ……; SET CURRENT SCHEMA = " SRCDB1"; SET CURRENT PATH = "SYSIBM","SYSFUN"," SRCDB1"; CREATE PROCEDURE SRCDB1.SQL_PROCEDURE_1 ( IN hostname varchar(4000), IN username varchar(4000), OUT SQLCODE_OUT int ) SPECIFIC SRCDB1.SQL_PROCEDURE_1 LANGUAGE SQL ------------------------------------------------- -- SQL Stored Procedure ------------------------------------------------- P1: BEGIN …… END P1 ; CREATE PROCEDURE SRCDB1.SQL_PROCEDURE_2 ……; …… CREATE PROCEDURE SRCDB1.SQL_PROCEDURE_N ……; xu yao zhu yi de shi ,db2 v6 ban ben de db2look shang wei shi xian chou qu ru UDF,TRIGGER,UserSpace,NodeGroup,BufferPool deng shu ju ku dui xiang de ddl yu ju 。 cong db2 v7 kai shi ,db2look ke yi chou qu shang shu dui xiang de DDL, dan shi yi ran wu fa chou qu chuang jian cun chu guo cheng dui xiang de ddl yu ju 。 cong db2 v8.2 kai shi , wan shan le dui db2look gong neng de zhi chi , shi xian le cun chu guo cheng ddl yu ju de chou qu gong neng 。 you yu ben wen suo she ji de yuan shu ju ku xi tong de ban ben jiao di (DB2 v8.1), yin ci xu yao cai qu shang shu fang an huo qu suo you shu ju ku dui xiang de DDL xin xi : 1). cong mou ge DB2 v8.2 xi tong dui SRCDB1(DB2 v8.1 ban ben ) zhi xing CATALOG cao zuo : db2 catalog db SRCDB1 as SRCDB1; 2). cong DB2 v8.2 xi tong dui SRCDB1 jin xing db2look chou qu guo cheng : db2look -d SRCDB1 -e -o srcdb1.ddl -a -i user_srcdb1 -w pw_srcdb1; zhe yang jiu ke yi huo qu wan zheng de shu ju ku dui xiang DDL xin xi 。 3. sheng cheng shu ju dao chu export jiao ben shi yong shell jiao ben sheng cheng bing dao chu suo you shu ju de DML jiao ben , bing jiang qi chong ding xiang dao srcdb1_export.sql wen jian zhong 。 dui yu shu xi DB2 de yong hu lai shuo , ying gai zhi dao shu ju ku zhong chuang jian de mei ge biao 、 shi tu 、 bie ming yun dui ying SYSCAT.TABLES zhong yi xing ji lu 。 yin ci ke yi tong guo xiang ying de shu ju ku select yu ju jiu ke yi huo qu suo you xu yao de shu ju ku biao xin xi 。 gen ju xu yao , xia shu shell jiao ben jiang cong xi tong biao SYSCAT.TABLES zhong gen ju tabname zi duan xuan chu SRCDB1 zhong suo you tabschema biao mo shi shi SRCDB1,ASN,SQLDBA,DB2DBG de biao ming zi , bing gen ju ta men de ming zi sheng cheng xiang ying de export dao chu yu ju , dao da pi liang dao chu de mu de 。rtrim han shu yong yu qu chu tabname zi duan shu ju de you bian de kong ge 。 qing dan 6. sheng cheng export jiao ben # db2 "select 'export to ' rtrim(tabname) '.ixf of ixf select * from ' rtrim(tabname) ';' from syscat.tables where tabschema in('SRCDB1', 'ASN', 'SQLDBA', 'DB2DBG')" > srcdb1_export.sql ; bian ji sheng cheng de srcdb1_export.sql, shan chu tou bu he yi bu suo xian shi de tong ji xin xi , zhi bao liu bi yao de export yu ju 。 tong guo xiu gai shang shu jiao ben zhong suo bao han de tabschema xin xi , ke yi zhi ding xu yao dao chu de biao de fan wei , ye ji qian yi guo cheng zhong xu yao de suo you biao ming 。 suo sheng cheng de export dao chu yu ju ju you ru xia de ming ling xing shi : db2 export to tablename.ixf of ixf select * from tablename; 4. sheng cheng shu ju dao ru load jiao ben shi yong shell jiao ben sheng cheng load jiao ben yong yu jiang shu ju dao ru mu biao xi tong :srcdb1_load.sql qing dan 7. sheng cheng load jiao ben # db2 "select 'load from ' rtrim(tabname) '.ixf of ixf insert into ' rtrim(tabname) ';' from syscat.tables where tabschema in ('SRCDB1', 'ASN', 'SQLDBA', 'DB2DBG')" > srcdb1_load.sql; bian ji sheng cheng de srcdb1_load.sql, shan chu tou bu he yi bu de tong ji xin xi , zhi bao liu bi yao de load yu ju 。 yu export dao chu yu ju lei si , shang shu shell jiao ben cong xi tong biao zhong xuan chu SRCDB1 zhong suo you biao de ming zi , bing gen ju ta men de ming zi sheng cheng xiang ying de import dao ru yu ju , dao da pi liang dao ru de mu de 。 suo sheng cheng de import dao ru yu ju ming ling xing shi ru xia : db2 load from tablename.ixf of ixf insert into tablename;
󰈣󰈤
  免责声明:本文仅代表作者个人观点,与王朝网络无关。王朝网络登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
华丽的模特拍摄(8)
华丽的模特拍摄(7)
华丽的模特拍摄(6)
华丽的模特拍摄(5)
八里沟
朝阳宫
天下峨眉 云上金顶
老家(四)
 
>>返回首页<<
 
 
 为你推荐
 
 
 
 转载本文
 UBB代码 HTML代码
复制到剪贴板...
 
 热帖排行
 
 
 
 
 
©2005- 王朝网络 版权所有