Posts

Showing posts from November, 2017

READ ONLY Tablespace Restore and Recovery

Please refer http://gavinsoorma.com/2009/08/read-only-tablespace-restore-and-recovery/ READ ONLY Tablespace Restore and Recovery Keeping static or historical data in read only tablespaces is a good practice especially for data warehouse type environments. Using the RMAN SKIP READONLY command, we can reduce the backup window and overhead as well by excluding these read only tablespaces from the database backupsets. But we need to keep in mind that we need to take at least one backup of the tablespace after it has been made read only and thereafter we can use the SKIP READONLY command to exclude these tablespaces from the daily or weekly database backups. However, while doing a restore we need to use the CHECK READONLY keywords otherwise by default the read only tablespaces will not be restored and hence the recovery will also bypass these tablespaces. Subssequent attempts to open the database will fail. Let us illustrate the same with an example where we have ma...

Long running SQL and verify database locks

CPU usage SELECT s.sid, s.serial#, p.spid as "OS PID",s.username, s.module, st.value/100 as "CPU sec"  FROM v$sesstat st, v$statname sn, v$session s, v$process p WHERE sn.name = 'CPU used by this session' -- CPU  AND st.statistic# = sn.statistic# AND st.sid = s.sid AND s.paddr = p.addr AND s.last_call_et < 1800 -- active within last 1/2 hour AND s.logon_time > (SYSDATE - 240/1440) -- sessions logged on within 4 hours ORDER BY st.value; SET ECHO OFF COL HOURS          FORMAT 999,990.99 COL MESSAGE        FORMAT A22 COL OPNAME         FORMAT A16        HEA "OPERATION" COL PCT_COMPLETE   FORMAT 99.9        HEA "PCT"  COL SERIAL#        FORMAT 99999 COL SID            FORMAT 9999 COL STARTED        FORMAT A16        HEA "START TIME" COL TARG...