grant create session,create pluggable database to system;
shutdown immediate;
startup open read only;
--his
create database link to_primary connect to system identified by his using '192.168.0.4:1521/orcl';
select 1 from dual@to_primary;
--webemr
create database link to_emr connect to system identified by his using '192.168.0.23:1521/webemr';
select 1 from dual@to_emr;
--(19c.16 linux rac 到 windows测试库pdb恢复)
SQL> create pluggable database orclpdb from orcl@to_primary file_name_convert=('+DATA/orcl/datafile/','D:\app\Administrator\oradata\CDB1\orclpdb\','+DATA/ORCL/TEMPFILE/','D:\app\Administrator\oradata\CDB1\orclpdb\');
--(19.3 linux 到 windows测试库pdb恢复)
SQL> create pluggable database emrpdb from webemr@to_emr file_name_convert=('/oradata/WEBEMR/','E:\oradata\emrpdb\');
alter session set container=orclpdb;
@?/rdbms/admin/noncdb_to_pdb.sql
alter pluggable database orclpdb open read write;
alter pluggable database emrpdb open read write;
select name,open_mode from v$pdbs;
--查看pdb克隆后报错,如果有报错,需要处理
set line 200
col pdb_name for a10
col time for a20
col message for a60
col type for a10
col status for a10
select name pdb_name, time, message, type, status from PDB_PLUG_IN_VIOLATIONS where status !='RESOLVED';
--遇到的报错1
PDB_NAME TIME MESSAGE TYPE STATUS
---------- -------------------- ------------------------------------------------------------ ---------- ----------
ORCLPDB 17-1月 -23 09.11.01. Sync PDB failed with ORA-40365 while performing 'alter user WARNING PENDING
987000 上午 sys account lock password expire'
ORCLPDB 17-1月 -23 09.16.32. Database option DV mismatch: PDB installed version NULL. CDB WARNING PENDING
824000 上午 installed version 19.0.0.0.0.
ORCLPDB 17-1月 -23 09.16.32. Database option OLS mismatch: PDB installed version NULL. CD WARNING PENDING
824000 上午 B installed version 19.0.0.0.0.
ORCLPDB 17-1月 -23 09.16.32. Interim patch 34086870/24803071 (OJVM RELEASE UPDATE: 19.16. ERROR PENDING
934000 上午 0.0.220719 (34086870)): Not installed in the CDB but install
PDB_NAME TIME MESSAGE TYPE STATUS
---------- -------------------- ------------------------------------------------------------ ---------- ----------
ed in the PDB
ORCLPDB 17-1月 -23 09.16.32. '19.16.0.0.0 Release_Update 2207170957' is installed in the ERROR PENDING
934000 上午 CDB but '19.16.0.0.0 Release_Update 2207030222' is installed
in the PDB
解决:打对应的补丁,psu和ojvm
1)关闭所有oracle服务,打目录补丁
2)应用补丁到数据库
sqlplus / as sysdba
shutdown immediate
startup upgrade
alter pluggable database emrpdb close immediate;
alter pluggable database emrpdb open upgrade;
cd d:\app\administrator\product\19c\OPatch\
datapatch -verbose
sqlplus / as sysdba
shutdown immediate
startup
alter pluggable database emrpdb open;
解决:
参考:ORA-600 [PL/SQL Native Code: Wrong Platform] Errors in the Alert Log in a DataGuard Environment (Doc ID 2860664.1)
1.When switching over to Linux, check the current value of the parameter PLSQL_CODE_TYPE. Confirm that it is INTERPRETED.
SQL> show parameter PLSQL_CODE_TYPE
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
plsql_code_type string INTERPRETED
2. Run the utlirp.sql script followed by utlrp.sql. These scripts will invalidate all the PL/SQL code and recompile it.From SQL*Plus connected to the database as AS SYSDBA, enter:
pdb:
alter pluggable database orclpdb close immediate;
alter pluggable database orclpdb open upgrade;
alter session set container=orclpdb;
@?\rdbms\admin\utlirp.sql
shutdown immediate
startup
@?\rdbms\admin\utlrp.sql