awrdump − Create a dump with extract from the awr repository
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.
-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. A typical 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.
--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.
--credential=<name>
Before being able to copy the generated file to a bucket in OCI, you need to have the necessary credentials created using dbms_cloud.create_credential. One way to do this is from your cloud console to create an Auth Token, which can be done via Identity->Users->User Details.
The Auth Token is a string of around 20 characters such as ’abc.123-defgji>XYZ(’, which is provided as the password to dbms_cloud.create_credential. A typical call to do this would be:
begin dbms_cloud.create_credential ( ’credname’ , username=>’first.last@example.com’ , password=>’abc.123-defgji>XYZ(’ ); end;
This needs to be done once per credential per user, and the first argument to dbms_cloud.create_credentail is the name you need to provide with the --credential option.
--region=<region>
Provide the name of the region where the bucket exists. Sample region names are us-phoenix-1, eu-frankfurt-1, ap-mumbai-1.
--bucket=<bucket>
Provide the name of the bucket, which must already be created using your OCI console in the actual region.
--tenancy=<tenancy>
Provide the name of your OCI tenancy. The complete name of the OBJECT_URI used by dbms_cloud.put_object will be https://swiftobjectstorage.{region}.oraclecloud.com/v1/{tenancy}/{bucket}/{filename}.dmp where region, tenancy, bucket and filename are the appropriate parameters.
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
Assuming you have credentials named mycred, a tenancy called mytenancy and a bucket called awrbucket, you could then use a call like the following to actually create the awr dump and copy it to your bucket:
awrdump -l admin/{password}@mydb_tp --dbid=2286054548 \ --directory=DATA_PUMP_DIR --filename=mydump \ --begin-snap=94000 --end-snap=96000 \ --credential=mycred --region=us-phoenix-1 \ --tenancy=mytenancy --bucket=awrbucket \ --logfile=/tmp/awrdump.log
As the --logfile option is used, the file /tmp/awrdump.log will contain the log output from data pump.
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.
Copyright
© 2023 Oracle Corporation
Licensed under the Universal Permissive License v 1.0 as
shown at https://oss.oracle.com/licenses/upl
rwloadsim(1rwl), ashplot(2rwl), utilities(2rwl), awrreport(2rwl)