Normally, you upgrade an Oracle Database with native operating system authentication. The upgrade tooling connects to the database as / as sysdba. However, in some organizations, this is not allowed for security reasons. Every connection must be with username and password.
How can you upgrade an Oracle Database using username and password?
Set-Up
First, I’ll disable connections using native operating system authentication. I do that in sqlnet.ora.
$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Nov 6 09:55:05 2024
Version 19.21.0.0.0
Copyright (c) 1982, 2022, Oracle. All rights reserved.
ERROR:
ORA-01017: invalid username/password; logon denied
Upgrade Without Operating System Authentication
I ensure that my AutoUpgrade is the latest version, or at least version 24.7.241021:
This is my AutoUpgrade config file. There’s nothing special in it, except for global.keystore which tells AutoUpgrade where to store its keystore. AutoUpgrade uses the keystore to keep your password safe until it is needed.
Now, I’m starting AutoUpgrade in -load_password mode. This is the first time I use it, so AutoUpgrade prompts for a password that it can use to encrypt the keystore:
$ java -jar autoupgrade.jar -config UPGR.cfg -load_password
Processing config file ...
Starting AutoUpgrade Password Loader - Type help for available options
Creating new AutoUpgrade keystore - Password required
Enter password:
Enter password again:
AutoUpgrade keystore was successfully created
To enter the username and password for my database, I change the group to PWD:’
PWD> group PWD
Group [PWD] is already active
Then, I can enter my username and password for my database (CDB19). AutoUpgrade validates the credentials, so you better make sure they work at this point:
PWD> add CDB19 -user SYS
Enter your secret/Password:
Re-enter your secret/Password:
Database SID: cdb19 User: SYS
I save the keystore and convert it into an auto-login keystore, so I don’t have to enter the keystore password every time I use AutoUpgrade:
PWD> save
Convert the AutoUpgrade keystore to auto-login [YES|NO] ? yes
Your operating system user (for instance, oracle) must be added to the appropriate groups in your operating system.
On UNIX/Linux, you allow native operating system authentication by authentication_services=beq in sqlnet.ora, or you can omit the parameter completely.
On Windows, you allow native operating system authentication by authentication_services=nts in sqlnet.ora. If you omit the parameter, then it won’t work.
At a recent event, a customer asked me a question.
I’m doing a Data Pump import, and processing PROCACT_SCHEMA takes a lot of time. What’s going on?
I love meeting our customers and hearing about these cases. So, let’s dig into it.
Situation
Here is an extract from the Data Pump import log:
08-SEP-24 18:10:18.604: W-4 Processing object type DATABASE_EXPORT/SCHEMA/PROCACT_SCHEMA
08-SEP-24 22:08:24.804: W-6 Completed 78693 PROCACT_SCHEMA objects in 14283 seconds
08-SEP-24 22:08:24.805: W-6 Completed by worker 1 78692 PROCACT_SCHEMA objects in 14283 seconds
08-SEP-24 22:08:24.826: W-6 Processing object type DATABASE_EXPORT/EARLY_POST_INSTANCE_IMPCALLOUT/MARKER
A few observations:
Seeing a customer using logtime=all and metrics=yes in their Data Pump jobs is great. It adds valuable diagnostic information to the log file.
Almost four hours on PROCACT_SCHEMA.
Almost 80.000 schemas – that’s a lot.
Only one active worker.
Tracing
The customer sent me a 10046 trace for that period. They had the suspicion that Data Pump was doing something for each schema. I had the same thought, so I sorted the trace file:
sort CDB01_dw00_54345.trc > sort.txt
Using my favorite text editor, I could scroll through the content and find this repeating call:
There’s not much public information about this package, but it is a package used during import to move logical replication settings – used by Oracle Streams and Oracle GoldenGate.
Oracle Streams
I’m not a big Streams expert, but I do know that it is desupported in Oracle Database 19c. But could there be some leftovers in the dictionary that caused Data Pump to move the configuration?
I asked the customer to query many of the DBA_STREAMS_* views in the database. One of them returned a lot of rows:
select count(*) from dba_streams_columns;
COUNT(*)
----------
72636
Solution
The customer asked for advice on using the Data Pump import parameter STREAMS_CONFIGURATION=NO. Judging from the parameter name, it sounds like a good idea, but the documentation reads:
… STREAMS_CONFIGURATION parameter specifies whether to import any GoldenGate Replication metadata that may be present in the export dump file.
But it states GoldenGate metadata – not Streams. But look in the 18c documentation:
… import any Streams metadata that may be present in the export dump file.
Streams and GoldenGate share a lot of the same architecture in the database because they serve the same purpose: Data replication. That’s why the parameter still exists even if Streams is desupported.
The customer didn’t use GoldenGate, so they decided to exclude the replication metadata during import:
impdp ... streams_configuration=no
The PROCACT_SCHEMA part of the import went from almost four hours to just 30 seconds!
Final Words
In this case, a full import, the issue happened during DATABASE_EXPORT/SCHEMA/PROCACT_SCHEMA. It could happen in a schema import as well. In that case, the phase would be SCHEMA_EXPORT/POST_SCHEMA/PROCACT_SCHEMA.
What is PROCACT? It is short for procedural actions. That phase handles things in the database that are not real objects nevertheless something you want to include. Data Pump calls out to other parts of the code to get the job done. That’s also why you typically see one worker active. I’d like to write a separate blog post about that one day.
A full export/import is convenient, but it includes everything, including the things you didn’t know you had in the database – leftovers or garbage data.
A schema export/import is a cleaner approach but would still be affected by the above issue.
If you’re short on time, consider a schema export/import and include just the objects that you really need. Something like:
For a while, my good friend Sinan and I have been racing to the 200th blog post.
He has more page hits than me, but luckily the bet was on number of posts. Sinan, you owe me one.
The History
I started at Oracle almost five years ago, and I was encouraged by my boss, Mike Dietrich, to start a blog.
With 200 blog posts and almost five years at Oracle, that’s almost a blog post a week. I’m proud of that. Page hits doubled last year and this year will see some good growth as well.
What does that mean? I’m helping people!
I like helping people and it is my job. But blogging is some times hard – so I need fuel. That fuel is feedback.
No More Navel-gazing
For a content creator like me, feedback is essential for many reasons:
It is my fuel. Knowing that my blog posts help you is what helps me to put in the extra effort it takes to blog.
Your comments make my blog posts even better. Often, I’ve re-written blog posts based on your feedback.
Your tricky questions make me learn new learn new things. I’m above to deep-dive into Oracle Restart because you’re asking for it.
Your ideas help me shape the requirements for the next features in Oracle Database. The next version of AutoUpgrade can upgrade the RMAN catalog as part of a database upgrade – because a user gave me that good idea.
Your complaints help me understand how we can improve our product. Today, a user reported an error to us, which led to a new pre-check in AutoUpgrade.
Your likes are a quick (but sometimes needed) dosis feel-good.
Your re-posts and comments on social media boost my reach and enable me to help even more people in the Oracle community.
Your Feedback Matters!
I first got in touch with my current boss, Mike, through a comment I left on his blog. This led to cooperation between my former employer and Oracle. Our cooperation turned into beta and reference projects and peaked – for me personally – when I presented with Mike and Roy at Oracle OpenWorld.
You never know what your feedback will end up with.
Thanks for staying with me for the first 200 blog posts. Here’s to the next 200 blog posts!
With the latest release of Oracle AutoUpgrade, patching an Oracle Database is much easier. Once I’ve configured AutoUpgrade, it takes just one command. That includes finding and downloading the right patches and creating a new Oracle home.
Currently, AutoUpgrade can’t download the Oracle Database 19c base release (LINUX.X64_193000_db_home.zip). I must do that manually and place it in the folder specified by the config file entry folder. I expect the next version to handle it automatically.
$ cd /home/oracle/autoupgrade-patching/patch
$ ls -l
total 2987996
-rw-r--r--. 1 oracle oinstall 3059705302 Mar 18 2020 LINUX.X64_193000_db_home.zip
I need to load my My Oracle Support credentials into the AutoUpgrade keystore so AutoUpgrade can use them to download patches. The first time AutoUpgrade creates the keystore, and I must provide a keystore password:
$ java -jar autoupgrade.jar -config FTEX.cfg -patch -load_password
Processing config file ...
Starting AutoUpgrade Patching Password Loader - Type help for available options
Creating new AutoUpgrade Patching keystore - Password required
Enter password:
Enter password again:
AutoUpgrade Patching keystore was successfully created
I add my credentials. This is the username and password that I use to connect to My Oracle Support:
MOS> add -user daniel.overby.hansen@oracle.com
Enter your secret/Password:
Re-enter your secret/Password:
I save the keystore and convert it to an auto-login keystore:
MOS> save
Convert the AutoUpgrade Patching keystore to auto-login [YES|NO] ? YES
With one command, I will patch my Oracle Database:
$ java -jar autoupgrade.jar -config FTEX.cfg -patch -mode deploy
AutoUpgrade Patching 24.7.241021 launched with default internal options
Processing config file ...
Loading AutoUpgrade Patching keystore
AutoUpgrade Patching keystore was successfully loaded
Connected to MOS - Searching for specified patches
------------------------------------------------------------
Downloading files to /home/oracle/autoupgrade-patching/patch
------------------------------------------------------------
DATABASE RELEASE UPDATE 19.25.0.0.0
File: p36912597_190000_Linux-x86-64.zip - VALIDATED
DATAPUMP BUNDLE PATCH 19.25.0.0.0
File: p37056207_1925000DBRU_Generic.zip - VALIDATED
OJVM RELEASE UPDATE 19.25.0.0.0
File: p36878697_190000_Linux-x86-64.zip - VALIDATED
OPatch 12.2.0.1.44 for DB 19.0.0.0.0 (Oct 2024)
File: p6880880_190000_Linux-x86-64.zip - VALIDATED
------------------------------------------------------------
+-----------------------------------------+
| Starting AutoUpgrade Patching execution |
+-----------------------------------------+
1 Non-CDB(s) will be processed
Type 'help' to list console commands
patch> Job 100 completed
------------------- Final Summary --------------------
Number of databases [ 1 ]
Jobs finished [1]
Jobs failed [0]
Jobs restored [0]
Jobs pending [0]
---- Drop GRP at your convenience once you consider it is no longer needed ----
Drop GRP from FTEX: drop restore point AU_PATCHING_9212_FTEX1921000
Please check the summary report at:
/home/oracle/autoupgrade-patching/log/cfgtoollogs/patch/auto/status/status.html
/home/oracle/autoupgrade-patching/log/cfgtoollogs/patch/auto/status/status.log
That’s it! My database is now running on Oracle Database 19.25.0.
This is the first release, and naturally, it comes with restrictions. We’re working hard behind the scenes to lift those requirements.
Will AutoUpgrade support other platforms?
Yes. AutoUpgrade supports most of the platforms where you run Oracle Database, including Windows, AIX and SPARCH Solaris.
What about in-place patching, using cloned Oracle homes, and support for gold images?
It’s in the plans.
Will you support other Oracle Database releases?
Yes – anything newer than Oracle Database 19c
What about Grid Infrastructure?
We’re focusing on Oracle Database. You should have a look at Oracle Fleet Patching and Provisioning.
What about …
We’re looking for new, great ideas. Please create an enhancement request in My Oracle Support and send me the number. I’ll check it and add it to our backlog. Feel free to also send me an email with your suggestion.
A colleague was helping a customer optimize an import using Data Pump via a database link that involved SecureFile LOBs.
Do you see a way to parallelize the direct import to improve performance and thus shorten the time it takes to import? Or is it not possible for LOB data?
Network mode imports are a flexible way of importing your data when you have limited access to the source system. However, it comes with the price of restrictions. One of them being:
Network mode import does not use parallel query (PQ) child processes.
In Data Pump, one worker will process a table data object which is either a:
Table
Table partition
Table subpartition
So, for a regular table, this means just one worker is processing the table and it doesn’t use parallel query. That’s bound to be slow for larger data sets, but can you do something?
Starting Point
To illustrate my point, I’ll use a sample data set consisting of:
One schema (BLOBLOAD)
With one table (TAB1)
Containing two columns
Number (ID)
BLOB (BLOB_DATA)
The table has around 16.000 rows
Size is 50 GB
Doing a regular Data Pump import over a database link is slow because there’s only one worker and no parallel query:
Since we know that multiple workers can process different partitions of the same table, let’s try to partition the source table. I’ll use hash partitioning and ensure my partitions are equally distributed:
alter table tab1
modify partition by hash (id)
partitions 32 online;
In the log, file you’ll see that multiple workers are processing partitions individually. So, even without parallel query, I get parallelism because of multiple workers on the same table – each on different partitions.
But partitioning is a separately licensed option.
Using QUERY Parameter and Multiple Data Pump Imports
I’ve previously blocked about do-it-yourself parallelism for Data Pump exports of BasicFile LOBs. Can I use the same approach here?
The idea is to start multiple Data Pump jobs importing the same table, but each working on a subset of the data.
No – that’s not possible. During imports, Data Pump acquires a lock on the table being imported using the APPEND hint. This is from a trace of the imports:
INSERT /*+ APPEND NESTED_TABLE_SET_REFS PARALLEL(KUT$,1) */ INTO "BLOBLOAD"."TAB1" KUT$ ("ID", "BLOB_DATA")
SELECT /*+ NESTED_TABLE_GET_REFS PARALLEL(KU$,1) */ "ID", "BLOB_DATA" FROM "BLOBLOAD"."TAB1"@srclnk KU$ WHERE mod(id, 4)=1
If you try to start multiple imports into the same table, you get an error:
ORA-02049: timeout: distributed transaction waiting for lock
So, let’s prevent that by adding data_options=disable_append_hint to each Data Pump import jobs.
Now, multiple Data Pump jobs may work on the same table, but it doesn’t scale lineary.
One concurrent job: Around 12 minutes
Four concurrent jobs: Around 8 minutes
Eight concurrent jobs: Around 7 minutes
It gives a performance benefit, but probably not as much as you’d like.
Two-Step Import
If I can’t import into the same table, how about starting four simultaneous Data Pump jobs using the do-it-yourself approach above, but importing into separate tables and then combining all the tables afterward?
I’ll start by loading 1/4 of the rows (notice the QUERY parameter):
While that runs, I’ll start three separate Data Pump jobs that each work on a different 1/4 of the data. I’m remapping the table into a new table to avoid the locking issue:
Now, I can load the rows from the three staging tables into the real one:
ALTER SESSION FORCE PARALLEL DML;
INSERT /*+ APPEND PARALLEL(a) */ INTO "BLOBLOAD"."TAB1" a
SELECT /*+ PARALLEL(b) */ * FROM "BLOBLOAD"."TAB1_2" b;
commit;
INSERT /*+ APPEND PARALLEL(a) */ INTO "BLOBLOAD"."TAB1" a
SELECT /*+ PARALLEL(b) */ * FROM "BLOBLOAD"."TAB1_3" b;
commit;
INSERT /*+ APPEND PARALLEL(a) */ INTO "BLOBLOAD"."TAB1" a
SELECT /*+ PARALLEL(b) */ * FROM "BLOBLOAD"."TAB1_4" b;
commit;
This approach took around 7 minutes (3m 30s for the Data Pump jobs, and 3m 30s to load the rows into the real table). Slower than partitioning but still faster than the starting point.
This approach is complicated; the more data you have, the more you need to consider things like transaction size and index maintenance.
Conclusion
Network mode imports have many restrictions, which also affect performance. Partitioning is the easiest and fastest improvement, but it requires the appropriate license option. The final resort is to perform some complicated data juggling.
Alternatively, abandon network mode imports and use dump files. In dump file mode, one worker can use parallel query during export and import, which is also fast.
Over the last months, our team has been working hard to finish the next evolution of AutoUpgrade which will make patching Oracle Database much easier. Evolution is a big word, but I really think this is a giant leap forward.
We promise you one-button patching of your Oracle Database (except that there’s no button to push, but rather just one command 😀).
Imagine you want to patch your Oracle Database. You run one command:
Patch the Oracle Database
That sounds interesting, right? You can learn much in our next webinar on Thursday, 24 October, 14:00 CEST. SIGN UP NOW!
What If?
I know some of you are already thinking:
What if my database is not connected to the internet?
Don’t worry – we thought about that and a lot more. If you have any questions, I promise that we won’t end the webinar until all questions are answered.
VIEWS_AS_TABLES is a neat feature in Oracle Data Pump that allows you to export the contents of a view and import them as tables.
The idea is to export a view as if it were a table. The dump file contains a table definition:
With the same name as the view
With the same columns as the view
With the same data as the view
Show Me
In the source database, you create a view, or you can use an existing view:
SQL> create view sales as select * from all_objects;
Next, you export that view as a table:
$ expdp ... views_as_tables=sales
In the target database, you import:
$ impdp ...
The view is now a table:
SQL> select object_type from all_objects where object_name='SALES';
OBJECT_TYPE
-----------
TABLE
When To Use It
Faster import of data over a database link when using the QUERY parameter.
Normally, the predicate in the QUERY parameter is evaluated on the target database, so during a Data Pump import over a database link, all rows are retrieved from the source database. Then, the QUERY parameter is applied to filter the rows. This is inefficient if you select a smaller portion of a larger table. By using VIEWS_AS_TABLES the filtering happens on the source database and might speed up the import dramatically.
Customized data export.
Another case I worked on involved a system where the user must be able to extract certain data in a format of their choosing. The user could define a view, export it, and import it into their local database for further processing. The view could:
Include various columns and the user can decide the ordering and column names.
Join tables to create a more complete data set.
Translate columns with domain values to text (like 1 being NEW, 2 being IN PROGRESS and so forth).
De-normalize data to make it more human-readable.
Format dates and numbers according to the user’s NLS settings.
Transform tables are part of a migration.
I’ve also seen some customers perform powerful transformations to data while the data was migrated. There are a lot of transformations already in Data Pump, but in these cases, the customer had more advanced requirements.
The Details
You can use VIEWS_AS_TABLES in all modes: full, tablespace, schema, and table.
The table has the same name as the view. But you can also use the REMAP_TABLE option in Data Pump to give it a new name.
During export, Data Pump:
Creates an empty table with the same structure as the view (select * from <view> where rownum < 1).
Exports the table metadata
Unloads data from the view
Drops the interim table
Data Pump also exports dependent objects, like grants, that are dependent on the view. On import, Data Pump adds those grants to the table.
Conclusion
A powerful feature that might come in handy one day to transform your data or boost the performance of network link imports.
Leave a comment and let me know how you used the feature.
The name must satisfy the requirements listed in “Database Object Naming Rules”. The first character of a PDB name must be an alphabet character. The remaining characters can be alphanumeric or the underscore character (_).
… However, database names, global database names, database link names, disk group names, and pluggable database (PDB) names are always case insensitive and are stored as uppercase. If you specify such names as quoted identifiers, then the quotation marks are silently ignored.
…
Names of disk groups, pluggable databases (PDBs), rollback segments, tablespaces, and tablespace sets are limited to 30 bytes.
So, AutoUpgrade is just playing by the rules.
The Answer
So, the answer is that the database use PDB names in alphanumeric uppercase. AutoUpgrade knows this and automatically converts to uppercase. The customer must accept that PDB names are uppercase.
These are the requirements for the PDB names
First character must be an alphabet character.
The name must be all uppercase.
The name can contain alphanumeric (A-Z) and the underscore (_) characters.
The PDB name must be unique in the CDB, and it must be unique within the scope of all the CDBs whose instances are reached through a specific listener.
Daniel’s Recommendation
I recommend that you use globally unique PDB names. In your entire organization, no PDBs have the same name. That way, you can move PDBs around without worrying about name collisions.
I know one customer that generates a unique number and prefix with P:
P00001
P00002
P00003
They have a database with a simple sequence and a function that returns P concatenated with the sequence number. The expose the function in their entire organization through a REST API using ORDS. Simple and yet elegant.
Final Words
I’ve spent more than 20 years working with computers. I have been burnt by naming issues so many times that I’ve defined a law: Daniel’s law for naming in computer science:
Use only uppercase alphanumeric characters
US characters only (no special Danish characters)
Underscores are fine
Never use spaces
Don’t try to push your luck when it comes to names :-)
If you want to save time during a Data Pump import, you can transform constraints to NOT VALIDATED.
Regardless of the constraint state in the source database, Data Pump will create the constraint using the novalidate keyword.
This can dramatically reduce the time it takes to import. But be aware of the drawbacks.
The Problem
Here is an example from a big import:
01-JAN-24 08:19:00.257: W-38 Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
01-JAN-24 18:39:54.225: W-122 Completed 767 CONSTRAINT objects in 37253 seconds
01-JAN-24 18:39:54.225: W-122 Completed by worker 1 767 CONSTRAINT objects in 37253 seconds
There is only one worker processing constraints, and it took more than 10 hours to add 767 constraints. Ouch!
A Word About Constraints
Luckily, most databases use constraints extensively to enforce data quality. A constraint can be:
VALIDATED
All data in the table obeys the constraint.
The database guarantees that data is good.
NOT VALIDATED
All data in the table may or may not obey the constraint.
The database does not know if the data is good.
When you create a new constraint using the VALIDATE keyword (which is also the default), the database recursively full scans the entire table to ensure existing data is good. If you add more constraints, the database full scans each time. Since full table scans rarely make it into the buffer cache, each new constraint causes a lot of physical reads.
How Does Data Pump Add Constraints
Data Pump adds the constraints in the same state as in the source. As mentioned above, the constraints are most likely VALIDATED.
During import, Data Pump:
Creates an empty table
Loads data
Adds dependent objects, like constraints
It could look like this in a simplified manner:
For each of the alter table ... add constraint commands will trigger a full table scan because of the validate keyword. For a large database, this really hurts, especially because the full scan does not go parallel.
The Solution
The idea is to add the constraints as NOT VALIDATED but still ENABLED.
NOT VALIDATED means the database doesn’t check the existing data
ENABLED means the database enforces the constraints for new data
In Data Pump, there is a simple transformation:
impdp ... transform=constraint_novalidate:y
Data Pump adds all constraints using the novalidate keyword regardless of the state in the source database.
Instead of a full table scan for each new constraint, the alter table ... add constraint command is instant. It’s just a short write to the data dictionary, and that’s it. No full table scan.
This transformation requires Oracle Database 19c, Release Update 23 with the Data Pump Bundle Patch.
Update: A few ran into the following error when using the feature:
ORA-39001: invalid argument value
ORA-39042: invalid transform name CONSTRAINT_NOVALIDATE
Unfortunately, you need to add patch 37280692 as well. It’s included in 19.27.0 Data Pump Bundle Patch.
Is It Safe To Use?
Yes. There is no chance that this feature corrupts your data. Further, you know that data was good in the source, so it will be good in the target database as well.
However, you should take care when you are changing data on import. The alteration might lead to constraints being unable to validate and you won’t know this until you eventually perform the validation. The data is still perfectly fine, however, the constraint would need to be altered to match the new data.
Imagine the following:
You are importing into a different character set – from singlebyte to Unicode.
One of your constraints checks the length of a text using byte semantics with the function LENGTHB.
After import into the Unicode database, some characters may take up two bytes or more.
The result of the LENGTHB function would change and you would need to update the constraint definition. Either by allowing more bytes or using LENGTH or LENGTHC.
Let me give you an example:
In my singlebyte database (WE8MSWIN1252), I have a table with these two rows:
ABC
ÆØÅ (these are special Danish characters)
In singlebyte all characters take up one byte, so
LENGTHB('ABC') = 3
LENGTHB('ÆØÅ') = 3
I migrate to Unicode and now the special Danish character expand. They take up more space in AL32UTF8:
LENGTHB('ABC') = 3
LENGTHB('ÆØÅ') = 6
If I have a check constraint using the LENGTHB function, I would need to take this into accout. Plus, there are other similar functions that works on bytes instead of chars, like SUBSTRB.
It’s probably rare to see check constraints using byte semantic functions, like LENGTHB and SUBSTRB. But I’ve seen that in some systems that had to integrate with other systems.
You can end up in a similar situation if you:
use the remap_data option to change data
perform other kinds of data transformation
Since the constraint is still enabled, the database still enforces the constraint for new data after the import.
What’s the Catch?
Validated constraints are very useful to the database because it enables the optimizer to perform query rewrite and potentially improve query performance. Also, index access method might become available instead of full table scans with a validated constraint.
You want to get those constraints validated. But you don’t have to do it during the import. Validating an enabled, not validated constraint does not require a lock on the table. Thus, you can postpone the validation to a later time in your maintenance window, and you can perform other activities at the same time (like backup). Perhaps you can validate constraints while users are testing the database. Or wait until the next maintenance window.
Further, Data Pump always adds validated constraints in these circumstances:
On DEFAULT ON NULL columns
Used by a reference partitioned table
Used by a reference partitioned child table
Table with Primary key OID
Used as clustering key on a clustered table
What About Rely
After import, you could manually add the rely clause:
alter table ... modify constraint ... rely;
Rely tells the database that you know the data is good. The optimizer still doesn’t trust you until you set the parameter QUERY_REWRITE_INTEGRITY to TRUSTED. Now, the optimizer can now benefit from some query rewrite options, but not all of them.
Nothing beats a truly validated constraint!
Validate Constraints Using Parallel Query
Since you want to validate the constraints, Connor McDonald made a video showing you can do that efficiently using parallel query:
Changing the default parallel degree (as shown in the video) might be dangerous in a running system.
alter session force parallel query;
alter table ... modify constraint ... enable validate;
The validation happens:
Without table lock
In parallel
And with no cursor invalidation
Nice!
Final Words
If you’re short on time, consider adding constraints as not validated.
The above case with more than 10 hours spent on adding validated constraints; that could have been just a few seconds with novalidate constraints. That’s a huge difference to a time critical migration.
Don’t forget to validate them at one point, because validated constraints are a benefit to the database.
Check my previous blog post for further details on constraint internals.
Appendix
Autonomous Database
The fix is also available in Autonomous Database, both 19c and 23ai.
Zero Downtime Migration
If you import via Zero Downtime Migration (ZDM) you need to add the following to your ZDM response file:
I am speaking at the DOAG 2024 Conference + Exhibition in Nuremberg, Germany, on November 19-22. The organizers told me that the agenda was now live, so I went to check it out.
This is an amazing line-up of world-class speakers, tech geeks, top brass, and everything in between.
Why don’t you finish 2024 by sharpening your knowledge and bringing home a wealth of ideas that can help your business get the most out of Oracle Database?
The Agenda
It is a German conference, and many sessions are in German. However, since there are many international speakers, there are also many sessions in English.