1.加密数据库

/*
Module 2 Implementing Transparent Data Encryption
*/ -- 2.1 Create DataBase Master Key
USE Master;
GO Create Master Key Encryption By Password='SuperKey@currentMachine'
-- The password above must adhere to the windows password policy
-- could also use a hardware encryption module. -- 2.2 Create a Srever Certificate Derived from Database Master Key
USE master;
GO Create Certificate TDE_Cert with subject='TDE_Encryption_Cert' -- 2.3 Create Database Encryption key for a User Database
USE TinyDB
GO Create Database Encryption Key with Algorithm=AES_256
Encryption by Server Certificate TDE_Cert
-- The are other algorithm choices but AES_256 is the STRONGEST -- 2.4 Protect User Database
USE TinyDB
GO Alter Database TinyDB
Set ENCRYPTION ON -- 2.5 FollowUp
/*
Back up all keys in the hierarchy to a safe place
In practice TEST moving/restoring the database to another instance.
*/

2. 压缩数据

/*
Implementing Data Compression
*/ Create Database DBWithRedundantData
GO USE DBWithRedundantData
GO --Create a Table Assigning Row Compression Create Table GreatForRowCompression
(
Col1 int
,Col2 char(5)
,Col3 char(3)
,Col4 char(2)
) WITH (DATA_Compression=ROW) --Create a Table Assigning Page Compression Create Table GreatForPageCompression
(
Col1 int
,Col2 char(5)
,Col3 char(3)
,Col4 char(2)
) WITH (DATA_Compression=PAGE) /*
Keep in mind ALTER TABLE and ALTER INDEX can be used
to implement compression when those obects already exist.
*/

3. 数据库可用性

/*
Change various database option and refresh the Mgmt
*/ -- 2.1 Setup: Add a Table and a couple of rows.
USE TinyDB;
GO Create Table dbo.T1 (Col1 int Identity, COl2 Varchar(20) default 'T1')
Insert T1 default values
GO 5 -- 2.2 Chnage Avalablity options
Alter database TinyDB
Set OFFLINE
-- The Database is Absolutely inaccessible
--Cleanly shus down the database without having to DETACH
--Refresh the Databasees node in Mgmt Studio to notice the change --Try this query to see what happens... Select * from T1 Alter database TinyDB
Set EMERGENCY
-- limited access (Only SysAdmins). This might be useful for
-- Transaction Log repairs with DBCC.
--Try this query to see what happens... Select * from T1 Alter database TinyDB
Set ONLINE -- The Default Option Alter database TinyDB
Set READ_ONLY
-- Cannot make changes to the database -- Try this query to see what happens... UPDATA T1 set Col2='dd' where Col1=1 Alter database TinyDB
Set READ_WRITE -- the Default Option Alter database TinyDB
Set SINGLE_USER
-- Only one authoritative user can connect to the database
-- Userd when DBCC CheckD repair_allow_data_loss is used Alter database TinyDB
Set RESTRICTED_USER Alter database TinyDB
Set MULTI_USER -- the Default Option

Microsoft SQL Server 2012 管理 (2): 实例与数据库管理的更多相关文章

  1. Microsoft SQL Server 2012 管理 (1): 安装配置SQL Server 重点

    SQL Server 可以在实例,数据库,列,查询分别指定排序规则 /* Module 1 - working with Clollations */ -- 1.1 Obtain the Instan ...

  2. Microsoft SQL Server 2012 管理 (2): Auditing

    -- Demostratin 2A (Using SQL Server Audit) -- Step 1: Use the master database USE master; GO -- Step ...

  3. Querying Microsoft SQL Server 2012 读书笔记:查询和管理XML数据 1 -使用FOR XML返回XML结果集

    XML 介绍 <CustomersOrders> <Customer custid="1" companyname="Customer NRZBB&qu ...

  4. 【转】Microsoft® SQL Server® 2012 Performance Dashboard Reports

    http://www.cnblogs.com/shanyou/archive/2013/02/12/2910232.html SQL Server Performance Dashboard Repo ...

  5. Microsoft SQL server 2012数据库学习总结(一)

    一.Microsoft SQL Server2012简介 1.基本概要 Microsoft SQL Server 2012是微软发布的新一代数据平台产品,全面支持云技术与平台,并且能够快速构建相应的解 ...

  6. Microsoft SQL Server 2012安装说明

    Microsoft SQL Server 2012安装说明 环境:Windows8, Windows7, WinVista, Win2003, WinXP Microsoft SQL Server 2 ...

  7. 微软推出的免费新书《Introducing Microsoft SQL Server 2012》

    微软推出的免费新书<Introducing Microsoft SQL Server 2012>,该书详细介绍微软SQL 2012数据库服务最新功能以及功能应用和使用技巧. 该书适合SQL ...

  8. Exam 70-462 Administering Microsoft SQL Server 2012 Databases 复习帖

    好吧最近堕落没怎么看书,估计这个月前是考不过了,还是拖到国庆之后考试吧.想着自己复习考试顺便也写点自己的复习的概要,这样一方面的给不准备背题库的童鞋有简便的复习方法(好吧不被题库的同学和我一样看MSD ...

  9. Microsoft® SQL Server® 2012 功能包

    Microsoft® SQL Server® 2012 功能包 http://www.microsoft.com/zh-cn/download/details.aspx?id=29065 Micros ...

随机推荐

  1. Spring Boot logback

    前言 今天来介绍下spring Boot如何配置日志logback,我刚学习的时候,是带着下面几个问题来查资料的,你呢 如何引入日志? 日志输出格式以及输出方式如何配置? 代码中如何使用? 正文 Sp ...

  2. 可能空字符串转换为浮点型或者整数型:java.lang.NumberFormatException: For input string: " "

    Integer.valueOf(str.equals("")?"0":str)

  3. ASP.NET中的URL编码解码(转)

    在对URL进行编码时,该用哪一个?这两都使用上有什么区别吗?测试: string file="文件上(传)篇.doc";string Server_UrlEncode=Server ...

  4. Matrix(二分套二分)

    Matrix http://poj.org/problem?id=3685 Time Limit: 6000MS   Memory Limit: 65536K Total Submissions: 8 ...

  5. python之类之多继承

    class A(object): def test_func(self): print("from A") class B(A): pass # def test_func(sel ...

  6. Spring依赖注入servlet会话监听器

    Spring提供了一个 “ContextLoaderListener” 监听器,以使 Spring 依赖注入到会话监听器. 在本教程中,通过添加一个 Spring 依赖注入一个bean 到会话监听器修 ...

  7. linq to sql之like

    contains——like '%提交%' StartsWith—— like '条件%' EndWith——like '%条件'

  8. postman get和post结合

  9. 1.spring环境的搭建

    1.app.config <?xml version="1.0" encoding="utf-8" ?><configuration> ...

  10. wcf数据推送

    http://www.cnblogs.com/artech/archive/2007/03/02/661969.html