I have two schemas.
1.Schema A
2.Schema B
I need to do following.
- I want create some tables in schema B (same as some tables in A)
- Then Move data from A to B.
Now I want to do ALL this from schema A. I have written a package which when executed in A will create all the tables in B and then create synonyms for them in A. And then will just select data from its own tables and insert into B’s tables.
VERY IMP : Now this entire thing has to happen in one go. Just an execution of one begin block should do the entire job.
Problem : But now the synonyms would not work because Schema A does not have any privs on the tables it created in B .
so is there a way to create tables (from A to B ) with all the privs given at the creation time ?
Or can the schemas be switched in PL-SQL while execution so that privs can be granted from B to A ? (I am sure this can not be done, but nothing is impossible they say ! :O 😛 so asking )
Please help me guys ! All suggestions are welcome !
The Main objective of this job is to do it in one go and from only one schema.
You can define a procedure which will run under definer rights, instead of caller rights
You would define such a procedure in schema B, which does the job and call it from schema A.