awrdump

NAME
SYNOPSIS
OPTIONS
EXAMPLES
NOTES
BUGS
COPYRIGHT
SEE ALSO

NAME

awrdump − Create a dump with extract from the awr repository

SYNOPSIS

awrdump -l u/p@c [options]

The awr dump utility is used to create an awr extract as a datapump export file, and potentially copy the file to a bucket created in Oracle Cloud Infrastructure. To only do the former, you need to be able to log in to some database with a user with access to the awr repository and with write access to a database directory object where the dump file will be written. If the database for which you want the awr dump, you also need to copy the file to a bucket in OCI. To do so, you need to have credentials configured using dbms_cloud.create_credential, and you need to already have a region specific bucket created in your tenancy.

Before using awrdump, you will want to use the list modes of awrreport(2rwl) to identify dbid and awr snapshot ranges.

OPTIONS

-l u/p
-l u/p@c

Compulsory option to provide the username, password, and potentially connect string for a database connection that provides access to a login with access to various the dba_ views containing the awr repository. If you omit /p, rwloadsim will prompt for the password.

--dbid=<dbid>

Without this option, provide a list of all available databases with the dbid in the awr repository similar to how awrreport does it. The option is required to create an actual awr dump.

If only this option is provided, a list of directories will be printed and no actual dump will be created.

--begin-snap=<N>
--end-snap=<N>

Specify the first and last snapshot id to include in the dump.

--directory=<DIRNAME>

Provide the name of a database directory, where the dump file will be written. The default name is DATA_PUMP_DIR.

--filename=<file>

Name the file to contain the awr dump; the suffix of .dmp will automatically be added, and the name should consist of letters, numbers, hyphen and underscore only. If not provided, the name will be a combination of dbid, begin-shap and end-snap.

--remove-file

If the file named (or automatically generated) already exists, it will be removed before generating the dump. The routine used to actually create the dump will refuse to overwrite an existing file and return an error if it already exists.

--use-extract

Don’t attempt using dbms_workload_repository.awr_exp. See BUGS.

--logfile=<filename>

When data pump performs the actual extract of the awr data, it will write its log to a file in the chosen directory; the name will be the same as the actual dump file except it will have a .log extension. If you have access to the directory, you can subsequently view the logfile there. If you do not have access to the directory, using the logfile option causes the data pump log output to be copied to the local file named by the option.

EXAMPLES

Initially list available databases using awrreport:

awrreport -l system/{password}@mydb_tp

which may generate an output like:

       dbid con snap cnt instance list
----------- --- -------- -------------
  734638888  /      6178 1,2,3,4,5,6,7,8
 2286054548  P      6302 1,2,3,5,6,7,8

This tells that there is data from two databases available in the repository. The second database being your actual PDB in use.

To see the available snapshots, use a call to awrreport like

awrreport -l admin/{password}@mydb_tp --dbid=2286054548

which may generate an output like this:

i#  losnap  hisnap  snaps       losnap_end      hisnap_end
-- ------- ------- ------ ---------------- ---------------
 1   94164   97115   1594 2022.10.23T12:54 2022.11.22T17:42
 2   96906   96907      2 2022.11.20T12:46 2022.11.20T12:56
 3   96908   97115    208 2022.11.20T13:49 2022.11.22T17:42
 5   93965   94165    201 2022.10.21T12:59 2022.10.23T13:05
 6   94165   94183     19 2022.10.23T13:05 2022.10.23T18:06
 7   94172   95530   1354 2022.10.23T15:11 2022.11.06T12:06
 8   93965   96905   2924 2022.10.21T12:59 2022.11.20T11:54

To list available directories where the extract can be dumped, you could call awrdump with only the --dbid option:

awrdump -l admin/{password}@mydb_tp --dbid=2286054548

which (among many other lines) may show:

directory                      path
------------------------------ --- ...
DATA_PUMP_DIR                  /u03/dbfs/93BE77A80A4656/data/dpdump

Since --directory=DATA_PUMP_DIR is default a possible command to create an actual awr dump is:

awrdump -l admin/{password}@mydb_tp --dbid=2286054548 \
  --begin-snap=94000 --end-snap=96000 \
  --logfile=/tmp/awrdump.log

As the --logfile option is used, the file /tmp/awrdump.log will contain the log output from data pump. Since the --filename option is not provided, a generated name of 2286054548_94000_96000.dmp based on dbid and snapshot interval will be used. Note that the .dmp suffix is added automatically by awrdump.

You could subsequently copy the file to a cloud bucking using:

ocp -l admin/{password}@mydb_tp \
  --credential=mycred --region=us-phoenix-1 \
  --namespace=mytenancy --bucket=awrbucket
  DATA_PUMP_DIR:2286054548_94000_96000.dmp

You could alternatively copy it to the file mydump.dmp on your local system using

ocp -l admin/{password}@mydb_tp DATA_PUMP_DIR:2286054548_94000_96000.dmp mydump.dmp

NOTES

If you are using the full distribution of rwloadsim, awrdump is an executable shell script in the bin directory that calls rwloadsim with the -u option getting awrdump.rwl from the public directory. As a stand alone binary distribution, awrdump is an executable with the awrdump.rwl code embedded.

BUGS

The actual api to perform the dump has changed over time and database versions, and awrdump will initially try using the documented dbms_workload_repository.awr_exp call. If that does not exist, dbms_workload_repository.extract will be used in stead. By providing --use-extract, the former call will not be tried first.

COPYRIGHT

Copyright © 2023 Oracle Corporation
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl

SEE ALSO

rwloadsim(1rwl), ashplot(2rwl), utilities(2rwl), awrreport(2rwl), ocp(2rwl)