SQL Server ÊÂÎñÈÕÖ¾ÊÕËõС½á
¶ÔÓÚÿһ¸öÊý¾Ý¿âÀ´½²£¬¶¼ÐèÒªÖÁÉÙÒ»¸öÊÂÎñÈÕÖ¾Îļþ¡£ÊÂÎñÈÕÖ¾ÎļþÊÇÕû¸öÊý¾Ý¿âµÄѪҺ£¬Èç¹ûûÓÐÊÂÎñÈÕÖ¾µÄ»°£¬ÄÇô½«ÎÞ·¨½øÐÐÈκβÙ×÷¡£
ÊÂÎñÈÕÖ¾ÓÐʲô¶«Î÷£¿
ÊÂÎñÈÕÖ¾¼Ç¼×ÅÔÚÏà¹ØÊý¾Ý¿âÉϵIJÙ×÷£¬Í¬Ê±»¹´æ´¢Êý¾Ý¿â»Ö¸´(recovery)µÄÏà¹ØÐÅÏ¢¡£
ÊÂÎñÈÕÖ¾ÓëÊý¾Ý¿â»Ö¸´(recovery)ÊÇÃÜÇÐÏà¹ØµÄ£¬ÆäʵÊý¾Ý¿âÔÚÆô¶¯Ê±£¬±ã»á½øÐÐÏà¹ØµÄ»Ö¸´(recovery)²Ù×÷£¬ÈçÏÂËùʾ¡£µ±È»£¬ÔÚÊý¾Ý¿â»¹Ôʱ£¬Ò²¿ÉÒÔÖ¸¶¨ÊÖ¹¤»Ö¸´(recovery).ÈκÎÔÚÊý¾Ý¿âÉϵĸı䣬Èç¹ûÔÚÊÂÎñÈÕÖ¾ÄÚ±»±ê¼ÇΪÒÑÌá½»£¬²¢ÓÃÒ»¸öLSN(LOG SEQUENCE NUMBER)À´±êʶ£¬Í¬Ê±Ïà¹Ø¸Ä±ä¾Í»áÌåÏÖÔÚÊý¾ÝÎļþÉÏ£¬¶ø±»±ê¼ÇΪδÌá½»µÄ¸Ä±ä½«²»»áÌåÏÖÔÚÊý¾ÝÎļþÉÏ¡£
2010-01-12 18:31:48.72 spid7s Recovery is complete. This is an informationa message only. No user action is required.
ÊÂÎñÈÕÖ¾Îļþ»¹´æ´¢×ÅÊý¾Ý¿âÐèÒª»Ø¹öµÄÏà¹ØÐÅÏ¢¡£ÔÚSQL ServerÊý¾Ý¿âÉÏ£¬Ä¬ÈÏÊÇÒþʽÌá½»µÄ£¬Ò²¾ÍÊÇ˵ÔÚ²éѯ·ÖÎöÆ÷ÀïÃæ½øÐеÄÿһ¸ö²Ù×÷£¬ÔÚ²Ù×÷Íê³Éºó£¬¶¼ÊÇĬÈÏÒѾcommit£¬µ«Èç¹ûͨ¹ýÖ¸¶¨begin tran ºÍrollback tranµÄÃüÁîÀ´±êʶÊÂÎñʱ£¬rollback tran¾ÍÐèҪʹÓÃÊÂÎñÈÕÖ¾ÄÚµÄÏà¹ØÐÅÏ¢²Å¿ÉÒԻعö¡£µ±È»£¬Èç¹ûSQL ServerÓöµ½Ïà¹Ø´íÎóʱ£¬ÈçËÀËø£¬ÄÇôҲ»á²úÉúÒ»¸öÄÚ²¿»Ø¹ö£¬ÕâЩ¶¼ÐèÒªÓõ½ÊÂÎñÈÕÖ¾Îļþ¡£
ΪʲôҪÊÕËõÊÂÎñÈÕÖ¾£¿
ÊÕËõÈÕÖ¾µÄÔÒòÓкܶàÖÖ£¬ÓÐЩÔòÊÇ¿¼Âǿռ䲻×㣬ÓÐЩÔòÊÇÓ¦ÓóÌÐòÏÞÖƵ¼Öµģ¬Ò»°ãÇé¿öÏ£¬ÊDz»½¨Òé¶ÔÊÂÎñÈÕÖ¾½øÐÐÆäËû¸Ä±äµÄ£¬ÈçÐèÒª¿ØÖÆÊÂÎñÈÕÖ¾µÄ´óС£¬Ôò¿ÉÒÔͨ¹ý°²ÅÅÊÂÎñÈÕÖ¾±¸·ÝÀ´½â¾ö¡£Èç¹ûÈ·¶¨ÊÂÎñÈÕÖ¾°üº¬½«²»ÔÙʹÓõÄδʹÓÿռ䣬Ôò¿ÉÒÔͨ¹ý¼õÉÙÊÂÎñÈÕÖ¾µÄ´óС£¬ÒÔ±ã»ØÊÕ¹ý¶à¿Õ¼ä¡£µ«ÕâÖÖÇé¿ö¶ÔÓÚÒ»¸öDBAÀ´½²£¬Ó¦¸ÃÒª¾¡Á¿±ÜÃâ¡£
½öµ±Êý¾Ý¿â´¦ÓÚÁª»ú״̬£¬¶øÇÒÖÁÉÙÒ»¸öÐéÄâÈÕÖ¾Îļþ¿ÉÓÃʱ£¬ÊÕËõ²Å»á·¢Éú¡£ÔÚijЩÇé¿öÏ£¬Ö±µ½ÏÂÒ»¸öÈÕÖ¾½Ø¶Ïºó£¬²ÅÄÜÊÕËõÈÕÖ¾¡£
ÊÂÎñÈÕÖ¾ÊÕËõµÄÔÀí
ÿ¸öÊÂÎñÈÕÖ¾Óɶà¸öÐéÄâÈÕÖ¾Îļþ×é³É(virtual log file).ÐéÄâÈÕÖ¾ÎļþûÓй̶¨µÄ´óС£¬Ò²Ã»Óй̶¨µÄ¸öÊý¡£ÔÚ´´½¨ÊÂÎñÈÕÖ¾Îļþ»òÕßÀ©Õ¹ÊÂÎñÈÕÖ¾Îļþʱ£¬SQL SERVER±ã»á×Ô¶¯´´½¨ºÏÊÊ´óСµÄÐéÄâÈÕÖ¾Îļþ£¬DBAÎÞ·¨¿ØÖÆÐéÄâÈÕÖ¾ÎļþµÄ´óСºÍ¸öÊý¡£ÔÚÀ©Õ¹ÈÕÖ¾Îļþºó£¬ÐéÄâÎļþµÄ´óСÊÇÏÖÓÐÈÕÖ¾´óСºÍÐÂÎļþÔöÁ¿´ó
Ïà¹ØÎĵµ£º
a.Êý¾Ý¿â»ù´¡
i.¸ÅÄ±í¼°Ïà¹Ø²Ù×÷¶ÔÏóµÄ¼¯ºÏ£¨Ö÷Êý¾ÝÎļþmdf£¬¶þ¼¶Êý¾ÝÎļþndf£¬ÈÕÖ¾ldf£©
ii.×é³É£ºÏµÍ³£º master(¼Ç¼ÁËËùÓеķþÎñÆ÷ϵͳÐÅÏ¢)
,model£¨¼Ç¼ÁËËùÓÐÁÙʱ¼Ç¼£¬Á´½Ó¶Ï¿ªÊ±£¬Êý¾Ý¶ªÊ§£©
Tempdb£¨Êý¾ÝÄ£°å¿â£¬º¬´´½¨¿âʱµÄȱʡÊý¾Ý£©
, ......
CREATE PROCEDURE dbo.OutputData
@tablename varchar(200)
AS
declare @column varchar(1000)
declare @ ......
oracle³£ÓþµäSQL²éѯ
³£ÓÃSQL²éѯ£º
1¡¢²é¿´±í¿Õ¼äµÄÃû³Æ¼°´óС
select t.tablespace_name, round(sum(bytes/(1024*1024)),0) ts_size
from dba_tablespaces t, dba_data_files d
where t.tablespace_name = d.tablespace_name
group by t.tablespace_name;
2¡¢²é¿´±í¿Õ¼äÎïÀíÎļþµÄÃû³Æ ......
ÔÚSQLÓï¾äÓÅ»¯¹ý³ÌÖУ¬ÎÒÃǾ³£»áÓõ½hint,ÏÖ×ܽáÒ»ÏÂÔÚSQLÓÅ»¯¹ý³ÌÖг£¼ûOracle HINTµÄÓ÷¨£º
1. /*+ALL_ROWS*/
±íÃ÷¶ÔÓï¾ä¿éÑ¡Ôñ»ùÓÚ¿ªÏúµÄÓÅ»¯·½·¨,²¢»ñµÃ×î¼ÑÍÌÍÂÁ¿,ʹ×ÊÔ´ÏûºÄ×îС»¯.
ÀýÈç:
SELECT /*+ALL+_ROWS*/ EMP_NO,EMP_NAM,DAT_IN from BSEMPMS WHERE EMP_NO='SCOTT';
2. /*+FIRST_ROWS*/
±íÃ÷¶ÔÓï¾ ......
create or replace procedure c
(
v_deptno in emp.deptno%type,
v_max out emp.sal%type
)
as
begin
select max(sal+nvl(comm,0)) into v_max from emp where deptno=v_deptno;
end;
create or replace procedure cc
(
v_empno in emp.empno%type,
v_sal out emp.sal%type,
v_comm out emp.comm% ......