In the new Active Data Guard option, users can now use statspack from the primary database to collect data from a standby database that is opened read-only and performing recovery. The standby statspack is installed in a separate schema on the Primary database, STDBYPERF which is then propagated to the standby. This user "STDBYPERF" user does not have DBA privileges and has no access to local V$ tables.
Installing and Using Standby
Statspack in 11gR1
Statspack in 11gR1
1. Standby Statspack Usage
1.1 Statspack Installation
The perfstat schema and statspack related objects must be present on the primary and standby prior to installing standby statspack. The standby statspack installation script (sbcreate.sql) creates the standby statspack schema to hold the standby snapshots. The script asks for:- A password for stdbyperf user
- Default tablespace
- Temporary tablespace
The script creates the ‘stdbyperf’ user and assigns it the selected default and temporary table space. After the user has been created it calls sbaddins.sql to add the first standby instance to the configuration.
1.2 Add an Instance to Statspack Configuration
Log in to the primary as the 'stdbyperf' user and run the script sbaddins.sql to add a standby instance to the configuration. The script asks for:- The TNS alias of the standby database instance
- The password of the perfstat user on the standby site
connect stdbyperf/your_password @sbaddins Input inst2_alias as the tns alias
1.3 Collect Performance Data from a Standby Instance
The script sbaddins.sql creates a separate PL SQL package for each standby instance. Run the snap procedure of those packages to collect the performance data. The statspack_<instance_name>.snap procedure accesses the data dictionary and stats$ views on the standby database via database link connected to the original perfstat user und stores the data to stats$ tables on the primary instance. For example, while the standby is opened read only, login to the primary database and create the snap:connect stdbyperf/your_password exec statspack_.snap
1.4 Generate Standby Statistics Report
The script sbreport.sql generates the standby statistics report. The script asks for: database id, instance number, high and low snapshots id to create the report. Example:sql> @sbreport
1.5 Purge a Set of Snapshots
The script sbpurge.sql purges a set of snapshots. The script asks for database id, instance number, low and high snapshots ids. The script purges all snapshots between the low and high snapshot ids for the given instance. Example:@sbreport
1.6 Delete an Instance from the Configuration
The script sbdelins.sql deletes an instance from the configuration, and deletes the associated PL SQL package. The scripts asks for instance name. The snapshots are not automatically purged when the instance is deleted. After deleting the instance, you are not able to generate reports for that instance. Example:@sbdelins
1.7 Drop Statspack Schema
The script sbdrop.sql drops the stdbyperf user and tables. The script must be run when connected to SYS (or internal). Example:connect / as sysdba @sbdrop.sqlDocumentation :
Metalink "Installing and Using Standby Statspack in 11gR1" note 454848.1
"The perfstat schema and statspack related objects must be present on the primary and standby prior to installing standby statspack."
ReplyDeleteWhat scripts need to be run on the Primary to have the "perfstat" schema and "statspack objects" installed? Even Metalink does not make any mention about these
See Statistics Package (STATSPACK) Guide [MOS 394937.1]
ReplyDeleteScripts used
SQL> connect / as sysdba
SQL> @?/rdbms/admin/spcreate