ylb: 数据库备份(Backup)和还原(Restore) ylbtech-SQL Server:SQL Server-数据库备份(Backup)和还原(Restore) |
-- =============================================-- ylb:数据库备份(Backup)和还原(Restore)-- KeyWord:Backup Database, Restore Database, SQL Server-- author:yuanbo-- ylb: ylb,tech-- 10:33 2012/2/17-- =============================================
ylb: 1,数据库备份(Backup Database) 返回顶部 |
-- ===========================-- Backup Database Template-- ylb:创建数据备份-- ===========================BACKUP DATABASE TestDb TO DISK = N'D:/PRogram Files/Microsoft SQL Server/MSSQL10.MSSQLSERVER/MSSQL/Backup/TestDb.bak' WITH NOFORMAT, COMPRESSION, NOINIT, NAME = N'TestDb-Full Database Backup', SKip, STATS = 10;GO
View Code ylb:2,数据库还原(Restore Database) 返回顶部 |
-- ============================-- Restore Database Template-- ylb:还原数据库(前提必须有备份)-- ============================USE masterGORESTORE DATABASE TestDb FROM DISK = N'D:/Program Files/Microsoft SQL Server/MSSQL10.MSSQLSERVER/MSSQL/Backup/TestDb.bak' WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 10GO
View Code ylb: 3,创建数据库备份驱动(Create Backup Device) 返回顶部 |
-- ================================-- Create Backup Device Template-- ylb:创建备份驱动-- ================================USE masterGOEXEC master.dbo.sp_addumpdevice @devtype = N'disk', @logicalname = N'Backup_Device_Name', @physicalname = N'D:/Program Files/Microsoft SQL Server/MSSQL10.MSSQLSERVER/MSSQL/Backup/Backup_Device_Name.bak'GO
View Code 未成功,还在进行中....
寄语:数据库的建模、架构和层次关系,对一个高级编程者十分重要,建议大家多看一些数据库方面的资料。因为一个软件(或者叫一个系统)的性能,主要取决于软件的架构和数据库层次。可以从以下两个方面考虑(暂不考虑物理配置):方面一:网站的检索数据的效率(数据库表的层次关系决定)方面二:要确保数据中的数据的一致性和隔离性。