Unplug and access pdb with wallet

surroundings:

OS: Hundreds 7

DB:12.2.0.1

 

Preparation Tasks:
view the current WALLET_TYPE type, if the automatic login type, you need to modify it to PASSWORD type
first view the current wallet type
SQL> the SELECT * from v $ encryption_wallet;

WRL_TYPE WRL_PARAMETER the STATUS WALLET_TYPE WALLET_OR FULLY_BAC CON_ID
------ -------------- ------------------------------------ -------------- ------------------------------ ------ -------------- --------- --------- ----------
FILE / etc / ORACLE / anbob / encryption_keystore / OPEN LOCAL_AUTOLOGIN SINGLE NO 1

and then modify
cd / etc / ORACLE / anbob / encryption_keystore /
mv cwallet.sso bak_cwallet.sso

restart the database, check the wallet type again

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 --

 

Guess you like

Origin www.cnblogs.com/hxlasky/p/12718366.html