Use the following steps to transfer SQL DBA users between databases:
1) Dump out the content of the _user table using Data Administration > Admin > Dump Data and Definitions > User Table Contents.
2) Use the following ABL code to generate .sql file to generate GRANT DBA statements for current DBA users:
OUTPUT TO VALUE("createDbaUsers.sql") APPEND.
FOR EACH _User NO-LOCK:
FOR EACH _Sysdbauth WHERE _Sysdbauth._grantee = _User._Userid NO-LOCK:
PUT UNFORMATTED "GRANT DBA TO " + _GRANTEE + "; " SKIP.
PUT UNFORMATTED "COMMIT WORK;" SKIP.
END.
END.
OUTPUT CLOSE.
3) Use SQLSCHEMA to dump out database object-related GRANTs.
In the new database with the .df loaded,
1) Start Data Administration against the database and:
- Reload users with Admin > Load Data and Definitions > User Table Contents.
- Create the sysprogress user in Data Administration > Admin > Security > Edit User List.
2) Use SQLEXP to execute the script to recreate DBA user(s); use the sysprogress user account to do this:
sqlexp -db myNewDatabase -S 9999 -user sysprogress -password sysprogress -infile createDbaUsers.sql3) Use SQLEXP to execute the .dfsql script to re-apply GRANTs using the DBA user created in step #2.
sqlexp -db myNewDatabase -S 9999 -user myDBA -password myDBApwd -infile grants.dfsql4) Remove the sysprogress user from the database.