In the past I’ve sometimes had to dump the contents of the redo log to a trace file when I needed to find out what work Oracle was doing behing the scenes. To minimise the volume dumped by the “alter system dump logfile” command and make it easier to find the bit I wanted to see I used to “switch logfile” just before (and sometimes just after) the statement I was investigating.
With the advent of pluggable databases the “switch logfile” command now raises Oracle error: “ORA-65040: operation not allowed from within a pluggable database”, so I had to change the strategy. This is just a brief note (echoing a footnote to an older note) of the approach I now use:
column current_scn new_value start_scn
select to_char(current_scn,'9999999999999999') current_scn from v$database;
-- do something interesting here
column current_scn new_value end_scn
select to_char(current_scn,'9999999999999999') current_scn from v$database;
alter session set tracefile_identifier='sometextyoulike';
alter system dump redo scn min &start_scn scn max &end_scn ;
alter session set tracefile_identifier='';
The list of options for the dump has been extended since I published the note on dumping the log file, and now (19.11.0.0) allows the following options (using c notation for the type of the variables you supply to each parameter):
rdba min %d rdba max %d tablespace_no %d
dba min %u %u dba max %u %u
securefile_dba %u %u
length %d
time min %d
time max %d
layer %d
opcode %d
scn min %llu
scn max %llu
xid %d %d %d
objno %u
con_id %d
skip corruption
If you try to restrict the dump on objno (object id) or xid (transaction id) then the trace file will skip any redo records generated by private threads / in-memory undo and report the text: “Skipping IMU Redo Record: cannot be filtered by XID/OBJNO”
The tablespace_no option can only be used when both rdba min and rdba max (rolback data block address range) have been specified.
The con_id option may only be legal when used to specify a PDB from the CDB
Remember – when you dump redo you get just the redo for your session; there is some scope for being selective, but the starting point would be all the redo for the PDB you’re working from.
[…] Dumping redo (Sept 2022): a convenient method for minimising the redo you need to dump when testing a feature. […]
Pingback by Infrastructure Catalogue | Oracle Scratchpad — September 12, 2022 @ 4:44 pm BST Sep 12,2022 |
[…] Parallel Default (Sept 2022): Why did my query run parallel? A possible reason and a simple demo. […]
Pingback by Troubleshooting catalogue | Oracle Scratchpad — September 12, 2022 @ 4:47 pm BST Sep 12,2022 |