Maintenance Plans For Backup Database dan Restore Database Applies To: Microsoft SQL Server 2008 R2 Tasks: Backup Database and Restore using Maintenance Plans. Example: • Backup Database “DB_Test” from Server “IT107\SQLSVR_1” to Local Drive  Maintenance Plan Name : Backup •

Restore file backup, to Database “DB_Test_Simulasi” in Server “IT107\SQLSVR_2”  Maintenance Plan Name : Restore

1

Maintenance Plan Name : Backup 1. a. Open “Management > Maintenance Plans”

b. Right-click, choose “New Maintenance Plan”  c. Type for “Name”, Example : Backup. Click “OK”.

2

2.

3. Save the file, Example: Backup – sa [Design].

4. Choose “Manage Connection…” 

3

5. Choose “Local Server Connection”  6. Type for “Password”. Click “OK”.

7. To save, press “CTR + S”  Note: If the Design is saved, will like this.

4

8. Choose “Maintenance Plan Tasks > Execute T-SQL-Statement Task”

And drag tasks to Designer Surface.

9.

5

10. Check location path of database.

6

11. Create Task-1 a. Right-click at “Execute T-SQL Statement Task”

b. Choose “Edit…” 

c. Type this code to “T-SQL Statement”  /* BEGIN */ USE [DB_Test] GO -- Truncate the log by changing the database recovery model to SIMPLE. ALTER DATABASE [DB_Test] SET RECOVERY SIMPLE; GO -- Shrink the truncated log file to 1 MB. DBCC SHRINKFILE (DB_Test); GO DBCC SHRINKFILE (DB_Test_Log, 1); GO -- Reset the database recovery model. ALTER DATABASE [DB_Test] SET RECOVERY FULL; GO USE master GO /* END */

7

d.

e. Click “OK”. f. Note: To Copy the code, choose “View T-SQL” 

8

12.

9

13. Create Task-2 a. Right-click at “Execute T-SQL Statement Task”

b. Choose “Edit…” 

c. Type this code to “T-SQL Statement” 

/* BEGIN */ Declare @Backup as varchar(100), @BackupFile as varchar(100) select @BackupFile='DB_Test' +'_'+ convert(varchar(20),getdate(),12) +'_'+ replace (CONVERT(VARCHAR(5),GETDATE(),108), ':', '')+'.dat' select @Backup='C:\BackupTest\'+@BackupFile backup database [DB_Test] to DISK=@Backup Declare @CopyCommand as varchar(200) select @CopyCommand='Copy '+@Backup+' \\xxx.xxx.x.44\Share\BackupDB\'+@BackupFile EXEC master..xp_cmdshell @CopyCommand,NO_OUTPUT select @CopyCommand='Copy '+@Backup+' \\xxx.xxx.x.44\Share\RestoreDB\DB_Test.DAT' EXEC master..xp_cmdshell @CopyCommand,NO_OUTPUT /* END */

10

d.

e. Click “OK”. f. Note: To Copy the code, choose “View T-SQL” 

11

14. Create pointer to connect from “Task – 1” to “Task – 2” a. Active Pointer at “Task – 1”

b. Drag pointer ( color:green ) from “Task – 1” to “Task – 2”

15. Check for Maintenance Plan Name : Backup, that already create.

12

16. Set Schedule Time.

a. Choose icon “



b. If you want, run this task at once, choose “Schedule Type” : One Time.

c. Click “OK”.

13

17. Check for Local Drive for Backup. There is no file.

18. Go to “Management > Maintenance Plans > Backup” Choose “Execute”.

14

19. Check for Local Drive for Backup.

20. Backup Database successfully.

15

Maintenance Plan Name : Restore 21. a. Open “Management > Maintenance Plans”

b. Right-click, choose “New Maintenance Plan”  c. Type for “Name”, Example : Restore. Click “OK”.

16

22.

23. Save the file, Example: Restore – sa [Design].

24. Choose “Manage Connection…” 

17

25. Choose “Local Server Connection”  26. Type for “Password”. Click “OK”.

27. To save, press “CTR + S”  Note: If the Design is saved, will like this.

18

28. Choose “Maintenance Plan Tasks > Execute T-SQL-Statement Task”

And drag tasks to Designer Surface.

29.

19

30. Check file backup for restore.

31. Check availability database.

32. Check location path of database.

20

33. Create Task-1 a. Right-click at “Execute T-SQL Statement Task”

b. Choose “Edit…” 

c. Type this code to “T-SQL Statement” 

/* Task for : Detach DB */ /* BEGIN */ USE [master] GO ALTER DATABASE [DB_Test_Simulasi] SET GO

SINGLE_USER WITH ROLLBACK IMMEDIATE

USE [master] GO EXEC master.dbo.sp_detach_db @dbname = N'DB_Test_Simulasi' GO /* END */

21

d. Click “OK”. e. Note: To Copy the code, choose “View T-SQL” 

22

34. Create Task-2 a. Right-click at “Execute T-SQL Statement Task”

b. Choose “Edit…” 

c. Type this code to “T-SQL Statement”  /* Task for : Attach DB */ /* BEGIN */ USE [master] GO CREATE DATABASE [DB_Test_Simulasi] ON ( FILENAME = N'C:\DB_Test\DB_Test_Simulasi.mdf' ), ( FILENAME = N'C:\DB_Test\DB_Test_Simulasi_log.ldf' ) FOR ATTACH GO /* END */

23

d. Click “OK”. e. Note: To Copy the code, choose “View T-SQL” 

24

35. Create Task-3 a. Right-click at “Execute T-SQL Statement Task”

b. Choose “Edit…” 

c. Type this code to “T-SQL Statement”  /* Task for : Restore DB */ /* BEGIN */

RESTORE DATABASE [DB_Test_Simulasi] FROM DISK = N'D:\Share\RestoreDB\DB_Test.DAT' WITH FILE = 1, MOVE N'DB_Test' TO N'C:\DB_Test\DB_Test_Simulasi.mdf', MOVE N'DB_Test_Log' TO N'C:\DB_Test\DB_Test_Simulasi_Log.ldf', NOUNLOAD, REPLACE, STATS = 10 GO /* END */

25

d. Click “OK”. e. Note: To Copy the code, choose “View T-SQL” 

26

36. Create pointer to connect from “Task – 1” to “Task – 3” a. Active Pointer at “Task – 1”

b. Drag pointer ( color:green ) from “Task – 1” to “Task – 3”

37. Check for Maintenance Plan Name : Restore, that already create.

27

38. Set Schedule Time.

a. Choose icon “



b. If you want, run this task at once, choose “Schedule Type” : One Time.

c. Click “OK”.

28

39. Check for database files date – before restore.

40. Go to “Management > Maintenance Plans > Restore” Choose “Execute”.

29

41. Check for database files date – after restore.

42. Restore Database successfully.

----- End of Documents -----

30

Backup and Restore Database Using Maintenance Plans.PDF ...

Backup and Restore Database Using Maintenance Plans.PDF. Backup and Restore Database Using Maintenance Plans.PDF. Open. Extract. Open with. Sign In.

969KB Sizes 0 Downloads 259 Views

Recommend Documents

Guide for Backup & Restore Database SQL Server 2000.pdf
Guide for Backup & Restore Database SQL Server 2000.pdf. Guide for Backup & Restore Database SQL Server 2000.pdf. Open. Extract. Open with. Sign In.

database backup solution
Dec 23, 2013 - Introduction of data backup solution ... Data backup file is saved in server and client computer. ... file to external HDD 1 time per working day.

Dr.Fone (Mac) - iOS Data Backup & Restore
^125+Buy: 'Dr.Fone (Mac) - iOS Data Backup & Restore' by Wondershare Software. Co., Ltd. Free Download. * Hey, if perhaps you've landed on this site it is ...

BURA SOLUTIONS Reinforce your backup & restore ...
which requires flexible approaches, customized to maintain the integrity and effectiveness of the overall backup & restore operation. This translates to potential ...

cara-backup-restore-email-di-thunderbird.pdf
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item.

'Backuptrans iPhone Contacts Backup & Restore for ...
Calendar, Call history, ... ackuptrans Android iPhone WhatsApp Transfer + ... Looking for a way to Transfer Viber Chat Messages Between Android ... Page 3 ...

Restore and Backup.pdf
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. Restore and ...

Restore Batteries
Don't miss the absolute best in the world of professional tractor pulling! ... Battery Chargers Grid Tie Battery Backup Solar Systems Sears Deep Cycle Battery.

backup and recovery software.pdf
Page 2 of 17. Backup. From Wikipedia, the free encyclopedia. This article is about backup in computer systems. For other uses, see Backup (disambiguation). In information technology, a backup,​or the process of backing up, refers to the copying and

Unitrends - Backup and Recovery Goals.pdf
Page 2 of 3. Never has there been more pressure on IT for continuity. The cost of downtime across all industries has never. been higher. Businesses simply can't ...

data backup and recovery.pdf
A data repository model may be used to provide structure to the storage. Nowadays ... 1.1Data repository models. Page 2 of 17 ... data backup and recovery.pdf.

Backup-Mikrotik.pdf
Sign in. Loading… Whoops! There was a problem loading more pages. Retrying... Whoops! There was a problem previewing this document. Retrying.

backup manager.pdf
... retention policy, typically configured within a backup. application for how long copies of data are required. Though backups represent a simple form of disaster.

man-91\car-maintenance-database-software.pdf
man-91\car-maintenance-database-software.pdf. man-91\car-maintenance-database-software.pdf. Open. Extract. Open with. Sign In. Main menu.

bm] scm backup peo scm backup da ta
Jun 25, 1997 - station and a Customer Service Center (CSC)/Over-the-Air. Activation ..... aspect of this invention, the SCM data portion of the. DoWnload Request .... maintained by the mobile station, such as call timers, missed calls, etc. Thus ...

man-91\car-maintenance-database-software.pdf
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item.

backup pc.pdf
Sign in. Page. 1. /. 17. Loading… Page 1 of 17. Page 1 of 17. Page 2 of 17. Backup. From Wikipedia, the free encyclopedia. This article is about backup in ...

backup online.pdf
software abierto llamado «software abierto». Usted puede ... Storage, the base of a backup system[edit]. Data repository ... backup online.pdf. backup online.pdf.

backup database.pdf
Whoops! There was a problem loading more pages. Retrying... backup database.pdf. backup database.pdf. Open. Extract. Open with. Sign In. Main menu.

Tutorial Database Testing using SQL.pdf
Page 2 of 22. Page 2 of 22. Database Testing Tutorial using SQL –. 3.4 Stress Testing. 3.5 Test back end via front end. 3.6 Benchmark testing. 3.7 Common bugs.

Restore the 'Moor.pdf
Page 3 of 38. Executive Summary. Acknowledgements. Background Information. Brightmoor Community Snapshot. Funding Support in Brightmoor.