Skip to main content

create pluggable pdb xml from datafiles

## problem: unplugged pdb xml file mismatch datafile info.

# cause: I tested flashback database after re-plug pdb

# fix: DBMS_PDB.RECOVER(

PDB_DESCR_FILE => 'DBA1_new.xml',

PDB_NAME => 'DBA1',

FILENAMES => '+DATA/DBA1C/FAF5D035069EFA1BE053327578CE0266/DATAFILE/system.1656.1191011593,

...

## below are journals:

rpres: rp_6

alter pluggable database dba1 open instances=all

*

ERROR at line 1:

ORA-65107: Error encountered when processing the current task on instance:1

ORA-01147: SYSTEM tablespace file 30 is offline

09:36:02 2025-03-18 server2 SYS@DBA1C::CDB$ROOT $

SELECT file#, name, status FROM v$datafile WHERE file# = 30;

FILE# NAME STATUS

---------- -------------------------------------------------------------------------------- ----------

30 /u01/app/odaorahome/oracle/product/19.0.0.0/dbhome_14/dbs/UNNAMED00030 SYSOFF

09:36:07 2025-03-18 server2 SYS@DBA1C::CDB$ROOT $

host ls -l /u01/app/odaorahome/oracle/product/19.0.0.0/dbhome_14/dbs/UNNAME*

ls: cannot access '/u01/app/odaorahome/oracle/product/19.0.0.0/dbhome_14/dbs/UNNAME*': No such file or directory

select con_id,file#,status,name FROM v$datafile;

CON_ID FILE# STATUS NAME

---------- ---------- ---------- --------------------------------------------------------------------------------

1 1 SYSTEM +DATA/DBA1C/DATAFILE/system.1630.1191011583

2 2 SYSTEM +DATA/DBA1C/3E7088A425BF6FAFE0531C7578CEAD5B/DATAFILE/system.2159.1191011585

1 3 ONLINE +DATA/DBA1C/DATAFILE/sysaux.1827.1191011587

2 4 ONLINE +DATA/DBA1C/3E7088A425BF6FAFE0531C7578CEAD5B/DATAFILE/sysaux.2255.1191011589

1 5 ONLINE +DATA/DBA1C/DATAFILE/undotbs1.1824.1191011591

1 6 ONLINE +DATA/DBA1C/DATAFILE/undotbs2.1606.1191011591

1 7 ONLINE +DATA/DBA1C/DATAFILE/users.1683.1191011593

3 30 SYSOFF /u01/app/odaorahome/oracle/product/19.0.0.0/dbhome_14/dbs/UNNAMED00030

3 31 OFFLINE /u01/app/odaorahome/oracle/product/19.0.0.0/dbhome_14/dbs/UNNAMED00031

3 32 OFFLINE /u01/app/odaorahome/oracle/product/19.0.0.0/dbhome_14/dbs/UNNAMED00032

...

65 rows selected.

ASMCMD [+] > ls -l +DATA/DBA1C/FAF5D035069EFA1BE053327578CE0266/DATAFILE

Type Redund Striped Time Sys Name

DATAFILE MIRROR COARSE MAR 18 09:00:00 Y APEX.1440.1192120889

DATAFILE MIRROR COARSE MAR 18 09:00:00 Y APEX_4217984311655501.1164.1191012213

DATAFILE MIRROR COARSE MAR 18 09:00:00 Y APEX_4418234048945997.1308.1191012215

...

DATAFILE MIRROR COARSE MAR 18 09:00:00 Y SYSAUX.1552.1191011595

DATAFILE MIRROR COARSE MAR 18 09:00:00 Y SYSTEM.1656.1191011593

...

ASMCMD [+] >

trying to re-create pdb: many errors..

10:04:30 2025-03-18 server2 SYS@DBA1C::CDB$ROOT $

drop pluggable database DBA1;

drop pluggable database DBA1

*

ERROR at line 1:

ORA-65179: cannot keep datafiles for a pluggable database that is not unplugged

10:04:53 2025-03-18 server2 SYS@DBA1C::CDB$ROOT $

drop pluggable database dba1 including datafiles;

Pluggable database dropped.

create pluggable database DBA1 as clone using '/mnt/sw/DBA/DBA1.xml' nocopy

*

ERROR at line 1:

ORA-65139: Mismatch between XML metadata file and data file +DATA/DBA1C/FAF5D035069EFA1BE053327578CE0266/DATAFILE/system.1656.1191011593 for value of cid (3 in the plug XML file, 4 in the data file)

create pluggable database DBA1 using '/mnt/sw/DBA/DBA1.xml' nocopy

create pluggable database DBA1 using '/mnt/sw/DBA/DBA1.xml' nocopy

*

ERROR at line 1:

ORA-65139: Mismatch between XML metadata file and data file +DATA/DBA1C/FAF5D035069EFA1BE053327578CE0266/DATAFILE/system.1656.1191011593 for value of cid (3 in the plug XML file, 4 in the data file)

create pluggable database DBA1 as clone using '/mnt/sw/DBA/DBA1.xml' move

create pluggable database DBA1 as clone using '/mnt/sw/DBA/DBA1.xml' move

*

ERROR at line 1:

ORA-65139: Mismatch between XML metadata file and data file +DATA/DBA1C/FAF5D035069EFA1BE053327578CE0266/DATAFILE/system.1656.1191011593 for value of cid (3 in the plug XML file, 4 in the data file)

cp /mnt/sw/DBA/DBA1_good.xml /mnt/sw/DBA/DBA1_good.xml

modify cid>3 to cid>4

create pluggable database DBA1 using '/mnt/sw/DBA/DBA1_good.xml' nocopy

*

ERROR at line 1:

ORA-65139: Mismatch between XML metadata file and data file +DATA/DBA1C/FAF5D035069EFA1BE053327578CE0266/DATAFILE/system.1656.1191011593 for value of guid (FAF5D035069EFA1BE053327578CE0266 in the

plug XML file, 30A11F94470C5F2FE063317578CE3447 in the data file)

change xml file <guid>FAF5D035069EFA1BE053327578CE0266 to <guid>30A11F94470C5F2FE063317578CE3447

create pluggable database DBA1 using '/mnt/sw/DBA/DBA1_good.xml' nocopy

*

ERROR at line 1:

ORA-65139: Mismatch between XML metadata file and data file +DATA/DBA1C/FAF5D035069EFA1BE053327578CE0266/DATAFILE/system.1656.1191011593 for value of afn (30 in the plug XML file, 88 in the data

file)

create pluggable database DBA1 as clone using '/mnt/sw/DBA/DBA1_good.xml' move

create pluggable database DBA1 as clone using '/mnt/sw/DBA/DBA1_good.xml' move

*

ERROR at line 1:

ORA-65139: Mismatch between XML metadata file and data file +DATA/DBA1C/FAF5D035069EFA1BE053327578CE0266/DATAFILE/system.1656.1191011593 for value of afn (30 in the plug XML file, 88 in the data

file)

change <afn>30 to <afn>88

create pluggable database DBA1 as clone using '/mnt/sw/DBA/DBA1_good.xml' nocopy

create pluggable database DBA1 as clone using '/mnt/sw/DBA/DBA1_good.xml' nocopy

*

ERROR at line 1:

ORA-65139: Mismatch between XML metadata file and data file +DATA/DBA1C/FAF5D035069EFA1BE053327578CE0266/DATAFILE/system.1656.1191011593 for value of createscnbas (1466530778 in the plug XML file,

2674705546 in the data file)

<createscnbas>1466530778 to <createscnbas>2674705546

create pluggable database DBA1 as clone using '/mnt/sw/DBA/DBA1_good.xml' nocopy

*

ERROR at line 1:

ORA-65139: Mismatch between XML metadata file and data file +DATA/DBA1C/FAF5D035069EFA1BE053327578CE0266/DATAFILE/system.1656.1191011593 for value of createscnwrp (519 in the plug XML file, 520 in

the data file)

ERROR at line 1:

ORA-65139: Mismatch between XML metadata file and data file +DATA/DBA1C/FAF5D035069EFA1BE053327578CE0266/DATAFILE/system.1656.1191011593 for value of fdbid (2564764372 in the plug XML file,

4273722816 in the data file)

# recreate the xml file according to the good datafiles:

SET SERVEROUTPUT ON

DECLARE

l_result BOOLEAN;

BEGIN

l_result := DBMS_PDB.check_plug_compatibility(

pdb_descr_file => '/mnt/sw/DBA/DBA1_good.xml',

pdb_name => 'DBA1');

IF l_result THEN

DBMS_OUTPUT.PUT_LINE('compatible');

ELSE

DBMS_OUTPUT.PUT_LINE('incompatible');

END IF;

END;

/

compatible

BEGIN

DBMS_PDB.RECOVER(

PDB_DESCR_FILE => '/mnt/sw/DBA/DBA1_new.xml',

PDB_NAME => 'DBA1',

FILENAMES => '+DATA/DBA1C/FAF5D035069EFA1BE053327578CE0266/DATAFILE/system.1656.1191011593,

+DATA/DBA1C/FAF5D035069EFA1BE053327578CE0266/DATAFILE/APEX.1440.1192120889,

+DATA/DBA1C/FAF5D035069EFA1BE053327578CE0266/DATAFILE/APEX_4217984311655501.1164.1191012213,

...

+DATA/DBA1C/FAF5D035069EFA1BE053327578CE0266/DATAFILE/XDBTS.1702.1191011599'

);

END;

/

CREATE PLUGGABLE DATABASE DBA1 USING '/mnt/sw/DBA/DBA1_new.xml' NOCOPY TEMPFILE REUSE;

Pluggable database created.

alter pluggable database dba1 open READ WRITE instances=all;

Comments

Popular posts from this blog

Opatch apply/lsinventory error: oneoff is corrupted or does not exist

I am applying the quarterly patch for 19c RDBMS, I tried using napply but failed, but somehow it corrupted the inventory though nothing applied. further apply and lsinventory command ran into error like this: $ ./OPatch/opatch lsinventory Oracle Interim Patch Installer version 12.2.0.1.21 Copyright (c) 2020, Oracle Corporation.  All rights reserved. Oracle Home       : /u02/app/oracle/19.0.0 Central Inventory : /u01/app/oraInventory    from           : /u02/app/oracle/19.0.0/oraInst.loc OPatch version    : 12.2.0.1.21 OUI version       : 12.2.0.7.0 Log file location : /u02/app/oracle/19.0.0/cfgtoollogs/opatch/opatch2020-09-08_13-35-59PM_1.log Lsinventory Output file location : /u02/app/oracle/19.0.0/cfgtoollogs/opatch/lsinv/lsinventory2020-09-08_13-35-59PM.txt -------------------------------------------------------------------------------- Inventory load failed... OPatch cannot load inventory ...

oracle dba_hist_sysmetric_summary

found this blog is helpful to get CPU and IO statistics on oracle database. http://shob-dbadmin.blogspot.ca/2012/12/how-to-find-total-io-of-database.html courtesy to  Shomil Bansal , below are hist writing, not mine. How to find total IO of the database instance Total IO of database instance is sum of the physical reads, physical writes and redo writes. There are several views to find these values. v$sysmetric  - Reports metric values for only the most current time sample 60 secs. v$sysmetric_summary  - Reports metric values for time sample of 1 hour. v$sysmetric_history  - Reports metric values every 60 sec from the time instance is up. Better way to analyse IO using this view to take deltas between two time periods. dba_hist_sysmetric_history  - All the above views are refreshed when the instance is restarted. This view, part of AWR, stores the historical stats. I have used this view for my report. Query: ====== set lines 350...

non-existent process lock port on windows server

I have a database link created between oracle and sqlserver using oracle tg4odbc, the product is installed on windows server and run as service "OracleOraGtw11g_home1TNSListener", but sometime the service cannot started, the root cause of this problem is that the port number 1521 is used by an non-existent process. The first step is to use netstat -bano|find "1521" to get the process id, in my case it's 5844, which shows the connection is from my oracle server 10.8.0.169 H:\>netstat -bano|find "1521"   TCP    0.0.0.0:1521           0.0.0.0:0              LISTENING       5844   TCP    10.14.45.33:1521       10.8.0.169:42987       ESTABLISHED     5844 however the process id does not show in either task manager or process explorer. The next step is to run tcpview, which shows non-existent under process column, there are three rows, t...