First of all i want to ask my apologies because this article was redacted very very fast and therefore there are a lot of errors with the words, semantic and vocabulary, also my english is very bad and poor. I repeat my apologies and in case of any doubt or error please you feel free for contact-me to my email (felipe@felipedonoso.cl, felipe.doonoso@oracle.com) or in the comments for this posts.
These are the steps about how implement a very basic RAT example. This was executed between a 12.2.0.1 environment (source and target). The first one you need execute the capture process on the source database for get the transactions files (or rat or *.rec files) and after copy that files to the target and replay these ones to the target db using the replay processes.
* Link for documentation:
* CAPTURE PROCESS: https://docs.oracle.com/database/121/ARPLS/d_workload_capture.htm#ARPLS69044
* REPLAY PROCESS: https://docs.oracle.com/database/121/ARPLS/d_workload_replay.htm#ARPLS208
* DocID for RAT on PDBs (multitenant):
Capture Process
1.- Preparing the capture
NOTE: It's not possible capture RAT directly on PDB
(for now until 18c, maybe on 19c it will be possible)
2.- How can I calculated the space required for database capture?
For estimate the size of our all capture process we can do it the next one:(from note: Real Application Testing: Database Capture FAQ (Doc ID 1920275.1))
Space required for capture can be approximated using:
2 * Bytes received via SQL*Net from client (from AWR).
The AWR report tracks the total in-coming network traffic under “bytes received via SQL*Net from client". By using an AWR report covering the period of a similar workload that ran before, you can get a good estimate for the on-going workload capture. For example: suppose we are planning a workload capture from 9am to 11am this Friday, the AWR report for last Friday of the same duration might give us a good estimate.
In the example below the space required can be calculated as 2*367,991,283 = 735,982,566 bytes
3.- Define filter for capture
Add the next for PDB capture. Put the pdb's name on the fvalueNote: for delete filter use DELETE_FILTER procedure
For more information about the use of filter review the next Support note:
* [ How to Create Filters for Either a Capture or Replay with Real Application Testing (RAT) (Doc ID 2285287.1) ]
* PRIOR 19c you only can capture from all CDB LEVEL:
19c New Feature Workload Capture and Replay in a PDB(Doc ID 2644357.1)
but if you need capture only for PDB prior 19c you can use this:
alter session set container=cdb$root ;BEGIN DBMS_WORKLOAD_CAPTURE.ADD_FILTER ( fname => 'RAT_FILTER_PDB1_20190821', fattribute => 'PDB_NAME', fvalue => 'PDB1' );END;/
This is the command for delete filter in case you need it:exec DBMS_WORKLOAD_CAPTURE.DELETE_FILTER('RAT_FILTER_PDB1_20190821');
This is import regarding delete filter:
(from https://docs.oracle.com/database/121/ARPLS/d_workload_capture.htm#ARPLS69044)
The DELETE_FILTER Procedure only affects filters that have not been used by any previous capture.
Consequently, filters can be deleted only if they have been added using the ADD_FILTER Procedures
after any capture has been completed. Filters that have been added using ADD_FILTER before a START_CAPTURE and FINISH_CAPTURE cannot be deleted anymore using this subprogram.
4.- Beginning the capture
We need to use a name for capture and the directory's name:5.- Do work or insert transactions on the source database
In this part we need to have our database in operational mode or insert a lot of transactions. In that way our capture process begin to create a lot of files (rat files) on the directory created in early steps. It's a very good idea have the capture process running for at least 3-5 hours. In my example we leave the capture process running with 8 hours.6.- Stop capture
7.- Reviewing the results of our capture
With this querys we can review basic information about the captures (using the directory's name)NOTE: Also remember the capture process generate a HTML report on this directory when we finish capture (Remember for my example the name of my directory is RAT_DIR_PDB1_20190821):
After finish or stop catpure we can see the next files (*.rec) generated (Example)