TechEvent Performance Analyses on Standby Database
1. BASEL BERN BRUGG DÜSSELDORF FRANKFURT A.M. FREIBURG I.BR. GENF HAMBURG
KOPENHAGEN LAUSANNE MANNHEIM MÜNCHEN STUTTGART WIEN ZÜRICH
Performance Analysis
on a Standby Database
Daniel Hillinger
@daniel8192 daniel8192.wordpress.com
2. Daniel Hillinger
Consultant at Trivadis GmbH Munich
Focus:
Oracle (RAC, Grid Infrastructure, Exadata, Dataguard)
Unix/Linux (OEL, RedHat, Solaris)
Azure (Automation, Design and Security)
daniel8192.wordpress.com
9/26/2018 Performance Analysis on a Standby Database2
3. Agenda
1. Reasons for Performance Analysis
2. Solutions and Limitation
3. Demo
4. Conclusion
9/26/2018 Performance Analysis on a Standby Database3
4. Reasons for Performance Analysis
Performance Analysis on a Standby Database4 9/26/2018
Primary
Standby
Standby 2
Queries
Redo Transport and Apply
Queries
Standby databases:
High Availability / Desaster Recovery
Scalability
– Reporting
– Move load away from primary
5. Reasons for Performance Analysis
Performance Analysis on a Standby Database5 9/26/2018
Primary
Standby
Standby 2
Redo Transport and Apply
Performance analysis:
Reader farm many small queries with relevant runtime
Reporting high optimization potential due too large queries
Day-1(snapshot) high optimization potential due too large queries
Apply too slow
Transport too slow
9. Available as of 11gR2
Only for active Dataguard and Diagnostic Pack
No configuration necessary
Memory contains data from standby DB
Disk contains data from primary DB
ASH – Active Session History
Performance Analysis on a Standby Database9 9/26/2018
SQl> @?/rdbms/admin/ashrpti.sql
10. AWR – Automatic Workload Repository
Performance Analysis on a Standby Database10 9/26/2018
Available as of 12cR1
Only for active Dataguard
and Diagnostic Pack
Supports RAC
HTML reports
ADDM (Automatic
Database Diagnostic Monitor)
SQL Tuning Advisor
collecting data
destination source
writing data via db_link
initiating snapshot via db_link
collecting data
11. AWR – Automatic Workload Repository
Performance Analysis on a Standby Database11 9/26/2018
Initial configuration:
DB links
Link registration
Node registration
Manual reconfiguration necessary
after switchover / failover and add /
remove hosts
User: SYS$UMF
Package: DBMS_UMF
Views: DBA_UMF_TOPOLOGY
DBA_UMF_REGISTRATION
DBA_UMF_LINK
DBA_UMF_SERVICE
13. Standby Statspack
Performance Analysis on a Standby Database13 9/26/2018
Availabe as of 11gR1
Read only or read write open
Statspack must be installed (PERFSTAT)
Installed in a separate schema on the primary db called STDBYPERF
Supports RAC, Multitenant
Only text, no HTML
Metalink Note: Installing and Using Standby Statspack (Doc ID 454848.1)
14. Standby Statspack - Setup
Performance Analysis on a Standby Database14 9/26/2018
Install standby statspack
Configure all db and instances
Prepare tnsnames.ora for each instance
TVDDG1_SITE1=(DESCRIPTION =
(ADDRESS=(PROTOCOL = TCP )(HOST = oeldbdg01 )(PORT = 1521 ))
(CONNECT_DATA =(SERVICE_NAME = TVDDG1_SITE1 ))
)
SQL> @?/rdbms/admin/sbcreate.sql
SQL> @?/rdbms/admin/sbaddins.sql
15. Standby Statspack - Usage
Performance Analysis on a Standby Database15 9/26/2018
Generate Report
Create Snapshot from your primary DB
SQL> connect STDBYPERF/XYZ
SQL> exec statspack_<db_unique_name>_<instance_name>.snap
SQL> @?/rdbms/admin/sbreport.sql
16. Standby Statspack - Usage
Performance Analysis on a Standby Database16 9/26/2018
Add manually a automatic run for snapshot creation and purge
BEGIN
DBMS_SCHEDULER.CREATE_JOB (
job_name => 'snap_<TNS_ALIAS>',
job_type => 'STORED_PROCEDURE',
job_action => 'statspack_<db_unique_name>_<instance>.snap',
repeat_interval => 'FREQ=MINUTELY;INTERVAL=30;',
auto_drop => FALSE,
enabled => TRUE,
comments => 'Standby Statspack automated snap for <TNS_ALIAS>');
END;
17. Standby Statspack – How it works
Performance Analysis on a Standby Database17 9/26/2018
DBMS_SCHEDULER
statspack_<db_unique_name>_<instance>.snap
Primary stdbyperf Standby perfstat
select data via db_link
18. Standby Statspack – How it works
Performance Analysis on a Standby Database18 9/26/2018
Using DB_Links, one for each standby instance from stdbyperf (primary) to perfstat
(standby)
Important: also for the primary DB
SQL> select OWNER, DB_LINK, USERNAME, HOST from dba_db_links where
username='PERFSTAT';
OWNER DB_LINK USERNAME HOST
--------- ----------------------------------- -------- ------------
STDBYPERF STDBY_LINK_TVDDG1_SITE2.LOCALDOMAIN PERFSTAT TVDDG1_SITE2
STDBYPERF STDBY_LINK_TVDDG1_SITE1.LOCALDOMAIN PERFSTAT TVDDG1_SITE1
19. Standby Statspack – How it works
Performance Analysis on a Standby Database19 9/26/2018
Do you really need active Dataguard or Snapshot DB?
YES, User PERFSTAT has no special privileges (like sysdba)
no login to mounted standby db
SQL> exec Statspack_TVDDG1_SITE2_tvddg1.snap
BEGIN Statspack_TVDDG1_SITE2_tvddg1.snap; END;
ERROR at line 1:
ORA-03150: end-of-file on communication channel for database link
ORA-02063: preceding line from STDBY_LINK_TVDDG1_SITE2
ORA-06512: at "STDBYPERF.STATSPACK_TVDDG1_SITE2_TVDDG1", line 59
ORA-06512: at "STDBYPERF.STATSPACK_TVDDG1_SITE2_TVDDG1", line 4167
ORA-06512: at "STDBYPERF.STATSPACK_TVDDG1_SITE2_TVDDG1", line 101
ORA-06512: at line 1
22. All solutions only for active Dataguard or Snapshot Database
ASH only temporary data
AWR a lot of effort and additional license, but ADDM and Tuning Advisor
Standby Statspack easy to configure and use
Conclusion
Performance Analysis on a Standby Database22 9/26/2018
My Favorite
23. Questions and answers…
Daniel Hillinger
Tel. +49 89 992 759 333
Daniel.Hillinger@Trivadis.com
@daniel8192 daniel8192.wordpress.com
9/26/2018 Performance Analysis on a Standby Database23
24. Session Feedback – now
TechEvent September 201824 14.09.2018
Please use the Trivadis Events mobile app to give feedback on each session
Use "My schedule" if you have registered for a session
Otherwise use "Agenda" and the search function
If the mobile app does not work (or if you have a Windows smartphone), use your
smartphone browser
– URL: http://trivadis.quickmobileplatform.eu/
– User name: <your_loginname> (such as "svv")
– Password: sent by e-mail...
26. Tuning
Performance Analysis on a Standby Database26 9/26/2018
SQL Plan Management
SQL Profiles
Stored Outlines
Stored in the database, same as primary db
Hints
Inside the sqltext, could be adapted for the standby db
Additional TEMPFILES can be created
In-Memory Parameter
28. STATSPACK Statistics Report for Physical Standby
Load Profile Total Per Second
~~~~~~~~~~~~ ------------------ -----------------
...
Redo MB applied: 2.1 0.5
...
Standby Statspack - Example Report
Performance Analysis on a Standby Database28 9/26/2018
29. Recovery Progress Stats DB/Inst: TVDDG1_SITE2/tvddg1 End Snap: 13
-> End Snapshot Time: 25-Aug-18 13:59:40
-> ordered by Recovery Start Time desc, Units, Item asc
Recovery Start Time Item Sofar Units Redo Timestamp
------------------- ----------------- -------------- ------- ------------------
23-Aug-18 15:49:57 Log Files 9 Files
23-Aug-18 15:49:57 Active Apply Rate 788 KB/sec
23-Aug-18 15:49:57 Average Apply Rat 5 KB/sec
23-Aug-18 15:49:57 Maximum Apply Rat 4,106 KB/sec
23-Aug-18 15:49:57 Redo Applied 917 Megabyt
23-Aug-18 15:49:57 Recovery ID 0 RCVID
...
Standby Statspack - Example Report
Performance Analysis on a Standby Database29 9/26/2018
30. Instance Recovery Stats DB/Inst: TVDDG1_SITE2/tvddg1 Snaps: 12-13
-> B: Begin snapshot, E: End snapshot
Targt Estd Log File Log Ckpt Log Ckpt
MTTR MTTR Recovery Actual Target Size Timeout Interval
(s) (s) Estd IOs Redo Blks Redo Blks Redo Blks Redo Blks Redo Blks
- ----- ----- ---------- --------- --------- ---------- --------- ------------
B 0 0 0 0
E 0 0 0 0
-------------------------------------------------------------
Standby Statspack - Example Report
Performance Analysis on a Standby Database30 9/26/2018
31. Managed Standby Stats DB/Inst: TVDDG1_SITE2/tvddg1 End Snap: 13
-> End Snapshot Time: 25-Aug-18 13:59:40
-> ordered by Process
Process pid Status Resetlog Id Thread Seq Block Num
----------- ---------- ------------ ----------- ------ ------- -----------
Client Proc Client pid Blocks Delay(mins) Active Agents
----------- ---------- -------------- -------------- --------------
ARCH 631 CLOSING 984865153 1 71 366592
ARCH 631 1,165 0 0
ARCH 649 CONNECTED 0 0 0 0
ARCH 649 0 0 0
ARCH 647 CLOSING 984865153 1 72 344064
...
Standby Statspack - Example Report
Performance Analysis on a Standby Database31 9/26/2018