Microsoft SQL Server 2012 管理 (1): 安装配置SQL Server 重点
SQL Server 可以在实例,数据库,列,查询分别指定排序规则
/*
Module 1 - working with Clollations
*/
-- 1.1 Obtain the Instance Collation from the GUI
--Create a Database without specifying a specific Collation
Create Database UnspecifiedCollationDB;
GO -- Use the statement bellow(code) to verfiy that the new database inherited the Collation
USE UnspecifiedCollationDB;
GO Select DB_NAME() as Current_Database, DATABASEPROPERTYEX('UnspecifiedCollationDB','Collation') DatabseCollation -- 1.2 Create a Database with a Collation that overrides the Instance Default Collation
Create Database MultiLingualSpeakDB
Collate Arabic_CI_AI
--Use The GUI to obtain the collation of the new database. -- 1.3 Create Text-base Columns Within a Table with Collations that overide the Database
USE MultiLingualSpeakDB
Create Table MixedSpeakTable
(
ProductDI int IDENTITY
,EnglighProdName nvarchar(30) COLLATE Latin1_General_CI_AI NOT NULL
,ArabicProdName nvarchar(30) NOT NULL
,GreeekProdName nvarchar(30) COLLATE Greek_CS_AS_KS NOT NULL
,JapaneseProdName nvarchar(30) COLLATE Japanese_90_CI_AS_KS_WS NOT NULL
);
--Use the GUI o drill down to the new table, then to one the columns and obtain
--column Collation settting. -- 1.4 Open a new query window to the tempDB database USE tempdb
GO
--Retrieve and discuss the collation of the system and tempdb
Select SERVERPROPERTY('Collation') as SystemCollation,
DATABASEPROPERTYEX('tempdb','Collation') as DatabaseCollation;
GO -- Create and populate a table with different column collations
Create Table dbo.TestCharacter
(
id int IDENTITY,
CIData varchar(10) COLLATE Latin1_General_CI_AS,
CSData varchar(10) COLLATE Latin1_General_CS_AS
) INSERT INTO dbo.TestCharacter(CIData,CSData)
VALUES ('Test Data','Test Data');
GO -- Execute queries that try to match the same
-- values from eache column with all lower case
SELECT * FROM dbo.TestCharacter
WHERE CIData='test data';
-- Now query the case-sensitive column
SELECT * FROM dbo.TestCharacter
WHERE CSData='test data'; -- No rows retruned
GO --Execute a query to perform a case-insensitive
--search on the case-sensitive data
SELECT * FROM dbo.TestCharacter
WHERE CSData='test data' COLLATE Latin1_General_CI_AS; -- Try to execute a query that compares the two columns
-- that have different collations. this will fail
-- as the collation conflict cannot be resolved
SELECT * FROM dbo.TestCharacter
WHERE CIData=CSData;
-- Execute the qery while specifying a collation
SELECT * FROM dbo.TestCharacter
WHERE CIData=CSData COLLATE Latin1_General_CI_AS;
合理分配文件组提升数据库性能
/*
Module 1 Create a Database with Advanced Design; Multiple Data and Multiple Filegroups
*/ --Enable xp_CMDSHELL to run operating system commands with T-SQL code. EXEC master.dbo.sp_configure 'Show Advanced Options',1;
RECONFIGURE;
EXEC master.dbo.sp_configure 'xp_CmdShell',1;
RECONFIGURE;
----------------- -- Make "Drive Latters" to simulate existence of may drive letters(LUNs)
-- for the advanced database.
USE master
Go
EXEC XP_CMDSHELL 'MD c:\Drive_D', no_output
EXEC XP_CMDSHELL 'MD c:\Drive_E', no_output
EXEC XP_CMDSHELL 'MD c:\Drive_F', no_output
EXEC XP_CMDSHELL 'MD c:\Drive_G', no_output
EXEC XP_CMDSHELL 'MD c:\Drive_H', no_output
EXEC XP_CMDSHELL 'MD c:\Drive_I', no_output
EXEC XP_CMDSHELL 'MD c:\Backups', no_output
GO -- 2.1 Create the AdvancedDB
CREATE DATABASE AdvancedDB
/* Scripte assumes the existence of c:\Drive_D etc,
to SIMULATE multipledisk drives.
*/
ON Primary
-- NOTICE below non-uniform SIZE, MAXSIZE,and FILEGROUP parmerters!
(
Name=AdvancedDBF1_PrimaryFG
,Filename='c:\Drive_D\AdvancedDB_F1_PrimaryFG.MDF'
,Size=16MB
,MaxSize=30
,FileGrowth=10%
)
,FILEGROUP CurrentDataFG
(
Name=AdvancedDBF1_CurrentDataFG
,Filename='c:\Drive_E\AdvancedDB_F1_CDFG.ndf'
,Size=6MB
,MaxSize=15
,FileGrowth=10%
)
,(
Name=AdvancedDBF2_CurrentDataFG
,Filename='c:\Drive_E\AdvancedDB_F2_CDFG.ndf'
,Size=6MB
,MaxSize=15
,FileGrowth=10%
)
,FILEGROUP ArchiveDataFG
(
Name=AdvancedDBF1_ArchiveDataFG
,Filename='c:\Drive_F\AdvancedDB_F1_AFG.ndf'
,Size=6MB
,MaxSize=15
,FileGrowth=10%
)
,(
Name=AdvancedDBF2_ArchiveDataFG
,Filename='c:\Drive_G\AdvancedDB_F2_AFG.ndf'
,Size=6MB
,MaxSize=15
,FileGrowth=10%
)
LOG ON
(
Name=AdvancedDBLogF1
,Filename='c:\Drive_G\AdvancedDB_LogF1.ldf'
,Size=6MB
,MaxSize=15
,FileGrowth=10%
)
; --Create a Table (space-occupying-object) withut specifying a FileGroup
USE AdvancedDB;
GO Create TABLE dbo.tb1_Table1
(
COl1 nvarchar(20)
)
Create TABLE dbo.tb1_Table2
(
COl1 nvarchar(20)
)
ON ArchiveDataFG
-- Use the GUI to show the FileGroups and Files of AdvancedDB
-- Use the GUI to show the two tables one being on the default FG
-- and the other table being on a designated FG.
Microsoft SQL Server 2012 管理 (1): 安装配置SQL Server 重点的更多相关文章
- Sql Server 2012数据库的安装【自己一点一点敲的】
Sql Server 2012数据库的安装 1.到微软官网上下载 下载链接为:https://www.microsoft.com/zh-cn/download/details.aspx?id=2906 ...
- Windows Server 2012 R2在线安装.NET Framework3.5
Windows Server 2012 (R2) 默认没有安装 .NET Framework 3.5,但可以通过在线安装或指定备用源路径方式. 之前在这个 在Win Server 2012中安装.NE ...
- Windows server 2012 R2下安装sharepoint2013
• 安装windows server 2012 R2 系统,配置IP.系统打补丁,修改主机名.加域后重启.• 安装WEB服务器,勾选windows身份验证 • 安装应用程序服务器 • 安装.NET F ...
- windows server 2012 R2里IIS配置.net core2.1遇到的坑
首先刚接触.net core不久,在本地也是简单写点测试程序,没遇到过什么问题,感觉还行,最近朋友搞了个asp.net core2.1的程序,让我给他服务器配置一下,我想这都跨平台了有什么难的吗?拿来 ...
- 解决Win8.1 / Win Server 2012 r2 下安装 Visual Studio 时一直要求重新启动的问题(原创)
注:本文为作者原创文章,转载于引用请注明出处,谢谢. 今天在x64的英文版Windows Server 2012 r2上安装最新版的 Visual Studio 2015 Exterprise 时,提 ...
- 在Windows Server 2012服务器上安装可靠多播协议
为什么要安装可靠多播协议? 答:随着因特网的发展,出现了视频点播.电视会议.远程学习.计算机协同工作等新业务.传统的点到点通信方式,不仅浪费大量的网络带宽,而且效率很低.一种有效利用现有带宽的技术 ...
- Windows Server 2012 R2上安装.Net4.6.1出错
在Windows Server 2012 R2上安装.Net4.6.1时提示“你需要先安装对应于 KB2919355 的更新,然后才可在……”解决方式: 在官网下载更新包,下载地址:https://w ...
- PL/SQL Developer 和 instantclient客户端安装配置
PL/SQL Developer 和 instantclient客户端安装配置 oracle的安装我就不写了,不会安装的网上随便找一个教程就能装上,安装起来比較简单.可是,PL/SQL Develop ...
- L/SQL Developer 和 instantclient客户端安装配置
PL/SQL Developer 和 instantclient客户端安装配置(图文) 一: PL/SQL Developer 安装 下载安装文件安装,我这里的版本号是PLSQL7.1.4.1391, ...
随机推荐
- SO\PR回写的数据如下
insert into OUT_ORDER_RES ---JAVA FOR PR ) as LGORT ,'SAPRFC' as ERNAM,out_pr.due_datetime,out_pr.so ...
- hdoj2612 Find a way (bfs)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2612 思路: 这个题我wa了十多发QAQ. 刚开始的思路是搜索每个‘@’,然后广搜该点到Y和M的最小距 ...
- 【转】从源码浅析MVC的MvcRouteHandler、MvcHandler和MvcHttpHandler
原文:http://www.cnblogs.com/jeffwongishandsome/archive/2012/01/08/2316521.html 熟悉WebForm开发的朋友一定都知道,Pag ...
- JTemplate学习(三)
另一种模板写法 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xh ...
- Photoshop和Halcon中的极坐标变换
极坐标想必学过高中数学的人都听过,一般的坐标系中用(x, y)值来描述一个点的位置,而在极坐标系中,则使用到原点的距离ρ和夹角θ来描述该点的位置. 我很早就接触了Photoshop,知道Photosh ...
- 设计模式-生成者模式之c#代码
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- 向文件写入一个数据块---write
函数原型:ssize_t write(int fd,const void *buf,size_t count); 参数说明:fd:文件描述符,buf:写入数据的缓冲区,count:写入数据的最大长度. ...
- linux系统编程之进程(五):exec系列函数(execl,execlp,execle,execv,execvp)使用
本节目标: exec替换进程映像 exec关联函数组(execl.execlp.execle.execv.execvp) 一,exec替换进程映像 在进程的创建上Unix采用了一个独特的方法,它将进程 ...
- idea使用svn提交时出现错误Warning not all local changes may be shown due to an error
参考于https://www.cnblogs.com/zhujiabin/p/6708012.html 解决方案: 1.File > Settings > Version Control ...
- Python 字典(Dictionary) keys()方法
Python 字典(Dictionary) keys() 函数以列表返回一个字典所有的键. 语法 keys()方法语法: dict.keys() 参数 NA. 返回值 返回一个字典所有的键. 实例 以 ...