【 11g 新特性】 Oracle 加密表空间 新年新群招募:中国Oracle精英联盟 170513055 群介绍:本群是大家的一个技术分享社区,在这里可以领略大师级的技术讲座,还有机会参加Oracle举办的技术沙龙,与兴趣相投的小伙伴一起笑谈风云起,感悟职场情! 前言 :数据
【11g新特性】Oracle加密表空间
新年新群招募: 中国Oracle精英联盟 170513055
群介绍:本群是大家的一个技术分享社区,在这里可以领略大师级的技术讲座,还有机会参加Oracle举办的技术沙龙,与兴趣相投的小伙伴一起笑谈风云起,感悟职场情!
前言:数据治理领域里面经常会遇到敏感数据,例如我们征信中心的征信数据就是涉密数据,并不是所有的人都可以看到,就算有授权也只能看到指定对象的数据,那么想一想假设这些数据被流失出来会是一个怎样的场景,就像“皇帝新装”这个故事一个,全部搬上银幕被展现出来,还记得前几天12306网站信息被泄露了吗!下面来介绍一个Oracle 11g新特性给大家,此特性可以完全避免上述事件的发生,这就是Oracle11g加密表空间特性。
理论
创建一个加密表空间,作用是只要放在加密表空间中的表,没有wallet钱包中的密钥用户是打不开的,这就可以形成一个保护罩,就算你有权限查询数据也不能看到明文,这就起到了风险保障的作用,只有知道秘钥的管理员才能查看,下面我们来详细讲解。
一 加密表空间与wallet的关系
1.Oracle表空间的加密与解密完全是基于wallet钱包中的密钥进行的。
2.如果wallet是open状态,那么我们可以使用其中的密钥,进行加密与解密处理。
3.如果wallet是close状态,那么我们就拿不到密钥,此时加密表空间是不可用的,例如 查询 修改 创建都不允许
4.唯一删除表是不需要密钥的,wallet是open or close状态都无所谓,直接删除即可
二 TDE(Transparent Data Encryption透明数据加密)使用场景
1.保护敏感数据,禁止未授权的访问,只有打开钱包才能查看数据。
2.防止数据丢失,当加密表空间的数据文件被恶意拷贝走后,如果你没有密钥是无法还原数据的。
3.防止数据被截获,当在网络传输时加密后的信息更安全,即使截获了也无法得知其中内容。
TDE可支持的加密算法种类AES(Advanced Encryption Standard高级加密标准) 是DES的升级版
① AES192 192位密钥加密
② AES128(default) 128位密钥加密
③ AES256 256位密钥加密
④ 3DES168 168位密钥加密 DES(Data Encryption Standard数据加密标准)
AES标准是美国联邦政府采用的一套加密标准,用来替代原先的DES标准。AES属于对称性加密算法(加密与解密使用同一密钥进行),反之非对称性加密算法(加密与解密使用不同密钥进行)例如 RSA标准有公钥与私钥。
三 TDE(Transparent Data Encryption透明数据加密)加密原理
① 先要创建一个“wallet钱包”,这个钱包里面保存着密钥,Oracle就是通过这个密钥对列进行加密和解密的。
② 生成wallet钱包之前先要设定wallet钱包的保存位置
设置wallet钱包位置的文件$ORACLE_HOME/network/admin/sqlnet.ora
[oracle@cafeadmin]$ vim sqlnet.ora 在这个文件中添加如下脚本
encryption_wallet_location=(source=
(method=file)
(method_data=
(directory=/u01/app/oracle/product/11.1.0/db_1/network/admin)))
③ 在wallet里面创建密钥key,创建后自动打开wallet,密码"oracle"不加引号时,后面使用时也不需要加引号
SYS@COFFEE>alter system set encryption key authenticated by"oracle";
或【alter system set encryption key identified by oracle;】
Systemaltered.
说明:authenticated by "oracle" :打开/关闭wallet的认证密码是oracle
如果报错
SYS@COFFEE>alter system set encryption key authenticated by "oracle";
altersystem set encryption key authenticated by "oracle"
*
ERRORat line 1:
ORA-28368: cannot auto-create wallet不能自动创建钱包
在/u01/app/oracle/product/11.1.0/db_1目录下运行sqlplus 登录数据库就可以成功执行
④ 查看一下wallet钱包是否在$ORACLE_HOME/network/admin/目录下生成
[oracle@cafeadmin]$ ll
-rw-r--r--1 oracle dba 1573 Nov 7 03:21 ewallet.p12 这个就是我们刚才生成的wallet钱包,里面有我们创建的密钥(密文形式),打开wallet钱包的认证密码是“oracle”,创建wallet钱包之后密钥就自动在里面了。
⑤ 创建一个加密表空间
SYS@COFFEE>create tablespace encrypted_tbs datafile '/u01/app/oracle/oradata/COFFEE/datafile/test_encrypted01.dbf'size 10m encryption default storage(encrypt);
【CREATE TABLESPACE stablespace DATAFILE '/u01/app/oracle/oradata/COFFEE/datafile/stablespace.dbf'SIZE 10M ENCRYPTION DEFAULT STORAGE(ENCRYPT);】
Tablespacecreated.
创建加密表空间encrypted_tbs,大小10MB,如果不指定加密算法默认使用AES128加密算法密钥长度128位,需open wallet
如果报错
ERRORat line 1:
ORA-28365: wallet is not open 此时报错是没有打开钱包,因为表空间的加密是使用钱包中的密钥进行加密的,如果钱包没打开便无法使用密钥,当然也就创建不了加密表空间。
Open&Closethe Oracle Wallet mothed
alter systemset wallet open identified by"oracle"; 打开钱包
【alter system set wallet close identified by "oracle";】 关闭钱包11gR2
【alter system set wallet close;】 关闭钱包11gR1
查看表空间属性
SYS@COFFEE>select tablespace_name,encrypted from dba_tablespaces;
TABLESPACE_NAME ENC
---------------------------------
SYSTEM NO
SYSAUX NO
UNDOTBS1 NO
TEMP NO
USERS NO
EXAMPLE NO
TBS1 NO
TBS2 NO
TBS3 NO
TBS4 NO
ENCRYPTED_TBS YES 加密状态
实验
在加密表空间上创建一张表encryption_t,这张表上数据全部为加密状态
SYS@COFFEE>create table encrypted_t (x int) tablespace encrypted_tbs;
Tablecreated.
插入一条数据
SYS@COFFEE>insert into encrypted_t values (100);
1 rowcreated.
SYS@COFFEE>commit;
Commitcomplete.
SYS@COFFEE>select * from encrypted_t;
X
--------------------
100
我们关闭wallet看效果
SYS@COFFEE>altersystem set wallet close;
Systemaltered.
当没有打开wallet时不允许开打表
SYS@COFFEE>select * from encrypted_t;在
select* from encrypted_t
*
ERRORat line 1:
ORA-28365: wallet is not open
创建一个新表encryption_t1时,也需要使用wallet钱包中的密钥进行加密
SYS@COFFEE>create table encrypted_t1 (x int) tablespace encrypted_tbs;
createtable encrypted_t1 (x int) tablespace encrypted_tbs
*
ERRORat line 1:
ORA-28365: wallet is not open
唯一例外->删除表,因为删除的过程是不需要密钥key参与,所以wallet是open or close状态都无所谓,直接执行就好
SYS@COFFEE>droptable encryption_t;
Tabledropped.
小结:我们介绍了Oracle加密表空间的原理、场景、实践操作,从理论到实践给朋友们展示了Oralce加密表空间的使用效果,这里切记一定不要忘记wallet的认证密码,否则你将不能查询到表空间内的数据,最好的办法就是把密码记录到一个密码生成器中,定期更新,这样既保证安全性又保证不会忘记。
Leonarding
2015.01.05
天津&winter
分享技术~成就梦想
Blog:www.leonarding.com

InnoDBBufferPool reduces disk I/O by caching data and indexing pages, improving database performance. Its working principle includes: 1. Data reading: Read data from BufferPool; 2. Data writing: After modifying the data, write to BufferPool and refresh it to disk regularly; 3. Cache management: Use the LRU algorithm to manage cache pages; 4. Reading mechanism: Load adjacent data pages in advance. By sizing the BufferPool and using multiple instances, database performance can be optimized.

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

MySQL is worth learning because it is a powerful open source database management system suitable for data storage, management and analysis. 1) MySQL is a relational database that uses SQL to operate data and is suitable for structured data management. 2) The SQL language is the key to interacting with MySQL and supports CRUD operations. 3) The working principle of MySQL includes client/server architecture, storage engine and query optimizer. 4) Basic usage includes creating databases and tables, and advanced usage involves joining tables using JOIN. 5) Common errors include syntax errors and permission issues, and debugging skills include checking syntax and using EXPLAIN commands. 6) Performance optimization involves the use of indexes, optimization of SQL statements and regular maintenance of databases.

MySQL is suitable for beginners to learn database skills. 1. Install MySQL server and client tools. 2. Understand basic SQL queries, such as SELECT. 3. Master data operations: create tables, insert, update, and delete data. 4. Learn advanced skills: subquery and window functions. 5. Debugging and optimization: Check syntax, use indexes, avoid SELECT*, and use LIMIT.

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

MySQL is an open source relational database management system that is widely used in Web development. Its key features include: 1. Supports multiple storage engines, such as InnoDB and MyISAM, suitable for different scenarios; 2. Provides master-slave replication functions to facilitate load balancing and data backup; 3. Improve query efficiency through query optimization and index use.

SQL is used to interact with MySQL database to realize data addition, deletion, modification, inspection and database design. 1) SQL performs data operations through SELECT, INSERT, UPDATE, DELETE statements; 2) Use CREATE, ALTER, DROP statements for database design and management; 3) Complex queries and data analysis are implemented through SQL to improve business decision-making efficiency.

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Dreamweaver CS6
Visual web development tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Zend Studio 13.0.1
Powerful PHP integrated development environment

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool