Sunday, 25 August 2013

BACKUP types

---------------------------------BACKUP types----------------------------

--WITH MOVE 
RESTORE DATABASE XX FROM DISK='D:\Back\full.bak' 
 WITH MOVE 'xx' TO 'E:\full.mdf', 
             MOVE 'xx_log' TO 'E:\full.ldf'
-- full backup
backup database xx to disk='D:\BACKUP\xx_full.bak'
-- Restoring full back
restore database xx from disk='D:\BACKUP\xx_full.bak' with  norecovery
--log back
backup log xx to disk='D:\BACKUP\XX_log.bak'
-- restore log back
restore log xx from disk='D:\BACKUP\XX_log.bak'with  norecovery
--differential back ---
backup database xx to disk='D:\BACKUP\XX_diff.bak' with differential
--restoring differential back
restore database xx from disk='D:\BACKUP\XX_diff.bak' with  norecovery
--Shared backup
backup database xx to disk='D:\BACKUP\XX_copy1.bak' ,disk ='D:\BACKUP\XX_copy2.bak' --with differential
--restoring shared backup files
restore database xx from disk='D:\BACKUP\XX_copy1.bak', disk ='D:\BACKUP\XX_copy2.bak' with  norecovery
--mirror backup/ copy of backup
backup database xx to disk='D:\BACKUP\XX_copy3.bak' mirror to disk='D:\BACKUP\XX_copy4.bak' with format--,differential
--restoring mirror backup files (these are full backup files )
restore database xx from disk ='D:\BACKUP\XX_copy4.bak' with replace, norecovery

-- restore data base to get thye orignal state of the database
--backup applied sets( latest full back up+latest differentials from latest full backup+ latest log back ups from latest differential onwords + tile log backup)

--taking database into recovery state
restore database xx with recovery

No comments:

Post a Comment

EMP, DEPT Sample script

/****** Object:  Table [dbo].[DEPT]    Script Date: 19-05-2016 06:58:37 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET A...