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. 使用js获取伪元素的content

    在测试过程中有时候会遇到反爬虫机制,一些元素会使用伪元素,这样在定位元素的时候会定位不到,这时候就要使用js来帮助定位,获取到想要的元素 下面是部分代码 //使用js获取伪元素的content Str ...

  2. Visual Studio宏

    MSVC++ 14.0 _MSC_VER == 1900 (Visual Studio 2015)MSVC++ 12.0 _MSC_VER == 1800 (Visual Studio 2013)MS ...

  3. jQuery控制TR显示隐藏

    参考链接:http://www.jb51.net/article/51221.htm 通过jQuery的hide和show方法即可.

  4. DB2频繁出现死锁,常用解决问题的命令

    --DB2频繁出现死锁,常用解决问题的命令db2 get snapshot for locks on sampledb2 get db cfg for sampledb2 update db cfg ...

  5. Boolean.getBoolean用法

    相信很多人被Boolean.getBoolean(String name)欺骗过,想当然的认为它是将"true"或者"false"转换为Boolean类型的AP ...

  6. "UX"将会是下一个Buzzword?

    “用户体验非常重要”.“没有用户体验就没有产品”.“UX就是一切”.不知道从何时开始,用户体验(UX) 这个名词已经变得如此多见了,但是人们真正的认识.认清了什么是用户体验了吗?设计师们常挂在嘴边的用 ...

  7. 常见sql for oracle

    select to_char(current_timestamp,'yyyy-mm-dd hh24:mi:ss.ff3'),to_char(sysdate,'yyyy-mm-dd hh24:mi:ss ...

  8. hdu-1207(规律推导)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1207 思路: 可以按照类似汉诺塔的推导形式来推导, 首先,有四个柱子,a,b,c,d. (1)a的x个 ...

  9. 46 What Is Real Happiness ? 什么是真正的幸福 ?

    46 What Is Real Happiness ? 什么是真正的幸福 ? ①The way people hold to the belief that a fun-filled, pain-fr ...

  10. Django介绍(2)

    https://www.cnblogs.com/yuanchenqi/articles/5658455.html