oracle 12c - PDB altered with errors - oracle

I have Oracle 12c installed.
I have two schemas installed in the plaggable DB ORCLPDB.
I restarted the machine where both oracle and my application exist.
now when I'm trying to open the pluggable database ORCLPDB using the below query :
alter pluggable database orclpdb open;
I'm getting the following Warning:
Warning: PDB altered with errors.
when I run this query :
SELECT NAME,STATUS,MESSAGE FROM PDB_PLUG_IN_VIOLATIONS;
I get this entry :
Name Status MESSAGE
--------------------------------
ORCLPDB PENDING Sync PDB failed with ORA-65177 during 'ALTER USER user123 IDENTIFIED BY *'
where user123 is an essential user that I cannot get rid of.
when I restarted the server , there was a hanged database transaction in the application , so I'm suspecting that this is the reason why the pluggable database is not opening correctly.
any suggestion to solve this issue is appreciated.

Related

Can't create HR schema on Oracle 21c (SP2-0310)

I'm new to Oracle and i'm trying to install HR schema but error occurs.
SP2-0310: unable to open file "SUB__CWD/human_resources/hr_cre.sql" connecting and granting seems work but this error occurs and i can't create hr schema..
I searched and tried many ways, but I couldn't find the right solution.
I'm using oracle 21c version and my OS is windows10.
I entered like this
sys as sysdba
alter session set "_ORACLE_SCRIPT"=true;
#?/demo/schema/human_resources/hr_main.sql hr users temp {password} $ORACLE_HOME/demo/schema/log/ localhost:1521/XE
I tried Installing Sample Schemas like this and installation of the sample schemas like this but it didn't work.
Thanks in advance

ORA-01219 - "database or pluggable database not open: queries allowed on fixed tables or views only"

I've just installed oracle database 18c on my windows 10 machine. Then I used Oracle SQL Developer to login to the database that I've created during the installation with connection information below:
The connection was successful and when I tried to open the Tables, it showed an error OCA-01219:
I've found this solution:
ORA-01219: database not open: queries allowed on fixed tables/views only
that trying to make the database open. I have tried this but still no success, my database status:
Can anyone please help to to solve this problem? Thank you very much in advanced.
I run into the same problem after having to restart the Oracle Service. The problem was the state of the pluggable database not that of the instance itself, which was "open" like in your case.
The following command worked for me (please replace "orclpdb" with your pluggable DB name):
alter pluggable database orclpdb open;
If output of 'select status from v$instance' is open, can you please execute below query and let me know the out put:
select name, open_mode from v$database;
Also, please let me know if you are trying to connect pluggable database. In case you are connecting to pluggable db, then run below query:
alter session set container='';
Then after apply above approach. please let me know if any query further

How can I force flyway to clean my docker oracle database?

I've downloaded the official oracle docker image for Oracle Database EE. I've got a flyway configuration and often run flyway:clean against the locally installed XE version of the database. However flyway tells me it is not allowed to clean the database in the docker image, but it can migrate it.
Is there a way to force flyway to clean the oracle db?
To answer the questions from the comments:
Here's the error message when running flyway through maven:
org.flywaydb.core.api.FlywayException: Clean not supported on Oracle for system schema "SCHEMA_OWNER"! It must not be changed in any way except by running an Oracle-supplied script! -> [Help 1]
The user I connect with was created with alter session set "_ORACLE_SCRIPT"=true;
Flyway will throw this exception if the current schema is considered a system schema:
#Override
protected void doClean() throws SQLException {
if (isSystem()) {
throw new FlywayException("Clean not supported on Oracle for system schema " + database.quote(name) + "! " +
"It must not be changed in any way except by running an Oracle-supplied script!");
}
A schema is considered to be a system schema if it in a list of known default schemas or has ORACLE_MAINTAINED = 'Y'.
Creating the user with alter session set "_ORACLE_SCRIPT"=true; sets ORACLE_MAINTAINED = 'Y' for the user / schema.
There are two kinds of database in Oracle 12c: a Container Database (CDB) and a Pluggable Database (PDB). This is to support Multitenancy.
You are currently creating the user in the CDB, which would be a common user across all PDBs. In that case, you must either prefix the user name with c##:
create user c##scott identified by tiger;
or use the alter session set "_ORACLE_SCRIPT"=true;, otherwise you will get the error:
ORA-65096: invalid common user or role name in oracle
The alternative is to connect to a PDB and create a local user there (no prefix required and the user will only exists in that PDB), e.g.:
sqlplus sys/Oradoc_db1#ORCLPDB1 as sysdba
create user scott identified by tiger;
The update the Flyway url to connect to that PDB as that user:
-url=jdbc:oracle:thin:#oracle-ee:1521/orclpdb1.localdomain -user="scott" -password=tiger

ORA-01031(insufficient privilages) ORA-01501(create database failed) ORA-01100(database already mounted)

I tried to create a database in Oracle database 11g edition but it throws an error:
ORA-01501:CREATE DATABASE failed
So I tried command SQL>shut immediate; but it also threw error:
ORA-01031:Insufficient Privileges
What does this mean "database already mounted"?
"Database already mounted" means the database's control file is already opened within a running ORACLE instance.
The DBCA utility (not the create database statement directly) is the recommended way of creating a database in 11G:
(Below is the URL for 11GR1 - the URL may be different for 11GR2):
https://docs.oracle.com/cd/B28359_01/server.111/b28310/create002.htm#ADMIN12479
If you're receiving ORA-1031 (insufficient privileges) when trying to shut down, make sure you are logged in as SYSDBA or SYSOPER, E.G.
sqlplus / as sysdba
In WINDOWS
Control Panel\All Control Panel Items\Administrative Tools\Services
Here I restarted the following services:
*OracleServiceXE
*OracleXEClrAgent
And Oracle database 11g edition started working normally again.
PS:Don't forget to restart the system

Not able to open PDB database- Oracle standard edition

I am using Oracle Database 12c Standard Edition Release 12.1.0.2.0 - 64bit on which I am facing a problem while opening PDB database.
Error:
SQL> select CON_ID,DBID,NAME,OPEN_MODE from v$pdbs;
CON_ID DBID NAME OPEN_MOD
---------- ------------- ------------------- -----------------
2 11247382 PDB$SEED READ ONLY
3 3988395454 PDB_ORCL12C MOUNTED
SQL> ALTER PLUGGABLE DATABASE ALL OPEN;
ALTER PLUGGABLE DATABASE ALL OPEN
*
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-01405: fetched column value is NULL
SQL> ALTER PLUGGABLE DATABASE pdb_orcl12c OPEN READ WRITE FORCE;
ALTER PLUGGABLE DATABASE pdb_orcl12c OPEN READ WRITE FORCE
*
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-01405: fetched column value is NULL
I am using below-mentioned steps for oracle database creation which is working fine on Oracle enterprise edition.
http://dbarahul.blogspot.in/2017/02/manual-cdb-pdb-database-creation-steps.html
Please help me to resolve this issue on Oracle standard edition.
According to the My Oracle Support, the error has occurred due to Bug 21061354.
Solution is to apply patch 21061354.
Reference: Alter Pluggable Database Open Returns ORA-01405 (Doc ID 2193378.1)

Resources