Thursday, 28 December 2017

Blocking query sessions
how to get PID from SID
sqlId from sid.
sql text from sqlid
how to kill session.
locked object
how to check how many sessions are running for same users.

Blocking session query.
----------------------------

SELECT DECODE (l.BLOCK, 0, 'Waiting', 'Blocking ->') user_status
,CHR (39) || s.SID || ',' || s.serial# || CHR (39) sid_serial
,(SELECT instance_name FROM gv$instance WHERE inst_id = l.inst_id)
conn_instance
,s.SID
,s.PROGRAM
,s.osuser
,s.machine
,DECODE (l.TYPE,'RT', 'Redo Log Buffer','TD', 'Dictionary'
,'TM', 'DML','TS', 'Temp Segments','TX', 'Transaction'
,'UL', 'User','RW', 'Row Wait',l.TYPE) lock_type
--,id1
--,id2
,DECODE (l.lmode,0, 'None',1, 'Null',2, 'Row Share',3, 'Row Excl.'
,4, 'Share',5, 'S/Row Excl.',6, 'Exclusive'
,LTRIM (TO_CHAR (lmode, '990'))) lock_mode
,ctime
--,DECODE(l.BLOCK, 0, 'Not Blocking', 1, 'Blocking', 2, 'Global') lock_status
,object_name
FROM
gv$lock l
JOIN
   gv$session s
ON (l.inst_id = s.inst_id
AND l.SID = s.SID)
JOIN gv$locked_object o
ON (o.inst_id = s.inst_id
AND s.SID = o.session_id)
JOIN dba_objects d
ON (d.object_id = o.object_id)
WHERE (l.id1, l.id2, l.TYPE) IN (SELECT id1, id2, TYPE
FROM gv$lock
WHERE request > 0)
ORDER BY id1, id2, ctime DESC;


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

2)

set lines 200 pages 200
select l1.inst_id,l1.sid, ' IS BLOCKING ', l2.sid,l1.type,l2.type,l1.lmode,l2.lmode,l2.inst_id
from gv$lock l1, gv$lock l2
where l1.block =1 and l2.request > 0
and l1.id1=l2.id1
and l1.id2=l2.id2;


3)


Wait time in seconds

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

set lines 200 pages 200

col wait_class for a10

col MACHINE for a10

col EVENT for a10

col USERNAME for a10

col MACHINE for a10

col status for a10



select

   blocking_session,blocking_instance, inst_id,

   sid,

   serial#,

   USERNAME, status,

   SQL_ID,

   wait_class,

   MACHINE,

   seconds_in_wait

from

   gv$session

where

   blocking_session is not NULL and seconds_in_wait >100

order by

   seconds_in_wait;
===============================================================



How to get PID from SID:

------------------------

col sid format 999999

col username format a20

col osuser format a15

select a.sid, a.serial#,a.username, a.osuser, b.spid

from v$session a, v$process b

where a.paddr= b.addr

and a.sid='&sid'

order by a.sid;





SQLID from SID

-------------------------------------

column plsql_entry_object_id format 99999 heading c1

column plsql_entry_subprogram_id format 99999 heading c2

column plsql_object_id format 99999 heading c3

column plsql_subprogram_id format 99999 heading c4

select t1.sql_id,( select t2.sql_fulltext from v$sql t2 where t1.sql_id = t2.sql_id and t1.sql_child_number = t2.child_number ) sql_fulltext,
( select t2.sql_fulltext
from v$sql t2
where t1.prev_sql_id = t2.sql_id and
t1.prev_child_number = t2.child_number ) prev_sql_fulltext,
plsql_entry_object_id,
plsql_entry_subprogram_id,
plsql_object_id,
plsql_subprogram_id
from v$session t1
where sid = 201 ;

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

select sql_text from v$sql where sql_id = 'a7u3m7hf3w3y4' ;


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

select distinct(username) from gv$session;
select count(*) , username from gv$session group by username;


Locked object :

TO single database.
------------------
select
   c.owner,
   c.object_name,
   c.object_type,
   b.sid,
   b.serial#,
   b.status,
   b.osuser,
   b.machine
from
   v$locked_object a ,
   v$session b,
   dba_objects c
where
   b.sid = a.session_id
and
   a.object_id = c.object_id;





To RAC database.
=============

select
   c.owner,
   c.object_name,
   c.object_type,
   b.INST_ID,
   b.sid,
   b.serial#,
   b.status,
   b.osuser,
   b.machine
from
   gv$locked_object a ,
   gv$session b,
   dba_objects c
where
   b.sid = a.session_id
and
   a.object_id = c.object_id;




following error occurs,if there is any locked objects.
Error starting at line : 1 in command -
DROP INDEX sys.TQD_QUEUE_KEY_BM_IDX
Error report -
SQL Error: ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired
00054. 00000 -  "resource busy and acquire with NOWAIT specified or timeout expired"
*Cause:    Interested resource is busy.
*Action:   Retry if necessary or increase timeout.

Tuesday, 19 December 2017

https://docs.oracle.com/cd/B13789_01/server.101/b10734/rcmbackp.htm - FOr BACKUP topics user official site.

RMAN catalog and RMAN stored script.

Reference : http://www.oracle.com/technetwork/issue-archive/2009/09-sep/o59recovery-085185.html.

https://docs.oracle.com/cd/B14117_01/server.101/b10734/rcmcnctg.htm#1008104.


RMAN> list script names;

List of Stored Scripts in Recovery Catalog


    Global Scripts


       Script Name
       Description
       -----------------------------------------------------------------------
       archive_bck_del

       archive_bck_no_del

       full_archive_delete

       global_medfull_level0

       global_smallfull_level0


RMAN> print Global Script archive_bck_del
2> ;

printing stored global script: archive_bck_del
{
backup Archivelog ALL
skip inaccessible
format='Arch_Delete_%d_%s_%p.dbf'
filesperset=20
delete input;
}

RMAN> print Global Script archive_bck_no_del
2> ;

printing stored global script: archive_bck_no_del
{
backup Archivelog ALL
skip inaccessible
format='Arch_NoDelete_%d_%s_%p.dbf'
filesperset=20;
}

RMAN> print Global Script full_archive_delete;

printing stored global script: full_archive_delete
{
backup Archivelog ALL
format='Arch_Delete_%d_%s_%p.dbf'
skip inaccessible
filesperset=20
delete input
not backed up 2 times;
}

RMAN> print Global Script global_medfull_level0;

printing stored global script: global_medfull_level0
{
   execute global script global_smallfull_level0;
}

RMAN> print global script global_smallfull_level0
2> ;

printing stored global script: global_smallfull_level0
{
     backup incremental level 0
     format='Small_Full_BCK_%d_%s_%p.dbf'
     database
     filesperset = 10;
}


RMAN> show all
2> ;

RMAN configuration parameters for database with db_unique_name PDMLI are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 45 DAYS;
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE 'SBT_TAPE' TO 'control_file_%F';
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u07/app/oracle/arch/PDMLI/RMAN/%d-%T_%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 16 BACKUP TYPE TO BACKUPSET;
CONFIGURE DEVICE TYPE SBT_TAPE PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS  'SBT_LIBRARY=/opt/omni/lib/libob2oracle8_64bit.so';
CONFIGURE CHANNEL DEVICE TYPE DISK MAXOPENFILES 4;
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO BACKED UP 1 TIMES TO 'SBT_TAPE';
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/reorg/PDMLI/backups/snapcf_PDMLI.f';


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

OMNI Backup tool:


/opt/omni/bin/omnirpt -report dl_info -tab | grep <dbname>

ex : g2u2554g:rdbms/log $ /opt/omni/bin/omnirpt -report dl_info -tab | grep PIDSI
Oracle8 Backup  B1_g2u2554g_PIDSI_F             oracle.dba@g2u2554g.austin.hpicorp.net  -       -
Oracle8 Backup  B1_g2u2554g_PIDSI_log_del               oracle.dba@g2u2554g.austin.hpicorp.net  -       -

g2u2554g:rdbms/log $ /opt/omni/bin/omnirpt -rep dl_sched -tab|grep -i PIDSI
Oracle8 Backup  B1_g2u2554g_PIDSI_F             12/15/17 15:45:00       1513352700 2017-12-15 15:45:00  full
Oracle8 Backup  B1_g2u2554g_PIDSI_log_del               12/10/17 21:45:00       1512942300 2017-12-10 21:45:00  full


g2u2554g:rdbms/log $ rman target /

Recovery Manager: Release 12.1.0.2.0 - Production on Sun Dec 10 06:29:28 2017

Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

connected to target database: PIDSI (DBID=1923135860)

RMAN> exit


Recovery Manager complete.
g2u2554g:rdbms/log $ /opt/omni/lbin/util_cmd -getmethod Oracle8 1923135860
DB_NAME='PIDSI';
CLIENT=('g2u2554g.austin.hpicorp.net%PIDSI');
TGT_NLS_LANG='AMERICAN_AMERICA.AL32UTF8';
CATALOG={
        CATALOG_DB_VERSION='11.2.0.3.0';
        RCPasswd='FHBBEHBBEHBBQGBBDIBBOHBBCHBBPHBB';
        RC_NLS_LANG='AMERICAN_AMERICA.AL32UTF8';
        RCService='AUSRCII';
        RCUser='RMAN_PIDSI';
        HOST_NAME='';
};


rman target omnibackup/omni_PIDSI@PIDSI catalog RMAN_PIDSI/dcc_rman@AUSRCII

/opt/omni/bin/omnidb -ses -data "B1_g2u2554g_PIDSI_log_del" -last 15

nohup /opt/omni/bin/omnib -oracle8_list B1_g2u2554g_PIDSI_log_del -protect > /tmp/B1_g2u2554g_PIDSI_log_del &(This one was not working)


nohup /opt/omni/bin/omnib -oracle8_list B1_g2u2554g_PIDSI_log_del  -protect days 15 > /tmp/B1_g2u2554g_PIDSI_log_del &


Backup issue:
============

/opt/omni/bin/omnirpt -rep dl_sched -tab|grep -i YESNO2I

/opt/omni/bin/omnirpt -report dl_info -tab | grep YESNO2I


execute sys.dbms_backup_restore.resetcfilesection(9);

/opt/omni/lbin/util_cmd -getmethod Oracle8  331502902 ---- what is the use of this command  --- 1923135860

/opt/omni/lbin/util_cmd -getmethod Oracle8 1143709814

rman target omnibackup/omni_PDMLI@PDMLI catalog RMAN_PDMLI/dcc_rman@AUSRCII

rman target omnibackup/omni_MA9@MA9 catalog rman_MA9/dcc_rman@AUSRCIP

rman target omnibackup/omni_D7C@D7C catalog RMAN_D7C/dcc_rman@AUSRC3P




/opt/omni/bin/omnidb -ses -data "S2S_B1_synchpdb_SYNCHP_F" -last 15

nohup /opt/omni/bin/omnib -oracle8_list S2S_V1_wcsdelpdb_WCSDELP_F > /tmp/S2S_V1_wcsdelpdb_WCSDELP_F &

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

To check backup SPEC related to particular DB
-------------------------------------------------------
/opt/omni/bin/omnirpt -report dl_info -tab | grep TRSTGP

 find . -name "HOUCM1Sarch_*.dbf" -mtime +10 -exec ll {} \;


To check last 15 days backup status
-------------------------------------------
/opt/omni/bin/omnidb -ses -data "Oracle8 S2S_V1_wcsautpdb_WCSAUTP_log_del" -last 15

/opt/omni/bin/omnidb -ses -data "Oracle8 B1_gvu10887_RDSP_F" -last 15

S2S_B1_trstgpdb_TRSTGP_log_del

To check backup Log
-------------------------
/opt/omni/bin/omnidb –ses 2017/07/11-792 -report

/opt/omni/bin/omnidb –details 2017/07/06-683 -re

To run backup manually
-----------------------------
nohup /opt/omni/bin/omnib -oracle8_list B1_dbcift6-inc_FT6_I -protect > /tmp/B1_dbcift6-inc_FT6_I & ( this one was not working )

nohup /opt/omni/bin/omnib -oracle8_list B1_g2u2554g_PIDSI_log_del -protect > /tmp/B1_g2u2554g_PIDSI_log_del &

nohup /opt/omni/bin/omnib -oracle8_list B1_gvu10584_AUIARC1I_log_del -protect days 15 > /tmp/B1_gvu10584_AUIARC1I_log_del &

B1_gvu4902_TRLIV1P_log_del

To delete applied archive logs at Standby DB
------------------------------------------------------
ksh /u01/app/oracle/admin/scripts/Applied_log_on_standby_delete.ksh

ksh /home/oracle/Applied_log_on_standby_delete.ksh
-------------------------------------------------------------------

backup
====


col STATUS format a9
col hrs format 999.99
select SESSION_KEY, INPUT_TYPE, STATUS,
to_char(START_TIME,'mm/dd/yy hh24:mi') start_time,
to_char(END_TIME,'mm/dd/yy hh24:mi') end_time,
elapsed_seconds/3600 hrs from V$RMAN_BACKUP_JOB_DETAILS
order by session_key;


SELECT * FROM DBA_ROLE_PRIVS WHERE GRANTEE='OMNIBACKUP';

GRANT DBA TO OMNIBACKUP;

Wednesday, 29 November 2017

https://drive.google.com/drive/folders/0BypKSZC46-r6WEZGWHoxWnpwSWc --- Devops document

[08/10, 21:17] ‪+91 93413 46686‬: AI to create jobs by 2020, says Gartner:

http://www.thehindu.com/sci-tech/technology/ai-to-create-jobs-by-2020-says-gartner/article19818440.ece


Example projects to be data scientist
[08/10, 21:19] ‪+91 93413 46686‬: https://www.analyticsvidhya.com/blog/2016/10/17-ultimate-data-science-projects-to-boost-your-knowledge-and-skills/

*Data Science*: Refers to the umbrella of techniques where you are trying to extract information and insights from data. This includes MIS reporting on the lowest level to building predictive models on the higher level.

*Data Mining*: refers to the science of collecting all the past data and then searching for patterns in this data. You look for consistent patterns and / or relationships between variables. Once you find these insights, you validate the findings by applying the detected patterns to new subsets of data. The ultimate goal of data mining is prediction - and predictive data mining is the most common type of data mining and one that has the most direct business applications.

*Data Analysis*: This is a loosely used term. People running reporting also say that they are analysing data and so do predictive modelers. I would just take this as any attempt to make sense of data can be called as data analysis.

*Machine learning* - is the science of creating algorithms and program which learn on their own. Once designed, they do not need a human to become better. Some of the common applications of machine learning include following: Web Search, spam filters, recommender systems, ad placement, credit scoring, fraud detection, stock trading, computer vision and drug design. An easy way to understand is this - it is humanly impossible to create models for every possible search or spam, so you make the machine intelligent enough to learn by itself. When you automate the later part of data mining - it is known as machine learning.

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


https://en.wikibooks.org/wiki/RAC_Attack_-_Oracle_Cluster_Database_at_Home/RAC_Attack_12c

-===============


Learn NODE JS through Animations*

👍 The most powerful server side javascript coding technology.
👍Easiest coding technology
👍Fastest server coding technology
👍 Beats Angularjs and ruby in technology growth.

Learn it and share to your friends

https://wikitechy.com/tutorials/node-js

Cheers,
Wikitechy.com
Animation tutorials company


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



http://sahandsaba.com/thirty-python-language-features-and-tricks-you-may-not-know.html --- Python 30 tricks

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

[14/10, 4:30 PM] Harish: https://drive.google.com/file/d/0Bw-23rnIKbExZVJEVXNwV29IeFk/view?usp=drivesdk
[14/10, 4:30 PM] Harish: https://drive.google.com/file/d/0Bw-23rnIKbExN25hNWZ2eXNiS1k/view?usp=drivesdk
[14/10, 4:30 PM] Harish: https://drive.google.com/file/d/0Bw-23rnIKbExRkcxaW5NOTBNMkE/view?usp=drivesdk
[14/10, 4:30 PM] Harish: https://drive.google.com/file/d/0Bw-23rnIKbExMG9xNm0tWmRYWGM/view?usp=drivesdk
=====================================================