Thursday, 24 May 2018

Error: Some required configuration is missing, corrupt, inaccessible, or insecure (access permissions are too liberal)

You will get this error while running emcli. 

Follow the below steps to fix.

create a directory

D:\EMCLI


Set environment
set JAVA_HOME=D:\app\product\Mware12104\jdk16\jdk
set PATH=%JAVA_HOME%\bin;%PATH%

java -jar emcliadvancedkit.jar client -install_dir=D:\EMCLI

cd D:\EMCLI

set EMCLI_STATE_DIR=D:\EMCLI

from existing middleware_home/bin run below

emcli setup -url=https://localhost.com:7800/em -username=sysman -trustall -autologin -dir=D:\EMCLI

emcli sync

Monday, 30 April 2018

Kill Windows Processes

Kill Windows Processes



C:\Users\>tasklist /m ora*

Image Name                     PID Modules
========================= ======== =================================
nmesrvc.exe                   1256 orauts.dll




C:\Users\>tasklist /m ora*

Image Name                     PID Modules
========================= ======== ============================================
oravssw.exe                   2600 OraClient11.Dll, oracore11.dll,
                                   oranls11.dll, oraunls11.dll, oraplp11.dll,
                                   orahasgen11.dll, oraocr11.dll,
                                   oraocrb11.dll, oraasmclnt11.dll,
                                   oracell11.dll, oraocrutl11.dll,
                                   orasql11.dll, OraPlc11.Dll, oranbeq11.dll
WmiPrvSE.exe                  3176 OraPerf11.Dll, oraclient11.dll,
                                   oracore11.dll, oranls11.dll, 
                                   orasql11.dll, oraperf.dll
sqlplus.exe                  11276 OraClient11.Dll, oracore11.dll,
                                   oranls11.dll, oraunls11.dll, 



###
C:\Users\>Taskkill /PID 11276 /F
SUCCESS: The process with PID 11276 has been terminated.

C:\Users\>Taskkill /PID 3176 /F
SUCCESS: The process with PID 3176 has been terminated.

C:\Users\>Taskkill /PID 2600 /F
SUCCESS: The process with PID 2600 has been terminated.


Sunday, 4 March 2018

Kill active sessions on windows OS

Patches will be rolled back in the following order:
   23530410
Prerequisite check "CheckActiveFilesAndExecutables" failed.
The details are:

Following files are active :
d:\eidologic\oracle\product\db\bin\oracell12.dll
d:\eidologic\oracle\product\db\bin\orageneric12.dll
d:\eidologic\oracle\product\db\bin\oracommon12.dll
d:\eidologic\oracle\product\db\bin\oraclient12.dll
d:\eidologic\oracle\product\db\bin\orapls12.dll
d:\eidologic\oracle\product\db\bin\oraplp12.dll
d:\eidologic\oracle\product\db\bin\orazt12.dll
d:\eidologic\oracle\product\db\bin\oraldapclnt12.dll
d:\eidologic\oracle\product\db\bin\oraztkg12.dll
d:\eidologic\oracle\product\db\bin\orannzsbb12.dll
d:\eidologic\oracle\product\db\bin\oran12.dll
d:\eidologic\oracle\product\db\bin\orantcp12.dll
d:\eidologic\oracle\product\db\bin\oranl12.dll
d:\eidologic\oracle\product\db\bin\oraxml12.dll
d:\eidologic\oracle\product\db\bin\orawsec12.dll
d:\eidologic\oracle\product\db\bin\orawsec12.dll
d:\eidologic\oracle\product\db\bin\orasql12.dll
d:\eidologic\oracle\product\db\bin\oraclsce12.dll
d:\eidologic\oracle\product\db\bin\oraocr12.dll
d:\eidologic\oracle\product\db\bin\oraocrb12.dll
d:\eidologic\oracle\product\db\bin\oraocrutl12.dll
d:\eidologic\oracle\product\db\bin\orahasgen12.dll
d:\eidologic\oracle\product\db\bin\orahasgen12.dll
d:\eidologic\oracle\product\db\bin\oraocr12.dll
d:\eidologic\oracle\product\db\bin\oraocrb12.dll
d:\eidologic\oracle\product\db\bin\oraocrutl12.dll
UtilSession failed: Prerequisite check "CheckActiveFilesAndExecutables" failed.
Log file location: d:\eidologic\oracle\product\db\cfgtoollogs\opatch\opatch2018-02-24_19-51-45PM_1.log

OPatch failed with error code = 73

D:\Soft\Patch\p23530410_121010_MSWIN-x86-64\23530410>tasklist /m ora*

Image Name                     PID Modules
========================= ======== ============================================
nmesrvc.exe                   6752 orauts.dll
Tomcat8.exe                  15012 OraClient12.Dll, oracore12.dll,
                                   oranls12.dll, oraunls12.dll,
                                   oracommon12.dll, orageneric12.dll,
                                   oraons.dll, oraxml12.dll, oran12.dll,
                                   oraldapclnt12.dll, orannzsbb12.dll,
                                   oranl12.dll, oranro12.dll, orapls12.dll,
                                   orasql12.dll, orauts.dll, orasnls12.dll,
                                   oraasmclnt12.dll, orawsec12.dll,
                                   orahasgen12.dll, oraocr12.dll, orazt12.dll,
                                   orancrypt12.dll, oranldap12.dll,
                                   oranhost12.dll, orancds12.dll,
                                   orantns12.dll, oraztkg12.dll,
                                   orantcp12.dll, oraslax12.dll, oravsn12.dll,
                                   oraplp12.dll, oracell12.dll,
                                   oraocrutl12.dll, oraclsce12.dll,
                                   oraocrb12.dll, OraPlc12.Dll

D:\Soft\Patch\p23530410_121010_MSWIN-x86-64\23530410>






Taskkill /PID 6752 /F


Taskkill /PID 15012 /F


D:\Soft\Patch\p23530410_121010_MSWIN-x86-64\23530410>Taskkill /PID 6752 /F
SUCCESS: The process with PID 6752 has been terminated.

D:\Soft\Patch\p23530410_121010_MSWIN-x86-64\23530410>Taskkill /PID 6752 /F
ERROR: The process "6752" not found.

D:\Soft\Patch\p23530410_121010_MSWIN-x86-64\23530410>tasklist /m ora*

Image Name                     PID Modules
========================= ======== ============================================
Tomcat8.exe                  15012 OraClient12.Dll, oracore12.dll,
                                   oranls12.dll, oraunls12.dll,
                                   oracommon12.dll, orageneric12.dll,
                                   oraons.dll, oraxml12.dll, oran12.dll,
                                   oraldapclnt12.dll, orannzsbb12.dll,
                                   oranl12.dll, oranro12.dll, orapls12.dll,
                                   orasql12.dll, orauts.dll, orasnls12.dll,
                                   oraasmclnt12.dll, orawsec12.dll,
                                   orahasgen12.dll, oraocr12.dll, orazt12.dll,
                                   orancrypt12.dll, oranldap12.dll,
                                   oranhost12.dll, orancds12.dll,
                                   orantns12.dll, oraztkg12.dll,
                                   orantcp12.dll, oraslax12.dll, oravsn12.dll,
                                   oraplp12.dll, oracell12.dll,
                                   oraocrutl12.dll, oraclsce12.dll,
                                   oraocrb12.dll, OraPlc12.Dll

D:\Soft\Patch\p23530410_121010_MSWIN-x86-64\23530410>Taskkill /PID 15012 /F
SUCCESS: The process with PID 15012 has been terminated.

Wednesday, 27 December 2017

Unlock Table statistics


########THEN####
SQL> col stattype_locked for a30
SQL> select owner, table_name, stattype_locked from dba_tab_statistics where stattype_locked is not null and owner not in ('SYS','SYSTEM');

OWNER TABLE_NAME STATTYPE_LOCKED
------------------------------ ------------------------------ ------------------------------
SCOTT TIGER ALL


1 rows selected.


SQL> exec dbms_stats.unlock_table_stats('SCOTT', 'TIGER');

PL/SQL procedure successfully completed.



####NOW#####

SQL> select owner, table_name, stattype_locked from dba_tab_statistics where stattype_locked is not null and owner not in ('SYS','SYSTEM');

no rows selected

SQL> 

Friday, 15 September 2017

Get the SQL_ID of the statement

1. Run the sql statement.

SQL> select name,open_mode from v$database;

NAME      OPEN_MODE
--------- --------------------
PRDWCS7   READ WRITE


2. Run below 
select * from table(dbms_xplan.display_cursor(null));


SQL> select * from table(dbms_xplan.display_cursor(null));

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID  9czut73sxc2y4, child number 0
-------------------------------------
select name,open_mode from v$database

Plan hash value: 3039639316

----------------------------------------------------------------------
| Id  | Operation            | Name     | Rows  | Bytes | Cost (%CPU)|
----------------------------------------------------------------------
|   0 | SELECT STATEMENT     |          |       |       |     1 (100)|
|   1 |  MERGE JOIN CARTESIAN|          |     1 |    14 |     0   (0)|

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------------------------------------------------------------------------
|*  2 |   FIXED TABLE FULL   | X$KCCDI  |     1 |    14 |     0   (0)|
|   3 |   BUFFER SORT        |          |     1 |       |     0   (0)|
|   4 |    FIXED TABLE FULL  | X$KCCDI2 |     1 |       |     0   (0)|
----------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   2 - filter("DI"."INST_ID"=USERENV('INSTANCE'))


21 rows selected.


3. you will get the output.

SQL_ID  9czut73sxc2y4


Sunday, 3 September 2017

Script to Delete Applied Archivelog from Standby ( RAC )

#!/bin/ksh
export ORACLE_SID=ORCL
export ORACLE_HOME=/app/oracle/product/12102/db
export NLS_DATE_FORMAT="DD-MON-RRRR HH24:MI:SS"
export TODAY=`date '+%Y%m%d'`
export TIME=`date '+%H%M%S'`
rm /app/oracle/dba/script/notearc.txt
sqlplus -s "/ as sysdba" << EOF
set pagesize 0
set pages 0 echo off feedback off
spool /app/oracle/dba/script/notearc.txt
select thread#,max(sequence#)-10 from gv\$archived_log where applied ='YES' and REGISTRAR='RFS' group by thread#;
spool off;
exit;
EOF

seq1=`cat /app/oracle/dba/script/notearc.txt | awk 'NR==1{print $2}'`
seq2=`cat /app/oracle/dba/script/notearc.txt | awk 'NR==2{print $2}'`
seq3=`cat /app/oracle/dba/script/notearc.txt | awk 'NR==3{print $2}'`
echo $seq1 $seq2 $seq3
$ORACLE_HOME/bin/rman msglog /app/oracle/dba/logs/STANDBYDBY_ARC_DEL.${TODAY}_${TIME}.log << EOF
connect target /
run{
delete noprompt archivelog until sequence $seq1 thread 1;
delete noprompt archivelog until sequence $seq2 thread 2;
delete noprompt archivelog until sequence $seq3 thread 3;
}
EOF


-------------------------------------crontab------------------------------

05 02 * * * /u01/app/oracle/cleanarc.ksh > /u01/app/oracle/clean_arc.log 2>&1

12c Create Dataguard Broker Configuration - DGMGRL for RAC

==> Pre-Check

Make sure below is set to false on primary and Standby.

#primary
SQL> sho parameter dg_broker_start

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
dg_broker_start                      boolean     FALSE

#standby
SQL> sho parameter dg_broker_start

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
dg_broker_start                      boolean     FALSE


1. Create config files on ASM DiskGroup.

==>On primary
alter system set dg_broker_config_file1 = '+RTLDATA01/ORCL/DATAFILE/dr1ORCL.dat' scope=both sid='*';
alter system set dg_broker_config_file2 = '+RTLDATA01/ORCL/DATAFILE/dr2ORCL.dat' scope=both sid='*';


P.S. Config file name has to be DB_UNIQUE_NAME

SQL> alter system set dg_broker_config_file1 = '+RTLDATA01/ORCL/DATAFILE/dr1ORCL.dat' scope=both sid='*';

System altered.

SQL> alter system set dg_broker_config_file2 = '+RTLDATA01/ORCL/DATAFILE/dr2ORCL.dat' scope=both sid='*';

System altered.

SQL> sho parameter config

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
dg_broker_config_file1               string      +RTLDATA01/ORCL/DATAFILE/dr1
                                                 ORCL.dat
dg_broker_config_file2               string      +RTLDATA01/ORCL/DATAFILE/dr2
                                                 ORCL.dat

==>On Standby

alter system set dg_broker_config_file1 = '+MDRDATA01/DRORCL/DATAFILE/dr1DRORCL.dat' scope=both sid='*';
alter system set dg_broker_config_file2 = '+MDRDATA01/DRORCL/DATAFILE/dr2DRORCL.dat' scope=both sid='*';


P.S. Config file name has to be DB_UNIQUE_NAME
SQL> alter system set dg_broker_config_file1 = '+MDRDATA01/DRORCL/DATAFILE/dr1DRORCL.dat' scope=both sid='*';

System altered.

SQL> alter system set dg_broker_config_file2 = '+MDRDATA01/DRORCL/DATAFILE/dr2DRORCL.dat' scope=both sid='*';

System altered.

SQL> sho parameter config

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
dg_broker_config_file1               string      +MDRDATA01/DRORCL/DATAFILE/d
                                                 r1DRORCL.dat
dg_broker_config_file2               string      +MDRDATA01/DRORCL/DATAFILE/d
                                                 r2DRORCL.dat


2. Start the Dataguard broker DMON process.

On Primary and Standby,

alter system set dg_broker_start=true sid='*'; 

##primary
SQL> alter system set dg_broker_start=true sid='*';

System altered.


#standby##
SQL> alter system set dg_broker_start=true sid='*';

System altered.


3.Take backup of log_archive_dest_2 and run below on primary and standby


Show parameter log_archive_dest_2


##primary
SQL> alter system set log_archive_dest_2='' scope=both sid='*';

System altered.


#standby##
SQL> alter system set log_archive_dest_2='' scope=both sid='*';

System altered.


4. Connect to DGMGRL

On Primary,

node1:/app/oracle/product/12.1.0.2/db/dbs>dgmgrl
DGMGRL for Solaris: Version 12.1.0.2.0 - 64bit Production

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

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect /
Connected as SYSDG.
DGMGRL>


5. Create configuration,


DGMGRL> CREATE CONFIGURATION '<configuration name>' AS PRIMARY DATABASE IS '<primary db_unique_name>' CONNECT IDENTIFIER IS <primary connect string>;


CREATE CONFIGURATION ORCL_DG_CONFIG AS PRIMARY DATABASE IS ORCL CONNECT IDENTIFIER IS ORCL;


DGMGRL> CREATE CONFIGURATION ORCL_DG_CONFIG AS PRIMARY DATABASE IS ORCL CONNECT IDENTIFIER IS ORCL;
Configuration "ORCL_dg_config" created with primary database "ORCL"
DGMGRL>


Verify configuration,

DGMGRL> show configuration;

Configuration - ORCL_dg_config

  Protection Mode: MaxPerformance
  Members:
  ORCL - Primary database

Fast-Start Failover: DISABLED

Configuration Status:
DISABLED


6. Add Standby,

DGMGRL>  add database <standby db_unique_name> as connect identifier is <standby connect string>;

ADD DATABASE DRORCL AS CONNECT IDENTIFIER IS DRORCL;




DGMGRL> ADD DATABASE DRORCL AS CONNECT IDENTIFIER IS DRORCL;
Database "drORCL" added
DGMGRL>


DGMGRL> show configuration;

Configuration - ORCL_dg_config

  Protection Mode: MaxPerformance
  Members:
  ORCL   - Primary database
    drORCL - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
DISABLED

DGMGRL>


7. Enable Configuration,

DGMGRL> enable configuration;
Enabled.
DGMGRL>


6. Verify configuration,

DGMGRL>


DGMGRL> show configuration;

Configuration - ORCL_dg_config

  Protection Mode: MaxPerformance
  Members:
  ORCL   - Primary database
    drORCL - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS   (status updated 10 seconds ago)

DGMGRL>



DGMGRL> show database ORCL;

Database - ORCL

  Role:               PRIMARY
  Intended State:     TRANSPORT-ON
  Instance(s):
    ORCL1
    ORCL2
    ORCL3

Database Status:
SUCCESS

DGMGRL> show database drORCL;

Database - drORCL

  Role:               PHYSICAL STANDBY
  Intended State:     APPLY-ON
  Transport Lag:      0 seconds (computed 1 second ago)
  Apply Lag:          0 seconds (computed 1 second ago)
  Average Apply Rate: 7.00 KByte/s
  Real Time Query:    OFF
  Instance(s):
    ORCL1 (apply instance)
    ORCL2
    ORCL3

Database Status:
SUCCESS


#Reference Doc
12c Create Dataguard Broker Configuration - DGMGRL (Doc ID 1583588.1)
Data Guard Broker Return ORA-16664 Unable To Receive The Result From A Database (Doc ID 2138555.1)