Search This Blog

Total Pageviews

Wednesday, 17 August 2016

How to re-open expired or EXPIRED(GRACE) Oracle database account without changing the password .

How to re-open expired or EXPIRED(GRACE)  Oracle database account without changing the password 



Oracle open a account without changing password for EXPIRED(GRACE) .
oracle EXPIRED(GRACE)
Oracle password EXPIRED
oracle ACCOUNT_STATUS EXPIRED(GRACE)
oracle ACCOUNT_STATUS EXPIRED




set linesize 200 pagesize 200 
col username for a20
select USERNAME,EXPIRY_DATE,ACCOUNT_STATUS from dba_users 
where 1=1 
and USERNAME like 'ANUJ%';



USERNAME EXPIRY_DATE ACCOUNT_STATUS
-------------------- -------------------- --------------------------------
ANUJ Feb-12-2017 03:06:30 OPEN
ANUJ1 Aug-17-2016 05:23:26 EXPIRED <<<<<----- 



ANUJ1 account is expired .


Run following Sql to create a sql 

set linesize 2000 longchunksize 300 long 5000 pagesize 0
select 'alter user ' || su.name || ' identified by values' || ' ''' || spare4 || ';' || su.password || ''';'
from sys.user$ su , dba_users du 
where su.name = du.username
and username='ANUJ1'
-- and ACCOUNT_STATUS like '%GRACE%' ;


execute this sql ..

alter user ANUJ1 identified by values 'S:B14311128BF87FFD1643BEF65E94695CAE0AF024E2A19A1EDF939E4DB739;H:895AC434525B471C4EAFEDDCE7A92E68;T:83572A338D2763FE2DDBF96C865557E58B916A1CD9EABA882E2FFF48C4CD69DA08B10582D0AD4FE3DC5CAC43322492C786B47C2BD12F3BA7136065D636BA9A8159AD3EB71BEFC2D754E253D09E5E849C;4A4D264BE7A4FEB0';


User altered.



Now user is alterted with old password 



Now Check the status is open ...



set linesize 200 pagesize 200 
col username for a20
select USERNAME,EXPIRY_DATE,ACCOUNT_STATUS from dba_users 
where 1=1 
and USERNAME like 'ANUJ%';


USERNAME EXPIRY_DATE ACCOUNT_STATUS
-------------------- -------------------- --------------------------------
ANUJ Feb-12-2017 03:06:30 OPEN
ANUJ1 Feb-13-2017 05:36:06 OPEN <<<<<----


Thursday, 11 August 2016

How to find out full table scan Sql

Oracle How to find out full table scan Sql 

Full table scan Sql


This SQL script will help to identify sql .


set line 200 pagesize 200 
col SQLTEXT for a70 wrap
SELECT inst_id,sql_id,Disk_Reads DiskReads, Executions,PARSING_SCHEMA_NAME, SQL_Text SQLText
--,SQL_FullText SQLFullText 
FROM
 (SELECT inst_id,Disk_Reads, 
 Executions, 
 SQL_ID, LTRIM(SQL_Text) SQL_Text, 
 SQL_FullText, 
 Operation, 
 Options,
 PARSING_SCHEMA_NAME,
 Row_Number() OVER (Partition By sql_text ORDER BY Disk_Reads * Executions DESC) KeepHighSQL 
 FROM ( SELECT Avg(Disk_Reads) OVER (Partition By sql_text) Disk_Reads, Max(Executions) OVER (Partition By sql_text) Executions,t.inst_id,t.SQL_ID, sql_text, sql_fulltext, p.operation,p.options,t.PARSING_SCHEMA_NAME FROM gv$sql t, gv$sql_plan p
 WHERE t.hash_value=p.hash_value 
 AND p.operation ='TABLE ACCESS' 
 AND p.options ='FULL' 
 -- AND p.object_owner NOT IN ('SYS','SYSTEM')
 and PARSING_SCHEMA_NAME not in ( 'SYS','SYSTEM','DBSNMP' , 'SYSMAN' , 'OUTLN' , 'MDSYS' , 'ORDSYS' , 'EXFSYS' , 'DMSYS' , 'WMSYS' , 'CTXSYS' , 'ANONYMOUS' , 'XDB' , 'ORDPLUGINS' , 'OLAPSYS' , 'PUBLIC','WWV_FLOW_PLATFORM','SYSDG','SYSBACKUP','GSMCATUSER','SYSKM' ,'OJVMSYS','DVSYS') 
 AND t.Executions > 1
 and t.inst_id=p.inst_id
 ) ORDER BY DISK_READS * EXECUTIONS DESC
 ) WHERE KeepHighSQL = 1
AND rownum <=5;




set line 200 pagesize 200 
col SQLTEXT for a70 wrap
SELECT inst_id,sql_id,Disk_Reads DiskReads, Executions,PARSING_SCHEMA_NAME, SQL_Text SQLText
--,SQL_FullText SQLFullText 
FROM
 (SELECT inst_id,Disk_Reads, 
 Executions, 
 SQL_ID, LTRIM(SQL_Text) SQL_Text, 
 SQL_FullText, 
 Operation, 
 Options,
 PARSING_SCHEMA_NAME,
 Row_Number() OVER (Partition By sql_text ORDER BY Disk_Reads * Executions DESC) KeepHighSQL 
 FROM ( SELECT Avg(Disk_Reads) OVER (Partition By sql_text) Disk_Reads, Max(Executions) OVER (Partition By sql_text) Executions,t.inst_id,t.SQL_ID, sql_text, sql_fulltext, p.operation,p.options,t.PARSING_SCHEMA_NAME FROM gv$sql t, gv$sql_plan p
 WHERE t.hash_value=p.hash_value 
 AND p.operation ='INDEX' 
 AND p.options ='FULL SCAN' 
 -- AND p.object_owner NOT IN ('SYS','SYSTEM')
 and PARSING_SCHEMA_NAME not in ( 'SYS','SYSTEM','DBSNMP' , 'SYSMAN' , 'OUTLN' , 'MDSYS' , 'ORDSYS' , 'EXFSYS' , 'DMSYS' , 'WMSYS' , 'CTXSYS' , 'ANONYMOUS' , 'XDB' , 'ORDPLUGINS' , 'OLAPSYS' , 'PUBLIC','WWV_FLOW_PLATFORM','SYSDG','SYSBACKUP','GSMCATUSER','SYSKM' ,'OJVMSYS','DVSYS') 
 AND t.Executions > 1
 and t.inst_id=p.inst_id
 ) ORDER BY DISK_READS * EXECUTIONS DESC
 ) WHERE KeepHighSQL = 1
AND rownum <=5;
==

--CARTESIAN

set linesize 200
col sql_text format a100
col parsing_schema_name for a20
select con_id,LAST_ACTIVE_TIME,parsing_schema_name,sql_id,substr(sql_text,1,100) sql_text from gv$sql where hash_value in (select hash_value from gv$sql_plan
where options = 'CARTESIAN'
AND operation LIKE '%JOIN%'
-- and TIMESTAMP > sysdate -interval '10' minute 
)
and PARSING_SCHEMA_NAME not in
('ORACLE_OCM',
'SYSMAN',
'WMSYS',
'XDB',
'ANONYMOUS',
'CTXSYS',
'MGMT_VIEW',
'OPS$ROOT',
'OPS$ORACLE',
'DBSNMP',
'OPS$DMADMIN',
'SYS',
'SYSTEM',
'JUDEK',
'MDDATA',
'TSMSYS',
'DIP',
'ORDSYS',
'SI_INFORMTN_SCHEMA',
'ORDPLUGINS',
'OUTLN',
'MDSYS'
)
and con_id=3
and  LAST_ACTIVE_TIME > sysdate -interval '10' minute 
order by hash_value

=====


SET PAGES 300 LINES 300 TRIMS ON
COL OPERATION FORMAT A15
COL OBJECT_NAME FORMAT A32
COL OBJECT_OWNER FORMAT A25
COL OPTIONS FORMAT A20
COL EXECUTIONS FORMAT 999,999,999


SELECT A.OBJECT_OWNER,
        b.sql_id,
         A.OBJECT_NAME,
         RTRIM (A.OPERATION)     OPERATION,
         A.OPTIONS,
         B.EXECUTIONS
    FROM gV$SQL_PLAN A, gV$SQLAREA B
   WHERE     A.SQL_ID = B.SQL_ID
     and A.inst_id = B.inst_id
         AND A.OPERATION IN ('TABLE ACCESS', 'INDEX')
         AND A.OPTIONS IN ('FULL',
                           'FULL SCAN',
                           'FAST FULL SCAN',
                           'SKIP SCAN',
                           'SAMPLE FAST FULL SCAN')
         AND A.OBJECT_OWNER NOT IN ('SYS', 'SYSTEM')
GROUP BY OBJECT_OWNER,b.sql_id,  OBJECT_NAME,  OPERATION, OPTIONS,   B.EXECUTIONS
ORDER BY OBJECT_OWNER,  OPERATION,  OPTIONS,  OBJECT_NAME;
		




--with row_num and sql_id 

COL OPERATION FORMAT A15
COL OBJECT_NAME FORMAT A32
COL OBJECT_OWNER FORMAT A15
COL OPTIONS FORMAT A20
COL EXECUTIONS FORMAT 999,999,999
SET PAGES 55 LINES 132 TRIMS ON

SELECT A.OBJECT_OWNER,
       b.sql_id,
         A.OBJECT_NAME,
         RTRIM (A.OPERATION)     OPERATION,
         A.OPTIONS,
         B.EXECUTIONS,
		 NUM_ROWS
    FROM gV$SQL_PLAN A, gV$SQLAREA B,dba_tables d
   WHERE     A.SQL_ID = B.SQL_ID
        and a.inst_id=b.inst_id 
         AND A.OPERATION IN ('TABLE ACCESS', 'INDEX')
         AND A.OPTIONS IN ('FULL',
                           'FULL SCAN',
                           'FAST FULL SCAN',
                           'SKIP SCAN',
                           'SAMPLE FAST FULL SCAN')
         AND A.OBJECT_OWNER NOT IN ('SYS', 'SYSTEM', 'PERFSTAT','SYSMAN')
		 and A.OBJECT_NAME=d.table_name
		 and NUM_ROWS> 1000
GROUP BY OBJECT_OWNER,
         b.sql_id,
         OBJECT_NAME,
         OPERATION,
         OPTIONS,
         B.EXECUTIONS,
		 NUM_ROWS
ORDER BY OBJECT_OWNER,
         OPERATION,
         OPTIONS,
         OBJECT_NAME;
============



set echo off
set feedback on
 
set pages 999
column nbr_FTS  format 99,999
column num_rows format 999,999
column blocks   format 9,999
column owner    format a20
column name     format a30
column ch       format a1
column time     heading "Snapshot Time"        format a15
 
column object_owner heading "Owner"            format a12
column ct           heading "# of SQL selects" format 999,999
 
break on time
 
select
   object_owner,
   count(*)   ct
from   dba_hist_sql_plan
where   object_owner is not null
group by   object_owner
order by   ct desc
;




set pages 999
column nbr_FTS  format 99,999
column num_rows format 999,999
column blocks   format 9,999
column owner    format a20
column name     format a30
column ch       format a1
column time     heading "Snapshot Time"        format a15
 
column object_owner heading "Owner"            format a12
column ct           heading "#SQL " format 999,999
 
break on time
 
select
   con_id,
   object_owner,
   sql_id,
   count(*)   ct
from   dba_hist_sql_plan
where   object_owner is not null
group by   con_id,sql_id,object_owner
order by   ct desc
;



             CON_ID Owner        SQL_ID           #SQL
------------------- ------------ ------------- --------
                  0 SYS          6h1ysp5jm8h8m      762
                  0 SYS          7r3793f1a0x0m      749
                  0 SYS          34cd4y8mbqvsk      710
                 

 
 
set heading on feedback on
 


column owner    format a20

select
   to_char(sn.end_interval_time,'dd-mm-yy hh24') time,
   a.sql_id,
   p.owner,
   p.name,
   t.num_rows,
--   ltrim(t.cache) ch,
   decode(t.buffer_pool,'KEEP','Y','DEFAULT','N') K,
   s.blocks blocks,
   sum(a.executions_delta) nbr_FTS
from
   dba_tables  t,
   dba_segments s,
   dba_hist_sqlstat a,
   dba_hist_snapshot sn,
   (select distinct
     pl.sql_id,
     object_owner owner,
     object_name name
   from      dba_hist_sql_plan pl
   where   operation = 'TABLE ACCESS'
      and  options = 'FULL') p
where
   a.snap_id = sn.snap_id
   and   a.sql_id = p.sql_id
   and   t.owner = s.owner
   and   t.table_name = s.segment_name
   and   t.table_name = p.name
   and   t.owner = p.owner
   and   t.owner not in ('SYS','SYSTEM')
   and sn.snap_id between :BEGIN_SNAP_ID and :END_SNAP_ID
having   sum(a.executions_delta) > 1
group by   to_char(sn.end_interval_time,'dd-mm-yy hh24'),a.sql_id,p.owner, p.name, t.num_rows, t.cache, t.buffer_pool, s.blocks
order by   1 asc;
 
 
 
 
 
column nbr_RID  format 999,999,999
column num_rows format 999,999,999
column owner    format a15
column name     format a25
 
ttitle 'Table access by ROWID and counts'
select
   to_char(sn.end_interval_time,'dd-mm-yy hh24') time,
   s.sql_id,
   p.owner,
   p.name,
   t.num_rows,
   sum(a.executions_delta) nbr_RID
from
   dba_tables t,
   dba_hist_sqlstat  a,
   dba_hist_snapshot sn,
  (select distinct
     pl.sql_id,
     object_owner owner,
     object_name name
   from    dba_hist_sql_plan pl
   where
      operation = 'TABLE ACCESS'
      and  options = 'BY USER ROWID') p
where
   a.snap_id = sn.snap_id
   and   a.sql_id = p.sql_id
   and   t.table_name = p.name
   and   t.owner = p.owner
   and sn.snap_id between :BEGIN_SNAP_ID and :END_SNAP_ID
having   sum(a.executions_delta) > 9
group by   to_char(sn.end_interval_time,'dd-mm-yy hh24'),s.sql_id,p.owner, p.name, t.num_rows
order by   1 asc;




 
--*************************************************
--  Index Report Section
--*************************************************
 
column nbr_scans  format 999,999,999
column num_rows   format 999,999,999
column tbl_blocks format 999,999,999
column owner      format a20
column table_name format a27
column index_name format a20
 
--ttitle 'Index full scans and counts'
select
   to_char(sn.end_interval_time,'dd-mm-yy hh24') time,
   s.sql_id,
   p.owner,
   d.table_name,
   p.name index_name,
   seg.blocks tbl_blocks,
   sum(s.executions_delta) nbr_scans
from
   dba_segments seg,
   dba_indexes d,
   dba_hist_sqlstat   s,
   dba_hist_snapshot sn,
  (select distinct
     pl.sql_id,
     object_owner owner,
     object_name name
   from      dba_hist_sql_plan pl
   where      operation = 'INDEX'
      and      options = 'FULL SCAN') p
where
   d.index_name = p.name
   and   s.snap_id = sn.snap_id
   and   s.sql_id = p.sql_id
   and   d.table_name = seg.segment_name
   and   seg.owner = p.owner
    and sn.snap_id between :BEGIN_SNAP_ID and :END_SNAP_ID
having   sum(s.executions_delta) > 9
group by   to_char(sn.end_interval_time,'dd-mm-yy hh24'),s.sql_id,p.owner, d.table_name, p.name, seg.blocks
order by   1 asc;
 
 
-- ttitle 'Index range scans and counts'
select
   to_char(sn.end_interval_time,'dd-mm-yy hh24') time,
   s.sql_id,
   p.owner,
   d.table_name,
   p.name index_name,
   seg.blocks tbl_blocks,
   sum(s.executions_delta) nbr_scans
from
   dba_segments seg,   dba_hist_sqlstat s,   dba_hist_snapshot sn,   dba_indexes d,
  (select distinct
     pl.sql_id,
     object_owner owner,
     object_name name
   from
      dba_hist_sql_plan pl
   where
      operation = 'INDEX'
      and      options = 'RANGE SCAN') p
where
   d.index_name = p.name
   and   s.snap_id = sn.snap_id
   and   s.sql_id = p.sql_id
   and   d.table_name = seg.segment_name
   and   seg.owner = p.owner
    and sn.snap_id between :BEGIN_SNAP_ID and :END_SNAP_ID
having   sum(s.executions_delta) > 9
group by   to_char(sn.end_interval_time,'dd-mm-yy hh24'),s.sql_id,p.owner, d.table_name, p.name, seg.blocks
order by   1 asc;
 
 
 
ttitle 'Index unique scans and counts'
select
   to_char(sn.end_interval_time,'dd-mm-yy hh24') time,
   p.owner,
   d.table_name,
   p.name index_name,
   sum(s.executions_delta) nbr_scans
from
   dba_hist_sqlstat s,   dba_hist_snapshot sn,   dba_indexes d,
  (select distinct
     pl.sql_id,
     object_owner owner,
     object_name name
   from      dba_hist_sql_plan pl
   where      operation = 'INDEX'
      and      options = 'UNIQUE SCAN') p
where
   d.index_name = p.name
   and   s.snap_id = sn.snap_id
   and   s.sql_id = p.sql_id
   and sn.snap_id between :BEGIN_SNAP_ID and :END_SNAP_ID
having
   sum(s.executions_delta) > 9
group by   to_char(sn.end_interval_time,'dd-mm-yy hh24'),p.owner, d.table_name, p.name
order by   1 asc;



Sunday, 7 August 2016

Oracle 11g and 12c archivelog mode on RAC

Oracle database 11g Or 12c on archivelog mode in RAC 



[oracle@mrac8 bin]$srvctl status database -d pratik
Instance pratik1 is running on node mrac3
Instance pratik2 is running on node mrac4
Instance pratik3 is running on node mrac8



[oracle@mrac8 bin]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Fri Aug 5 09:26:55 2016

Copyright (c) 1982, 2013, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 1
Current log sequence 2



Create this dir on asm via asmcmd !!!!

+RECOVERY/pratik/archive



set parameter for Archive log

%s log sequence number
%t thread number
%r resetlogs ID that ensures unique names are constructed for the archived log files across multiple incarnations of the database


SQL> alter system set LOG_ARCHIVE_FORMAT ='Log%s_%t_%r.Arc' scope=spfile;

System altered.

SQL> alter system set log_archive_dest_1='location=+RECOVERY/pratik/archive' SCOPE=SPFILE;

System altered.

==
to change archive log dest only 


 archive log list


set linesize 300 pagesize 300
col destination for a70
select destination,STATUS from v$archive_dest where statuS='VALID';

 alter system set log_archive_dest_1='LOCATION=+DATA' scope=both;

======


[oracle@mrac8 bin]$ srvctl status database -d pratik
Instance pratik1 is running on node mrac3
Instance pratik2 is running on node mrac4
Instance pratik3 is running on node mrac8


shutdown the database

[oracle@mrac8 bin]$ srvctl stop database -d pratik -o immediate


start the database on one node on mount !!!!!!



[oracle@mrac8 bin]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Fri Aug 5 09:36:57 2016

Copyright (c) 1982, 2013, Oracle. All rights reserved.

Connected to an idle instance.


SQL> startup mount
ORACLE instance started.

Total System Global Area 1043886080 bytes
Fixed Size 2259840 bytes
Variable Size 717227136 bytes
Database Buffers 318767104 bytes
Redo Buffers 5632000 bytes
Database mounted.


SQL> alter database archivelog;

Database altered.



shutdown the database now !!!!

SQL> shutdown immediate
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.


Now start the database on all node

[oracle@mrac8 bin]$ srvctl start database -d pratik



[oracle@mrac8 bin]$ srvctl status database -d pratik
Instance pratik1 is running on node mrac3
Instance pratik2 is running on node mrac4
Instance pratik3 is running on node mrac8




[oracle@mrac8 bin]$ !sqlplus
sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Fri Aug 5 09:40:46 2016

Copyright (c) 1982, 2013, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination +RECOVERY/pratik/archive
Oldest online log sequence 1
Next log sequence to archive 2
Current log sequence 2


SQL> ALTER SYSTEM ARCHIVE LOG CURRENT;

System altered.


SQL> ALTER SYSTEM ARCHIVE LOG CURRENT;

System altered.

SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination +RECOVERY/pratik/archive
Oldest online log sequence 4
Next log sequence to archive 5
Current log sequence 5


SQL>

**********************************************************************************
Check archive file !!!!

ASMCMD [+RECOVERY/pratik/archive] > pwd
+RECOVERY/pratik/archive

ASMCMD [+RECOVERY/pratik/archive] > ls -lt

Type Redund Striped Time Sys Name
N log2_3_917396374.arc => +RECOVERY/pratik/ARCHIVELOG/2016_08_05/thread_3_seq_2.256.919071665
N log3_3_917396374.arc => +RECOVERY/pratik/ARCHIVELOG/2016_08_05/thread_3_seq_3.257.919071671
N log4_3_917396374.arc => +RECOVERY/pratik/ARCHIVELOG/2016_08_05/thread_3_seq_4.258.919071751
N log19_1_917396374.arc => +RECOVERY/pratik/ARCHIVELOG/2016_08_06/thread_1_seq_19.259.919164185
ASMCMD [+RECOVERY/pratik/archive] >




===

we can use below 

 alter system set log_archive_dest_1='location=USE_DB_RECOVERY_FILE_DEST' scope=both;

System altered.

SQL> show parameter log_archive_dest_1

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_1                   string      location=USE_DB_RECOVERY_FILE_
                                                 DEST



https://anuj-singh.blogspot.com/2012_06_03_archive.html Oracle Flashback info 

https://anuj-singh.blogspot.com/2011/08/oracle-flashback-info.html

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


ALTERNATE Attribute of LOG_ARCHIVE_DEST




 def
DEFINE _DATE           = "08-06-24 08:31" (CHAR)
DEFINE _CONNECT_IDENTIFIER = "vihcdbd8" (CHAR)
DEFINE _USER           = "SYS" (CHAR)
DEFINE _PRIVILEGE      = "AS SYSDBA" (CHAR)
DEFINE _SQLPLUS_RELEASE = "1202000100" (CHAR)
DEFINE _EDITOR         = "vi" (CHAR)
DEFINE _O_VERSION      = "Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production" (CHAR)
DEFINE _O_RELEASE      = "1202000100" (CHAR)
DEFINE GNAME           = "primary:sys@vihcdbd8-vihcdbd8" (CHAR)




cdbd8-vihcdbd8 sqlplus> alter system set log_archive_dest_2 = 'LOCATION=+LOGS noreopen' scope=both;
alter system set log_archive_dest_state_2=ALTERNATE scope=both;
System altered.

primary:sys@vihcdbd8-vihcdbd8 sqlplus>

System altered.


 add NOREOPEN. Otherwise it will not spill over to ALTERNATE location. ALTERNATE Attribute of LOG_ARCHIVE_DEST_n Does Not Appear to Work (Doc ID 369120.1)

primary:sys@vihcdbd8-vihcdbd8 sqlplus> alter system set log_archive_dest_1 = 'LOCATION=+DATA NOREOPEN ALTERNATE=LOG_ARCHIVE_DEST_2' scope=both;

System altered.
or 
alter system set log_archive_dest_1='location=use_db_recovery_file_dest noreopen alternate=log_archive_dest_2' scope=both;




set linesize 300
col DEST_NAME for a35
col DESTINATION for a20
col ALTERNATE  for a20
select DEST_NAME,TARGET,DESTINATION,VALID_ROLE,STATUS,ALTERNATE from v$archive_dest where status!='INACTIVE';


 select DEST_NAME,TARGET,DESTINATION,VALID_ROLE,STATUS,ALTERNATE from v$archive_dest where status!='INACTIVE';

DEST_NAME                           TARGET           DESTINATION          VALID_ROLE   STATUS    ALTERNATE
----------------------------------- ---------------- -------------------- ------------ --------- --------------------
LOG_ARCHIVE_DEST_1                  PRIMARY          +DATA                ALL_ROLES    VALID     LOG_ARCHIVE_DEST_2
LOG_ARCHIVE_DEST_2                  PRIMARY          +LOGS                ALL_ROLES    ALTERNATE NONE




alter system set db_recovery_file_dest='+DATA' scope=both sid='*';
alter system set db_recovery_file_dest_size=20G scope=both sid='*';
alter system set log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST  NOREOPEN ALTERNATE=LOG_ARCHIVE_DEST_2' scope=both;
alter system set log_archive_dest_2='LOCATION=+LOGS NOREOPEN ALTERNATE=LOG_ARCHIVE_DEST_1' scope=both;
alter system set log_archive_dest_state_2=ALTERNATE scope=both;



set linesize 300
col DEST_NAME for a35
col DESTINATION for a30
col ALTERNATE  for a20
select DEST_NAME,TARGET,DESTINATION,VALID_ROLE,STATUS,ALTERNATE from v$archive_dest where status!='INACTIVE';


 select DEST_NAME,TARGET,DESTINATION,VALID_ROLE,STATUS,ALTERNATE from v$archive_dest where status!='INACTIVE';




 srvctl start database -d ORCLX -startoption restrict
 srvctl status database -d ORCLX -v
Instance ORCLX1 is running on node ora2 Instance status: Restricted Access.
Instance ORCLX2 is running on node ora3 Instance status: Restricted Access.



====
alter system set log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST' scope=both;

select * from v$flash_recovery_area_usage

SQL> alter system set db_recovery_file_dest_size=100G scope=both sid='*';
 
 
SQL> alter system set db_recovery_file_dest='+REDO' scope=both sid='*';

Oracle DBA

anuj blog Archive