Move SQL Tuning Sets between Oracle instances
Takeaway: SQL Tuning Sets (STS) capture the workload of an Oracle instance. Starting in Oracle 10g Release 2, these tuning sets can be transported from one instance to another to facilitate testing.
SQL Tuning Sets (STS) are a part of Oracle 10g's SQL Tuning Advisor feature. Each tuning set contains one or more SQL statements, plus the context information needed to interpret them correctly. A tuning set is used as input to the SQL Tuning Advisor, which examines the statements and makes recommendations for improving them.
The initial release of Oracle 10g required this analysis to be performed on the same machine that captured the SQL Tuning Set, because there was no way to move the tuning set to a different instance. This added overhead to the production system, and required giving developers more privileges in the production instance than they normally would have.
The ability to move SQL Tuning Sets has been added in Oracle 10g Release 2. By using a staging table and the procedures in the package DBMS_SQLTUNE, you can export SQL Tuning Sets from the instance in which they were created and import them into a test instance for analysis.
The actual procedure is documented in the Oracle Database Performance Tuning Guide. Briefly, the procedure consists of the following steps:
- Create one or more SQL Tuning Sets. STS can be created in Oracle Enterprise Manager from existing AWR snapshots, preserved snapshot sets, or a defined period of historical SQL. They can also be created manually using procedures in DBMS_SQLTUNE.
- Use the CREATE_STGTAB_SQLSET procedure in DBMS_SQLTUNE to create a staging table to hold the STS that will be transported.
- Use the PACK_STGTAB_SQLSET procedure to load the staging table with existing tuning sets.
- Move the staging table the same as you would any other table, such as via Datapump export and import.
- On the destination system, use the UNPACK_STGTAB_SQLSET procedure to import the tuning sets into the system. They can then be analyzed using DBMS_SQLTUNE or Enterprise Manager.
Miss a tip?
Check out the Oracle archive, and catch up on our most recent Oracle tips.
Bob Watkins (OCP, MCDBA, MCSE, MCT) is a computer professional with 25 years of experience as a technical trainer, consultant, and database administrator. Visit Bob's site.
Print/View all Posts Comments on this article
SponsoredWhite Papers, Webcasts, and Downloads
- TechRepublic Resource Guide - VoIP Best Practices TechRepublic
- Case Study: The DCMA Improves Application Performance and Users' Satisfaction with WAN Optimization Riverbed
- Riverbed Raises the Ante Again in WDS with RiOS 5.0 Riverbed
- Strategies for Centralizing Data Backup Riverbed
- Sales 2.0: How Businesses are Using Online Collaboration to Spark Sales Oracle
Article Categories
- Security
- Security Solutions, IT Locksmith
- Networking and Communications
- E-mail Administration NetNote, Cisco Routers and Switches
- CIO and IT Management
- Project Management, CIO Issues, Strategies that Scale
- Desktops, Laptops & OS
- Windows 2000 Professional, Microsoft Word, Microsoft Excel, Microsoft Access, Windows XP,
- Data Management
- Oracle, SQL Server
- Servers
- Windows NT, Linux NetNote, Windows Server 2003
- Career Development
- Geek Trivia
- Software/Web Development
- Web Development Zone, Visual Basic, .NET
