Wednesday, March 16, 2011

How to grant all privileges in Oracle

SQL>


SQL> sho user


USER is "SYSTEM"


SQL> select * from system_privilege_map


-- Create a new user


SQL> create user siva identified by sivag;


User created.


SQL> -- connect as siva and grant all privileges to siva


SQL> connect siva / sivag


Connected.


SQL> grant all privileges to siva;


Grant succeeded.


How to grant all privileges in Oracle

Wednesday, March 2, 2011

Extracting META information from Oracle

List TABLEs
Here's the query that will return the names of the tables defined in the current database:


SELECT table_name  FROM user_tables;
-- or
SELECT table_name FROM tabs;


List VIEWs
Here's the query that will return the names of the VIEWs defined in the current database:

SELECT view_name FROM user_views;


List users
NB: you'll need DBA access rights to execute the following query:

SELECT username FROM dba_users;