环境:
OS:Centos 7
DB:12.2.0.1
准备任务:
查看当前的WALLET_TYPE类型,若是自动登录类型的,需要将其修改为PASSWORD类型
首先查看当前的钱包类型
SQL> select * from v$encryption_wallet;
WRL_TYPE WRL_PARAMETER STATUS WALLET_TYPE WALLET_OR FULLY_BAC CON_ID
-------------------- -------------------------------------------------- ------------------------------ -------------------- --------- --------- ----------
FILE /etc/ORACLE/anbob/encryption_keystore/ OPEN LOCAL_AUTOLOGIN SINGLE NO 1
然后修改
cd /etc/ORACLE/anbob/encryption_keystore/
mv cwallet.sso bak_cwallet.sso
重启动数据库,再次查看钱包类型
SQL> select * from v$encryption_wallet;
WRL_TYPE WRL_PARAMETER STATUS WALLET_TYPE WALLET_OR FULLY_BAC CON_ID
-------------------- -------------------------------------------------- ------------------------------ -------------------- --------- --------- ----------
FILE /etc/ORACLE/anbob/encryption_keystore/ OPEN PASSWORD SINGLE NO 1
1.生成秘钥
alter session set container=ORA12CPDB2;
administer key management set keystore open identified by "oracle";
administer key management export encryption keys with secret "oracle" to '/home/oracle/ORA12CPDB2.p12' identified by "oracle";
2.unplug数据库
alter session set container=cdb$root;
alter pluggable database ORA12CPDB2 close immediate;
alter pluggable database ORA12CPDB2 unplug into '/home/oracle/ORA12CPDB2.xml';
3.删除pdb,但是保留文件
SQL>drop pluggable database ORA12CPDB2 keep datafiles;
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 ORA12CPDB1 READ WRITE NO
6 ORA12CPDB4 READ WRITE NO
4.重新加入cdb
SQL> create pluggable database ORA12CPDB2 using '/home/oracle/ORA12CPDB2.xml' NOCOPY;
Pluggable database created.
SQL> alter pluggable database ORA12CPDB2 open;
Warning: PDB altered with errors.
查看错误信息:
set linesize 1000;
column MESSAGE format a64;
column name format a16;
column ACTION format a64;
column type format a16;
column cause format a24;
SQL> select name,cause,type,status,message,action from pdb_plug_in_violations;
NAME CAUSE TYPE STATUS MESSAGE ACTION
---------------- ------------------------ ---------------- --------- ---------------------------------------------------------------- ----------------------------------------------------------------
ORA12CPDB4 Sync Failure ERROR RESOLVED Sync PDB failed with ORA-959 during 'create user c##goldengate i
dentified by * default tablespace tps_goldengate temporary table
space TEMP quota unlimited on tps_goldengate container = all'
ORA12CPDB2 Wallet Key Needed ERROR PENDING PDB needs to import keys from source. Import keys from source.
5.导入秘钥信息
SQL> alter session set container=ORA12CPDB2;
Session altered.
SQL> administer key management set keystore open identified by "oracle";
SQL> administer key management import encryption keys with secret "oracle" from '/home/oracle/ORA12CPDB2.p12' identified by "oracle" with backup;
SQL> alter session set container=CDB$ROOT;
SQL> alter pluggable database ORA12CPDB2 close;
SQL> alter pluggable database ORA12CPDB2 open;
-- The End --