Do you want all of the variously-owned tables/views/etc in the source database to be duplicated and owned by the single alternate-user in the result database? That's what it sounds like to me.
I can't offhand think of a one-step way to do it. The simplest, assuming that the database data isn't large enough to be a problem, might be to run unloaddb and run the resulting unload.ing script. Then, edit the copy.in and take out the "set session authorization foo" statements for all of the object owners except for the ones that set the session to the original dba. Change those set-session statements to reflect the new dba. Edit the object owner names for all of the non-table objects (views, db procedures, etc) to reflect the new dba. Cat /dev/null to the copy output files for everything EXCEPT the iixxx copy files (i.e. you now have zero-length copy-in data files). Create the new database with createdb -u and run reload.ing.
If you have character-forms objects (reports, forms, etc), they can pose a challenge since the catalog entries include the owner names. Your best bet there is probably to unload the objects using forms tools such as copyform, copyapp out, etc and reload them into the new database as the new user.
Anyone have any better suggestions?
|