java±¸·Ýsql serverÊý¾Ý¿â ´æ´¢¹ý³Ì
½ñÌì¸ø´ó¼Ò·ÖÏíÒ»ÏÂÈçºÎ±¸·ÝºÍ»Ø¸´sql server Êý¾Ý£¬
Ê×ÏÈÈ·±£Äã¾ßÓÐDBµÄ×î¸ßȨÏÞ
ÔÚJAVA´úÂëÖÐ Äã¿ÉÒÔÕâÑùдpublic class Opp extends TestCase{
public void test1()
{
try
{
Connection con = DBUtils.getConn();
String sql="backup database tdzl to disk='d:\\tdzl.bak'";
Statement st = con.createStatement();
st=con.createStatement();
st.execute(sql);
}catch(Exception e)
{
e.printStackTrace();
}
}
}
ÔÚMASTERÊý¾Ý¿âÖд´½¨Á½¸ö´æ´¢¹ý³Ì
p1
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER proc [dbo].[killspid] (@dbname varchar(20))
as
begin
declare @sql nvarchar(500)
declare @spid int
set @sql='declare getspid cursor for select spid from sysprocesses where dbid=db_id('''+@dbname+''')'
exec (@sql)
open getspid
fetch next from getspid into @spid
while @@fetch_status <> -1
begin
exec('kill '+@spid)
fetch next from getspid into @spid
end
close getspid
deallocate getspid
end
p2
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[restore_database]
-- Add the parameters for the stored procedure here
@db_name varchar(30),
@db_path varchar(80)
AS
BEGIN
execute killspid @db_name
restore database @db_name from disk=@db_path with replace
END
»Ø¸´Ê±µ÷ÓÃÉÏÊö´æ´¢¹ý³Ì¾ÍµÃÒÔʵÏÖ
ÏÂһƪ½«½âÊÍÈçºÎͨ¹ýJAVAµ÷Óøô洢¹ý³Ì
Ïà¹ØÎĵµ£º
Òý:ÏÖÔÚһЩÖÐСÆóÒµ¶¼¹ã·ºÊ¹ÓÃMS Windows NT ΪÍøÂç²Ù×÷ϵͳƽ̨£¬SQL Server Ϊºǫ́Êý¾Ý¿â¹¹½¨ÆóÒµÄÚ²¿µÄ¸÷ÖÖ¹ÜÀíϵͳ£¬¸Ã³ÉÊì¼¼ÊõµÄÆÕ¼°£¬ÄÜÓÐЧµØ°ïÖúÆóÒµ¶ÔÄÚ²¿Êý¾Ý½øÐйÜÀí¡£ÕâÀàÓ¦ÓÃÖУ¬¶ÔÊý¾Ý¿âµÄ±¸·ÝÊǺÜÖØÒªµÄÒ»Ï×÷£¬ÆäÖØÒªÐÔ²»±Ø¶àÑÔ¡£
¡¡¡¡Æ䱸·ÝµÄ·½·¨ºÜ¶à£¬È磺ÔÚһЩ¹æÄ£½Ï´ó¡¢×ʽðÐÛºñµÄÆóÒµ£¬ÍùÍùÊÇ ......
ÈçºÎÓÃÃüÁîÉú³ÉSQL SERVER½Å±¾
--ÒÔÏÂÉú³ÉÕû¸öÊý¾Ý¿âµÄSQL½Å±¾£¬ÎÒ²âÊÔÁË£¬Ï൱ºÃÓá£
--(scptxfr.exeµÄ·¾¶ÒªÕýÈ·ÒÔÏÂÊÇÎҵķ¾¶)
declare @cMd varchar(1000)
set @cmd = 'master.dbo.xp_cm ......
ϵͳ»·¾³£ºwindows xp pro
Êý¾Ý¿â£ºMS Sql 2000
IIS: 5.1 ASP.NET2.0
ÒòΪ´úÂëÊÇ2.0.netµÄ,ûÓа취ֻºÃ°²×°ÁË.netÏÂÔØÄã¿ÉÒÔȥ΢ÈíµÄÍøÕ¾ÉÏÈ¥ÏÂÔØ.Õâ¸öÊÇÃâ·ÑµÄÈí¼þ£¬ÎÒÖªµÀµÄÊÇÃâ·ÑµÄ¡£
Êý¾Ý¿â×öÁËѹËõºó׺ÊÇbakµÄ£¬ËùÒÔÊý¾Ý¿â²»ÄÜÖ±½ÓʹÓã¬ÐèÒªµ¼ÈëÔÚÍøÉϲéÁ˺ܶàµÄ×ÊÁϵ«ÊDz»¶à£¬µ«×Ô¼º³É¹¦µ¼ÈëÁË£¬Ð´ÏÂÀ´×öÒ»¸ö±¸ ......
д³ÌÐòµÄÈË£¬ÍùÍùÐèÒª·ÖÎöËùдµÄSQLÓï¾äÊÇ·ñÒѾÓÅ»¯¹ýÁË£¬·þÎñÆ÷µÄÏìӦʱ¼äÓжà¿ì£¬Õâ¸öʱºò¾ÍÐèÒªÓõ½SQLµÄSTATISTICS״ֵ̬À´²é¿´ÁË¡£
ͨ¹ýÉèÖÃSTATISTICSÎÒÃÇ¿ÉÒԲ鿴ִÐÐSQLʱµÄϵͳÇé¿ö¡£Ñ¡ÏîÓÐPROFILE£¬IO £¬TIME¡£½éÉÜÈçÏ£º
SET STATISTICS PROFILE ON£ºÏÔʾ·ÖÎö ......
2008µÄSSMS±È2005°æÒª¶àÏûºÄÒ»±¶×óÓÒµÄÄڴ棬¶øÇÒËƺõ²»»á×Ô¼ºÊÍ·Å£¬ÖÁÉÙÒ²ÊÇÄÚ´æ¹ÜÀí²»ÊǺܺÏÀí£¬ÍùÍù´ò¿ª¼¸¸ö²éѯ´°¿Ú½øÐвéѯºóÄÚ´æ¾Í»áÉýµ½ÄÑÒÔ200MBµ½300MB£¬ÇҹصôºóÄÚ´æ²»»áÊÍ·Å£¬¶ø2005µÄSSMSÒ»°ãÖ»ÊÇÔÚ100MB×óÓÒ¡£¶ÔÓµÓдóÄÚ´æµÄµçÄÔÀ´ËµÕâ¿ÉÄܲ»Ëãʲô£¬µ«¶ÔÄÚ´æÖ»ÓÐ1G»ò¸üÉÙµÄÓû§À´Ëµ£¬Õ⼸ºõÊDz»¿ÉÈÝÈ̵ģ¬ÒòÎ ......