重庆思庄Oracle、Redhat认证学习论坛

标题: linux19c rac noncdb克隆到windows 单机pdb实操 [打印本页]

作者: wangxu    时间: 2023-3-5 14:12
标题: linux19c rac noncdb克隆到windows 单机pdb实操

1)nongcdb创建用户并打开到只读(搭建测试库不需要打开只读)
2)cdb创建dblink到noncdb
3)执行克隆
4)执行noncdb_to_pdb.sql
5)打开pdb

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;

--遇到的报错2
ORA-00600: 内部错误代码, 参数: [PL/SQL Native code: wrong platform], [13], [12], [], [], [], [], [], [], [], [], []
ORCLPDB(4):Incident details in: D:\APP\ADMINISTRATOR\diag\rdbms\cdb1\cdb1\incident\incdir_56697\cdb1_ora_12648_i56697.trc

解决:
参考: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:

non-cdb:
shutdown immediate
startup upgrade
@?\rdbms\admin\utlirp.sql
shutdown immediate
startup
@?\rdbms\admin\utlrp.sql

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






欢迎光临 重庆思庄Oracle、Redhat认证学习论坛 (http://bbs.cqsztech.com/) Powered by Discuz! X3.2