Microsoft SQL Server 2012 管理 (2): 实例与数据库管理
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): 实例与数据库管理的更多相关文章
- Microsoft SQL Server 2012 管理 (1): 安装配置SQL Server 重点
SQL Server 可以在实例,数据库,列,查询分别指定排序规则 /* Module 1 - working with Clollations */ -- 1.1 Obtain the Instan ...
- Microsoft SQL Server 2012 管理 (2): Auditing
-- Demostratin 2A (Using SQL Server Audit) -- Step 1: Use the master database USE master; GO -- Step ...
- Querying Microsoft SQL Server 2012 读书笔记:查询和管理XML数据 1 -使用FOR XML返回XML结果集
XML 介绍 <CustomersOrders> <Customer custid="1" companyname="Customer NRZBB&qu ...
- 【转】Microsoft® SQL Server® 2012 Performance Dashboard Reports
http://www.cnblogs.com/shanyou/archive/2013/02/12/2910232.html SQL Server Performance Dashboard Repo ...
- Microsoft SQL server 2012数据库学习总结(一)
一.Microsoft SQL Server2012简介 1.基本概要 Microsoft SQL Server 2012是微软发布的新一代数据平台产品,全面支持云技术与平台,并且能够快速构建相应的解 ...
- Microsoft SQL Server 2012安装说明
Microsoft SQL Server 2012安装说明 环境:Windows8, Windows7, WinVista, Win2003, WinXP Microsoft SQL Server 2 ...
- 微软推出的免费新书《Introducing Microsoft SQL Server 2012》
微软推出的免费新书<Introducing Microsoft SQL Server 2012>,该书详细介绍微软SQL 2012数据库服务最新功能以及功能应用和使用技巧. 该书适合SQL ...
- Exam 70-462 Administering Microsoft SQL Server 2012 Databases 复习帖
好吧最近堕落没怎么看书,估计这个月前是考不过了,还是拖到国庆之后考试吧.想着自己复习考试顺便也写点自己的复习的概要,这样一方面的给不准备背题库的童鞋有简便的复习方法(好吧不被题库的同学和我一样看MSD ...
- Microsoft® SQL Server® 2012 功能包
Microsoft® SQL Server® 2012 功能包 http://www.microsoft.com/zh-cn/download/details.aspx?id=29065 Micros ...
随机推荐
- java 注解 基本原理 编程实现
摘要: java 1.5开始引入了注解和反射,正确的来说注解是反射的一部分,没有反射,注解无法正常使用,但离开注解,反射依旧可以使用,因此来说,反射的定义应该包含注解才合理一些. java 1.5开始 ...
- shell获取函数的返回值
背景:定义了一个函数,比对本地和线上服务器集群数量差别,想要获取不同集群的个数.shell和其他语言的函数返回值还是差别挺大的. 定义一个函数 functionname(){ 操作内容 ...
- 基于AspectJ的注解方式进行AOP开发
-------------------siwuxie095 基于 AspectJ 的注解方式进行 AOP 开发 ...
- day4:vcp考试
Q61. Which two statements are true regarding Virtual SAN Fault Domains? (Choose two.)A. They enable ...
- 二叉树的层次遍历 · Binary Tree Level Order Traversal
[抄题]: 给出一棵二叉树,返回其节点值的层次遍历(逐层从左往右访问) [思维问题]: [一句话思路]: 用queue存每一层 [输入量]:空: 正常情况:特大:特小:程序里处理到的特殊情况:异常情况 ...
- 屏幕录像专家exe视频批量翻录成视频avi格式
笔者下载过一些视频,全部是屏幕录像专家录制的exe视频,这些视频没有密码,可以顺利打开看看. 有一日想把这些视频转换成wmv格式放到手机上查看.一个目录下有那么大exe视频.一个个转特别麻烦. 后来想 ...
- IE8不支持数组的indexOf方法 如何解决
转自:http://www.jbxue.com/article/8367.html 原因分析: 这是一个js bug, 在IE8下,js数组没有indexOf方法,会报错:而在其它浏览器下(Firef ...
- MyIocp 测试截图
根据 小猪的网络教程 学习了 IOCP 并且自己写了一个命令行版本的 客户端测试还是使用的小猪的代码 有兴趣学习IOCP的 建议去小猪的空间看看 代码思路都讲解的很清楚 推荐 http://blog. ...
- 十年前,女:“对不起,我不会喜欢你的,你不要再坚持了,就好比让 Linux 和 Windows 同时运行在一台PC机上,可能吗?
1.十年前,女:“对不起,我不会喜欢你的,你不要再坚持了,就好比让 Linux 和 Windows 同时运行在一台PC机上,可能吗?”男生听后默默走开, 十年后,在一次虚拟技术大会上,我听到一名虚拟技 ...
- 2018.09.25 poj3070 Fibonacci(矩阵快速幂)
传送门 矩阵快速幂板题,写一道来练练手. 这一次在poj做题总算没忘了改万能库. 代码: #include<iostream> #include<cstdio> #define ...