dsadmin Command for administering Projects

dsadmin  is the command used for administering projects and has large range of options.
Command Syntax:
dsadmin [-file <file> <domain> <DataStage server> | -domain <domain> -user <user> -password <password> -server <DataStage server>]
<primary command> [<arguments>]
Valid primary command options are:
-createproject
-deleteproject
-oshvisible
-enablercp
-enablejobadmin
-envadd
-envdelete
-envset
-advancedruntime
-basedirectory
-deploymentdirectory
-customdeployment
-listprojects
-listproperties
-listenv
-enablegeneratexml
-protectproject
FileFormat:
Format of the file entry should be like :
domain,server,user,password
and the dsadmin command will be like :
dsadmin -file filename domain server <command arguments>
where domain = Information server domain name
Server=Datastage Enginetier Server name
Creating Project:
dsadmin -file file  domain dsengine -createproject ProjectName [-location ProjectLocation] [-copyroles <sourceproject>]
ProjectName is the name of the project.
-location is the project location and is optional.
-copyroles if you want to copy roles from existing project and is optional
If project location is not specified, project is created in the Projects dir in the server install directory.
Ex:
dsadmin -file /tmp/dscredentials.txt  isdomain dsengine -createproject dstage2 -location /projects/dstage2
Status code = 0
dsjob -lprojects
dstage2
Status code = 0
/projects>ls -tlr
total 4
drwxrwxr-x 45 dsadm dstage 4096 Sep 15 20:30 dstage2
================
dsadmin -listproperties dstage2
OSHVisible=0
JobAdminEnabled=
RTCPEnabled=
PXAdvRTOptions=
PXRemoteBaseDirectory=
PXDeployJobDirectoryTemplate=
PXDeployCustomAction=
PXDeployGenerateXML=
Status code = 0

Enabling/disabling OSH display

dsadmin -oshvisible TRUE dstage2
Status code = 0

Enabling/disabling runtime column propagation

dsadmin -enablercp TRUE | FALSE ProjectName
ex:
dsadmin -enablercp TRUE dstage2

Enabling/disabling job administration from the Director client

dsadmin -enablejobadmin TRUE | FALSE ProjectName    Example:  dsadmin -enablejobadmin TRUE dstage2

Adding an environment variable

dsadmin can be used for created env variable and is added to the User Defined Category
Syntax:
dsadmin -envadd EnvVarName -type STRING | ENCRYPTED   -prompt "PromptText" [-value "Value"] ProjectName    Ex:  Now i will add new env called "TEST" to the dstage project.    We use dsadmin -listenv dstage to check if this env is defined or not.
dsadmin -listenv dstage2 | grep TEST
Status code = 0
dsadmin -envadd TEST -type STRING  -prompt "TEST ADDING ENV" -value "Test" dstage2
dsadmin -listenv dstage2 | grep TEST
TEST=Test

Deleting an environment variable

dsadmin -envdelete EnvVarName ProjectName    dsadmin -envdelete TEST dstage2
dsadmin -envdelete TEST dstage2
Status code = 0
dsadmin -listenv dstage2 | grep TEST
Status code = 0

Setting the value of an environment variable

Syntax:
dsadmin -envset EnvVarName -value "Value" ProjectName
dsadmin -listenv dstage2 | grep TEST
TEST=Test
Status code = 0
Now we will change the value from Test to Test2
dsadmin -envset TEST -value "Test2″ dstage2
dsadmin -listenv dstage2 | grep TEST
TEST=Test2

Listing projects:

dsadmin -listprojects
dstage2

Listing properties

dsadmin -listproperties ProjectName
dsadmin -listproperties dstage2
OSHVisible=1
JobAdminEnabled=1
RTCPEnabled=1
PXAdvRTOptions=
PXRemoteBaseDirectory=
PXDeployJobDirectoryTemplate=
PXDeployCustomAction=
PXDeployGenerateXML=
Status code = 0

Listing environment variables:

dsadmin -listenv ProjectName    EX:  dsadmin -listenv dstage2
Initially I struggled to use -file option in dsadmin and following good Technote from IBM.
On IBM Information Server 8, dsadmin line command with -file option will fail with error message "Failed to locate information for server"
Technote (FAQ)
Question
When trying to use the dsadmin line command with the -file option in order to avoid specifying the user/password in the line command, the dsadmin command will fail with the following error message : "Failed to locate information for server" (Similar issue will occur with dsjob command)
Cause
Incorrect syntax in the file specified for the -file option
Answer
This issue is caused by a missing or incorrect argument in the file, either the domain name or the server name.
Note that the dsadmin command is using a combination of both the domain name and the server name to lookup the connection details in the file.
Format of the file entry should be like :
domain,server,user,password
and the dsadmin command will be like :
dsadmin -file filename domain server <command arguments>
(This is also available for the dsjob command)
We don't have command line options to setup Sequence compilation options and also to set Auto-purge of job log
If IBM enhance these two options in the command line then we can totally automate datastage project creating using script.
WorkAround:
Create a template project and copy the DSParams file from template project to the original project.







Popular posts from this blog

Shrink you container size up to 95%.

alma linux: dnf Module yaml error: Unexpected key in data