Microsoft SQL Server 2012 管理 (2): 執行個體與資料庫管理

來源:互聯網
上載者:User

標籤:style   blog   color   os   io   strong   ar   for   資料   

1.加密資料庫

/*Module 2 Implementing Transparent Data Encryption*/-- 2.1 Create DataBase Master KeyUSE Master;GOCreate Master Key Encryption By Password=‘[email protected]‘-- 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 KeyUSE master;GOCreate Certificate TDE_Cert with subject=‘TDE_Encryption_Cert‘-- 2.3 Create Database Encryption key for a User DatabaseUSE TinyDBGOCreate Database Encryption Key with Algorithm=AES_256Encryption by Server Certificate TDE_Cert-- The are other algorithm choices but AES_256 is the STRONGEST-- 2.4 Protect User DatabaseUSE TinyDBGOAlter Database TinyDBSet ENCRYPTION ON-- 2.5 FollowUp/*Back up all keys in the hierarchy to a safe placeIn practice TEST moving/restoring the database to another instance.*/

 2. 壓縮資料

/*Implementing Data Compression*/Create Database DBWithRedundantDataGOUSE DBWithRedundantDataGO--Create a Table Assigning Row CompressionCreate Table GreatForRowCompression(Col1 int,Col2 char(5),Col3 char(3),Col4 char(2)) WITH (DATA_Compression=ROW)--Create a Table Assigning Page CompressionCreate 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;GOCreate Table dbo.T1 (Col1 int Identity, COl2 Varchar(20) default ‘T1‘)Insert T1 default valuesGO 5-- 2.2 Chnage Avalablity optionsAlter 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 T1Alter 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 T1Alter database TinyDB    Set ONLINE -- The Default OptionAlter 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=1Alter database TinyDB    Set READ_WRITE -- the Default OptionAlter database TinyDB    Set SINGLE_USER    -- Only one authoritative user can connect to the database    -- Userd when DBCC CheckD repair_allow_data_loss is usedAlter database TinyDB    Set RESTRICTED_USERAlter database TinyDB    Set MULTI_USER -- the Default Option

 

Microsoft SQL Server 2012 管理 (2): 執行個體與資料庫管理

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.