Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ORACLE SQL ÓÅ»¯

http://kang275284.javaeye.com/blog/154331
Ò»¡¢ ÏȽéÉÜÒ»ÏÂoracle
µÄSGA£ºÊý¾Ý¿âµÄϵͳȫ¾ÖÇø£¬SGAÖ÷ÒªÓÉÈý²¿·Ö¹¹
³É£º¹²Ïí³Ø¡¢Êý¾Ý»º³åÇø¡¢ÈÕÖ¾»º³åÇø¡£
1¡¢ ¹²Ïí³ØÓÖÓÉÁ½²¿·Ö¹¹³É£º¹²ÏíSQL
Çø
ºÍÊý¾Ý×ֵ仺³åÇø¡£¹²ÏíSQL
ÇøרÃÅ´æ·ÅÓû§SQL
Ãü
Áoracle
ʹÓÃ×î½ü×îÉÙʹÓõÈÓÅÏȼ¶Ëã·¨À´¸üи²¸Ç£»Êý¾Ý×ֵ仺³åÇø£¨library

cache£©´æ·ÅÊý¾Ý¿âÔËÐеĶ¯Ì¬ÐÅÏ¢¡£Êý¾Ý¿âÔËÐÐÒ»¶Îʱ¼äºó£¬DBAÐèÒª²é¿´ÕâЩÄÚ´æÇøÓòµÄÃüÖÐÂÊÒÔ´ÓÊý¾Ý¿â½Ç¶È¶ÔÊý¾Ý¿âÐÔÄܵ÷ÓÅ¡£Í¨¹ýÖ´ÐÐÏÂÊöÓï¾ä²é
¿´£º
select (sum(pins - reloads)) / sum(pins) "Lib Cache"  from 
v$librarycache;
--²é¿´¹²ÏíSQL
ÇøµÄÖØÓÃÂÊ£¬×îºÃÔÚ90£¥ÒÔÉÏ£¬
·ñÔòÐèÒªÔö¼Ó¹²Ïí³ØµÄ´óС¡£
select (sum(gets - getmisses - usage - fixED
)) / sum(gets) "Row
Cache"  from v$rowcache;
--²é¿´Êý¾Ý×ֵ仺³åÇøµÄÃüÖÐÂÊ£¬×îºÃÔÚ90£¥ÒÔÉÏ£¬·ñÔòÐèÒªÔö¼Ó¹²Ïí³ØµÄ´óС¡£
2¡¢ 
Êý¾Ý»º³åÇø£º´æ·Åsql
ÔËÐнá¹ûץȡµ½µÄdata block£»
 SELECT
name, value   from v$sysstat   WHERE name IN ('db block gets',
'consistent gets','physical reads');
--²é¿´Êý¾Ý¿âÊý¾Ý»º³åÇøµÄʹÓÃÇé¿ö¡£²éѯ³öÀ´µÄ½á¹û¿ÉÒÔ¼ÆËã³öÀ´Êý
¾Ý»º³åÇøµÄʹÓÃÃüÖÐÂÊ£½1 - ( physical reads / (db block gets + consistent gets)
)¡£ÃüÖÐÂÊÓ¦¸ÃÔÚ90£¥ÒÔÉÏ£¬·ñÔòÐèÒªÔö¼ÓÊý¾Ý»º³åÇøµÄ´óС¡£
3¡¢ ÈÕÖ¾»º³åÇø£º´æ·ÅÊý¾Ý¿âÔËÐÐÉú³ÉµÄÈÕÖ¾¡£
select
name,value from v$sysstat where name in ('redo entries','redo log space
requests');
--²é¿´ÈÕÖ¾»º³åÇøµÄʹÓÃÇé¿ö¡£²éѯ³öµÄ½á¹û¿ÉÒÔ¼ÆËã³öÈÕÖ¾»º³åÇøµÄÉêÇëʧ°ÜÂÊ£ºÉêÇëʧ°Ü
ÂÊ£½requests/entries£¬ÉêÇëʧ°ÜÂÊÓ¦¸Ã½Ó½üÓÚ0£¬·ñÔò˵Ã÷ÈÕÖ¾»º³åÇø¿ªÉè̫С£¬ÐèÒªÔö¼ÓORACLE
Êý
¾Ý¿âµÄÈÕÖ¾»º³åÇø¡£
¶þ£®Sql
Óï¾äµÄÖ´Ðв½Ö裺
¡¡ Á˽âsql
µÄÖ´Ðв½ÖèÓÐÀûÓÚ¸üºÃµÄÓÅ»¯ËüÃÇ£¬Ã¿Ìõsql
Óï
¾äÖ´ÐÐʱ¶¼Òª¾­ÀúÒÔϼ¸²½£º
1.  Create  cursor £»
2.  Parse, if it is not
already in the shared pool.£»
3.  Any query in the statement is
processed.
4.  Bind Variables 
5.  Execute.
6.  If possible,
the statement is parallelized.
7.  Rows to be returned are fetched.

ÆäÖУ¬Pars


Ïà¹ØÎĵµ£º

ÓÃoracle utl_file°ü¶ÁÈ¡Êý¾ÝдÈëÎļþ

create or replace directory MY_DIR as '/usr/test/';
create or replace function f_exportTxt(
  --´«Èë²ÎÊý
  i_query in varchar2,
  i_separator in varchar2,
  i_dir in varchar2,
  i_filename in varchar2
) return number
is
  /**
  ** º¯ÊýÃû:f_exportTxt
&nbs ......

ORACLE EXP/IMP ²ÎÊýÏê½â

ORACLE EXP/IMP ²ÎÊýÏê½â2010-03-22 17:53OracleÊý¾Ý¿âʹÓÃIMP/EXP¹¤¾ß½øÐÐÊý¾Ýµ¼ÈëÓëµ¼³ö½éÉÜ£º
1.ʹÓÃÃüÁîÐУº
Êý¾Ýµ¼³ö£º
1.½«Êý¾Ý¿âTESTÍêÈ«µ¼³ö,Óû§ÃûsystemÃÜÂëmanagerµ¼³öµ½D:\Test_bak.dmpÖÐ
exp system/manager@ora10 file=d:\Test_bak.dmp full=y
ora10±íʾÊý¾Ý¿âÃû
2.½«Êý¾Ý¿âÖÐsystemÓû§ÓësysÓû§µÄ±íµ ......

oracle ÔöÁ¿±¸·Ý½Å±¾

oracle ÔöÁ¿±¸·Ý½Å±¾
¡¡¡¡OS :RHEL AS 4 oracle 10g
¡¡¡¡0±¸·Ý½Å±¾
¡¡¡¡#!/bin/bash
¡¡¡¡# incremental level 0 backup script
¡¡¡¡source /home/oracle/.bash_profile
¡¡¡¡current_day=`date +%Y%m%d`
¡¡¡¡mkdir /home/oracle/RMANBACKUP/$current_day
¡¡¡¡rman target / <<EOF
¡¡¡¡run
¡¡¡¡{
¡¡¡¡CONFIG ......

SQL·Ö¸î¶ººÅµÄº¯ÊýºÍÓ÷¨

      ÔÚ³ÌÐòÖÐÎÒÃÇ¿ÉÄܾ­³£»áÓöµ½ÕâÖÖÇé¿ö£¬±ÈÈçҪȡһ¸ölistboxÀïÃæµÄÑ¡ÔñÏµÃµ½µÄ½á¹û¿ÉÄÜÊÇstring ID="id1,id2,id3,id4",È»ºóÎÒÃÇÒª°ÑÕâЩID²åÈëµ½Êý¾Ý¿âÖУ¬Í¬Ê±Ã¿¸öid¶ÔÓ¦µÄÊÇÒª²åÈëÒ»Ìõ¼Ç¼¡£ÊµÏֵķ½·¨Óкܶ࣬µ«ÊÇÈç¹ûÎÒÃÇͨ¹ýÏÂÃæÕâ¸öº¯Êý£¨RecurrentSplit£©¾ÍÄܼòµ¥µÄ´ïµ½ ......

SQL¾«»ªÊÕ¼¯

order by µÄÊýÖµÐÍÁé»îʹÓÃ
select * from table_a where id=p_id order by decode(º¯Êý,'asc',1,'desc',-1)*jsny;
¿ØÖÆÊÔͼµÄ·ÃÎÊʱ¼ä£º
6.create view ...
as
select ... from where exists(select x from dual where sysdate>=8:00am and sysdate<=5:00pm)
ÃîÓÃdecodeʵÏÖÅÅÐò
select * from tabnam ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ