*建立備份裝置 */
--新增備份裝置
sp_addumpdevice 'disk', 'northwind_backup', 'f:\northwd.bak'
--刪除備份裝置
sp_dropdevice 'northwind_backup'
--檢視備份裝置
sp_helpdevice /*
*修改資料庫還原模型 */
--完全還原
alter database northwind
set recovery full
--簡單還原
alter database northwind
set recovery ******
--大容量日誌還原
alter database northwind
set recovery bulk_logged /*
*完全備份 */
--備份
backup database northwind to northwind_backup
--還原
restore database northwind from northwind_backup /*
*差異備份 */
--備份
backup database northwind to northwind_backup
backup database northwind to northwind_backup
with differential
--還原
restore database northwind
from northwind_backup with norecovery
restore database northwind from northwind_backup
with file=2, recovery /*
*事務日誌備份 */
--備份
backup database northwind to northwind_backup
backup log northwind to northwind_backup
--還原
restore database northwind from northwind_backup with norecovery
restore log northwind from northwind_backup with norecovery
--還原到某個即時點
restore log northwind from northwind_backup with recovery, stopat 'jue 14, 2006 12:00 am' /*
*檔案和檔案組備份 */
--備份:
backup database mydb file =『mydbfile1』filegroup = 『primary』to mydb_backup1
backup database mydb file =『mydbfile2』filegroup = 『primary』to mydb_backup2
backup database mydb file =『mydbfile3』filegroup = 『mygroup』to mydb_backup3
backup database mydb file =『mydbfile4』filegroup = 『mygroup』to mydb_backup4
--還原:
restore database mydb file =『mydbfile1』filegroup = 『primary』to mydb_backup1
restore database mydb file =『mydbfile2』filegroup = 『primary』to mydb_backup2
restore database mydb file =『mydbfile3』filegroup = 『mygroup』to mydb_backup3
restore database mydb file =『mydbfile4』filegroup = 『mygroup』to mydb_backup4
Ms Sql Server 基本管理指令碼 1
登入帳戶管理 授予windows賬號test訪問資料庫的許可權 exec sp grantlogin teacher jin test 拒絕windows賬號test訪問資料庫的許可權 exec sp denylogin teacher jin test windows賬號test訪問資料庫的許可權...
MSSQLSERVER 儲存過程
系統儲存過程 列出sql server例項中的資料庫 sp databases 返回sql server 資料庫閘道器或基礎資料來源的特性名和匹配值的列表 sp server info 返回當前環境中的儲存過程列表 sp stored procedures 返回當前環境下可查詢的物件的列表 任何可出...
簡單MSSQLServer語句
常見的的sql語句 資料庫 ms sqlserver db 代表資料庫 tb 代表表 col 代表列 表table 行 row 列 column 備份資料庫 backup database db to disk f dbbak db.bak 備份資料表 select into tb 20170116...