Page 1 of 1

Truncate a project

Posted: Mon Aug 09, 2004 11:14 pm
by Amos.Rosmarin
Hi there,

I'm looking for a script that truncates a project - delete all non-default components: jobs, routines, table definitions etc.

I can always delete and create the project but I want to do it automatically so it has to be done from the command line.


Any one know howto do it ?

Amos

Posted: Tue Aug 10, 2004 12:53 am
by roy
Hi Amos,
While I'm not familiar with the inside stuf and perhaps you'll have problems getting that info (I hope I'm wrong)
There is always the last course of action, which is to write a code, for example with tcl/tk or any language that you prefer and can do such things, that will emulate the interactive use of the DS Administrator.
So for truncating a project you need to perform a delete and create operation with the same project name which will be this program's parameter.

IHTH,

Posted: Tue Aug 10, 2004 2:36 am
by ray.wurlod
I don't know how to do it from the UNIX command line.

Even if you could do it from the DataStage command prompt (>), there are way too many separate components to drop or remove (as appropriate) ever to be conveniently loaded into a single command.

To create such a command (set of commands run from a script) would require more knowledge about the structure of the Repository than has been published by Ascential, and therefore is venturing into dangerous waters!

I'd strongly recommend staying with delete project, create project. Two mouse clicks!

Posted: Tue Aug 10, 2004 3:03 am
by Amos.Rosmarin
Thanks Ray

What do you think about using a unix rm and cp command ??
delete the contant of the project directory
and then copy the content of an empty project into the project directory.

I think that if I do it while the dsEngine is down it is qiute safe .... am I right ??


Amos

Posted: Tue Aug 10, 2004 4:56 am
by kduke
That would almost work but the indexes would pointing to the wrong place. Indexes have the full path in them. There is a command to fix them or you can delete them and recreate them through DS.TOOLS or manually.

I agree with Ray. Delete the project and then recreate it is much safer.

Posted: Tue Aug 10, 2004 5:41 am
by ray.wurlod
If you delete the entire contents of the directory you're also taking out the software - what you called the "default conmponents".
Further, there are administrative entries in the Admin (UV) account and in the SQL Catalog, as well as secondary indexes already mentioned, that would need to be repaired.
Again, don't attempt it!

Posted: Tue Aug 10, 2004 6:37 am
by datastage
this might be a shot in the dark. I'm not sure (and I think we are all wondering) why you have this need in the first place to truncate a project, but depending on what you need to do I'm curious if something like this would work for you: Could you possibly create many projects in advance (manually) with some sort of sequence number appended to the project them. Then if you have a program that is reloading the projects you can keep a store of the next project and then load to this project.

It depends on what you are doing, but you could create projects in advance and delete the old ones as needed, and thus you could still have some sort of automated program that could always find a clean project to begin with

Posted: Tue Aug 10, 2004 9:13 am
by Amos.Rosmarin
I was thinking of a way to create a loop that goes over DS_JOBS and for each jobno delets the RT_LOGxx, RT_BPxx etc....
Then does clear.file ds_jobs and ds_jobobjects
After this goes to the DS_routines and DS_METADATA

In this way truncate the project

Do you think it's feasible

Posted: Tue Aug 10, 2004 10:58 am
by kduke
Try it and let us know.

Posted: Tue Aug 10, 2004 10:51 pm
by ray.wurlod
For the third and last time, don't do it!

Posted: Wed Aug 11, 2004 4:09 am
by kduke
Ray

Let him do it. They don't want our advice anyway. I want to see how many problems this will create.

Posted: Wed Aug 11, 2004 6:51 am
by chulett
I'm still really curious why someone would "need" to do this. :?

Posted: Wed Aug 11, 2004 7:13 am
by datastage
Yes, Amos...you really need to let us curious minds know what technical/business requirement is driving your need to truncate a project!

Let's see how creative we can be too. As far as this comment:
I was thinking of a way to create a loop that goes over DS_JOBS and for each jobno delets the RT_LOGxx, RT_BPxx etc....
Then does clear.file ds_jobs and ds_jobobjects
After this goes to the DS_routines and DS_METADATA

I think this would get you close, but surely there are a few things that would be overlooked with that method. I'm too tired to try to think of other things this might miss at the moment, perhaps Ray can come up with a something good that will prevent an attempts of truncating a project.

Posted: Wed Aug 11, 2004 9:25 pm
by ray.wurlod
Just the sheer possibility that you might miss something.

What's in all those other Repository tables? The design-time information as well as the run-time information? What records ought you not to be removing? What about hashed files in non-project directories? System table entries for any UV tables created (which therefore should be dropped properly)? DSNs for ODBC (in the DSEngine directory as well as in uvodbc.config)? Modifications to DSParams - undo or keep? The list goes on - would you get them all?

Can we get a "stop sign" emoticon? :twisted:

Posted: Wed Aug 11, 2004 9:49 pm
by kduke
Let him do it. Cause more problems than it would solve. Please try it. I think it is a terrible idea but go for it. Let us know what kind of problems you have.