Oracle Database12c ORA 01918 and connection error
I have installed Oracle 12c and I am having problems creating my first database and using it. I start SQL Developer and use user "hr", but he keeps telling me that the account is locked out. I have searched for answers on stackoverflow and official doc and tried to unlock it with:
ALTER USER HR IDENTIFIED BY password ACCOUNT UNLOCK;
but without success. I got error ORA01918 which means the user does not exist.
I tried to use the user created during installation (SYS as SYSDBA) but then it says the user / password is wrong. I'm pretty sure I have installed Oracle 12c correctly on my system, it is Windows 8.1 x64.
What should I do? Please help me.
Another thing that I don't understand is, anyway, the term "database" is equivalent to MySQL "Schema"? A "connection" is a connection to a specific database, right? Thank.
source to share
How did you set up your database? Have you checked the option for Pluggable database
? If so, make sure you are logged in PDB
and not CDB
.
Please read Oracle 12c Post-Installation Required Steps .
By default, pre-installed
users such as SCOTT
, HR
etc. are in container database
, not in Pluggable database
.
tnsnames.ora
Edit the tnsnames.ora file to add PDB data. For example,
PDBORCL = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = pdborcl) ) )
Open all PDBs
To open all / specific PDBs immediately upon login, create a AFTER START level trigger in the CDB.
Since PDBs are not opened via CDB launch. Let's get a look:
SHUTDOWN IMMEDIATE;
STARTUP;
SQL> SELECT name, open_mode FROM v$pdbs;
NAME OPEN_MODE
------------------------------ ----------
PDB$SEED READ ONLY
PDBP6 MOUNTED
So, to have all PDBs automatically open, do the following:
Do, " ", and then do: SQLPLUS / AS SYSDBA
CREATE OR REPLACE TRIGGER open_pdbs
AFTER STARTUP ON DATABASE
BEGIN
EXECUTE IMMEDIATE 'ALTER PLUGGABLE DATABASE ALL OPEN';
END open_pdbs;
/
It creates a runlevel trigger after being run in CDB.
SQLPLUS / AS SYSDBA
The most common misunderstanding concerns the use of SQLPLUS / AS SYSDBA.
Since we tested the ability to create a single CDB , the SQLPLUS / AS SYSDBA command will always be written to the CDB. Typically, developers have unlocked the "SCOTT" account directly after registering with SYSDBA. But here's the trick:
"SCOTT" and other schematic examples are in the PDB, not the CDB . So, you need to login as sysdba in PDB.
sqlplus SYS/password@PDBORCL AS SYSDBA
SQL> ALTER USER scott ACCOUNT UNLOCK IDENTIFIED BY tiger;
sqlplus scott/tiger@pdborcl
SQL> show user;
USER is "SCOTT"
source to share