0% found this document useful (0 votes)
65 views3 pages

Account Settings

The document provides instructions and examples for managing Oracle database users including changing passwords, checking existing users, creating new users, dropping users, and backing up objects before dropping a user.

Uploaded by

joaopaulo164
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views3 pages

Account Settings

The document provides instructions and examples for managing Oracle database users including changing passwords, checking existing users, creating new users, dropping users, and backing up objects before dropping a user.

Uploaded by

joaopaulo164
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

===================================================================================

==============
ACCOUNT SETTINGS
===================================================================================
==============
### CHANGE PASSWORD FOR 'SYS' IF NOT WORKING.
$> sqlplus 'sys/ch!ps#d3l!ghT as sysdba'

SQL> alter user USER identified by PASSWORD;


SQL> alter user USER password expire;
SQL> alter user USER identified by marriott#1 password expire;
SQL> alter user USER account lock/unlock;

SQL> select password from sys.user$ where name='COGNOS';

PASSWORD
-----------------
4AF58B7275032AA0

SYS> SELECT name, ctime, ptime FROM sys.user$ WHERE name = 'SYSADM';

CTIME Indicates - Creation Time


PTIME Indicates - Password Change Time

===================================================================================
==============
--Check user if exists in database:
set lines 200
col USERNAME for a10
SELECT USERNAME, USER_ID, ACCOUNT_STATUS, EXPIRY_DATE, CREATED from dba_users where
USERNAME = 'MCARR632'
/

--Check user role privs:


select * from dba_role_privs where GRANTEE = 'EPMREAD'
/

--Check user table privs:


select * from dba_tab_privs where OWNER = 'EPMREAD'
/
===================================================================================
==============
*** FOR CREATE USER (MANUAL) ***

#1
For Test/Prod databases:
$> create_newuser.ksh <username> read <ORACLE_SID>

For Dev databases:


$> create_newuser.ksh <username> change <ORACLE_SID>

#2
$> grep "ORA-" newuser_generic_<ORACLE_SID>.log
$> grep "SP2-" newuser_generic_<ORACLE_SID>.log
$> tail -43 newuser_generic_<ORACLE_SID>.log
===================================================================================
==============
Your ID <username> has been created with a default password on <passwd> in the
databases mentioned below.

<SUMMARY FILE>

Please note that the password has been set to expire.


You have to change your password on your first log in to be able to connect to the
database.
As such, please connect first through sql*plus, you will be prompted to input the
password indicated above and then to input a new password.

===================================================================================
==============
FOR DROPPING USER WITH BACKUP
===================================================================================
==============
#1 $> vi pre_check.sql

-- check user privs


select grantee,'' role,owner,table_name,privilege,grantable,'' admin, ''
default_role
from dba_tab_privs where grantee in ('<USERNAME>')
union
select grantee,'','','',privilege,'',admin_option, ''
from dba_sys_privs where grantee in ('<USERNAME>')
union
select grantee,granted_role,'','','','',admin_option, default_role
from dba_role_privs where grantee in ('<USERNAME>')
/

-- check users existing


select username, user_id, DEFAULT_TABLESPACE, TEMPORARY_TABLESPACE from dba_users
where username in ('<USERNAME>')
/

-- check if user created objects


select OWNER, OBJECT_NAME, OBJECT_TYPE, CREATED, LAST_DDL_TIME, STATUS from
dba_objects
where owner in ('<USERNAME>')
/

select OWNER, SEGMENT_NAME, SEGMENT_TYPE, PARTITION_NAME, TABLESPACE_NAME,


BYTES/1024/1024 from dba_segments
where owner in ('<USERNAME>')
/

-- check if user has db_link


select OWNER,DB_LINK,USERNAME,HOST from dba_db_links
where OWNER in ('<USERNAME>')
/
===================================================================================
==============
#2 $> vi backup.par

BUFFER=10485760
ROWS=Y
INDEXES=Y
GRANTS=Y
STATISTICS=NONE
DIRECT=Y
COMPRESS=N
RECORDLENGTH=65535
OWNER=<USERNAME>
===================================================================================
==============
#3 $> vi drop_user.sql

drop user RLSTE496;


===================================================================================
==============
#2 $> vi post_check.sql

-- same as pre_check.sql
===================================================================================
==============

You might also like