Useful shortcuts for vi editor

Showing posts with label profile. Show all posts
Showing posts with label profile. Show all posts

Friday, 6 October 2017

ORA-28000 solution

Error
ORA-28000: the account is locked

Solution
Find the assigned profile for related user
SQL> select profile from DBA_USERS where username = 'HR';
-- e.g. DEFAULT

Disable failed_login_attempts parameter
SQL> alter profile "DEFAULT" limit failed_login_attempts UNLIMITED;

Check it
SQL> select resource_name,limit from dba_profiles where profile='DEFAULT';

Apply the new setting for user
SQL> alter user "HR" ACCOUNT UNLOCK;

Tuesday, 1 August 2017

ORA-28002 solution

Error
ORA-28002: the password will expire within [A] days

Solution
Disable password expiration
SQL> select profile from DBA_USERS where username = 'HR';
-- e.g. DEFAULT

Change password_life_time parameter
SQL> alter profile "DEFAULT" limit password_life_time UNLIMITED;

Check it
SQL> select resource_name,limit from dba_profiles where profile='DEFAULT';

Apply the new setting for user
SQL> alter user "HR" identified by "hr";

Wednesday, 11 January 2017

How to define timeout setting for auto logout users in linux system?

Configure it
# vi /etc/profile
add following parameter at the end of the profile file:
# this parameter runs as seconds and affects all users. e.g. 3600; one hour
TMOUT=3600

Check it
$ echo $TMOUT

Test result
$ timed out waiting for input: auto-logout

Wednesday, 15 October 2014

How to see all profiles and assigned limits?

Please execute the commands as "sys";

SQL> SELECT * FROM DBA_PROFILES ORDER BY PROFILE;

Tuesday, 14 October 2014

How to alter a profile in Oracle?

Please login to database server with ssh as oracle user and run that commands.

sqlplus / as sysdba

SQL> ALTER PROFILE engineer LIMIT 
SESSIONS_PER_USER 5
IDLE_TIME 60
CONNECT_TIME 1200;

SQL> exit

-- SESSIONS_PER_USER; Specify the number of concurrent sessions to which you want to limit the user.
-- IDLE_TIME; Specify the permitted periods of continuous inactive time during a session, expressed in minutes. Long-running queries and other operations are not subject to this limit.
-- CONNECT_TIME; Specify the total elapsed time limit for a session, expressed in minutes.

How to define new profile or change old profile in Oracle?

Please login to database server with ssh as oracle user and run that commands.

sqlplus / as sysdba

SQL> CREATE PROFILE engineer LIMIT 
SESSIONS_PER_USER 1
IDLE_TIME 30
CONNECT_TIME 600;

SQL> exit

-- SESSIONS_PER_USER; Specify the number of concurrent sessions to which you want to limit the user.
-- IDLE_TIME; Specify the permitted periods of continuous inactive time during a session, expressed in minutes. Long-running queries and other operations are not subject to this limit.
-- CONNECT_TIME; Specify the total elapsed time limit for a session, expressed in minutes.

other parameters:
CPU_PER_SESSION; Specify the CPU time limit for a session, expressed in hundredth of seconds.
CPU_PER_CALL; Specify the CPU time limit for a call (a parse, execute, or fetch), expressed in hundredths of seconds.
LOGICAL_READS_PER_SESSION; Specify the permitted number of data blocks read in a session, including blocks read from memory and disk.
LOGICAL_READS_PER_CALL; Specify the permitted number of data blocks read for a call to process a SQL statement (a parse, execute, or fetch).
PRIVATE_SGA; Specify the amount of private space a session can allocate in the shared pool of the system global area (SGA). Refer to size_clause for information on that clause.
COMPOSITE_LIMIT; Specify the total resource cost for a session, expressed in service units. Oracle Database calculates the total service units as a weighted sum of CPU_PER_SESSION, CONNECT_TIME, LOGICAL_READS_PER_SESSION, and PRIVATE_SGA.

Change current profile
ALTER PROFILE DEFAULT LIMIT IDLE_TIME 60;
ALTER PROFILE DEFAULT LIMIT CONNECT_TIME 6000;
ALTER PROFILE DEFAULT LIMIT SESSIONS_PER_USER 1;

Add this parameter into init.ora file permanently or apply this for already running instance temporary:
Option 1: 
*.resource_limit=TRUE 
Option 2:
alter system set resource_limit = true;