Shrink spaceºÏ²¢±íµÄËéƬ
Ò»°ã±íÀïÓÐËéƬÎÒÃǶ¼²ÉÓÃalter table table_name move tablespace_name,»òÕßexp,drop table table_name,impµÄ2ÖÖ·½Ê½10G¸øÎÒÃÇÆäËûµÄ·½·¨.ÏÂÃæÎÒÀ´ÊÔÒ»°É
ÓÃShrink SpaceÊÕËõOracleÊý¾Ý¶Î
ÔÚoracleÖпÉÒÔʹÓÃalter table table_name shrink spaceÊÕËõ±í,ʹÓÃshrinkÓÐÁ½¸öÇ°ÌáÌõ¼þ:
1¡¢±í±ØÐëÆôÓÃrow movement
2¡¢±í¶ÎËùÔÚ±í¿Õ¼äµÄ¶Î¿Õ¼ä¹ÜÀí(segment space management)±ØÐëΪauto
ʵÑéÈçÏ£º
--½¨Á¢Ò»¸ösegment space management auto±í¿Õ¼ä
SQL> create tablespace ts_auto datafile 'd:\oracle\product\10.2.0\oradata\orcl\ts_auto.dbf' size 100m
extent management local segment space management auto;
±í¿Õ¼äÒÑ´´½¨¡£
--½¨Òé²âÊÔ±í
SQL> create table table_auto as select * from dba_objects;
±íÒÑ´´½¨¡£
--²é¿´shrinkÇ°µÄ¿éÊýÁ¿
SQL> select blocks from dba_segments where segment_name='table_auto';
BLOCKS &n ......
Ëæ×ÅOracle¼¼ÊõºÍÊг¡µÄ¿ìËÙ·¢Õ¹£¬Ä¿Ç°´ÓÊÂOracle DBA¹¤×÷µÄÈËȺԽÀ´Ô½ÅӴ󣬴ÓһЩÎÒ¾³£È¥µÄÂÛ̳ºÍÉçÇøÖдó¼Ò·¢µÄÌû×ÓÉÏ¿´µÄ³ö£¬ºÜ¶àÈ˶¼¿ÊÍûÔÚÏÖÔÚ»ò½«À´´ÓÊÂÕâÒ»ÁìÓòµÄ¹¤×÷£¬ÏÖÔÚµÄÊг¡ÐèÇóÒ²ºÜ´ó£¬µ«²»ÄÑ¿´³ö£¬¸÷¸ö¹«Ë¾¶ÔDBAÕâ¸ö¸ÚλµÄÒªÇóÒ²Ô½À´Ô½¸ß£¬µ±È»ÁË£¬¸ßн¡¢¸ßÌôÕ½ºÍ¿É³ÖÐø·¢Õ¹µÄְҵͨµÀÎüÒýÁË´óÁ¿µÄÄêÇáÈËÈ¥³¢ÊÔ½øÈëÕâÒ»ÁìÓò¹¤×÷.¡¡
¶ÔÒ»¸öÒÔǰûÔõô½Ó´¥¹ýOracle DatabaseµÄÐÂÊÖÀ´Ëµ,ÈçºÎ²ÅÄÜ¿ìËٵijÉΪһ¸öOracle DBA,ÊÇËûÃÇÄ¿Ç°ËùÆÈÇпÊÍûµÄ.ºÜ¶àÈËÒòΪѧϰµÄ·½·¨²»¶Ô,×ßÈëÁËÎóÇø,¸Ð¾õµ½Ô½Ñ§Ô½ÀÛ,ԽѧԽºýÍ¿,ԽѧԽ²»Ã÷°×...¡¡
¹ØÓÚѧϰ·½·¨Õâ¸öÎÊÌâ,¿ÉÒÔ˵ÊÇÈÊÕß¼ûÈÊ,ÖÇÕß¼ûÖÇ.ÿ¸öÈ˶¼ÓÐÒ»Ì××Ô¼ºÒѾϰ¹ßÁËѧϰģʽºÍ½ÓÊÕÐÂÊÂÎïµÄÏ°¹ß.Oracle ACE ¸Ç¹úÇ¿ÏÈÉúΪºóÀ´µÄѧµÜѧÃÃÃÇÌá³öÁ˺ܶ౦¹óµÄÒâ¼ûºÍ½¨Òé.¡¡
ÏÂÃæժ¼һЩ¸Ç¹úÇ¿ÏÈÉú¶ÔOracle°®ºÃÕß¹ØÓÚѧϰ·½·¨ºÍ˼··½ÃæÔø¾Ìá̸µ½µÄ¾µä½¨Òé
1)¿Ë·þÐÄÀí¿Ö¾åÕÏ°
2)ѧ»áÈÏÕæÔĶÁ,»ù´¡ÖØÓÚÒ»ÇÐ
3)Óɵ㼰Ãæ¡¢ÓÉdzÈëÉî
4)ͨ¹ýʵ¼ù¼ìÑéËùѧ֪ʶ
5)¼û΢֪Öø¡¡
ÐËȤ + ÇÚ·Ü + ¼á³Ö + ·½·¨≈³É¹¦
¾ß±¸ÁËÕâЩ»ù± ......
dba_¿ªÍ·
dba_users Êý¾Ý¿âÓû§ÐÅÏ¢
dba_segments ±í¶ÎÐÅÏ¢
dba_extents Êý¾ÝÇøÐÅÏ¢
dba_objects Êý¾Ý¿â¶ÔÏóÐÅÏ¢
dba_tablespaces Êý¾Ý¿â±í¿Õ¼äÐÅÏ¢
dba_data_files Êý¾ÝÎļþÉèÖÃÐÅÏ¢
dba_temp_files ÁÙʱÊý¾ÝÎļþÐÅÏ¢
dba_rollback_segs »Ø¹ö¶ÎÐÅÏ¢
dba_ts_quotas Óû§±í¿Õ¼äÅä¶îÐÅÏ¢
dba_free_space Êý¾Ý¿â¿ÕÏпռäÐÅÏ¢
dba_profiles Êý¾Ý¿âÓû§×ÊÔ´ÏÞÖÆÐÅÏ¢
dba_sys_privs Óû§µÄϵͳȨÏÞÐÅÏ¢
dba_tab_privs Óû§¾ßÓеĶÔÏóȨÏÞÐÅÏ¢
dba_col_privs Óû§¾ßÓеÄÁжÔÏóȨÏÞÐÅÏ¢
dba_role_privs Óû§¾ßÓеĽÇÉ«ÐÅÏ¢
dba_audit_trail Éó¼Æ¸ú×ټǼÐÅÏ¢
dba_stmt_audit_opts Éó¼ÆÉèÖÃÐÅÏ¢
dba_audit_ ......
1. ×ÊÔ´Õýæ´íÎó
ÔÚpl/sql developer¿ªÒ»¸ösql window,Ö´ÐÐÈçÏÂsql²»Ìá½»
Create Table aa(a Int);
Insert Into aa Values(234);
ÔÙ¿ªÒ»¸ösqlwindowÖ´ÐÐ
Drop Table aa
¾Í»á±¨ora-00054´íÎó¡£
OracleËøµÄ֪ʶ£º
´ËʱOracleÒѾ¶Ô·µ»ØµÄ½á¹û¼¯ÉϼÓÁËÅÅËüµÄÐм¶Ëø£¬ËùÓÐÆäËû¶ÔÕâЩÊý¾Ý½øÐеÄÐ޸Ļòɾ³ý²Ù×÷¶¼±ØÐëµÈ´ýÕâ¸öËøµÄÊÍ·Å£¬²úÉúµÄÍâÔÚÏÖÏó¾ÍÊÇÆäËûµÄ²Ù×÷½«·¢Éú×èÈû£¬Õâ¸öÕâ¸ö²Ù×÷commit»òrollback.
ͬÑùÕâ¸ö²éѯµÄÊÂÎñ½«»á¶Ô¸Ã±í¼Ó±í¼¶Ëø£¬²»ÔÊÐí¶Ô¸Ã±íµÄÈκÎddl²Ù×÷£¬·ñÔò½«»á±¨³öora-00054´íÎó£º:resource busy and acquire with nowait specified.
ÒòΪDDLÓï¾äÐèÒª±íÉϵÄÅÅËûËø,¶øÕâÓëDMLÓï¾äÒÑÔÚ±íÉÏ·ÅÖÃÁ˹²ÏíËøÏà³åÍ»,ËùÒÔÊÔͼÔÚ±íÖвåÈëÒ»¸öÁеÄÕâÌõDDLÓï¾ä»áʧ°Ü.ÐèҪעÒâµÄÊÇ:ÔÚÀàËÆÇé¿öÏÂ,DMLÓï¾ä»áµÈ´ý²¢²»¶Ï½øÐг¢ÊÔ,Ö±ÖÁ»ñµÃÆäËùÐèµÄËø(»»¾ä»°Ëµ¾ÍÊǹÒÆð);¶øDDLÓï¾äÔò»áÓÉÓÚ´íÎóÁ¢¼´ÖÕÖ¹.
ejb BllRequireNewTransÔÚejb-jar.xml±»ÅäÖÃΪÐèÒªÒ»¸öÐÂÊÂÎñ£¬ËùÒÔµ÷ÓôËejb·½·¨µÄÊÂÎñºÍBllRequireNewTrans²»ÔÚÒ»¸öÊÂÎñÖÐ,²»×¢Òâ¾Í»áÒý·¢ÉÏÃæµÄ´íÎó¡£
<container-transaction>
<method>
&nb ......
create or replace procedure TestJiaoJi
is
type nt_table_type is table of number;
nt1 nt_table_type:=nt_table_type(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
nt2 nt_table_type:=nt_table_type(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
result nt_table_type;
iTotalNum integer:=0;--¼Ç¼½»¼¯¸öÊý,²»°üÀ¨0
begin
for n in 1..5
loop
nt1(n) :=n;
nt2(n) :=n+2;
end loop;
result:=nt1 multiset intersect nt2;--Çó½»¼¯
dbms_output.put_line('½»¼¯ÊÇ:');
for i in 1..result.count
loop
if(result(i)!=0) then
  ......
Partition outer join is a new mechanism in 10g to "invent" data to fill the gaps in non-contiguous results. In 10g there are many methods to deal with such a problem (including the awe-inspiring, but equally terrifying, MODEL clause). In older versions of Oracle, "data-densification" was not as simple and certainly less efficient than it has now become.
the problem
This article has been motivated by a response I gave to a problem raised on an Oracle developer forum. Our requirement is to produce a report that details customer spending for each month of the year. Our database only records actual spend, so for any given month, data for dormant or idle customers will have to be generated.
setup
First, we'll create a mock CUSTOMER_ORDERS table with sparse data to represent customer spending. To keep the example simple, we'll denormalise the customer name onto the orders table.
SQL> CREATE TABLE customer_orders (name, dt, amt)
2 AS
3 SEL ......