Total Pageviews

Monday, December 10, 2018

HOW TO CONNECT TO OTHER USER AND CREATE OBJECTS WITH OUT KMOWING THE PASSWORD OF OTHERS USER


Suppose a user ASHWANI wants to connect to SCOTT user and create a table and we don’t know the password of SCOTT.

Connect to SYS user

SQL> conn / as sysdba
Connected.

Grant below privilege

SQL> alter user Scott grant connect through ashwani;

User altered.

Connect as below and provide the ashwani user password.

SQL> conn ashwani[scott]
Enter password:         => Provide the password of ashwani user
Connected.

SQL> sho user
USER is "SCOTT"

Create table

SQL> create table emp_bkp as select * from emp;

Table created.

CONNECT TO SYS USER AND CHECK THE DETAILS OF THE OBJECT CREATED.
SQL> SELECT OBJECT_NAME,OBJECT_TYPE,OWNER,CREATED FROM DBA_OBJECTS WHERE OBJECT_NAME='EMP_BKP';

OBJECT_NAME          OBJECT_TYPE         OWNER           CREATED
-------------------- ------------------- --------------- ---------
EMP_BKP              TABLE               SCOTT           10-DEC-18

No comments:

Post a Comment