Automatic SQL Backup/Restore

polonious
Member Posts: 64
Hi guys,
I'm trying to think of a good way of automating a backup/restore of a SQL database on a weekly/biweekly basis. Anybody know if this is possible through a SQL script or similar, or have any examples?
Any help would be great. Thanks.
I'm trying to think of a good way of automating a backup/restore of a SQL database on a weekly/biweekly basis. Anybody know if this is possible through a SQL script or similar, or have any examples?
Any help would be great. Thanks.
0
Comments
-
Sure, use the SQL Server job scheduler. Read all about it in Books Online (Start, All programs, SQL Server, Documentation and Tutorials).0
-
I should clarify, it's a backup of a Live DB and restoring to a Test DB to keep the test environment up to date.0
-
DenSter wrote:Sure, use the SQL Server job scheduler. Read all about it in Books Online (Start, All programs, SQL Server, Documentation and Tutorials).0
-
[Topic moved from 'NAV/Navision' forum to 'SQL General' forum]Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
In SSMS you could quickly create the require TSQL scripts - as DenSter said, you'll find the details in "Books Online" & Co..
Here an example:BACKUP DATABASE [Navision] -- Live DB TO DISK = N'D:\Backup\LiveToTest.bak' WITH DESCRIPTION = N'Full Backup for Test DB', NOFORMAT, INIT, NAME = N'LiveToTest', SKIP, NOREWIND, NOUNLOAD, STATS = 10 GO RESTORE DATABASE [TestDB] -- Test DB FROM DISK = N'D:\Backup\LiveToTest.bak' WITH FILE = 1, MOVE N'NAV_Data' TO N'D:\Databases\TestDB.mdf', -- change mapping MOVE N'NAV_1_Data' TO N'D:\Databases\TestDB_1.ndf', -- change mapping MOVE N'NAV_Log' TO N'E:\Databases\TestDB_2.ldf', -- change mapping NOUNLOAD, REPLACE, STATS = 10 GO
Put something like this in a Job and execute as you like :thumbsup:Jörg A. Stryk (MVP - Dynamics NAV)
NAV/SQL Performance Optimization & Troubleshooting
STRYK System Improvement
The Blog - The Book - The Tool0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions