How to Get User DDL Information

How to check username and account status :


SQL> select username,account_status from dba_users where username='SCF';

USERNAME                       ACCOUNT_STATUS
------------------------------ --------------------------------
SCF                            OPEN

How to check user DDL infromation :


SQL> select dbms_metadata.get_ddl('USER','SCF') from dual;

DBMS_METADATA.GET_DDL('USER','SCF')
--------------------------------------------------------------------------------

   CREATE USER "SCF" IDENTIFIED BY VALUES 'S:E1D7DD865F2335EC32DFA3D9FCB76A76D88
5410349C215A751372DDC5DF7;FD5793DB46F278AE'
      DEFAULT TABLESPACE "TECH"
      TEMPORARY TABLESPACE "TEMP1"



How to Chek user profile : 

SQL> select username,account_status,profile from dba_users where username='SCF';

USERNAME                       ACCOUNT_STATUS
------------------------------ --------------------------------
PROFILE
------------------------------
SCF                            OPEN
DEFAULT

How to Check user Role Privileges: 

SQL> select dbms_metadata.get_granted_ddl('ROLE_GRANT','SCF') from dual;



How to Check user Object Levl Privilages information:


SQL> select dbms_metadata.get_granted_ddl('OBJECT_GRANT','SCF') from dual;

DBMS_METADATA.GET_GRANTED_DDL('OBJECT_GRANT','SCF')
--------------------------------------------------------------------------------

  GRANT UPDATE ON "SZ"."K1" TO "SCF"
  GRANT SELECT ON "SZ"."K1" TO "SCF"



How to Check user System Level information:



SQL> select dbms_metadata.get_granted_ddl('SYSTEM_GRANT','SCF') from dual;

DBMS_METADATA.GET_GRANTED_DDL('SYSTEM_GRANT','SCF')
--------------------------------------------------------------------------------

  GRANT CREATE TABLE TO "SCF"
  GRANT CREATE SESSION TO "SCF"



How to Create User : 

 SQL> CREATE USER "SLM" IDENTIFIED BY SLM
  DEFAULT TABLESPACE "TECH"
  TEMPORARY TABLESPACE "TEMP1"
  PROFILE DEFAULT;             

User created.


How to grant the Priviliges to User :

SQL> GRANT UPDATE ON "SZ"."K1" TO "SLM";

Grant succeeded.

SQL> GRANT SELECT ON "SZ"."K1" TO SLM;

Grant succeeded.

SQL> GRANT CREATE TABLE TO SLM;

Grant succeeded.

SQL> GRANT CREATE SESSION TO SLM;

Grant succeeded.


No comments:

Post a Comment