Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Monthly backup and restore of SQL

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

-back up the database- -- USE [master] GOALTER DATABASE [TEST] SET RECOVERY SIMPLE WITH NO_WAIT-- simple USE [TEST] goDBCC SHRINKFILE 0, TRUNCATEONLY)-- USE [master] GOALTER DATABASE [TEST] SET RECOVERY FULL WITH NO_WAIT-- complete declare @ RiQi varchar, @ LuJing varchar, @ Path varchar @ Path ='\\ DC01\ Buckups$\'--Network shared storage set @ RiQi = (select CONVERT (varchar (4), DATEPART (YEAR,getdate () + CONVERT (varchar (2), DATEPART (mm)) Getdate ()) set @ LuJing = @ Path + @ RiQi + 'TEST.bak'backup database TEST to disk=@LuJing with init declare @ RiQi varchar (6), @ LuJing varchar, @ Path varchar set @ Path ='\\ DC01\ Buckups$\ 'set @ RiQi = (select CONVERT (varchar (4), DATEPART (YEAR,getdate () + CONVERT (varchar (2), DATEPART (mm) Getdate ()) set @ LuJing = @ Path + @ RiQi + 'TEST.bak'backup log TEST to disk=@LuJing--- to view backup files-- -restore headeronly from disk='\\ DC01\ Buckups$\ 20183TEST.bakelite Murmuri-restore the database- -restore database TEST from disk='\\ DC01\ Buckups$\ TEST.bak' with file=1 Replace,norecovery-the first full restore restore log TEST from disk='\\ DC01\ Buckups$\ 20183TEST.bak' with file=2,replace,norecovery-the second log restore restore log TEST from disk='\\ DC01\ Buckups$\ 20183TEST.bak' with file=3,replace,norecovery-the third log restore restore log TEST from disk='\\ DC01\ Buckups$\ 20183TEST.bak' with file=4,replace,recovery-the last log restore

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report