Search This Blog

Total Pageviews

Thursday 29 December 2011

ORA-00845: MEMORY_TARGET not supported on this system



SQL> show parameter memory

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
hi_shared_memory_address integer 0
memory_max_target big integer 968M
memory_target big integer 968M
shared_memory_address integer 0


alter system set memory_max_target=1200m scope=spfile;


SQL> alter system set memory_max_target=1200m scope=spfile;

System altered.



SQL> alter system set memory_target=1200m scope=spfile;

System altered.


SQL> startup force;
ORA-00845: MEMORY_TARGET not supported on this system


SQL> !df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
21G 17G 2.9G 86% /
tmpfs 1000M 420K 1000M 1% /dev/shm <<<<------------------ increase this value
/dev/sda1 485M 41M 419M 9% /boot




from root

[root@localhost ~]# mount -t tmpfs shmfs -o size=2048m /dev/shm


vi /etc/fstab


/dev/mapper/VolGroup-lv_root / ext4 defaults 1 1
UUID=9a9b0c22-cacf-491c-ad27-b636c69da3cf /boot ext4 defaults 1 2
/dev/mapper/VolGroup-lv_swap swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
shmfs /dev/shm tmpfs size=2048m 0 0 <<<<<<<<<---- add following line


then init 6 from reboot <<<<<--- if you can other wise leave



SQL> startup ;
ORACLE instance started.

Total System Global Area 1255473152 bytes
Fixed Size 1344652 bytes
Variable Size 754977652 bytes
Database Buffers 486539264 bytes
Redo Buffers 12611584 bytes
Database mounted.

 

 

 






SQL> show parameter memory

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
hi_shared_memory_address integer 0
memory_max_target big integer 1200M
memory_target big integer 1200M
shared_memory_address integer 0

Monday 26 December 2011

Oracle validate rpm location

wget http://oss.oracle.com/el5/oracle-validated/oracle-validated-1.0.0-5.el5.i386.rpm

http://oss.oracle.com/el5/oracle-validated/

Thursday 22 December 2011

Oracle flashback on

how to start flashback ?
how to start oracle flashback ?
Oracle flashback start




SQL> select VERSION from v$instance ;

VERSION
-----------------
11.2.0.3.0




LOG_ARCHIVE_FORMAT must be in the format: %s,%t,%r.

%s log sequence number
%S log sequence number, zero filled
%t Thread number
%T Thread number, zero filled
%a activation ID
%d database ID
%r resetlogs ID that ensures unique names are constructed for the archived log files across multiple incarnations of the database



start from here <<<<<<<<<<<<<<<<<<<<<<<<<<<




SQL> create pfile='/tmp/init_aptdb.txt' from spfile ;

File created.



in pfile <<<<<

*.log_archive_dest_1="LOCATION=/ptus/oracle/Arch/Aptdb"
*.log_archive_format='AptOra_%t_%s_%r.arc'
*.db_recovery_file_dest='/ptus/oracle/Diag/Flashback'
*.db_recovery_file_dest_size=3221225472 --- 3gb
*.db_flashback_retention_target=7200 --- 5 days



SQL> startup mount pfile='/tmp/init_aptdb.txt' ;
ORACLE instance started.

Total System Global Area 1252663296 bytes
Fixed Size 2227944 bytes
Variable Size 939524376 bytes
Database Buffers 301989888 bytes
Redo Buffers 8921088 bytes
Database mounted.
SQL> Alter database flashback on;

Database altered.



SQL> alter database open ;

Database altered.


SELECT name,current_scn ,flashback_on FROM v$database;

NAME CURRENT_SCN FLASHBACK_ON
--------- ----------- ------------------
APTDB 1278076 YES


SQL> create spfile from pfile='/tmp/init_aptdb.txt' ;

File created.



SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /ptus/oracle/Arch/Aptdb
Oldest online log sequence 90
Next log sequence to archive 92
Current log sequence 92

SQL> show parameter recovery

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string /ptus/oracle/Diag/Flashback
db_recovery_file_dest_size big integer 3G
recovery_parallelism integer 0

SQL> show parameter retention

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_flashback_retention_target integer 7200
undo_retention integer 900




/ptus/oracle/Diag/Flashback/APTDB/flashback

-bash-4.1$ ls -lh
total 101M
-rw-r-----. 1 oracle oinstall 51M Dec 22 14:46 o1_mf_7h6hht6d_.flb
-rw-r-----. 1 oracle oinstall 51M Dec 22 14:26 o1_mf_7h6hhwnt_.flb

Wednesday 21 December 2011

Oracle user info



Oracle user Info .... 


set linesize 200 verify off
alter session set nls_timestamp_tz_format = 'dd-mon-yyyy hh24:mi:ss';
alter session set nls_date_format = 'dd-mon-yyyy hh24:mi:ss';
col username  format a20
col account_status  format a16
col default_tablespace  format a15
col temporary_tablespace  format a15
col profile  format a15
col initial_rsrc_consumer_group for a23
SELECT username,
       account_status,
       lock_date,
       expiry_date,
       default_tablespace,
       temporary_tablespace,
       created, 
       profile,
       initial_rsrc_consumer_group,
       editions_enabled,
       authentication_type
from   dba_users
where  username like upper('%&username%')
ORDER BY username;



USERNAME             ACCOUNT_STATUS   LOCK_DATE            EXPIRY_DATE          DEFAULT_TABLESP TEMPORARY_TABLE CREATED              PROFILE         INITIAL_RSRC_CONSUMER_G E AUTHENTI
-------------------- ---------------- -------------------- -------------------- --------------- --------------- -------------------- --------------- ----------------------- - --------
ANONYMOUS            EXPIRED & LOCKED 26-jan-2017 15:27:28 26-jan-2017 15:27:28 SYSAUX          TEMP            26-jan-2017 14:27:18 DEFAULT         DEFAULT_CONSUMER_GROUP  N PASSWORD
ANUJ                 OPEN                                  19-sep-2018 14:51:20 USERS           TEMP            09-jan-2018 15:34:41 DEFAULT         DEFAULT_CONSUMER_GROUP  N PASSWORD
ANUJ1                OPEN                                  11-aug-2018 06:56:36 USERS           TEMP            09-jan-2018 15:48:40 DEFAULT         DEFAULT_CONSUMER_GROUP  N PASSWORD
ANUJ10               OPEN                                  11-jul-2018 13:13:23 USERS           TEMP            12-jan-2018 13:13:23 DEFAULT         DEFAULT_CONSUMER_GROUP  N PASSWORD
ANUJ3                OPEN                                  08-jul-2018 15:49:55 USERS           TEMP            09-jan-2018 15:49:55 DEFAULT         DEFAULT_CONSUMER_GROUP  N PASSWORD
ANUJ4                OPEN                                  08-jul-2018 15:54:59 USERS           TEMP            09-jan-2018 15:54:59 DEFAULT         DEFAULT_CONSUMER_GROUP  N PASSWORD



with server name !!!

set linesize 300 verify off
alter session set nls_timestamp_tz_format = 'dd-mon-yyyy hh24:mi:ss';
alter session set nls_date_format = 'dd-mon-yyyy hh24:mi:ss';
col username      for a20
col account_status    for a16
col default_tablespace    for a15
col temporary_tablespace    for a15
col profile      for a15
col initial_rsrc_consumer_group for a23
col host for a38
col DATABASE_NAME  for a14
SELECT 
to_char(sysdate,'dd-mm-yyyy hh24:mi') sdate,SYS_CONTEXT('USERENV','HOST') host,SYS_CONTEXT('USERENV','DB_NAME') database_name,
username,
       account_status,
       lock_date,
       expiry_date,
       default_tablespace,
       temporary_tablespace,
       created, 
       profile,
       initial_rsrc_consumer_group,
       editions_enabled,
       authentication_type
from   dba_users
where 1=1  
--and username like upper('%&username%')
ORDER BY username;





---with last change date 
set linesize 300 pagesize 300 verify off
alter session set nls_timestamp_tz_format = 'dd-mon-yyyy hh24:mi:ss';
alter session set nls_date_format = 'dd-mon-yyyy hh24:mi:ss';
col username     format a20
col account_status    format a16
col default_tablespace    format a15
col temporary_tablespace   format a15
col profile     format a15
col initial_rsrc_consumer_group for a23
col host for a38
col DATABASE_NAME  for a14
SELECT 
to_char(sysdate,'dd-mm-yyyy hh24:mi') sdate,SYS_CONTEXT('USERENV','HOST') host,SYS_CONTEXT('USERENV','DB_NAME') database_name,
d.username,
       d.account_status,
   d.created,
       d.lock_date,
   u.ptime "Last Changed",
       d.expiry_date,
       d.default_tablespace,
       d.temporary_tablespace,
       d.profile,
       d.initial_rsrc_consumer_group,
       d.editions_enabled,
       d.authentication_type
from   dba_users d,user$ u
where  1=1
--and d.username like upper('%&username%')
and d.username = u.name
ORDER BY username;



set linesize 200 pagesize 300 verify off
alter session set nls_timestamp_tz_format = 'dd-mon-yyyy hh24:mi:ss';
alter session set nls_date_format = 'dd-mon-yyyy hh24:mi:ss';
col username                    for a20
col account_status              for a16
col default_tablespace          for a15
col temporary_tablespace        for a15
col profile                     for a15
col initial_rsrc_consumer_group for a23
SELECT username,
       account_status,
       lock_date,
       expiry_date,
       default_tablespace,
       temporary_tablespace,
       created, 
       profile,
       initial_rsrc_consumer_group,
       editions_enabled,
       authentication_type
from   dba_users
where  1=1
-- and username like upper('%username%')
and ACCOUNT_STATUS='EXPIRED(GRACE)'
ORDER BY username;




===



SET LONG 20000 LONGCHUNKSIZE 20000 PAGESIZE 0 LINESIZE 1000 FEEDBACK OFF VERIFY OFF TRIMSPOOL ON

BEGIN
   DBMS_METADATA.set_transform_param (DBMS_METADATA.session_transform, 'SQLTERMINATOR', true);
   DBMS_METADATA.set_transform_param (DBMS_METADATA.session_transform, 'PRETTY', true);
END;
/
select
dbms_metadata.get_ddl('VIEW', 'CDB_USERS', 'SYS') 
from
dual;

  CREATE OR REPLACE FORCE NONEDITIONABLE VIEW "SYS"."CDB_USERS"  CONTAINER_DATA
 ("USERNAME", "USER_ID", "PASSWORD", "ACCOUNT_STATUS", "LOCK_DATE", "EXPIRY_DATE", "DEFAULT_TABLESPACE", "TEMPORARY_TABLESPACE", "LOCAL_TEMP_TABLESPACE", "CREATED", "PROFILE", "INITIAL_RSRC_CONSUMER_GROUP", "EXTERNAL_NAME", "PASSWORD_VERSIONS", "EDITIONS_ENABLED", "AUTHENTICATION_TYPE", "PROXY_ONLY_CONNECT", "COMMON", "LAST_LOGIN", "ORACLE_MAINTAINED", "INHERITED", "DEFAULT_COLLATION", "IMPLICIT", "ALL_SHARD", "CON_ID", "CON$NAME", "CDB$NAME") AS
  SELECT k."USERNAME",k."USER_ID",k."PASSWORD",k."ACCOUNT_STATUS",k."LOCK_DATE",k."EXPIRY_DATE",k."DEFAULT_TABLESPACE",k."TEMPORARY_TABLESPACE",k."LOCAL_TEMP_TABLESPACE",k."CREATED",k."PROFILE",k."INITIAL_RSRC_CONSUMER_GROUP",k."EXTERNAL_NAME",k."PASSWORD_VERSIONS",k."EDITIONS_ENABLED",k."AUTHENTICATION_TYPE",k."PROXY_ONLY_CONNECT",k."COMMON",k."LAST_LOGIN",k."ORACLE_MAINTAINED",k."INHERITED",k."DEFAULT_COLLATION",k."IMPLICIT",k."ALL_SHARD",k."CON_ID", k.CON$NAME, k.CDB$NAME 
  FROM CONTAINERS("SYS"."DBA_USERS") k;


--- cdb_users users 
set linesize 300 pagesize 300 verify off
alter session set nls_timestamp_tz_format = 'dd-mon-yyyy hh24:mi:ss';
alter session set nls_date_format = 'dd-mon-yyyy hh24:mi:ss';
col username     format a20
col account_status    format a16
col default_tablespace    format a15
col temporary_tablespace   format a15
col profile     format a15
col initial_rsrc_consumer_group for a23
col host for a38
col DATABASE_NAME  for a14
SELECT distinct
to_char(sysdate,'dd-mm-yyyy hh24:mi') sdate,SYS_CONTEXT('USERENV','HOST') host,SYS_CONTEXT('USERENV','DB_NAME') database_name,
d.CON_ID,
d.username,
       d.account_status,
   d.created,
       d.lock_date,
   u.ptime "Last Changed",
       d.expiry_date,
       d.default_tablespace,
       d.temporary_tablespace,
       d.profile,
       d.initial_rsrc_consumer_group,
       d.editions_enabled,
       d.authentication_type,
   COMMON,
   INHERITED
from   cdb_users d,user$ u
where  1=1
--and d.username like upper('%&username%')
and d.username = u.name
and INHERITED!='YES'
ORDER BY username;

===========



alter session set nls_timestamp_tz_format = 'dd-mon-yyyy hh24:mi:ss';
alter session set nls_date_format = 'dd-mon-yyyy hh24:mi:ss'; 
set linesize 300
col username for a20
col profile for a15
col last_login for a25
select username,default_tablespace,temporary_tablespace,profile,account_status,created,last_login from dba_users where username like upper('%&1%');

USERNAME             DEFAULT_TABLESP TEMPORARY_TABLE PROFILE         ACCOUNT_STATUS   CREATED              LAST_LOGIN
-------------------- --------------- --------------- --------------- ---------------- -------------------- -------------------------
SYS                  SYSTEM          TEMP            DEFAULT         OPEN             26-jan-2017 13:53:25
SYSTEM               SYSTEM          TEMP            DEFAULT         EXPIRED(GRACE)   26-jan-2017 13:53:26 09-feb-2018 16:32:19


set pagesize 200 lines 200
col ownr format a20         justify c heading 'Owner' 
col name format a20         justify c heading 'Tablespace' trunc 
col qota format a12         justify c heading 'Quota (KB)' 
col used format 999,999,990 justify c heading 'Used (KB)' 
set colsep '|'
select 
  username          ownr, 
  tablespace_name   name, 
  decode(greatest(max_bytes, -1), 
    -1, 'UNLIMITED', 
    to_char(max_bytes/1024, '999,999,990') 
  )                 qota, 
  bytes/1024        used 
from  dba_ts_quotas 
where ( max_bytes!=0    or  bytes!=0) 
and username like upper('%&username%')
order by  1,2 

       Owner        |     Tablespace     | Quota (KB) | Used (KB)
--------------------|--------------------|------------|------------
ANUJ                |TEST_DATA           |UNLIMITED   |           0
ANUJ                |TEST_DATA_IND       |UNLIMITED   |           0
ANUJ1               |TEST_DATA           |UNLIMITED   |           0
ANUJ1               |TEST_DATA_IND       |UNLIMITED   |           0
ANUJ10              |TEST_DATA           |UNLIMITED   |           0
ANUJ10              |TEST_DATA_IND       |UNLIMITED   |           0
ANUJ3               |TEST_DATA           |UNLIMITED   |           0
ANUJ3               |TEST_DATA_IND       |UNLIMITED   |           0
ANUJ4               |TEST_DATA           |UNLIMITED   |           0
ANUJ4               |TEST_DATA_IND       |UNLIMITED   |           0

10 rows selected.





set linesize 300 pagesize 300
alter session set nls_timestamp_tz_format = 'dd-mon-yyyy hh24:mi:ss';
alter session set nls_date_format = 'dd-mon-yyyy hh24:mi:ss'; 
set pagesize 66
ttitle skip 2 center 'USRS - Database Users' skip 2
column username  format A25
column user_id  format 99999999999 heading "ID"
column default_tablespace  format A12 trunc heading "Default|Tablespace"
column temporary_tablespace  format A12 trunc heading "Temporary|Tablespace"
column profile  format A19 trunc heading "Profile"
select username, user_id, default_tablespace, temporary_tablespace, profile,created,LAST_LOGIN from dba_users
where 1=1 
and user_id <1000000
;




Oracle 12c
set linesize 300 pagesize 300
alter session set nls_timestamp_tz_format = 'dd-mon-yyyy hh24:mi:ss';
alter session set nls_date_format = 'dd-mon-yyyy hh24:mi:ss'; 
set pagesize 66
ttitle skip 2 center 'USRS - Database Users' skip 2
col COMMON                              format a10
col username  format A25
col user_id  format 99999999999 heading "ID"
col default_tablespace  format A12 trunc heading "Default|Tablespace"
col temporary_tablespace  format A12 trunc heading "Temporary|Tablespace"
col profile  format A19 trunc heading "Profile"
col LAST_LOGIN                          format a23
select username,COMMON, user_id, default_tablespace, temporary_tablespace, profile,created,LAST_LOGIN from dba_users
where 1=1 
and user_id <1000000
;



col username format a23 heading 'Username'             justify c
col role     format a30 heading 'Role (admin,grant)'   justify c
col dts      format a12 heading 'Default|Tablespace'   justify c
col tts      format a12 heading 'Temporary|Tablespace' justify c
col prof     format a30 heading 'Profile'              justify c
break on username on role on dts on tts
select
  username,
  default_tablespace    dts,
  temporary_tablespace  tts,
  profile        prof,
  granted_role || '-' ||  decode(admin_option,'YES','Y','N') ||  decode(granted_role,'YES','Y','N') role,ACCOUNT_STATUS
from  dba_users,  dba_role_privs
where  dba_users.username = dba_role_privs.grantee 
and username != 'PUBLIC'
order by   1,2,3,4
/



set pagesize 300 
col USERS for a20
col GRANTED_ROLE for a25
SELECT MAX(level_deep) level_deep, grantee users, granted_role
    FROM
      ( SELECT DISTINCT level level_deep, grantee, granted_role
        FROM dba_role_privs
       --  START WITH granted_role ='DBA'
        CONNECT BY prior grantee=granted_role
       )
    WHERE grantee IN (SELECT username FROM dba_users 
                     where 1=1 
                      and NOT regexp_like(username,'SYS|OUTLN|DBSNMP|ORACLE_OCM')
                      and username='ANUJ'  ------ <<<<
                     )
   GROUP BY grantee, granted_role
   ORDER BY 1,2
   ;

LEVEL_DEEP|USERS               |GRANTED_ROLE
----------|--------------------|-------------------------
         5|ANUJ                |DBA


col username format a23 heading 'Username'             justify c
col role     format a30 heading 'Role (admin,grant)'   justify c
col dts      format a12 heading 'Default|Tablespace'   justify c
col tts      format a12 heading 'Temporary|Tablespace' justify c
col prof     format a30 heading 'Profile'              justify c
break on username on role on dts on tts
select
  username,
  default_tablespace    dts,
  temporary_tablespace  tts,
  profile        prof,
  granted_role || '-' ||  decode(admin_option,'YES','Y','N') ||  decode(granted_role,'YES','Y','N') role,ACCOUNT_STATUS
from  dba_users,  dba_role_privs
where  dba_users.username = dba_role_privs.grantee 
and username != 'PUBLIC'
order by   1,2,3,4
/


       Username          Tablespace   Tablespace             Profile                   Role (admin,grant)       ACCOUNT_STATUS
----------------------- ------------ ------------ ------------------------------ ------------------------------ -----------------
ABC                     USERS        TEMP         DEFAULT                        CONNECT-NN                     OPEN
                        USERS        TEMP         DEFAULT                        RESOURCE-NN                    OPEN
ANUJ                    USERS        TEMP         DEFAULT                        CONNECT-NN                     OPEN
                        USERS        TEMP         DEFAULT                        DBA-NN                         OPEN
                        USERS        TEMP         DEFAULT                        RESOURCE-NN                    OPEN
ANUJREP                 USERS        TEMP         DEFAULT                        CONNECT-NN                     OPEN
                        USERS        TEMP         DEFAULT                        RESOURCE-NN                    OPEN
ANUJTEST                ANUJTEST     TEMP         DEFAULT                        CONNECT-NN                     OPEN
                        ANUJTEST     TEMP         DEFAULT                        RESOURCE-NN                    OPEN
APEX_030200             SYSAUX       TEMP         DEFAULT                        CONNECT-YN                     EXPIRED & LOCKED
                        SYSAUX       TEMP         DEFAULT                        RESOURCE-YN                    EXPIRED & LOCKED




-- Passwd file info
set echo off  feedback 6  heading on  linesize 200  pagesize 300  termout on timing off  trimout on trimspool on  verify off 
clear columns clear breaks clear computes

col username              format a30    head 'username'
col account_status        format a17    head 'status'
col expiry_date                         head 'expire date'
col default_tablespace    format a28    head 'default tablespace'
col temporary_tablespace  format a15    head 'temp tablespace'
col created                             head 'created on'
col profile               format a20    head 'profile'
col sysdba                format a6     head 'sysdba'
col sysoper               format a7     head 'sysoper'
 select distinct
    a.username                                        username
  , a.account_status                                  account_status
  , to_char(a.expiry_date, 'mm/dd/yyyy hh24:mi:ss')   expiry_date
  , a.default_tablespace                              default_tablespace
  , a.temporary_tablespace                            temporary_tablespace
  , to_char(a.created, 'mm/dd/yyyy hh24:mi:ss')       created
  , a.profile                                         profile
  , decode(p.sysdba,'true', 'true','')                sysdba
  , decode(p.sysoper,'true','true','')                sysoper
from    dba_users a , v$pwfile_users  p
where   p.username (+) = a.username
order by username
/
==



alter session set nls_date_format='dd-mm-yyyy hh24:mi';
col username for a30
col account_status for a20
col profile for a25
col expiry_date for a30
col lock_date for a30
set lines 200 pages 200
select username,account_status,profile,expiry_date,lock_date from dba_users order by 1;



alter session set nls_date_format='dd-mm-yyyy hh24:mi';
set linesize 300 pagesize 300

col USERNAME for a20 
col PASSWORD_LIFE_TIME for a20
col PROFILE for a20
select u.username
,      u.account_status
,      u.lock_date
,      u.expiry_date
,      u.profile
,      p1.limit as password_life_time
from dba_users u
,    ( select * from dba_profiles where resource_name like 'PASSWORD_LIFE_TIME' ) p1
where u.profile = p1.profile
order by 1
;



=========






define username='SYS'

set linesize 200 verify off
alter session set nls_timestamp_tz_format = 'dd-mon-yyyy hh24:mi:ss';
alter session set nls_date_format = 'dd-mon-yyyy hh24:mi:ss';
col username     format a20
col account_status    format a16
col default_tablespace    format a15
col temporary_tablespace   format a15
col profile     format a15
col initial_rsrc_consumer_group for a23
SELECT username,
       account_status,
       lock_date,
       expiry_date,
       default_tablespace,
       temporary_tablespace,
       created, 
       profile,
       initial_rsrc_consumer_group,
       editions_enabled,
       authentication_type
from   dba_users
where  username like upper('%&username')
ORDER BY username;




col  LIMIT for a20
SELECT PROFILE, RESOURCE_NAME, RESOURCE_TYPE, LIMIT
    from dba_profiles
where PROFILE in ('DEFAULT')
    and resource_name='PASSWORD_LIFE_TIME'
      order by RESOURCE_NAME; 




col NAME for a20
select NAME, TO_CHAR(EXPTIME, 'dd-mm-YYYY HH24:MI:SS') as "EXPTIME"
    from SYS.USER$
      where NAME in ('SYS');


===
After Changing SYS Password, DBA_USERS.EXPIRY_DATE Not Updated For SYS User (Doc ID 2518310.1)


col username for a20
col authentication_type for a20
SELECT username,
           account_status,
           authentication_type
    FROM   dba_users
 WHERE 1=1
and username='SYS'
-- and ROWNUM < 10
;

define 1='enable_ptime_update_for_sys'

set linesize 300 pagesize 300
col parameter for a30
col session for a28
col instance for a12
col "Session Value" for a15
col "Instance Value" for a15
col IS_SESSION_MODIFIABLE for a25
col IS_SYSTEM_MODIFIABLE for a25
col description for a70
col comment for a30
col "Default Value" for a15

SELECT a.ksppinm "Parameter", 
       b.KSPPSTDF "Default Value",
       b.ksppstvl "Session Value", 
       c.ksppstvl "Instance Value",
       decode(bitand(a.ksppiflg/256,1),1,'TRUE','FALSE') IS_SESSION_MODIFIABLE,
       decode(bitand(a.ksppiflg/65536,3),1,'IMMEDIATE',2,'DEFERRED',3,'IMMEDIATE','FALSE') IS_SYSTEM_MODIFIABLE
FROM   x$ksppi a,
       x$ksppcv b,
       x$ksppsv c
WHERE  a.indx = b.indx
AND    a.indx = c.indx
AND    a.ksppinm LIKE '/_%' escape '/'
and upper(a.ksppinm) like upper('%&1%')
/



Parameter                      Default Value   Session Value   Instance Value  IS_SESSION_MODIFIABLE     IS_SYSTEM_MODIFIABLE
------------------------------ --------------- --------------- --------------- ------------------------- -------------------------
_enable_ptime_update_for_sys   TRUE            FALSE           FALSE           TRUE                      IMMEDIATE




set linesize 300 pagesize 300
col PROFILE for a20 
col LIMIT for a20
col COMMON for a10 
col INHERITED for a10
col IMPLICIT for a10
select * from dba_profiles where PROFILE='DEFAULT'; 



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




set linesize 300 
col FILE_NAME for a70
col IS_ASM for a10
select * from  V$PASSWORDFILE_INFO;

FILE_NAME                                                              FORMAT IS_ASM         CON_ID
---------------------------------------------------------------------- ------ ---------- ----------
/u01/app/oracle/product/19.3.0/db_1/dbs/orapwt24prodc                  12.2   FALSE               0

SQ



How to Interpret the ACCOUNT_STATUS Column in DBA_USERS (Doc ID 260111.1)

select * from user_astatus_map;

STATUS# STATUS
---------- --------------------------------
0 OPEN
1 EXPIRED
2 EXPIRED(GRACE)
4 LOCKED(TIMED)
8 LOCKED
5 EXPIRED & LOCKED(TIMED)
6 EXPIRED(GRACE) & LOCKED(TIMED)
9 EXPIRED & LOCKED
10 EXPIRED(GRACE) & LOCKED

What do these mean ?
~~~~~~~~~~~~~~~~~~~

These values are directly related to two features 'Account Locking' and 'Password Aging
and Expiration' that are now explained briefly:

1) Account Locking - LOCKED / LOCKED(TIMED)

An account can be locked by a DBA or is locked automatically after a number of
failed login attempts. When a PASSWORD_LOCK_TIME is defined, the account
unlocks automatically after the set time: this is indicated by LOCKED(TIMED).
The LOCKED(TIMED) value is what you always see if the account was locked
due to the number of failed logins > FAILED_LOGIN_ATTEMPTS.

You only see LOCKED if the account is explicitly locked during create or
alter user/role.

You may expect that when the account is automatically locked and PASSWORD_LOCK_TIME is set to unlimited, the account would appear as just LOCKED. This is however not the case: it still shows as LOCKED(TIMED). However the account never unlocks automatically because of the unlimited PASSWORD_LOCK_TIME (infinity).

To add to the confusion, at some point it was decided that even if the account is locked automatically, we should not set it to LOCKED(TIMED) if the PASSWORD_LOCK_TIME is unlimited, since in that case the account would never automatically unlock, this would give up on a crucial piece of information, namely if the account was locked manually or automatically, this change was introduced in 11.2.0.1. However this change caused a regression in Bug 9693615 causing the lock_date to be NULL in dba_users in case the account was locked automatically, the fix to this bug backed out the change again and now we have the LOCKED(TIMED) for automatically locked accounts back with this fix.

So a DBA will know that when the ACCOUNT_STATUS is LOCKED(TIMED) that the
lock was a result of a failed login attempt, even if the lock will not expire. In 11.2.0.1 (without the fix to Bug 9693615) you can verify if the account was locked automatically if the lock_date in dba_users is null.

2) Password Expiration - EXPIRED / EXPIRED(GRACE)

A password can be set to expire, with or without a grace period:
when a password expires and no grace is defined, the password is set at
EXPIRED, meaning that the user is prompted for a new password upon the
next login attempt.

When a grace is defined, during the grace period, a warning is issued,
and the ACCOUNT_STATUS is set to EXPIRED(GRACE).

Conclusion
~~~~~~~~~~
Password Expiration and Account Locking are two separate features:
an account cannot be locked by exceeding the expire or subsequent grace
time.
An account that is neither expired nor locked appears as OPEN (STATUS# 0),
since account locking (based on failed login attempts) and expiration
(based on not changing password) are basically unrelated.

In addition to the EXPIRED (1,2) and LOCKED (4,8) bits being set, you can
have combinations of both with STATUS# 5,6,9 and 10: internally the
STATUS# are added for the combinations of expired and locked.

For example :

'EXPIRED' + 'LOCKED' = 1 + 8 = 9 = 'EXPIRED & LOCKED'

 

=======




https://anuj-singh.blogspot.com/2016/08/how-to-re-open-expired-or-expiredgrace_17.html


set pagesize 0
col alert1 for a140
SELECT 'ALTER USER '|| name ||' IDENTIFIED BY VALUES '''|| spare4 ||';'|| password ||''';'  alter1 FROM sys.user$ WHERE name='SYS';
set pagesize 80



set long 5000
SELECT DBMS_METADATA.get_ddl ('USER', 'SYS') FROM DUAL;




Sunday 18 December 2011

oracle 10g DBMS_SCHEDULER

 



Oracle 10g DBMS_SCHEDULER


The DBMS_JOB package is replaced by the DBMS_SCHEDULER package in oracle 10g
( oracle job )


login as sys or system

sqlplus / as sysdba

sqlplus>


this job will run daily 4 a.m


begin
dbms_scheduler.create_job
(
job_name => 'RMAN_FULL_F',
job_type => 'EXECUTABLE',
job_action => '/usr/bin/ksh',
start_date =>sysdate+ 1/288 ,
number_of_arguments => 1,
repeat_interval => 'freq=daily; byhour=4; byminute=0; bysecond=0',
enabled => false,
comments => 'oracle backup RMAN '
);
end;
/

PL/SQL procedure successfully completed.

(start_date =>sysdate+ 1/288 this will start job after 5min )

Notice that the JOB_TYPE can be PLSQL_BLOCK, STORED_PROCEDURE, and EXECUTABLE.

REPEAT_INTERVAL: can be HOURLY, DAILY, MINUTELY, YEARLY or BYMONTH, BYWEEKNO, BYYEARDAY, BYMONTHDAY, BYDAY, BYHOUR, BYMINUTE, BYSECOUND.
For example, FREQ=BYWEEKNO=4,7,52 or BYDAY=MON, etc.






exec dbms_scheduler.set_job_argument_value(job_name=>'RMAN_FULL_F',argument_position=>1 ,argument_value=>'/aptus/oracle/admin/aptdb/script/rman_oracle.sh') ;

PL/SQL procedure successfully completed.

(rman_oracle.sh is the novagenesis Rman backup file )

to eable the job

SQL> exec dbms_scheduler.enable(name=>'RMAN_FULL_F');

PL/SQL procedure successfully completed.



to see the detail of job

select status,run_duration,actual_start_date,additional_info from dba_scheduler_job_run_details where job_name='RMAN_FULL_F' ;





To find out the job

COL COMMENTS FORMAT A30
COL REPEAT_INTERVAL FORMAT A40
SET PAGESIZE 100
SET LINESIZE 200
SELECT job_name, repeat_interval,COMMENTS FROM dba_scheduler_jobs where job_name='RMAN_FULL_F';

To show running jobs:

select job_name
, session_id
, running_instance
, elapsed_time
, cpu_used
from dba_scheduler_running_jobs;




to disable job

BEGIN
DBMS_SCHEDULER.disable (NAME => 'RMAN_FULL_F', FORCE=> TRUE);
END;
/



to drop the job

BEGIN
DBMS_SCHEDULER.drop_job (job_name => 'RMAN_FULL_F');
END;



Saturday 17 December 2011

How to delete Oracle

echo $ORACLE_HOME


rm -f /etc/init.d/init.cssd
rm -f /etc/init.d/init.crs
rm -f /etc/init.d/init.crsd
rm -f /etc/init.d/init.evmd
rm -f /etc/rc2.d/K96init.crs
rm /etc/oratab
rm /etc/oraInst.loc
rm -R /etc/oracle
rm /usr/local/bin/oraenv
rm /usr/local/bin/coraenv
rm /usr/local/bin/dbhome
rm -R /opt/oracle/10.1.0/*
rm -R /opt/oracle/oraInventory
rm -R /oracle/tmp/*
rm -R /oracle/oradata/*
rm -f /etc/rc2.d/S96init.crs
rm -f /etc/rc3.d/K96init.crs
rm -f /etc/rc3.d/S96init.crs
rm -f /etc/rc5.d/K96init.crs
rm -f /etc/rc5.d/S96init.crs
rm -Rf /etc/oracle/scls_scr
rm -f /etc/inittab.crs
cp /etc/inittab.orig /etc/inittab



/etc/init.d/init.evmd stop
/etc/init.d/init.evmd disable
/etc/init.d/init.cssd stop
/etc/init.d/init.cssd disable
/etc/init.d/init.crsd stop
/etc/init.d/init.crsd disable
/etc/init.d/init.crs stop
/etc/init.d/init.crs disable
rm -rf /etc/oracle /etc/oraInst.loc /etc/oratab
rm -rf /etc/init.d/init.crsd /etc/init.d/init.crs /etc/init.d/init.cssd /etc/init.d/init.evmd
rm -rf /etc/rc2.d/K96init.crs /etc/rc2.d/S96init.crs etc/rc3.d/K96init.crs
rm -rf /etc/rc3.d/S96init.crs /etc/rc4.d/K96init.crs /etc/rc4.d/S96init.crs
rm -rf /etc/rc5.d/K96init.crs /etc/rc5.d/S96init.crs /etc/rc.d/rc0.d/K96init.crs
rm -rf /etc/rc.d/rc1.d/K96init.crs /etc/rc.d/rc6.d/K96init.crs /etc/rc.d/rc4.d/K96init.crs
cp /etc/inittab.orig /etc/inittab
rm -rf /etc/inittab.crs /etc/inittab.no_crs
rm -rf /tmp/*.sh
rm -rf /tmp/*
rm -rf /tmp/.oracle
rm -rf /usr/local/bin/dbhome /usr/local/bin/oraenv /usr/local/bin/coraenv
rm -rf /var/tmp/.oracle
rm -rf /u01/crs/*
cd /u01/app/oracle
rm -rf oraInventory

Oracle 11g R2 Silent install using only the command line



./runInstaller -silent -ignoreSysPrereqs -ignorePrereq ORACLE_BASE=/aptus/oracle ORACLE_HOME=/aptus/oracle/product/11.2.0/db_1 ORACLE_HOME_NAME=aptdb oracle.install.option=INSTALL_DB_SWONLY oracle.install.db.InstallEdition=EE oracle.install.db.DBA_GROUP=oinstall oracle.install.db.OPER_GROUP=oper DECLINE_SECURITY_UPDATES=true



$ tail -100f /aptus/oracle/oraInventory/logs/installActions2011-12-17_09-05-09AM.log




-bash-4.1$ cat oraInstall2011-12-17_09-05-09AM.out
The installation of Oracle Database 11g was successful.
Please check '/aptus/oracle/oraInventory/logs/silentInstall2011-12-17_09-05-09AM.log' for more details.

As a root user, execute the following script(s):
1. /aptus/oracle/product/11.2.0/db_1/root.sh


Successfully Setup Software.



 

 

 

 


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



SECURITY_UPDATES_VIA_MYORACLESUPPORT=false DECLINE_SECURITY_UPDATES=true oracle.installer.autoupdates.option=SKIP_UPDATES

 




SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
DECLINE_SECURITY_UPDATES=true
oracle.installer.autoupdates.option=SKIP_UPDATES

other exmaple 


[root@localhost ~]$ su - oracle
[oracle@localhost ~]$ cd /software/11gr2/database
[oracle@localhost database]$ ./runInstaller -silent -force \
FROM_LOCATION=/software/11gr2/database/stage/products.xml \
oracle.install.option=INSTALL_DB_SWONLY \
UNIX_GROUP_NAME=oinstall \
INVENTORY_LOCATION=/home/oracle/oraInventory \
ORACLE_HOME=/u01/app/oracle/product/11.2/db_1 \
ORACLE_HOME_NAME="OraDb11g_Home1" \
ORACLE_BASE=/u01/app/oracle \
oracle.install.db.InstallEdition=SE \
oracle.install.db.isCustomInstall=false \
oracle.install.db.DBA_GROUP=dba \
oracle.install.db.OPER_GROUP=dba \
DECLINE_SECURITY_UPDATES=true
[oracle@localhost database]$ exit
# As a root user, execute the following script(s):
[root@localhost ~]$ /home/oracle/oraInventory/orainstRoot.sh
[root@localhost ~]$ /u01/app/oracle/product/11.2/db_1/root.sh

 

Oracle INS-30060 Check for group existence failed





INS-30060
[FATAL] [INS-30060] Check for group existence failed.
[INS-30060] Check for group existence failed
INS-30060 Check for group existence failed
[FATAL] [INS-30060] Check for group existence failed.

 

if you are getting this error during installtion then go to the /tmp dir check the group of

oracle file in tmp dir 

 


-bash-4.1$ ls -ltr /tmp
total 40
drwxr-xr-x. 2 500 svnuser 4096 Dec 1 13:17 logs
drwxr-xr-x. 3 500 svnuser 4096 Dec 2 08:20 CVU_11.2.0.3.0_oracle <<<<<<<<<<<<<<<<<<<<<<<<<<<<----------------
drwxr-xr-x. 2 500 svnuser 4096 Dec 2 12:44 hsperfdata_oracle
drwxr-x---. 8 oracle 1003 4096 Dec 7 15:26 OraInstall2011-12-07_03-26-39PM
drwxr-x---. 10 oracle dba 4096 Dec 7 16:32 OraInstall2011-12-07_04-32-02PM
drwxr-x---. 8 oracle dba 4096 Dec 7 16:49 OraInstall2011-12-07_04-49-15PM
drwxr-x---. 2 oracle dba 4096 Dec 7 16:50 OraInstall2011-12-07_04-50-06PM
drwxr-x---. 2 oracle dba 4096 Dec 7 16:50 OraInstall2011-12-07_04-50-28PM
drwxr-x---. 13 oracle oinstall 4096 Dec 17 08:23 OraInstall2011-12-17_08-19-16AM
drwxr-x---. 13 oracle oinstall 4096 Dec 17 08:33 OraInstall2011-12-17_08-30-52AM



-bash-4.1$ cd /tmp
-bash-4.1$ su
Password:


[root@apt-rdbms-02 tmp]# chown -R oracle:oinstall CVU_11.2.0.3.0_oracle/
[root@apt-rdbms-02 tmp]# chown -R oracle:oinstall OraInstall2011-12-07_03-26-39PM/
[root@apt-rdbms-02 tmp]# chown -R oracle:oinstall OraInstall2011*


Oracle DBA

anuj blog Archive