Halim, a Georgia Tech graduate Senior Database Engineer/Data Architect based in Atlanta, USA, is an Oracle OCP DBA and Developer, Certified Cloud Architect Professional, and OCI Autonomous Database Specialist. With extensive expertise in database design, configuration, tuning, capacity planning, RAC, DG, scripting, Python, APEX, and PL/SQL, he combines technical mastery with a passion for innovation. Notably, Halim secured 16th place worldwide in PL/SQL Challenge Cup Playoff on the year 2010.
Sunday, October 2, 2011
How to Prepare a SQL select statement for SQL Tuning in oracle?
1) connect sqlplus, then set following command
set linesize 1000
set pagesize 1000
set trimout on trimspool on
2) then issue following command
alter session set statistics_level=all;
3) [then Run your query ]
4) then issue following command
select * from table ( sys.dbms_xplan.display_cursor( '','','ADVANCED ALLSTATS LAST'));
5)
and then copy&paste the sqlplus output for sql tuning purpose.
example:-
SQL*Plus: Release 10.2.0.1.0 - Production on Sun Oct 2 13:11:14 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL>
SQL> conn scott/tiger
Connected.
SQL>
SQL>
SQL> set linesize 1000
SQL>
SQL> set pagesize 1000
SQL>
SQL> set trimout on trimspool on
SQL>
SQL> alter session set statistics_level=all;
Session altered.
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL> select ename,sum(sal) from emp where ename like '%L%' group by ename order by ename ;
ENAME SUM(SAL)
---------- ----------
ALLEN 1600
BLAKE 2850
CLARK 2450
MILLER 1300
SQL>
SQL> select * from table ( sys.dbms_xplan.display_cursor( '','','ADVANCED ALLSTATS LAST'));
PLAN_TABLE_OUTPUT
-------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------
SQL_ID 0rxmvbjh43c88, child number 0
-------------------------------------
select ename,sum(sal) from emp where ename like '%L%' group by ename order by ename
Plan hash value: 15469362
-------------------------------------------------------------------------------------------------------------------
-----------------------------
| Id | Operation | Name | Starts | E-Rows |E-Bytes| Cost (%CPU)| E-Time | A-Rows | A-Time | Buffers
| OMem | 1Mem | Used-Mem |
-------------------------------------------------------------------------------------------------------------------
-----------------------------
| 1 | SORT GROUP BY | | 1 | 4 | 80 | 4 (25)| 00:00:01 | 4 |00:00:00.01 | 7
| 9216 | 9216 | 8192 (0)|
|* 2 | TABLE ACCESS FULL| EMP | 1 | 4 | 80 | 3 (0)| 00:00:01 | 4 |00:00:00.01 | 7
| | | |
-------------------------------------------------------------------------------------------------------------------
-----------------------------
Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------
1 - SEL$1
2 - SEL$1 / EMP@SEL$1
Outline Data
-------------
/*+
BEGIN_OUTLINE_DATA
IGNORE_OPTIM_EMBEDDED_HINTS
OPTIMIZER_FEATURES_ENABLE('10.2.0.1')
ALL_ROWS
OUTLINE_LEAF(@"SEL$1")
FULL(@"SEL$1" "EMP"@"SEL$1")
END_OUTLINE_DATA
*/
Predicate Information (identified by operation id):
---------------------------------------------------
2 - filter("ENAME" LIKE '%L%')
Column Projection Information (identified by operation id):
-----------------------------------------------------------
1 - (#keys=1) "ENAME"[VARCHAR2,10], SUM("SAL")[22]
2 - "ENAME"[VARCHAR2,10], "SAL"[NUMBER,22]
Note
-----
- dynamic sampling used for this statement
47 rows selected.
SQL>
Thursday, September 22, 2011
In 32-bit Linux operating system, Memory utilization limit for oracle database
On a 32-bit Linux operating system, without Physical Address Extension (PAE), the physical memory is divided into a 3GB user space and a 1GB kernel space. It is therefore possible to create a 2.7GB SGA, but you will need make several changes at the Linux operating system level by changing the mapped base. In the case of a 2.7GB SGA, you would want to set the SHMMAX parameter to 3GB.
Maximum value of the SHMMAX parameter is 4GB In 32-bit Linux operating system .
Wednesday, September 21, 2011
ORA-03115:unsupported network datatype or representation in toad 9.6
Action: Upgrade the older version of Oracle and try again.
Problem:-
i am connecting remote oracle database 10g using oracle developer 6i home as a "installed clients" conncetion location in Toad.
its give me this above error, when i am trying to execute AWR report via toad.
Solution:
after then I change the conncetion location home to "oraDB10g_home" in replace of developer 6i home.
then above error is gone.
so this problem is happen for lower version of installed clients net8 connection home.
Thursday, September 15, 2011
ORA-28056:writing audit records to windows event log failed
and could not write log anymore.
Solution:-
1) clear the event log
as follows
Control Panel->Administrative Tools->Event Viewer->
right click on specific event viewer then > Clear All Events
Note:- you can backup event viewer log. it is just log nothing else.
Wednesday, September 14, 2011
Oracle Streams and Oracle(CDC) Change Data Capture comparative description
Tom kytes says
think of streams like a brick. think of CDC like a building made of brick.
streams can be used to build CDC.
CDC is built on top of streams (async CDC is anyway, sync CDC is trigger based).
they are complimentary, not really competing.
|
| ||
| Definition | Change Data Capture is database functionality that enables capturing incremental changes with predefined API against an Oracle Database and to make the change data available for further use. | Streams provides a flow mechanism in which, the database changes flow in a streamed manner, hence the name Streams. It is a very broad and flexible way of capturing changes, moving them, and applying them. |
| Purpose | CDC is for monitoring changes in a database. | For Information Sharing/Distribution |
| Mechanism | Source TABLE => Change Table => Subscriber view =>TARGET system | CATPURE => Staging => APPLY |
| DML and DDL changes | You can capture only DML changes CDC is *NOT* supported for doing DDL operation | You can also capture DDL changes.Note 238457.1 What DML and DDL is Captured by Streams |
| Usage | CDC most commonly used to capture transactional changes from an OLTP system and publish the changes to one or more subscription systems use Change Data Capture to simplify ET L (extraction and transportation of relational data) in data warehouse applications. The advantage of CDC is that it is intended for extracting data in a data-warehousing environment so you can process only the changed data not entire tables and makes the change data available for further use. | Used for the following: |
| How does it work | Synchronous Change Data Capture uses triggers on the source database to capture change data. |
|
|
| The internal Change Data Capture (CDC) tasks of Streams Capture and Apply are | For bidirectional/unidirectional Streams replication does not have any restriction on Oracle version or OS . |
| With respect to Non Oracle Databases |
|
|
| With respect to logical Standby |
| Streams cannot be used in 9i and 10g with Logical Standby as logical standby cannot run jobs BUT in 11g you can use Streams with Logical Standby only in Combined Capture and Apply mode |
|
| CDC offers cost savings by simplifying the extraction of change data from database as its part of Oracle 9i database and later versions. | Integrated Feature of Oracle9i Database |
| LIMITATION | Asynchronous mode CDC purely worked based on logged operations, so any non-logged DML operations are not captured. | TDE columns are not supported by Oracle Streams in 9i and 10g but supported in 11g http://download.oracle.com/docs/cd/B19306_01/server.102/b14229/strms_over.htm |
| Reference | Oracle® Database Data Warehousing Guide 10g Release 2 (10.2) Part Number B14223-02 http://download.oracle.com/docs/cd/B19306_01/server.102/b14223.pdf |
|
My Blog List
-
-
-
Savepoint Funny3 months ago
-
-
-
-
-
-
-
-
-
Moving Sideways10 years ago
-
-
Upcoming Events...12 years ago
-