Sunday, 14 January 2018

How to create user and grant privileges in oracle in R12.2

Hi DBA-mates,
As we all know, creating a Schema or DB User is very easy and we all do it in DBA’s life. Here, How to create database user and grant privileges in oracle.
However, there is some important points, which we need to take care.
There is some points such as how to create User’s and Grant them the Privileges.

How to create User and grant the user:
1. Create DB User or Schema:
Note: Here username is ora-data.
$sqlplus '/as sysdba'
Before creating user, we should check either user is existing or not.
SQL>select USERNAME from DBA_USERS where USERNAME like '%ORA-DATA%';

Query:
CREATE USER user_name IDENTIFIED BY  'passsword' DEFAULT TABLESPACE tablespace_name TEMPORARY TABLESPACE tablespace_name PROFILE DEFAULT ACCOUNT UNLOCK;

Example:
SQL>CREATE USER ora-data IDENTIFIED BY ora-data DEFAULT TABLESPACE user TEMPORARY TABLESPACE TEMP PROFILE DEFAULT ACCOUNT UNLOCK;
Cross check:
SELECT USERNAME, ACCOUNT_STATUS, DEFAULT_TABLESPACE, TEMPORARY_TABLESPACE, CREATED from dba_users where USERNAME='ora-data';

Providing GRANTS:
SQL>GRANT CONNECT, RESOURCE TO ora-data;
SQL>GRANT CREATE SESSION TO ora-data;

SQL>GRANT CONNECT TO ora-data;
SQL>GRANT SELECT ANY DICTIONARY to ora-data;
SQL>GRANT SELECT ANY TABLE to ora-data;
SQL>GRANT UNLIMITED TABLESPACE to ora-data;
SQL>ALTER USER ora-data ENABLE EDITIONS; (In R12.2 specially)

If you want to Grant only on any particular Table (tb1) then find the below details:
SQL>GRANT SELECT ON tb1 to ora-data;

Suppose, if you want to GRANT for any particular OWNER for particular TABLE then follow below steps:

Example: OWNER= xxabc, TABLE= tb1, USERNAME=ora-data

SQL>conn xxabc/password
SQL>show user
xxabc
SQL> GRANT SELECT ON tb1 TO ora-data;

How to Check the GRANT details:
1. DBA_SYS_PRIVS: To show information about user's privileges related to System (DBA).
2. DBA_TAB_PRIVS: To show information about user's privileges related to Tables.
3. DBA_ROLE_PRIVS: To show information about user's privileges related to Roles.

To know details:
SQL>desc DBA_SYS_PRIVS;

Some Column Name and details:
GRANTEE: It is the name, role, or user that was assigned the privilege.

PRIVILEGE: It is the privilege that is assigned.

ADMIN_OPTION: It indicates if the granted privilege also includes the ADMIN option.

SQL>desc DBA_TAB_PRIVS;

GRANTEE: It is the name of the user with granted access.

TABLE_NAME: It is the name of the object (table, index, sequence, etc).

PRIVILEGE: It is the privilege assigned to the GRANTEE for the associated object.

Hope this may useful and helpful. If there is any suggestions or  corrections, please let us know either in comment box or contact us @https://ora-data.blogspot.in/

Some more useful links:
Regards,
ora-data Team

20 comments:


  1. It is very good and useful .Learned a lot of new things from your post!Good creation ,thanks for good info Oracle SOA Online Training Bangalore

    ReplyDelete
  2. You actually make it appear really easy together with your presentation but I find this topic to be really one thing which I think I would never understand.
    It sort of feels too complicated and very broad for me.
    I am having a look ahead to your subsequent post, I'll try to get the hang of it!

    ReplyDelete
    Replies

    1. Dear User,

      Thank you for your valuable comments.

      Regards,
      ora-data Team

      Delete
  3. I wish to show thanks to you just for bailing me out of this particular trouble. As a result of checking through the net and meeting techniques that were not productive, I thought my life was done.Oracle Training in Chennai
    Oracle Training Institute in Chennai

    ReplyDelete
  4. This information which you provided is very much useful for us. It was very interesting and useful for Oracle Apps DBA online training.
    Oracle Apps DBA Online Training

    ReplyDelete
  5. Really very informative and creative contents. This concept is a good way to enhance the knowledge.thanks for sharing plz keep it up
    Oracle Training in Gurgaon

    ReplyDelete
  6. Thanks for sharing article according to oracle database. It's a helpful for me.

    Regards,
    PHP web developer | PHP developer

    ReplyDelete
  7. Hi there, It has been a beautiful article and thank you for writing this share.

    ReplyDelete
  8. I have to voice my passion for your kindness giving support to those people that should have guidance on this important matter.Oracle DBA Training in Bangalore

    ReplyDelete
  9. Excellent information with unique content and it is very useful to know about the Oracle DBA.Oracle DBA Training in Bangalore

    ReplyDelete
  10. I wanted to thank you for this excellent read!! I definitely loved
    every little bit of it. I've got you saved as a favorite to check out new stuff you post…

    ReplyDelete
  11. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. oracle training in chennai

    ReplyDelete
  12. Simply wish to say your article is as astonishing. The clarity in your post is simply great, and I could assume you are an expert on this subject. Same as your blog i found another one Oracle Project Portfolio Management Cloud Software .Actually I was looking for the same information on internet for Oracle PPM and came across your blog. I am impressed by the information that you have on this blog. Thanks a million and please keep up the gratifying work.

    ReplyDelete
  13. Learn Oracle DBA for making your career towards a sky-high with Infycle Technologies. Infycle Technologies provides the top Oracle DBA Training in Chennai and offering programs in Oracle such as Oracle PL/SQL, Oracle Programming, etc., in the 200% hands-on practical training with professional specialists in the field. In addition to that, the interviews will be arranged for the candidates to set their careers without any struggle. Of all that, Cen percent placement assurance will be given here. To have the best job for your life, call 7502633633 to Infycle Technologies and grab a free demo to know more.No.1 Oracle DBA Training in Chennai | Infycle Technologies

    ReplyDelete
  14. Learn Amazon Web Services for excellent job opportunities from Infycle Technologies, the Excellent AWS Training in Chennai. Infycle Technologies gives the most trustworthy AWS course in Chennai, with full hands-on practical training from professional trainers in the field. Along with that, the placement interviews will be arranged for the candidates, so that, they can meet the job interviews without missing them. To transform your career to the next level, call 7502633633 to Infycle Technologies and grab a free demo to know more

    ReplyDelete
  15. Infycle Technologies, the No.1 software training institute in Chennai offers the No.1 Big Data Hadoop Training in Chennai | Infycle Technologies for students, freshers, and tech professionals. Infycle also offers other professional courses such as DevOps, Artificial Intelligence, Cyber Security, Python, Oracle, Java, Power BI, Selenium Testing, Digital Marketing, Data Science, etc., which will be trained with 200% practical classes. After the completion of training, the trainees will be sent for placement interviews in the top MNC's. Call 7502633633 to get more info and a free demo.

    ReplyDelete
  16. Get the Digital Marketing Training in Chennai from Infycle Technologies, one of the best software training institute, and Placement center in Chennai which is providing professional software courses such as Data Science, Artificial Intelligence, Cyber Security, Big Data, Java, Hadoop, Selenium, Android, and iOS Development, DevOps, Oracle, etc with 200% hands-on practical training. Dial 7504633633 to get more info and a free demo and to grab the certification for having a peak rise in your career.Get Digital Marketing Course in Chennai | Infycle Technologies

    ReplyDelete
  17. Grab the Digital Marketing Training in Chennai from Infycle Technologies, the best software training institute, and Placement center in Chennai which is providing professional software courses such as Data Science, Artificial Intelligence, Cyber Security, Big Data, Java, Hadoop, Selenium, Android, and iOS Development, DevOps, Oracle, etc with 100% hands-on practical training. Dial 7504633633 to get more info and a free demo and to grab the certification for having a peak rise in your career.

    ReplyDelete

Thank you for your comments and suggestions. It's good to talk you.