IT Gourmet
数据仓库, ETL的笔记
Datastage属性状态(转)
Oracle Enterprise组件中:
Write Method
Upsert会判断数据存在与否,存在更新,存在插入;
Load会装载数据,存在该条数据不更新也不装载;不存在则会装载
Delete Rows会删除该对应的数据,不存在则不作处理
只有Write Method= Load时:Write Mode有以下选项:
Append:追加数据,如果数据存在(或者主键存在)则会报错
Create:表不存在创建表并插入数据,存在则会报错
Replace:无论表存在与否都会重新创建并替代原有的表;
Truncate:--删除表中所有的数据之后在做操作,(效率要比Delete rows高)

Sequential file组件:
File Update Mode:
Overwrite会覆盖原来的文件,如果没有则会创建文件,格式为txt格式
Create会创建一个文件,如果该文件存在则会报错
Append:会在原来的文件基础上拼接,如果没有也会创建文件,格式同样为txt
 
Difference Stage组件:
Ddifference stage 比较两个文件找出不同的记录,以before中的数据为准与after中的数据比较,输出的是before的数据。这个 输出的字段中也多了一个字段(Difference())输出的字段为两个的并集
比较策略说明
Drop Output For Copy        False:保留before及afte link中key值相同的行
                            True:删除before及afte link中key值相同的行
Drop Output For Delete      False:保留before link中有但是afte link中没有的key值所在的行
                            True:删除before link中有但是afte link中没有的key值所在的行
Drop Output For Edit        False:保留key值相同,value不同的行
                            True:删除key值相同,value不同的行
Drop Output For Insert      False:保留before link中没有但afte link中有的key值所在的行
                            True:删除before link中没有但afte link中有的key值所在的行

lookup组件:LookUp Stage把数据读入内存执行查询操作,将匹配的字段输出,或者在在符合条件的记录中修改或加入新的字段。
将主表放在另一个表中查询,若主表中的数据在另一个表中的都有则输出相同的数据 否则没有数据输出。

Sort Stage组件:
Option具体说明
Allow Duplicates:         是否去除重复数据。为False时,只选取一条数据,当Stable Sort为True时,选取第一条数据。当Sort Unility为UNIX时此选项无效。
Sort Utility:              选择排序时执行应用程序,可以选择DataStage内建的命令或者Unix的Sort命令
Output Statistics:        是否输出排序统计信息到job日志
Stable Sort:              是否对数据进行二次整理
Create Cluster Key Change Column:是否为每条记录创建一个新的字段:clusterKeyChange。当Sort Key Mode为Don’t Sort(Previously Sorted) 或 Don’t Sort (Previously Grouped)时,对于第一条记录该字段被设置为1,其余的记录设置为0。
Create Key Change Column:   是否为每一条记录创建一个新的字段KeyChange。
 
Change Capture Stage组件:
Change Capture Stage有两个输入,分别标记为before link 及 after link。输出的数据表示before link和after link的区别,输出after 中的字段,但是输出时会自动增加一个字段chang code();
输出的是after中的数据。加上after中没有但是before中有的key值其余字段为空。
key及value的说明
key值是比较的关键值,value是当key值相同是作进一步比较用的。
change mode选项说明:
All keys,Explicit Values        需要指定value,其余字段为key
Explicit Keys&Values             key及value都需要指定
Explicit Keys,All Values        需要指定key,其余的字段为value
输出策略说明
Drop Output For Copy          False:保留before及afte link中key值相同的行
                            True:删除before及afte link中key值相同的行
Drop Output For Delete         False:保留before link中有但是after link中没有的key值所在的行
                            True:删除before link中有但是afte link中没有的key值所在的行
Drop Output For Edit           False:保留key值相同,value不同的行
                            True:删除key值相同,value不同的行
Drop Output For Insert          False:保留before link中没有但afte link中有的key值所在的行
                            True:删除before link中没有但afte link中有的key值所在的行
Merge stage 组件:
将Merge Key值相同的记录合并。将其中的一个输入设定为Master,其余的为Update。把Update中Merge Key相同的记录合并入Master。输出的是key值与update中相等的数据 但是Master中的数据字段 是update中的字段。
Funnel stage 组件:
将多个字段相同的数据文件合并为一个单独的文件输出 只是输出 相同的字段。
合并策略说明
Continuous Funnel:从每一个input link中循环取一条记录
Sort Funnel:按照Key值排序合并输出
Sequence:先输出第一个input link的数据,输出完毕后再输出第二个input link的数据,依此类推,直到结束。(此时可以通过调整link Ordering调整输出顺序)
 

Modify Stage组件:
Specification=新列名:类型=原列名

Datastage命令行接口 (Datastage Command Line Interface)
环境:Red Hat Linux AS 4 + Oracle DB 10g + Datastage EE 7.5.2
Datastage提供了命令行的接口,这样我们能够使用命令去操控Datastage Server。
Datastage Command分为三类:
1.用于控制正在运行的Jobs;
2.用于管理Projects;
3.用于搜索Jobs
现在进行分类介绍:
第一类,控制Jobs的命令,可以实现的功能如下:
?? The logon clause
?? Starting a job
?? Stopping a job
?? Listing projects, jobs, stages, links, and parameters
?? Setting an alias for a job
?? Retrieving information
?? Accessing log files
?? Importing job executables
?? Generating a report
所有命令以dsjob开始,加上参数选项实现以上列举的功能,语法格式如下:
$ dsjob
Command Syntax:
        dsjob [-file <file> <server> | [-server <server>][-user <user>][-password <password>]]
                        <primary command> [<arguments>]
Valid primary command options are:
        -run
        -stop
        -lprojects
        -ljobs
        -linvocations
        -lstages
        -llinks
        -projectinfo
        -jobinfo
        -stageinfo
        -linkinfo
        -lparams
        -paraminfo
        -log
        -logsum
        -logdetail
        -lognewest
        -report
        -jobid
        -import
Status code = -9999?DSJE_DSJOB_ERROR
$
第二类,管理Projects的命令,可以实现的功能如下:
?? The logon clause
?? Creating a project
?? Deleting a project
?? Enabling/Disabling the display of generated OSH in parallel jobs.
?? Enabling/Disabling runtime column propagation in parallel jobs.
?? Enabling/Disabling the availability of job administartion features in the DataStage Director for a particular project.
?? Setting the advanced runtime options for parallel jobs.
?? Setting the base directory name for parallel jobs.
?? Setting the deployed job template directory for parallel jobs.
?? Setting custom deployment options for parallel jobs.
?? Creating a new environment variable.
?? Deleting an environment variable.
?? Setting the value of an environment variable
?? Listing projects on a server.
?? Listing project properties.
?? Listing environment variables.
所有命令以dsadmin开始,加上参数选项实现以上列举的功能,语法格式如下:
$ dsadmin
Command Syntax:
        dsadmin [-file <file> <server> | [-server <server>][-user <user>][-password <password>]]
                        <primary command> [<arguments>]
Valid primary command options are:
        -createproject
        -deleteproject
        -oshvisible
        -enablercp
        -enablejobadmin
        -envadd
        -envdelete
        -envset
        -advancedruntime
        -basedirectory
        -deploymentdirectory
        -customdeployment
        -listprojects
        -listproperties
        -listenv
        -enablegeneratexml
Status code = -9999?
$
第三类,搜索Jobs的命令,可以实现的功能如下:
?? The logon clause.
?? Search for jobs whose name match, or partially match, the supplied text.
?? Search for jobs used by job sequences.
?? Search for job sequences that use the specified job.
?? Search for jobs that use the specified database table in a DRSstage.
所有命令以dsjob开始,加上参数选项实现以上列举的功能,语法格式如下:
$ dssearch
Command Syntax:
        dssearch [-file <file> <server> | [-server <server>][-user <user>][-password <password>]]
                        <primary command> [<arguments>]
Valid primary command options are:
        -ljobs
Status code = -9999?DSJE_DSSEARCH_ERROR
$
更详尽内容,请参见产品文档Parallel Job Advanced Developer's Guide --- Command Line Interface

PLUS:
另外关于uv的命令,在Linux环境下启动或关闭Datastage时经常用到,在这里一并介绍:
uv命令的位置$DSHOME/bin/uv
启动datastage命令:$DSHOME/bin/uv -admin -start
关闭datastage命令:$DSHOME/bin/uv -admin -stop
其他命令选项如下:
$ $DSHOME/bin/uv -admin
uv [-admin option]
        -autostart [on|off]    enable/disable autostart feature
        -clearshm               clear BASIC catalog bit.
        -freeLOGSEM             release LOGSEM semaphore.
        -impersonation [on|off] enable/disable impersonation mode
        -info                   implementation information
        -lic_report             display licensing information.
        -regen      {opts}      generate configuration file.
        -reset      {opts}      reinitialize shared memory.
        -start      [force]     start DSEngine. (force if lockfile exists)
        -stop       [nowait]    shutdown DSEngine (nowait on segments).
        -version                display version number.
        -Lock                   Suspend file I/O.
        -Report                 Current suspension status.
        -Unlock
$
---------------------------EOF------------------------------------------------

posted on 2012-06-20 17:22  ImToffee  阅读(991)  评论(0)    收藏  举报