|
TDE(默认没打开):
- [oracle@station86 ~]$ sqlplus /nolog
- SQL*Plus: Release 11.2.0.1.0 Production on Thu Jul 5 19:33:55 2018
- Copyright (c) 1982, 2009, Oracle. All rights reserved.
- SQL> conn / as sysdba
- Connected.
- SQL> set linesize 1000
- SQL> select * from v$encryption_wallet;
- WRL_TYPE
- --------------------
- WRL_PARAMETER
- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- STATUS
- ------------------
- file
- /u01/app/oracle/admin/orcl/wallet
- CLOSED
- SQL>
复制代码 制造主密钥:
- [oracle@station86 wallet]$ sqlplus /nolog
- SQL*Plus: Release 11.2.0.1.0 Production on Thu Jul 5 19:37:47 2018
- Copyright (c) 1982, 2009, Oracle. All rights reserved.
- SQL> conn / as sysdba
- Connected.
- SQL> alter system set encryption key identified by "oracle123";
- System altered.
- SQL> exit
- Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
- With the Partitioning, Automatic Storage Management, OLAP, Data Mining
- and Real Application Testing options
- [oracle@station86 wallet]$ ls
- ewallet.p12
- [oracle@station86 wallet]$ file ewallet.p12
- ewallet.p12: data
- [oracle@station86 wallet]$ du -sh ewallet.p12
- 4.0K ewallet.p12
- [oracle@station86 wallet]$
复制代码- [oracle@station86 wallet]$ sqlplus /nolog
- SQL*Plus: Release 11.2.0.1.0 Production on Thu Jul 5 19:40:11 2018
- Copyright (c) 1982, 2009, Oracle. All rights reserved.
- SQL> conn / as sysdba
- Connected.
- SQL> select * from v$encryption_wallet;
- WRL_TYPE
- --------------------
- WRL_PARAMETER
- --------------------------------------------------------------------------------
- STATUS
- ------------------
- file
- /u01/app/oracle/admin/orcl/wallet
- OPEN
复制代码- SQL> conn hr/oracle_4U
- Connected.
- SQL> create table t05304_a ( a number encrypt using '3des168' ) ;
- Table created.
- SQL> insert into t05304_a values (1) ;
- 1 row created.
- SQL> commit;
- Commit complete.
- SQL> select * from t05304_a;
- A
- ----------
- 1
- SQL>
复制代码 打开和关闭主密钥:
- SQL> conn / as sysdba
- Connected.
- SQL> alter system set encryption wallet close identified by "oracle1234";
- alter system set encryption wallet close identified by "oracle1234"
- *
- ERROR at line 1:
- ORA-28391: cannot close wallet or HSM, password mismatch
- SQL> alter system set encryption wallet close identified by "oracle123";
- System altered.
- SQL> select * from v$encryption_wallet;
- WRL_TYPE
- --------------------
- WRL_PARAMETER
- --------------------------------------------------------------------------------
- STATUS
- ------------------
- file
- /u01/app/oracle/admin/orcl/wallet
- CLOSED
- SQL> conn hr/oracle_4U
- Connected.
- SQL> select * from t05304_a;
- select * from t05304_a
- *
- ERROR at line 1:
- ORA-28365: wallet is not open
- SQL> conn / as sysdba
- Connected.
- SQL> alter system set encryption wallet open identified by "oracle1234";
- alter system set encryption wallet open identified by "oracle1234"
- *
- ERROR at line 1:
- ORA-28353: failed to open wallet
- SQL> alter system set encryption wallet open identified by "oracle123";
- System altered.
- SQL> conn hr/oracle_4U
- Connected.
- SQL> select * from t05304_a;
- A
- ----------
- 1
- SQL>
复制代码 双重加密模式:
- RMAN> set encryption identified by "oracle456" ;
- executing command: SET encryption
- using target database control file instead of recovery catalog
- RMAN> backup tag '5TEP_USERS_FULL' tablespace users;
- Starting backup at 2018-07-05:20:12:12
- allocated channel: ORA_SBT_TAPE_1
- channel ORA_SBT_TAPE_1: SID=52 device type=SBT_TAPE
- channel ORA_SBT_TAPE_1: Oracle Secure Backup
- allocated channel: ORA_SBT_TAPE_2
- channel ORA_SBT_TAPE_2: SID=57 device type=SBT_TAPE
- channel ORA_SBT_TAPE_2: Oracle Secure Backup
- channel ORA_SBT_TAPE_1: starting full datafile backup set
- channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
- input datafile file number=00004 name=+DATA/orcl/datafile/users.265.980712241
- channel ORA_SBT_TAPE_1: starting piece 1 at 2018-07-05:20:12:24
- RMAN-00571: ===========================================================
- RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
- RMAN-00571: ===========================================================
- RMAN-03009: failure of backup command on ORA_SBT_TAPE_1 channel at 07/05/2018 20:12:25
- ORA-19914: unable to encrypt backup
- ORA-28365: wallet is not open
- RMAN> backup tag '5TEP_USERS_FULL' tablespace users;
- Starting backup at 2018-07-05:20:12:42
- using channel ORA_SBT_TAPE_1
- using channel ORA_SBT_TAPE_2
- channel ORA_SBT_TAPE_1: starting full datafile backup set
- channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
- input datafile file number=00004 name=+DATA/orcl/datafile/users.265.980712241
- channel ORA_SBT_TAPE_1: starting piece 1 at 2018-07-05:20:12:42
- channel ORA_SBT_TAPE_1: finished piece 1 at 2018-07-05:20:13:47
- piece handle=45t78v9q_1_1 tag=5TEP_USERS_FULL comment=API Version 2.0,MMS Version 10.3.0.2
- channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:01:05
- Finished backup at 2018-07-05:20:13:47
- Starting Control File and SPFILE Autobackup at 2018-07-05:20:13:48
- piece handle=c-1359978017-20180705-01 comment=API Version 2.0,MMS Version 10.3.0.2
- Finished Control File and SPFILE Autobackup at 2018-07-05:20:14:23
- RMAN>
复制代码
用口令解密:
或者用TDE解密:
- [oracle@station86 wallet]$ rman target /
- Recovery Manager: Release 11.2.0.1.0 - Production on Thu Jul 5 20:28:01 2018
- Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
- connected to target database: ORCL (DBID=1359978017)
- RMAN> restore datafile 4;
- Starting restore at 2018-07-05:20:28:07
- using target database control file instead of recovery catalog
- allocated channel: ORA_DISK_1
- channel ORA_DISK_1: SID=56 device type=DISK
- allocated channel: ORA_DISK_2
- channel ORA_DISK_2: SID=100 device type=DISK
- allocated channel: ORA_DISK_3
- channel ORA_DISK_3: SID=52 device type=DISK
- allocated channel: ORA_DISK_4
- channel ORA_DISK_4: SID=103 device type=DISK
- allocated channel: ORA_DISK_5
- channel ORA_DISK_5: SID=141 device type=DISK
- allocated channel: ORA_DISK_6
- channel ORA_DISK_6: SID=12 device type=DISK
- allocated channel: ORA_DISK_7
- channel ORA_DISK_7: SID=57 device type=DISK
- allocated channel: ORA_DISK_8
- channel ORA_DISK_8: SID=102 device type=DISK
- allocated channel: ORA_SBT_TAPE_1
- channel ORA_SBT_TAPE_1: SID=143 device type=SBT_TAPE
- channel ORA_SBT_TAPE_1: Oracle Secure Backup
- allocated channel: ORA_SBT_TAPE_2
- channel ORA_SBT_TAPE_2: SID=11 device type=SBT_TAPE
- channel ORA_SBT_TAPE_2: Oracle Secure Backup
- channel ORA_SBT_TAPE_1: starting datafile backup set restore
- channel ORA_SBT_TAPE_1: specifying datafile(s) to restore from backup set
- channel ORA_SBT_TAPE_1: restoring datafile 00004 to +DATA/orcl/datafile/users.265.980713303
- channel ORA_SBT_TAPE_1: reading from backup piece 45t78v9q_1_1
- channel ORA_SBT_TAPE_1: piece handle=45t78v9q_1_1 tag=5TEP_USERS_FULL
- channel ORA_SBT_TAPE_1: restored backup piece 1
- channel ORA_SBT_TAPE_1: restore complete, elapsed time: 00:00:55
- Finished restore at 2018-07-05:20:29:16
- RMAN> recover datafile 4;
- Starting recover at 2018-07-05:20:29:22
- using channel ORA_DISK_1
- using channel ORA_DISK_2
- using channel ORA_DISK_3
- using channel ORA_DISK_4
- using channel ORA_DISK_5
- using channel ORA_DISK_6
- using channel ORA_DISK_7
- using channel ORA_DISK_8
- using channel ORA_SBT_TAPE_1
- using channel ORA_SBT_TAPE_2
- starting media recovery
- archived log for thread 1 with sequence 59 is already on disk as file +FRA/orcl/archivelog/2018_07_05/thread_1_seq_59.313.980713007
- archived log for thread 1 with sequence 60 is already on disk as file +FRA/orcl/archivelog/2018_07_05/thread_1_seq_60.346.980713009
- archived log for thread 1 with sequence 61 is already on disk as file +FRA/orcl/archivelog/2018_07_05/thread_1_seq_61.342.980713009
- archived log for thread 1 with sequence 62 is already on disk as file +FRA/orcl/archivelog/2018_07_05/thread_1_seq_62.353.980713013
- archived log for thread 1 with sequence 63 is already on disk as file +FRA/orcl/archivelog/2018_07_05/thread_1_seq_63.258.980713015
- archived log for thread 1 with sequence 64 is already on disk as file +FRA/orcl/archivelog/2018_07_05/thread_1_seq_64.267.980713015
- archived log for thread 1 with sequence 65 is already on disk as file +FRA/orcl/archivelog/2018_07_05/thread_1_seq_65.354.980713601
- archived log for thread 1 with sequence 66 is already on disk as file +FRA/orcl/archivelog/2018_07_05/thread_1_seq_66.338.980713603
- archived log for thread 1 with sequence 67 is already on disk as file +FRA/orcl/archivelog/2018_07_05/thread_1_seq_67.330.980713605
- archived log for thread 1 with sequence 68 is already on disk as file +FRA/orcl/archivelog/2018_07_05/thread_1_seq_68.355.980713607
- archived log for thread 1 with sequence 69 is already on disk as file +FRA/orcl/archivelog/2018_07_05/thread_1_seq_69.286.980713611
- archived log for thread 1 with sequence 70 is already on disk as file +FRA/orcl/archivelog/2018_07_05/thread_1_seq_70.257.980713611
- archived log file name=+FRA/orcl/archivelog/2018_07_05/thread_1_seq_59.313.980713007 thread=1 sequence=59
- archived log file name=+FRA/orcl/archivelog/2018_07_05/thread_1_seq_60.346.980713009 thread=1 sequence=60
- archived log file name=+FRA/orcl/archivelog/2018_07_05/thread_1_seq_61.342.980713009 thread=1 sequence=61
- archived log file name=+FRA/orcl/archivelog/2018_07_05/thread_1_seq_62.353.980713013 thread=1 sequence=62
- archived log file name=+FRA/orcl/archivelog/2018_07_05/thread_1_seq_63.258.980713015 thread=1 sequence=63
- archived log file name=+FRA/orcl/archivelog/2018_07_05/thread_1_seq_64.267.980713015 thread=1 sequence=64
- archived log file name=+FRA/orcl/archivelog/2018_07_05/thread_1_seq_65.354.980713601 thread=1 sequence=65
- archived log file name=+FRA/orcl/archivelog/2018_07_05/thread_1_seq_66.338.980713603 thread=1 sequence=66
- archived log file name=+FRA/orcl/archivelog/2018_07_05/thread_1_seq_67.330.980713605 thread=1 sequence=67
- archived log file name=+FRA/orcl/archivelog/2018_07_05/thread_1_seq_68.355.980713607 thread=1 sequence=68
- media recovery complete, elapsed time: 00:00:02
- Finished recover at 2018-07-05:20:29:25
- RMAN> sql "alter tablespace users online";
- sql statement: alter tablespace users online
- RMAN>
复制代码
改主密钥:
关于cumulative:
- RMAN> backup tag '6TE_USERS_INCR0' incremental level 0 tablespace users;
- Starting backup at 2018-07-05:21:14:29
- released channel: ORA_DISK_1
- released channel: ORA_DISK_2
- released channel: ORA_DISK_3
- released channel: ORA_DISK_4
- released channel: ORA_DISK_5
- released channel: ORA_DISK_6
- released channel: ORA_DISK_7
- released channel: ORA_DISK_8
- using channel ORA_SBT_TAPE_1
- using channel ORA_SBT_TAPE_2
- channel ORA_SBT_TAPE_1: starting incremental level 0 datafile backup set
- channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
- input datafile file number=00004 name=+DATA/orcl/datafile/users.265.980714801
- channel ORA_SBT_TAPE_1: starting piece 1 at 2018-07-05:21:14:29
- channel ORA_SBT_TAPE_1: finished piece 1 at 2018-07-05:21:15:24
- piece handle=49t792tl_1_1 tag=6TE_USERS_INCR0 comment=API Version 2.0,MMS Version 10.3.0.2
- channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:55
- Finished backup at 2018-07-05:21:15:24
- Starting Control File and SPFILE Autobackup at 2018-07-05:21:15:24
- piece handle=c-1359978017-20180705-04 comment=API Version 2.0,MMS Version 10.3.0.2
- Finished Control File and SPFILE Autobackup at 2018-07-05:21:16:09
- RMAN>
- RMAN>
- RMAN> backup tag '7TE_USERS_INCR1' incremental level 1 tablespace users;
- Starting backup at 2018-07-05:21:16:28
- using channel ORA_SBT_TAPE_1
- using channel ORA_SBT_TAPE_2
- channel ORA_SBT_TAPE_1: starting incremental level 1 datafile backup set
- channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
- input datafile file number=00004 name=+DATA/orcl/datafile/users.265.980714801
- channel ORA_SBT_TAPE_1: starting piece 1 at 2018-07-05:21:16:28
- channel ORA_SBT_TAPE_1: finished piece 1 at 2018-07-05:21:17:03
- piece handle=4bt7931c_1_1 tag=7TE_USERS_INCR1 comment=API Version 2.0,MMS Version 10.3.0.2
- channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:35
- Finished backup at 2018-07-05:21:17:03
- Starting Control File and SPFILE Autobackup at 2018-07-05:21:17:03
- piece handle=c-1359978017-20180705-05 comment=API Version 2.0,MMS Version 10.3.0.2
- Finished Control File and SPFILE Autobackup at 2018-07-05:21:17:48
- RMAN> report need backup incremental 1;
- Report of files that need more than 1 incrementals during recovery
- File Incrementals Name
- ---- ------------ ----------------------------------------------
- RMAN> report need backup incremental 0;
- Report of files that need more than 0 incrementals during recovery
- File Incrementals Name
- ---- ------------ ----------------------------------------------
- 4 1 +DATA/orcl/datafile/users.265.980714801
- RMAN> report need backup incremental 1;
- Report of files that need more than 1 incrementals during recovery
- File Incrementals Name
- ---- ------------ ----------------------------------------------
- RMAN> backup tag '8TE_USERS_INCR1' incremental level 1 tablespace users;
- Starting backup at 2018-07-05:21:19:21
- using channel ORA_SBT_TAPE_1
- using channel ORA_SBT_TAPE_2
- channel ORA_SBT_TAPE_1: starting incremental level 1 datafile backup set
- channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
- input datafile file number=00004 name=+DATA/orcl/datafile/users.265.980714801
- channel ORA_SBT_TAPE_1: starting piece 1 at 2018-07-05:21:19:21
- channel ORA_SBT_TAPE_1: finished piece 1 at 2018-07-05:21:19:56
- piece handle=4dt7936p_1_1 tag=8TE_USERS_INCR1 comment=API Version 2.0,MMS Version 10.3.0.2
- channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:35
- Finished backup at 2018-07-05:21:19:56
- Starting Control File and SPFILE Autobackup at 2018-07-05:21:19:56
- piece handle=c-1359978017-20180705-06 comment=API Version 2.0,MMS Version 10.3.0.2
- Finished Control File and SPFILE Autobackup at 2018-07-05:21:20:31
- RMAN> report need backup incremental 1;
- Report of files that need more than 1 incrementals during recovery
- File Incrementals Name
- ---- ------------ ----------------------------------------------
- 4 2 +DATA/orcl/datafile/users.265.980714801
- RMAN> backup tag '9TE_USERS_INCR1' incremental level 1 cumulative tablespace users;
- Starting backup at 2018-07-05:21:22:39
- using channel ORA_SBT_TAPE_1
- using channel ORA_SBT_TAPE_2
- channel ORA_SBT_TAPE_1: starting incremental level 1 datafile backup set
- channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
- input datafile file number=00004 name=+DATA/orcl/datafile/users.265.980714801
- channel ORA_SBT_TAPE_1: starting piece 1 at 2018-07-05:21:22:39
- channel ORA_SBT_TAPE_1: finished piece 1 at 2018-07-05:21:23:24
- piece handle=4ft793cv_1_1 tag=9TE_USERS_INCR1 comment=API Version 2.0,MMS Version 10.3.0.2
- channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:45
- Finished backup at 2018-07-05:21:23:24
- Starting Control File and SPFILE Autobackup at 2018-07-05:21:23:25
- piece handle=c-1359978017-20180705-07 comment=API Version 2.0,MMS Version 10.3.0.2
- Finished Control File and SPFILE Autobackup at 2018-07-05:21:24:00
- RMAN> report need backup incremental 1;
- Report of files that need more than 1 incrementals during recovery
- File Incrementals Name
- ---- ------------ ----------------------------------------------
- RMAN> report need backup incremental 0;
- Report of files that need more than 0 incrementals during recovery
- File Incrementals Name
- ---- ------------ ----------------------------------------------
- 4 1 +DATA/orcl/datafile/users.265.980714801
- RMAN>
复制代码
块跟踪:
- SQL> alter database enable block change tracking using file '+FRA';
- Database altered.
- SQL> select * from v$block_change_tracking;
- STATUS FILENAME BYTES
- ---------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------
- ENABLED +FRA/orcl/changetracking/ctf.358.980717365 11599872
- SQL>
- SQL>
复制代码
|
|