Simple way is to use combination of
- ddglen (utility provided by SAP/Sybase for getting metadata out) and
- SQL generation for dropping users and groups (from system tables in the ASE database)
Before loading extract from target database
- as a precaution you can bcp out (character mode) all system tables from the target database
this will be handy if things do not go as planned.
- extract group info (this includes grants for public + groups )
e.g. ddlgen -U sa -S <Server> -P<passw> -TGRP -N<DBName>.% -o groups.ddl
- extract user info (includes group member ship for user )
e.g. ddlgen -U sa -S <Sever> -P<passw> -TUSR -N<DBName>.% -o users.ddl
Before load but run on source side (or on target after the load)
- generate drop users (using select on sysusers)
- generate drop NON-dbo aliases (using select on sysalternates)
- generate drop user groups (use select on sysusers with gid = uid and gid > last system gid)
On target after the load
- drop users, aliases and groups using the SQL generated
- add groups using ddlgen output
- add users using ddlgen output
This allows you have local sets of groups and users for each environment (PROD/QA/DEV)
Note that this method avoided updating system tables directly.
HTH
Avinash