How to find schema name in Oracle ? when you are connected in sql session using read only user

前端 未结 3 1177
猫巷女王i
猫巷女王i 2021-02-18 15:29

I am connected to a oracle database with a read only user and i used service name while Setting up connection in sql developer hence i dont know SID ( schema ).

How can

3条回答
  •  无人及你
    2021-02-18 15:45

    How about the following 3 statements?

    -- change to your schema

    ALTER SESSION SET CURRENT_SCHEMA=yourSchemaName;
    

    -- check current schema

    SELECT SYS_CONTEXT('USERENV','CURRENT_SCHEMA') FROM DUAL;
    

    -- generate drop table statements

    SELECT 'drop table ', table_name, 'cascade constraints;' FROM ALL_TABLES WHERE OWNER = 'yourSchemaName';
    

    COPY the RESULT and PASTE and RUN.

提交回复
热议问题