How To Connect With Oracle Database | Create Your Own User In Oracle Database
How to work with Oracle database a guide from beginner to advance. In this article, we will look at all the concepts which are useful to work with the oracle database.
Steps to follow work with Oracle Database:
- Install the Oracle database from the Oracle official site.
- Set the password for the system/sys user you can set any password which you want to set.
- Now is the time to design our own user in the Oracle database but before designing the user we want to connect sys / system or any other user.
- Type command in SQL Command line: connect system/password SQl>show user
- SQL> create user Harshit identified by abc;
user id - Harshit
Password- abc
To connect with the Harshit user we need to assign the privileges.
- SQL> grant connect, resource to Harshit;
-SQL> grant dba to Harshit; - Now Harshit user can perform dba task also, all privilege affected on new session.
-SQL> revoke dba from Harshit; - until re-login Harshit user work as dba, but after re-login Harshit user will work as the normal user.
Change the user password
If we want to change the user password then we can change our own password but the dba user can change any user password.
SQL> alter user Harshit identified by rewq;
Lock and Unlock the user
If we want to lock and unlock the existing user the the following command:
SQL> alter user Harshit account lock; -To lock the account
SQL> alter user Harshit account unlock; -To unlock the account
For expire the user password type:
SQL>alter user Harshit password expire;
Display the list of all existing user;
To display the list of all the existing use in the database type :
SQL> select* from all_user;
To display the current working user type :
SQL>show user;
To drop the existing user type:
SQL>drop user Harshit; -If the user table is linked with another user table then an error will generate.
SQL>drop sure Harshit cascade; - Drop the user forcefully.
User name and pass plz
ReplyDelete