Perform schema import by changing Grant and synonym

Asked

Viewed 33 times

1

In one environment I have 5 schemas that make grant and synonym among themselves, of which they are already working.

Now I need to duplicate that default environment for the customer environment, and I need to change the name of schemas, grant and synonym.

The part about changing the name of schemas resolution in IMPDP thus:

REMAP_SCHEMA=SCHEMAPADRAO:SCHEMACLIENTE
SCHEMAS=SCHEMAPADRAO

But I always have to redo the grant and synonym because they have an incorrect name.

I would like to resolve this in the IMPDP itself, but if it is not possible I would like another solution.

1 answer

1

Run these selects and run the result.

 SELECT DBMS_METADATA.GET_GRANTED_DDL('SYSTEM_GRANT',USERNAME) FROM ALL_USERS WHERE (USERNAME IN ('APEX_030200', 'APEX_PUBLIC_USER','ETC')) ORDER BY USER_ID;   

 SELECT DBMS_METADATA.GET_GRANTED_DDL('OBJECT_GRANT',USERNAME) FROM ALL_USERS WHERE (USERNAME IN ('APEX_030200', 'APEX_PUBLIC_USER','ETC')) ORDER BY USER_ID;

SELECT 'CREATE '|| decode(owner,'PUBLIC','PUBLIC ',null) ||
       'SYNONYM ' || decode(owner,'PUBLIC',null, owner || '.') ||
        lower(synonym_name) || ' FOR ' || lower(table_owner) ||
        '.' || lower(table_name) ||
        decode(db_link,null,null,'@'||db_link) || ';'
  from sys.dba_synonyms
  order by owner;
  • Not only would it rotate, it would have to change to do / TO, replacing, and conditions only for the schemas, that for the grants. As for the synonyn change to do the CREATE OR REPLACE, I think it would work because that way I have all the grants and synonym registered. I will wait if there is a direct way in the IMP to accomplish this. Thank you Daniel

Browser other questions tagged

You are not signed in. Login or sign up in order to post.