Friday, July 13, 2007

How to export/import schema in ClearQuest (Part 2)

How to export/import schema in ClearQuest (Part 1)

How to decrease the schema version

In the part 1, we have mentioned usually we use the testing env to debug the schema and use exportschema/importschema or exportintegration/importschema to update the schema.

Using exportschema/importschema command, we can export/import all versions. Using exportintegration/importintegration command, we can export/import the partial versions but constrained by that the schema must exist in target schema repository.

Sometimes the schema we debugged in the testing env need to be check-out/check-in many times. It makes the version number large. If the schema existed in our production schema, we can use exportintegration/importintegration command to import the schema with only the version in the production env to increase by 1. For example,

We have the schema gqasch in testing env with version 40 while the version in production is 1. After we use the exportintegration/importintegration, the schema version in production is increased by 1, it becomes to 2.

If the schema does not exist in production env, and the schema version in testing env is 40 for example. Most of us can not bear the version in production is also 40 after using importschema. Hence we can not use importschema/importintegration command to cater for such case. Following steps is for such scenario,

Solution 1,
We assumed that the schema gqasch with version 40 and no such schema in production env. Here are the steps,

    1. export schema using exportschema command
    2. cqload exportschema -dbset cqms.testingclan.site admin 123456 gqasch c:\temp\abc.txt

    b. import schema using importschema command

      cqload importschema –dbset cqms.productclan.site admin 345678 c:\temp\abc.txt

    c. delete the schema version

      In the ClearQuest designer, delete the schema version from 2 to 40

    d. export schema using exportintegration command

      cqload exportintegration –dbset cqms.testingclan.site admin 123456 gqasch 2 39 “” c:\temp\abc.txt

    e. import schema using importintegration command

      cqload importintegration –dbset cqms.productclan.site admin 345678 gqasch “” “testing usage” 40 c:\temp\abc.txt “”

After all above steps done, the schema version of gqasch in production env is 2.


Solution 2:

    1. export schema using exportschema command
    2. cqload exportschema -dbset cqms.testingclan.site admin 123456 gqasch c:\temp\abc.txt

    b. import schema using importschema command

      cqload importschema –dbset cqms.productclan.site admin 345678 c:\temp\abc.txt

    c. using cloneschema to clone the scheme gqasch with another name

      The syntax of cloneschema is,

      installutil clonescheam dbsetname cq_login cq_password from_schema_name from_schema_rev to_schema_name to_schema_description

dbsetname is the name of the schema repository

      from_schema_name is the schema name which you want to clone form
      from_schema_rev is the version you want to clone
      to_schema_name is the schema name which you want to clone to

      Now we want to clone all version of gqasch to gqasch1. Gqasch1 is not existing in the production env. Here is the command line

      installutil cloneschema cqms.productclan.site zhengol 3398810 gqasch 40 gqasch1 “copy from gqasch”

      After command exits successfully, the schema gqasch1 is created with version 1. you can change the to_schema_name with a meaningful name. If you still want to use the gqasch, pls precede step d

    d. Delete the whole schema gqasch in the ClearQuest designer.
    e. Using the clone schema again to change back the schema name

      installutil cloneschema cqms.productclan.site zhengol 3398810 gqasch1 1 gqasch “copy back from gqasch”

    f. Delete the schema gqasch1 in the ClearQuest designer

After all above steps done, you can find the schema gqasch with version 1.

1 comment:

Deli Shen said...

Very good trick, it is useful to me, thanks for sharing.