Home >Database >Mysql Tutorial >通过T-SQL语句实现数据库备份与还原的代码

通过T-SQL语句实现数据库备份与还原的代码

WBOY
WBOYOriginal
2016-06-07 18:03:421101browse

利用T-SQL语句,实现数据库的备份与还原的功能,需要的朋友可以参考下。







( dbo.sysobjects id (N) xtype (N, N, N))
.


f_getdbpath( sysname)
()


()
()
((filename)) master..sysdatabases name

((filename)) master..sysdatabases name


((,(,),))

((,(,),))
()








( dbo.sysobjects id (N) (id, N) )
.


p_backupdb
sysname, (), (), (),
()
(,) ()
(,) dbo.f_getdbpath()
(,)
(((,,)
,,(,(),))
,,((,(),),,))





()








( dbo.sysobjects id (N) (id, N) )
.


p_RestoreDb
(), sysname, (), (), , ,
()

(,)
()
, (,)
(,(,),)
, (,)
(,(,))
,()

(,) dbo.f_getdbpath()



( )
(,)




(), (),

#tb(ln (),pn (),tp (),fgn (),sz numeric(,),Msz numeric(,))
#tb ()
#f ln,tp #tb
#f
#f ,



( )

,
#f ,

#f
#f




()
#spid
spid(spid ()) master..sysprocesses dbid()
#spid
#spid


()
#spid

#spid
#spid


()






( dbo.sysobjects id (N) (id, N) )
.


p_createjob
(), (), sysname, (), ,
(,) ()

msdb..sp_add_job

msdb..sp_add_jobstep ,
,
,
,
,
,
, ,



,



msdb..sp_add_jobschedule ,
,
, , , , ,





()

p_createjob ,,

DF
p_createjob ,,


p_createjob ,,,



()


p_createjob ,,,


p_createjob ,,,


p_createjob ,,,
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn