Slow Autocad / Autodesk - the newer the Oracle database version is, the worser the performance?

The initial situation

One day, not so far before I went to my summer holidays, we got an ask to help one of our customers running Autocad (Autodesk) for a geo information system. The database, autocad is running on, is an 11g Enterprise Edition with spatial and tuning and diagnostics pack.

The runtime for some queries, the customer told me, was over ten minutes - and they would be happy to get results within the application in less than a minute.

As I didn't had any points of contact with Autocad on Oracle database before, I made the decision to visit our customer and to get an impression of the database performance. There I saw 2 different kind of schemas. One user/schema type is normal, but the other one is using virtual private database (VPD). The application running on the vpd user schema was horrible in performance, the same application running on the non vpd user schema was still incredible slow with some statements, but still better. All normal performance and memory parameters have been set to reasonable values. All performance critical things like read-writes, cache hit rates, etc. showed me a very good performing database - all in all, this database seemed to be in a very good condition - which I normaly don't see if we where ask for performance reviews.
I searched on the internet for a possible answer and I found an autocad knowledge base entry named:

AutoCAD Map 3D and Oracle Versioning causes performance degradation

And what I have found there?

Causes:
There will always be a performance degradation once the database is versioned.  The same behavior happens with the Industry Model when the database is job-enabled.  Both implementations use Virtual Private Databases.  There is no conflict in Oracle versioning.

Solution:
Oracle tuning is necessary and requires participation with an Oracle DBA.

Well, not that helpful, also the other entries in the knowledge system of autodesk were not helpful, too (if autocad is slow, you should index - isn't that a job also for an ISV to sell a FAST and STABLE application?)

I first recognized, that most of the slow queries I have seen, were bound to selects from views - views with up to 20 different tables and a lot of joins. The customer then told me, that he have heard from other Autocad users that they stepped back to an old Oracle database version (9i!), as the selects where running faster. The newer the database, the worser the performance? Rule based optimizer beats Cost based optimizer? Sounds like an unsolved riddle, maybe it's also an unsolvable riddle? I didn't hoped so...

So I've asked the customer to get a dump of both schemas and I made a trace file with a small number of the worst performing selects. With this and with my curiosity I hoped to shed some light in the dark at home in my lab...

Tracing and Testing


On my MS Windows 10 (customer is running oracle on MS Windows server) laptop I imported both schemas in my 12.1.0.2 database. After that, I've started with my tests. First I made some tests of the sqls and traced them with a normal sql trace to get also the execution plans. The behavior of my 12.1 database seemed to be totally the same as the 11.2 of our customer, not in total seconds, but in factors of the runtime between non-VPD and VPD schema selects.

Again, I've found a nearly good execution plan for one of the worst statements - even the roundabout 20 joins seemed to be a good choice. But the total runtime was still bad.

Parts of the trace file showed again, that the database executed and fetched the values incredible fast. Again, all parameters and cache hit rates, etc. looked very promising. But there was a very high elapsed and cpu time for parsing the statements:


select count(*) from el_v_wp_sleeve
call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        1    171.39     173.50          4        276          0           0
Execute      1      0.00       0.00          0          0          0           0
Fetch        1      0.07       0.25        924      13744          0           1
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total        3    171.46     173.75        928      14020          0           1

--------------------------------------------------------------------------------
Together with the customer statement, that autocad is running faster on older oracle versions, I realized that my first thought I had before is right:
It seems to be likely to have some problems within the cost based optimizer as the older versions of oracle used other internal functions in CBO or the RBO. I decided to turn on the cost based optimizer tracing:

alter session set events '10053 trace name context forever, level 1';

Some test executions and 2 GB of trace files later, I started my investigation. What was happening in the parse phase that was so exhausting for the optimizer to blow up the runtime to nearly 3 minutes, when executing and fetch only do need a quarter of a second? It didn't took me that long to find out, that the optimizer was trying a lot of different execution and join plans to find the best one. And - at the end - the plan found and used is really good - this was crystal clear by looking at the execution and fetch times.

The system statistics, the optimizer uses, are fine:

-----------------------------
SYSTEM STATISTICS INFORMATION
-----------------------------
Using dictionary system stats.
  Using NOWORKLOAD Stats
  CPUSPEEDNW: 3305 millions instructions/sec (default is 100)
  IOTFRSPEED: 4096 bytes per millisecond (default is 4096)
  IOSEEKTIM:  10 milliseconds (default is 10)
  MBRC:       NO VALUE blocks (default is 8)

And the Table and Index Stats in the Base Statistical Information didn't show any strange values. But in the optimizer optimation part of the trace file, I've found a couple of different trys: Considering view merge, considering outer-join elimination, considering predicate, find best directive, ... and again considering, find directive ... and again considering, ...Obvious to say - most of them are
--- snip ---
rejected
OJE:   outer-join not eliminated
OJE: End: finding best directive for query block SEL$2 (#0)
CVM:   Checking validity of merging in query block SEL$3 (#0)
CVM: Considering view merge in query block SEL$3 (#0)
OJE: Begin: find best directive for query block SEL$3 (#0)
OJE: End: finding best directive for query block SEL$3 (#0)
SVM:     SVM bypassed: Query NO MERGE hint.
CVM: Considering view merge in query block SEL$4 (#0)
OJE: Begin: find best directive for query block SEL$4 (#0)
OJE: Considering outer-join elimination on query block SEL$4 (#0)
OJE: considering predicate"SP"."FID_ATTR"="IP"."FID"
--- snip end ---

Considering so many different possible execution plans made it at the end to a fast execution plan, but, the next time this statement executes, it starts parsing from the beginning, considering again a lot of possibilities. I never have seen that behavior before, but as I have found the problem, I knew, there will be some kind of workaround.

Speeding up performance from minutes to parts of seconds


Finding the problem is normally 80 percent of the solution - so I was happy to find some kind of root cause, even if I didn't know if this could be normal behavior or if this is a bug in the optimizer.

And the optimizer said: Help me - Hint me
The first thing I have tested was to tune the queries in the non-VPD schema. This is the most relevant case for our customer. After searching in google and in Oracle support a lot, trying to change session (or system parameters) to other values, I decided to create some more indexes (more than 10 new ones) on the tables that are used in the view. This speeded up the parse phase - for a couple of seconds, but it was still a parse phase nearly 3 minutes in time. So I knew, the new indexes are used in the new execution plan and the new execution plan executed and fetched faster as the old one. Speeding up the execution and fetch phase from 0.25 seconds to 0.17 - great work!
But as the customer problem was not the execution and fetch phase, it still was not a solution. As I knew the query and the final execution plan, I started to put some hints in the view - I wanted to tell the optimizer more to let him less decisions to consider. Trying different Index and Use_-/NO_USE hints also speeded up the parse time for seconds, but it was still some boring 2 minutes in time. One of the last shots I wanted to try fitted: Creating the view with a NO_QUERY_TRANSFORMATION hint. Great!

SELECT /*+ NO_QUERY_TRANSFORMATION */ G.FID, G.SLEEVE_SPECIFIC_TYPE,
  G.FID_ATTR, G.ORIENTATION, G.DISPLAY_COLOR, G.ID_SLEEVE_TYPE, G.SLEEVE_TYPE,
   G.ID_VOLTAGE, G.VOLTAGE, G.ID_DISPOSITION_STATE, G.DISPOSITION_STATE,
  G.ID_ACCURACY, G.ACCURACY, G.DATE_INSTALLATION, G.ID_SLEEVE_CONSTRUCTION,
  G.SLEEVE_CONSTRUCTION, G.ID_SLEEVE_SPECIFIC_TYPE, G.GEOM.SDO_POINT.X,
  G.GEOM.SDO_POINT.Y, G.GEOM.SDO_POINT.Z
FROM
 EL_V_WP_SLEEVE G

call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        1      1.01       1.02          0        210          0           0
Execute      1      0.00       0.00          0          0          0           0
Fetch        6      0.01       0.02          0       2951          0         569
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total        8      1.03       1.05          0       3161          0         569

Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 104     (recursive depth: 1)

I have reduced the parse time from 3 minutes to 1 second. Good enough for our customer, so I stopped with more investigations on the non-VPD schema.

The next step: Will my new hint also fit to the VPD schema? What's your guess? Oh yes, you are totally right. 
NO!!
Using the hint reduced the parsing time for selects on the view in the VPD schema by some seconds, but the parsing time was still some minutes also here. Creating and testing the VPD policy is part of the parsing phase. That means, it is a must have to check the PL/SQL function which is executed for the VPD policy - in this case it was running roundabout 2 or 3 seconds with a high number of queries and some PL/SQL stuff. Not a huge time killer...

And the optimizer said: Help me - with database/session parameters

Back to start - Tracing 10053 with VPD. And yes, it was the same problem, the optimizer still is considering hundreds of paths/changes/joins/predictions and nearly never comes to an end. But the execution and fetch phase - still incredible fast. I knew why - the VPD workflow is killing my hint somewhere.

It was more or less just a little try to change some of the system parameters. But one parameter (and ONLY this one) worked:

alter session set "_optimizer_cost_based_transformation"=off;

Later on, I have found another blog with some cost based optimizer related problems. There the guy  was setting _btree_bitmap_plans and optimizer_index_cost_adj in addition, but changing both parameters did not made any difference on the total statement execution time. I've gotten, for the VPD schema, a really good two to five second runtime (spending nearly 5 minutes before).

Ok, I have two different approaches to push the Autocad performance: For VPD schemas I can set the system or session parameter _optimizer_cost_based_transformation. For non vpd schemas creating the views (or using SQL Patch) with a NO_QUERY_TRANSFORMATION hint also speeds up. But vice versa? No, I have to use both approaches in parallel.

And the optimizer said: Help me - give me a goal
As we do let the customer decide, which solution they would implement, I checked for another possibility that is used not often (enough) in my opinion: DBMS_SPM allows to create sql plan baselines. This feature is part of the Enterprise Edition without licensing Diagnostics and Tuning Pack (https://blogs.oracle.com/optimizer/does-the-use-of-sql-plan-management-and-the-dbmsspm-database-package-require-a-tuning-or-diagnostic-pack-license).

Why is using an SQL Plan Baseline a good choice here? Because we know, that after parsing, the execution plans are running fast as hell (More information of managing baselines can be found here: https://docs.oracle.com/database/121/TGSQL/tgsql_spm.htm#TGSQL94621). I run the statement (after flushing the sga) again without any hint and without the _optimizer_cost_based_transformation=off session/system parameter to get my plan.
This time, the execution was as slow as I knew from the beginning. Then I captured the plan from the cursor cache and created a SQL Baseline:

SQL> variable cnt number;
SQL> execute :cnt := dbms_spm.load_plans_from_cursor_cache(sql_id=>'1pmbtxzgktxfj')

That's it, folks! After that, I have checked by querying dba_sql_plan_baselines that the baseline was accepted and enabled.
Then I have re-run the statement again. As the cost based optimizer now skips any optimization after hard parse (creating sql-id, checking statement syntax and rights and permissions), the statement just "executes" and "fetches". So all the statements running minutes before are now running in parts of seconds.

Conclusion

 

As you can see - as often in Oracle databases there isn't a single truth. If you can find a root case (and typically you will), you can (if it is not a bug) find a workaround. For this Autocad problem, the customer has chosen to implement the system parameter and to change the views. This is fast enough for them and it is easier to handle as DBMS_SPM (where they do need all SQL-IDs from the slow running queries). 


How to upgrade a PDB on MS Windows from Oracle Database 12.1.0.2 to 12.2.0.1 by unplug / plug in


As single-tenant is the new default for all Oracle databases 12c R2 (12.2.0.1) I was happy that I already had a multi-tenant database in my Oracle 12.1.0.2 home on my laptop (running Windows 10). To test some stuff I need to prepare for my presentation at DOAG Conference 2017 (e.g. new cross-endian functionality of RMAN), I installed the fresh 12.2.0.1 database software to my oracle product folder.


Within the installer I liked to create a container database, but without a PDB – my goal was to unplug one of my existing (Spatial) PDBs from 12.1 and plug it into the 12.2 database on the same machine - but the installer does not allow to create a container database without a PDB, so I created also a PDB called jso2pdb.

(For your understanding: When I refer to CDB121 it’s the 12.1.0.2 container database I am working with, when I refer to CDB122 it’s the 12.2.0.1.)

After the software installation and the new CDB122 was created, I connected as sys to CDB122 and dropped the new pluggable database (which I never wanted to exist):

SQL> drop pluggable database jso2pdb including datafiles;

SQL> select pdb_id, pdb_name from dba_pdbs;

    PDB_ID PDB_NAME

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

         2 PDB$SEED


Next to that, I recreated the listener service from the new home using the old *.ora files and added my new stuff to tnsnames.ora. Everything is prepared now, so I started with the work on the CDB121 as a SYS User connected to the CDB:

SQL> select con_id, name, open_mode from v$pdbs;

    CON_ID NAME                           OPEN_MODE

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

         2 PDB$SEED                       READ ONLY

         3 JSOPDB1                        MOUNTED

         4 SPATEST                        READ WRITE

The PDB SPATEST is the one I want to unplug, plug and upgrade, but it is still in READ WRITE mode, so first we need to put it in the mount state by closing it. Don’t forget to close always PDBs immediate – otherwise they are shut down with the normal mode.

SQL> alter pluggable database SPATEST close immediate;

Done


SQL> select con_id, name, open_mode from v$pdbs;

    CON_ID NAME                           OPEN_MODE

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

         2 PDB$SEED                       READ ONLY

         3 JSOPDB1                        MOUNTED

         4 SPATEST                        MOUNTED


Now I unplug the PDB SPATEST by creating the XML File which stores the metadata of the PDB:

SQL> ALTER PLUGGABLE DATABASE SPATEST

  2    UNPLUG INTO 'C:\app\oracle\admin\orcljso2\temp\SPATEST.xml';

     

Done

Selecting from v$pdbs does still show my PDB as mounted, but at dba_pdbs we can see it’s unplugged.

SQL> select con_id, name, open_mode from v$pdbs;

    CON_ID NAME                           OPEN_MODE

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

         2 PDB$SEED                       READ ONLY

         3 JSOPDB1                        MOUNTED

         4 SPATEST                        MOUNTED


SQL> select PDB_ID, PDB_NAME, STATUS from dba_pdbs;

    PDB_ID PDB_NAME                                                                         STATUS

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

         2 PDB$SEED                                                                         NORMAL

         3 JSOPDB1                                                                          NORMAL

         4 SPATEST                                                                          UNPLUGGED

Do not drop the PDB from the old CDB121 NOW.  

When I open the XML file with an editor, I can see that my file paths still refer to the old location:

      <path>C:\DATA\ORACLEDB\ORADATA\DATAFILES\ORCLJSO\SPATEST\SYSTEM01.DBF</path>


Don’t change the entries in the XML file by your own, we can do this later…

We now test the compatibility of the SPATEST PDB with the new CDB122 by running the following PL/SQL block on CDB122:

SQL> SET SERVEROUTPUT ON

SQL> DECLARE

  2    compatible CONSTANT VARCHAR2(3) :=

  3      CASE DBMS_PDB.CHECK_PLUG_COMPATIBILITY(

  4             pdb_descr_file => 'C:\app\oracle\admin\orcljso2\temp\SPATEST.xml',

  5             pdb_name       => 'SPATEST')

  6      WHEN TRUE THEN 'YES'

  7      ELSE 'NO'

  8  END;

  9  BEGIN

 10    DBMS_OUTPUT.PUT_LINE(compatible);

 11  END;

 12  /

NO

PL/SQL procedure successfully completed

Unfortunately, it is not compatible, so we need to check, why:

SQL> select cause, type, line, message from pdb_plug_in_violations where name='SPATEST';

CAUSE                                                            TYPE            LINE MESSAGE

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

VSN not match                                                    ERROR              1 PDB's version does not match CDB's version: PDB's version 12.1.0.2.0. CDB's vers

OPTION                                                           ERROR              1 PDB's version is lower than CDB and PDB has more components than the CDB, plug i

Parameter                                                        WARNING            1 CDB parameter processes mismatch: Previous 300 Current 320

APEX                                                             ERROR              2 APEX mismatch: PDB has installed common APEX. CDB has not installed APEX.

Parameter                                                        WARNING            2 CDB parameter pga_aggregate_limit mismatch: Previous 10G Current 3980M

Parameter                                                        WARNING            3 CDB parameter memory_target mismatch: Previous 4080M Current 0

CDB undo mode                                                    WARNING            1 Undo mode mismatch: PDB using SHARED undo.  CDB using LOCAL undo.

Parameter                                                        WARNING            4 CDB parameter memory_max_target mismatch: Previous 6096M Current 0

Parameter                                                        WARNING            5 CDB parameter compatible mismatch: Previous '12.1.0.2.0' Current '12.2.0'

Parameter                                                        WARNING            6 CDB parameter job_queue_processes mismatch: Previous 200 Current 4000

10 rows selected


OK, let’s sort it out:

  • VSN not match: Yes, we want to upgrade the pdb after plugging it into CDB122.
  • Option and APEX: Ok – some options are missing in my CDB122, we should fix that first
  • Parameter: Ok, nothing that makes any trouble while plugging the database in
  • CDB undo mode: Yes, 12.2 has local undo, we need to change that after the PDB is plugged into CDB122.
  • There is no warning/error about a mismatch in endian format or character set.

To fix the only real error I have remembered that the database CDB122 was created by the software installation process while the CDB121 I had created some months ago using DBCA. And it’s true, the DBCA shows that Oracle Application Express is not installed in CDB122 (JVM, Text, Multimedia, OLAP, Spatial, Label Security, Database Vault and Database Extensions for .NET are all installed by default), so I added it to the installed components list and finished the DBCA. After that, I still got an error about APEX: The Apex version in the CDB121 is 4.x, the Apex installed in CDB122 is 5.x, but I still can proceed with the plugin of the PDB.

So I plugin the SPATEST into CDB122 (which is running some seconds):

SQL> create pluggable database SPATEST

  2  using  'C:\app\oracle\admin\orcljso2\temp\SPATEST.xml'

  3  move file_name_convert=

  4  ('C:\data\OracleDB\oradata\Datafiles\ORCLJSO\SPATEST','C:\data\OracleDB\oradata\Datafiles\ORCLJSO2\SPATEST');

     

Done

SQL> select con_id, name, open_mode from v$pdbs;

    CON_ID NAME                                                                             OPEN_MODE

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

         2 PDB$SEED                                                                         READ ONLY

         3 SPATEST                                                                          MOUNTED


My database is now plugged into the CDB122 and stays in mount state. With Windows Explorer I can see all datafiles do exist in the new location.

In Oracle DB 12.2 we can upgrade PDBs using priority lists, but as we do need to upgrade only one, we can specify the upgrade direct with the –c switch.

First I prepare the SPATEST PDB:

SQL> alter pluggable database SPATEST open upgrade;

Done

Next I run the new parallel upgrade utility on SPATEST by using the dbupgrade.cmd in Windows. The parameters are the same as for catctl.pl (-n= 4 parallel sessions, -c= List of PDBs  to upgrade)

C:\>%ORACLE_HOME%\bin\dbupgrade -c 'SPATEST' –n 4


On my laptop, this was running now for roundabout 45 minutes. After this has finished, the PDB can now be opened on CDB122:

SQL> alter session set container=CDB$ROOT;

Session altered


SQL> select con_id, name, open_mode from v$pdbs;

    CON_ID NAME                                                                             OPEN_MODE

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

         2 PDB$SEED                                                                         READ ONLY

         3 SPATEST                                                                          MOUNTED


SQL> alter pluggable database SPATEST open;

Done


SQL> col message for a35 word_wrapped

SQL> select cause, type, line, message from pdb_plug_in_violations where name='SPATEST' and status <> 'RESOLVED';

CAUSE                                                            TYPE            LINE MESSAGE

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

OPTION                                                           WARNING           15 Database option RAC mismatch: PDB i

                                                                                      nstalled version 12.2.0.1.0. CDB in

                                                                                      stalled version NULL.


Still one warning – There is a RAC option enabled in the PDB (CDB121 wasn’t a RAC?), so we need to switch this option off. Checking the CDB122 first:

SQL> select COMP_ID, COMP_NAME, STATUS from dba_registry;

COMP_ID                        COMP_NAME                                                                        STATUS

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

CATALOG                        Oracle Database Catalog Views                                                    VALID

CATPROC                        Oracle Database Packages and Types                                               VALID

JAVAVM                         JServer JAVA Virtual Machine                                                     VALID

XML                            Oracle XDK                                                                       VALID

CATJAVA                        Oracle Database Java Packages                                                    VALID

APS                            OLAP Analytic Workspace                                                          VALID

RAC                            Oracle Real Application Clusters                                                 OPTION OFF

XDB                            Oracle XML Database                                                              VALID

OWM                            Oracle Workspace Manager                                                         VALID

CONTEXT                        Oracle Text                                                                      VALID

ORDIM                          Oracle Multimedia                                                                VALID

SDO                            Spatial                                                                          VALID

XOQ                            Oracle OLAP API                                                                  VALID

OLS                            Oracle Label Security                                                            VALID

APEX                           Oracle Application Express                                                       VALID

DV                             Oracle Database Vault                                                            VALID

16 rows selected


Checking the DBA_REGISTRY of the PDB shows that RAC was upgraded:

SQL> alter session set container=SPATEST;

Session altered


SQL> select COMP_ID, COMP_NAME, STATUS from dba_registry;

COMP_ID                        COMP_NAME                                                                        STATUS

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

CATALOG                        Oracle Database Catalog Views                                                    UPGRADED

CATPROC                        Oracle Database Packages and Types                                               UPGRADED

JAVAVM                         JServer JAVA Virtual Machine                                                     UPGRADED

XML                            Oracle XDK                                                                       UPGRADED

CATJAVA                        Oracle Database Java Packages                                                    UPGRADED

APS                            OLAP Analytic Workspace                                                          UPGRADED

RAC                            Oracle Real Application Clusters                                                 UPGRADED

XDB                            Oracle XML Database                                                              UPGRADED

OWM                            Oracle Workspace Manager                                                         UPGRADED

CONTEXT                        Oracle Text                                                                      UPGRADED

ORDIM                          Oracle Multimedia                                                                UPGRADED

SDO                            Spatial                                                                          UPGRADED

XOQ                            Oracle OLAP API                                                                  UPGRADED

OLS                            Oracle Label Security                                                            UPGRADED

APEX                           Oracle Application Express                                                       UPGRADED

DV                             Oracle Database Vault                                                            UPGRADED

16 rows selected

This seems to be a bug, because in the CDB121 RAC also has the status “OPTION OFF”. Now it’s easy to set the RAC option of on the PDB level.

SQL> exec dbms_registry.OPTION_OFF('RAC');

PL/SQL procedure successfully completed


SQL> select COMP_ID, COMP_NAME, STATUS from dba_registry;

COMP_ID                        COMP_NAME                                                                        STATUS

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

CATALOG                        Oracle Database Catalog Views                                                    UPGRADED

CATPROC                        Oracle Database Packages and Types                                               UPGRADED

JAVAVM                         JServer JAVA Virtual Machine                                                     UPGRADED

XML                            Oracle XDK                                                                       UPGRADED

CATJAVA                        Oracle Database Java Packages                                                    UPGRADED

APS                            OLAP Analytic Workspace                                                          UPGRADED

RAC                            Oracle Real Application Clusters                                                 OPTION OFF

XDB                            Oracle XML Database                                                              UPGRADED

OWM                            Oracle Workspace Manager                                                         UPGRADED

CONTEXT                        Oracle Text                                                                      UPGRADED

ORDIM                          Oracle Multimedia                                                                UPGRADED

SDO                            Spatial                                                                          UPGRADED

XOQ                            Oracle OLAP API                                                                  UPGRADED

OLS                            Oracle Label Security                                                            UPGRADED

APEX                           Oracle Application Express                                                       UPGRADED

DV                             Oracle Database Vault                                                            UPGRADED

16 rows selected


Oracle checks the violations when we open a PDB, so I do a last restart of my pdb and check the status again:


SQL> alter pluggable database close immediate;

Done


SQL> alter pluggable database open;

Done


SQL> select cause, type, line, message from pdb_plug_in_violations where name='SPATEST' and status <> 'RESOLVED';

CAUSE                                                            TYPE            LINE MESSAGE

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


SQL>

All violations are gone. Now it’s time to make a backup of the new database environment. After this has finished the pluggable database can safely be dropped from CDB121 (but be aware of losing backup metadata https://www.pythian.com/blog/rman-12c-say-goodbye-to-your-backup-when-dropping-your-pdb/). I needed to remove the SYSAUX and SYSTEM datafiles manually from the disk stored in the OLD PDB folder.

At this step I was wondering about my undo. Because in 12.1 there is one shared undo for the CDB and all PDBs and in 12.2 every PDB has it’s local Undo. And I never have changed something in here, but the upgrade procedure did it by itself and created a local undo tablespace.

SQL> select t.name,d.name, d.status, to_char(d.creation_time,'DD.MM.YYYY HH24:MI:SS') from v$tablespace t, v$datafile d where d.ts#=t.ts# and t.name like '%UNDO%' ;

NAME                           NAME                                                                             STATUS  TO_CHAR(D.CREATION_TIME,'DD.MM

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

UNDO_1                         C:\DATA\ORACLEDB\ORADATA\DATAFILES\ORCLJSO2\SPATEST\SYSTEM01_I1_UNDO.DBF         ONLINE  26.07.2017 13:25:26


I can live with that, so I didn’t change the default undo to another name and another file.

Lessions learned:
- Upgrading a PDB from 12.1 to 12.2 by unplug / plugin on Windows is running roundabout 1h
- Seems there is a bug while upgrading the options, so RAC Option is enabled/upgraded by default, even it is off
- Never touch the XML File created, everything like moving datafiles etc. can be done at the plugin phase
- I thought I have to deal with the creation of a local undo, but it’s migrated by default
- Even if the test says, the PDB is NOT compatible with the CDB I want to plug it in – check the errors and proceed