30-04-2021



Home
E-mail Us
Oracle Articles
New Oracle Articles


Oracle Training
Oracle Tips

Oracle Forum
Class Catalog

Remote DBA
Oracle Tuning
Emergency 911
RAC Support
Apps Support
Analysis
Design
Implementation
Oracle Support


SQL Tuning
Security

Oracle UNIX
Oracle Linux
Monitoring
Remote s
upport
Remote plans
Remote
services
Application Server

Applications
Oracle Forms
Oracle Portal
App Upgrades
SQL Server
Oracle Concepts
Software Support

Remote S
upport
Development

Implementation


Consulting Staff
Consulting Prices
Help Wanted!


Oracle Posters
Oracle Books

Oracle Scripts
Ion
Excel-DB



Oracle Database Tips by Donald BurlesonFebruary 21, 2015

SQL Tuning Cheat sheet
by Donald K. Burleson


-- Create a function-based index
create index idx_rtrim_title on titles ( rtrim(title));


Gather stats
exec dbms_stats.gather_schema_stats('scott?);
exec dbms_stats.gather_table_stats ('scott?,?emp)
-- system statistics during peak workload period
execute dbms_stats.gather_system_stats('Start');
-- delay while you watch the workload
execute dbms_stats.gather_system_stats('Stop');

Autotrace commands
set autotrace on
set autotrace on explain
set autotrace traceonly
set autotrace traceonly explain
set autotrace traceonly statistics
Alter session commands
-- enable commands
alter system enable parallel query;
alter system enable parallel dml;
alter system enable parallel ddl;
-- change optimizer parms
alter session set optimizer_index_cost_adj=20 -- default is 100;
alter session set optimizer_index_caching=50 -- default is 0;
alter session set '_optimizer_cost_model'=io; -- default is cpu;
-- change optimizer modes
alter session set optimizer_mode=rule;
alter session set optimizer_mode=first_rows_1;
alter session set optimizer_mode=first_rows_10;
alter session set optimizer_mode=first_rows_100;
alter session set optimizer_mode=first_rows_1000;
alter session set optimizer_mode=all_rows;
Good Hints:
-- Table join order hints
select /*+ ordered */ -- join tables in order of FROM clause
select /*+ leading */ -- Driving table is 1st table in FROM clause
-- optimizer mode hints
select /*+ all_rows */ -- optimizer to minimize CPU resources
select /*+ first_rows_1 */ -- optimize to minimize response time
select /*+ first_rows_10 */ -- optimize to minimize response time
select /*+ first_rows_100 */ -- minimize response time
select /*+ first_rows_1000 */ -- minimize response time
insert /*+ append */ into. . . - use a empty data block for inserts
select /*+ dynamic_sampling(customer 4) */ - Use dynamic sampling
select /*+ cardinality( gtt, 500 ) */ -- estimate result set size
select /*+driving_site(huge_table)*/ -- In distributed SQL, largest table is the driving table
select /*+ no_cpu_costing */ -- use older i/o-based optimizer costing
-- table join exclusion hints
select /*+ no_use_hash(titles, sales) */ -- don't use a hash join
select /*+ no_use_nl(titles, sales) */ -- don't use nested loops
select /*+ no_use_merge(titles, sales) */ -- don't use merge join
select /*+ parallel (book 4) */
Bad Hints: (for testing only)
select /*+ rule */ - great for testing for bad metadata
-- table access Hints
select /*+ index (emp, emp_lname_idx) */ -- only use for testing
select /*+ full use_hash(emp, jobs) */
Table join hints:
select /*+ use_hash(titles, sales) */ -- force a hash join
select /*+ use_nl(titles, sales) */ -- force nested loops
select /*+ use_merge(titles, sales) */ -- force merge join

Get the Complete
Oracle SQL Tuning Information

The landmark book 'Advanced Oracle SQL Tuning The Definitive Reference' is filled with valuable information on Oracle SQL Tuning. This book includes scripts and tools to hypercharge Oracle 11g performance and you can buy it for 30% off directly from the publisher.
Get the Complete
Oracle SQL Tuning Information

The landmark book 'Advanced Oracle SQL Tuning The Definitive Reference' is filled with valuable information on Oracle SQL Tuning. This book includes scripts and tools to hypercharge Oracle 11g performance and you can buy it for 30% off directly from the publisher.

Burleson is the American Team

Note:This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals. Feel free to ask questions on our Oracle forum.

Verify experience!Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata? Oracle technology is changing and we strive to update our BC Oracle support information. If you find an error or have a suggestion for improving our content, we would appreciate your feedback. Just and include the URL for the page.




Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning


Copyright © 1996 - 2020

All rights reserved by Burleson

Oracle® is the registered trademark of Oracle Corporation.



��

Useful Oracle RAC Commands 12c cheat sheet Guide Diagnose Description Survival guide to administer Oracle Real application Cluster 12c/18c/19c. Stop/start/status RAC components, srvctl, crsctl, CRS, HAS, SCAN VIPS, OCR. SQL for Oracle NoSQL Database Cheat Sheet EXAMPLE create table if not exists Example (id integer, firstname string, lastname string, age integer, income integer, address record(street string, city string, state string, phones array(record(type enum(work, home), areacode integer, number integer))), connections array(integer), properties map(string). How to Unlock the Oracle. To unlock the Oracle you must have beaten Marked for Death with any of the 4 initial characters (maybe the Bandit can also be used but I didnt try it and getting the Bandit is Grindy AF). To get Marked for Death you must have acquired all 8 Quest Flags.


Oracle

Oracle Database Tips by Donald BurlesonFebruary 21, 2015. SQL Tuning Cheat sheet by Donald K. Burleson- Create a function-based index.

Sheet
RMAN> list backupset of database;
Cheat
RMAN> list backupset of database completed before '22-NOV-00';
RMAN> list backupset of tablespace users;

RMAN> list backup;
RMAN> list backup of tablespace SYSTEM;
RMAN> list backup of archivelog all ;
RMAN> list copy of database;

RMAN> configure channel device type disk clear ;
RMAN> report need backup days=2 database;
RMAN> report need backup days=4 datafile 'D:ORACLEORADATAOR816TEMP01.DBF';
RMAN> report obsolete;
Oracle Cheat Sheet
RMAN> crosscheck backup;
RMAN> crosscheck copy;
RMAN> crosscheck controlfilecopy '/ora01/oracle/admin/BACKUP/demo/demo_controlfile_bak_03-15-11_19:59:11' ;
RMAN> delete noprompt expired backup ;
RMAN> delete archivelog all;
RMAN> delete archivelog all completed before 'sysdate -1';
Oracle for dummies

Oracle Dba Cheat Sheet

RMAN> delete noprompt archivelog until time 'sysdate - 1';
RMAN> delete archivelog all backed up 1 times to device type disk completed before 'sysdate-1';

Crypto Oracle Cheat Sheet Pdf



I hope this article helped you. Your suggestions/feedback are most welcome.

Keep learning... Have a great day!!!