天天看點

Using Transparent Database Encryption in Oracle Database 11g

This tutorial describes how you can use Transparent Database Encryption to encrypt data stored on disk using Enterprise Manager Database Control in Oracle Database 11g.

Note: This OBE was tested on production software however some of the screenshots may still refer to the beta software.

30 minutes

This tutorial covers the following topics:

Using Transparent Database Encryption in Oracle Database 11g

<a href="http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/11g/r1/prod/security/tde/tde.htm#o">Overview</a>

Using Transparent Database Encryption in Oracle Database 11g

<a href="http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/11g/r1/prod/security/tde/tde.htm#pr">Prerequisites</a>

Using Transparent Database Encryption in Oracle Database 11g

<a href="http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/11g/r1/prod/security/tde/tde.htm#t2">Preparing the Database for Encryption</a>

Using Transparent Database Encryption in Oracle Database 11g

<a href="http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/11g/r1/prod/security/tde/tde.htm#t3">Encrypting a Column in an Existing Table</a>

Using Transparent Database Encryption in Oracle Database 11g

<a href="http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/11g/r1/prod/security/tde/tde.htm#t4">Creating an Encrypted Tablespace</a>

Using Transparent Database Encryption in Oracle Database 11g

<a href="http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/11g/r1/prod/security/tde/tde.htm#t4a">Accessing Data Using an Index From an Encrypted Tablespace</a>

Using Transparent Database Encryption in Oracle Database 11g

<a href="http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/11g/r1/prod/security/tde/tde.htm#t5">Regenerating the Database Master Key</a>

Using Transparent Database Encryption in Oracle Database 11g

<a href="http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/11g/r1/prod/security/tde/tde.htm#s">Summary</a>

Using Transparent Database Encryption in Oracle Database 11g

Place

the cursor over this icon to load and view all the screenshots for this tutorial. (Caution: This action loads all screenshots simultaneously, so response time may be slow depending on your Internet connection.)

Note: Alternatively, you can place the cursor over each individual icon in the following steps

to load and view only the screenshot associated with that step.

Transparent data encryption enables you to encrypt individual table columns or an entire tablespace. When a user inserts data into an encrypted column, transparent data encryption automatically encrypts the data.

When users select the column, the data is automatically decrypted. After the selection, the data is reencrypted.

Transparent data encryption helps protect data stored on media in the event that the storage media or data file gets stolen, because it stores the encryption keys in a security module (that is, a wallet) external

to the database. Protecting data from this type of theft is required for most compliance regulations. The benefit to using transparent data encryption is that it requires little coding and is quick and easy to implement.

In Oracle Database 11g, you can use Enterprise Manager to manage transparent data encryption.

<a href="http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/11g/r1/prod/security/tde/tde.htm#t">Back to Topic List</a>

Before starting this tutorial, you should:

1.

Install Oracle Database 11g

In this section, you change the location of the wallet and open it with Enterprise Manager Database Control. Perform the following steps:

Open your browser and enter the following URL.

https://&lt;hostname&gt;:1158/em

Login as the system user.

Using Transparent Database Encryption in Oracle Database 11g

2.

Select the Server tab.

Using Transparent Database Encryption in Oracle Database 11g

3.

Under Security, click Transparent Data Encryption.

Using Transparent Database Encryption in Oracle Database 11g

4.

To change the wallet location to a location outside of the Oracle installation (to avoid that it ends up on a backup tape together with encrypted data), click Change.

Using Transparent Database Encryption in Oracle Database 11g

5.

Since the directory that you want to change to doesn't exist yet, you need to create it. Open a terminal window and execute the following commands to create the directory and change the owner to the oracle user:

Using Transparent Database Encryption in Oracle Database 11g

6.

Now that the directory is created, switch back to Enterprise Manager. Select Network Profile from the list under Administer and click Go.

Using Transparent Database Encryption in Oracle Database 11g

7.

Login with your Oracle software owner Username and Password and click Login.

Using Transparent Database Encryption in Oracle Database 11g

8.

Expand Advanced Security Options.

Using Transparent Database Encryption in Oracle Database 11g

9.

Select Wallet Location.

Using Transparent Database Encryption in Oracle Database 11g

10.

Copy and paste the default /etc/ORACLE/WALLETS/oracle location into the Encryption Wallet Location field and click OK.

Using Transparent Database Encryption in Oracle Database 11g

12.

It takes some time for the system to pick up the change; to force the update, logout and log back in. Click Logout.

Using Transparent Database Encryption in Oracle Database 11g

13.

Click Login.

Using Transparent Database Encryption in Oracle Database 11g

14.

Login as system again.

Using Transparent Database Encryption in Oracle Database 11g

15.

Using Transparent Database Encryption in Oracle Database 11g

16.

Using Transparent Database Encryption in Oracle Database 11g

17.

Notice that the directory name has changed. Enter a strong password that protects the Wallet and click OK. Optionally, this password can be known only to a Security DBA, enforcing separation of duty.

The password is not stored anywhere, so it can under no circumstances be recovered.

Using Transparent Database Encryption in Oracle Database 11g

18.

Your wallet is now open.

Using Transparent Database Encryption in Oracle Database 11g

In this tutorial, you encrypt a column in the OE.CUSTOMERS table. Perform the following steps:

Under Related Links, click Tables.

Using Transparent Database Encryption in Oracle Database 11g

Enter OE in the Schema field and click Go.

Select the radio button in front of CUSTOMERS and click Edit.

Using Transparent Database Encryption in Oracle Database 11g

You can specify a different encryption algorithm and the key seed to be used for all encrypted columns in this table. Click Encryption Options.

Using Transparent Database Encryption in Oracle Database 11g

Review the options and click Continue.

Using Transparent Database Encryption in Oracle Database 11g

Select the checkbox in the Encryption column for CREDIT_LIMIT and click Apply.

Using Transparent Database Encryption in Oracle Database 11g

A job was submitted to encrypt the column. Click the link to the job.

Using Transparent Database Encryption in Oracle Database 11g

The job succeeded. Click the Database breadcrumb.

Using Transparent Database Encryption in Oracle Database 11g

In this section, you create a tablespace that is encrypted. Perform the following steps:

From the Server tab in Enterprise Manager Database Control, under Storage, select Tablespaces.

Using Transparent Database Encryption in Oracle Database 11g

Click Create.

Using Transparent Database Encryption in Oracle Database 11g

Enter OBE for the name of the tablespace and click Add under Datafiles.

Using Transparent Database Encryption in Oracle Database 11g

Enter OBE for the File Name and click Continue.

Using Transparent Database Encryption in Oracle Database 11g

Tablespace encryption protects all the objects in a tablespace by storing data in encrypted format on disk. An Oracle wallet must exist and needs to be in open state. Click Encryption Options.

Using Transparent Database Encryption in Oracle Database 11g
Using Transparent Database Encryption in Oracle Database 11g

Select the Encryption checkbox and click OK.

Using Transparent Database Encryption in Oracle Database 11g

Your tablespace was created successfully. Select the OBE link from the list of Tablespaces.

Using Transparent Database Encryption in Oracle Database 11g

Note: If you receive an error, switch to a terminal window, login to sqlplus as system and execute the following command:

Notice that the Encryption option is set to YES. Click the Database breadcrumb.

Using Transparent Database Encryption in Oracle Database 11g

In this section, you create a table in the encrypted tablespace, create an index on one of the columns in the table and then access the data in that column to see what execution plan is used. Perform the following

steps:

Open SQLDeveloper. On Linux, open a terminal window and execute the following commands:

If you receive a message asking you if you want to migrate your previous connections, click No.

Create a Connection. Right-click Connections and select New Connection.

Using Transparent Database Encryption in Oracle Database 11g

Enter OE for the Connection Name, Username and Password. Enter orcl for the SID and click Test.

Using Transparent Database Encryption in Oracle Database 11g

Your test was successful. Click Connect.

Using Transparent Database Encryption in Oracle Database 11g

You first want to create a copy of the CUSTOMERS table. From the SQL Worksheet, enter the following command and click Execute.

Using Transparent Database Encryption in Oracle Database 11g

Now you can move the table into the OBE tablespace (that is encrypted). Expand Tables and right-clickCUSTOMERS_OBE and select Storage then Move Tablespace.

Using Transparent Database Encryption in Oracle Database 11g

Select the OBE tablespace from the list and click Apply.

Using Transparent Database Encryption in Oracle Database 11g

The table was moved to the OBE tablespace successfully. Click OK.

Using Transparent Database Encryption in Oracle Database 11g

Now you can create an index on the DATE_OF_BIRTH column. Enter the following command in the SQL Worksheet area and click Execute.

Using Transparent Database Encryption in Oracle Database 11g

You can now select some data from the DATE_OF_BIRTH column. Enter the following command in the SQL Worksheet area and click Execute.

Using Transparent Database Encryption in Oracle Database 11g

The data is selected. So what explain plan did it use. Click the Explain Plan icon.

11.

Notice that it used the index and did an index(range scan) to retrieve the data rather than a full table scan.

Using Transparent Database Encryption in Oracle Database 11g

The database master key can be regenerated if it has been compromised. This procedure only regenerates the master keys used for encrypted columns; master keys for encrypted tablespaces cannot be re-keyed. If you

need to regenerate the master key for an encrypted tablespace, you need to create a new encrypted tablespace and move all the content from the original encrypted tablespace to the new encrypted tablespace. Perform the following steps:

From the Server tab in Enterprise Manager Database Control, under Security, select Transparent Data Encryption. .

Using Transparent Database Encryption in Oracle Database 11g

Click the + in front of Advanced Options.

Using Transparent Database Encryption in Oracle Database 11g

Under Regenerate Master Database Key, click Regenerate. Enter the same strong password you used when initially creating the wallet; both the old and new master keys are not related to the wallet

password at all; click OK.

Using Transparent Database Encryption in Oracle Database 11g

Your Master Database Key was regenerated.

Using Transparent Database Encryption in Oracle Database 11g

In this tutorial, you learned how to:

Using Transparent Database Encryption in Oracle Database 11g

Prepare the database for encryption

Using Transparent Database Encryption in Oracle Database 11g

Encrypt a column in an existing table

Using Transparent Database Encryption in Oracle Database 11g

Create an encrypted tablespace

Using Transparent Database Encryption in Oracle Database 11g

Regenerate the database master key

上一篇: 做圖工具