Monthly Archives: July 2016

find_rman_backup_piece.sql

alter session set nls_date_format=’dd-mon-yy hh:mi’; /* — archive logs select r.sequence#, p.handle, p.start_time from v$backup_piece p, v$backup_redolog r where r.set_stamp = p.set_stamp and r.set_count = p.set_count — and r.sequence# = 63 order by r.sequence# ; */ — data files select … Continue reading

Posted in Uncategorized | Leave a comment

rman duplicate command

export NLS_DATE_FORMAT=’YYYY-MM-DD:HH24:MI:SS’ rman target / nocatalog auxiliary sys/syspwd@TARGET  log=dup_target.log run { set until time “to_date(’10-JAN-2010 23:05:25′, ‘DD-MON-YYYY HH24:MI:SS’)”; allocate auxiliary  channel c1 type disk; allocate auxiliary  channel c2 type disk; duplicate target database to TARGET; }

Posted in Uncategorized | Leave a comment

TWO_TASK

TWO_TASK lets you silently support a tns network connect string, that is, instead of: sqlplus scott/tiger@tnsname you can: export TWO_TASK=tnsname sqlplus scott/tiger <<<== that has an implied @tnsname oracle_sid is used for a local connection – direct to the server … Continue reading

Posted in Uncategorized | Leave a comment

Find objects and rows causing deadlocks

Trace file info: Rows waited on: Session 335: obj – rowid = 000BAC75 – AAC6x1AAIAAClO9AAF (dictionary objn – 765045, file – 8, block – 676797, slot – 5) Session 92: obj – rowid = 000BAC75 – AAC6x1AAGAACZaUAAE (dictionary objn – … Continue reading

Posted in Uncategorized | Leave a comment

printtbl.sql

Credit for this goes to Tom Kyte @ asktom.oracle.com — printtbl.sql — Ex. @printtbl.sql ‘select * from dba_users where username = “E9811012″‘ set serveroutput on set verify off declare l_theCursor integer default dbms_sql.open_cursor; l_columnValue varchar2(4000); l_status integer; l_descTbl dbms_sql.desc_tab; l_colCnt number; … Continue reading

Posted in Uncategorized | Leave a comment

SQL Profiles

Query to show sql_ids related to SQL Profiles COLUMN category FORMAT a10 COLUMN sql_text FORMAT a88 col name for a33 col last_modified for a12 SELECT NAME, SQL_TEXT, CATEGORY, STATUS, trunc(last_modified) FROM DBA_SQL_PROFILES; select distinct p.name sql_profile_name, s.sql_id from dba_sql_profiles p, DBA_HIST_SQLSTAT … Continue reading

Posted in Uncategorized | Leave a comment