32

I'm trying to create my own database using SQLPlus. So first I log into it as admin:

sqlplus sys/sys_password as sysdba

And then I try to create a new user, called sqlzoo :

CREATE USER sqlzoo IDENTIFIED BY sqlzoo 
DEFAULT TABLESPACE tbs_perm_01sqlzoo 
TEMPORARY TABLESPACE tbs_perm_01sqlzoo 
QUOTA 20M ON tbs_perm_01sqlzoo;

This gives me the following error :

ERROR at line 1:
ORA-01109: database not open

Why is it giving me such an error?

Mureinik
  • 297,002
  • 52
  • 306
  • 350
Caffeinated
  • 11,982
  • 40
  • 122
  • 216

13 Answers13

39

As the error states - the database is not open - it was previously shut down, and someone left it in the middle of the startup process. They may either be intentional, or unintentional (i.e., it was supposed to be open, but failed to do so).

Assuming that's nothing wrong with the database itself, you could open it with a simple statement:(Since the question is asked specifically in the context of SQLPlus, kindly remember to put a statement terminator(Semicolon) at the end mandatorily, otherwise, it will result in an error.)

ALTER DATABASE OPEN;
Sreedhar S
  • 699
  • 9
  • 21
Mureinik
  • 297,002
  • 52
  • 306
  • 350
  • Thanks !! For some reason, when I entered that command it tells me "Oracle not available" .. not sure – Caffeinated Dec 03 '14 at 19:55
  • I think I should avoid using `sysdba` user? – Caffeinated Dec 03 '14 at 19:59
  • 2
    please note that without the semicolon (;) at the end of the statement this will not work (at least from inside the SqlPlus) – Hakan Fıstık Sep 06 '16 at 15:17
  • Oracle. Where "STARTUP" doesn't "start up" a database and you're expected to know to do this as well... – Jobbo May 15 '19 at 14:14
  • Its already opened but still getting the same error while making connection in Oracle SQL Developer software. https://stackoverflow.com/questions/70706962/oracle-db-service-is-already-opened-but-still-getting-database-not-open-error – Kamlesh Jan 14 '22 at 07:36
27

I got a same problem. Below is how I solved the problem. I am working on an oracle database 12c pluggable database(pdb) on a windows 10.

-- using sqlplus to login as sysdba from a terminal; Below is an example:

sqlplus sys/@orclpdb as sysdba

-- First check your database status;

SQL> select name, open_mode from v$pdbs;

-- It shows the database is mounted in my case. If yours is not mounted, you should mount the database first.

-- Next open the database for read/write

SQL> ALTER PLUGGABLE DATABASE OPEN; (or ALTER PLUGGABLE DATABASE YOURDATABASENAME OPEN;)

-- Check the status again.

SQL> select name, open_mode from v$pdbs;

-- Now your dababase should be open for read/write and you should be able to create schemas, etc.

Renhuai
  • 536
  • 9
  • 9
5

If you are using 19c then just follow the following steps

  1. Login with sys user.
  2. alter the session to the pluggable database with the following command.
  3. SQL>alter session set container=orclpdb;
  4. Next startup the database.
  5. SQL>startup After that database will not show the above error.
Mukesh Chauhan
  • 791
  • 8
  • 9
4

alter pluggable database orclpdb open;`

worked for me.

orclpdb is the name of pluggable database which may be different based on the individual.

Charitha
  • 41
  • 1
3
I was facing some problem from SQL PLUS Command Promt.

So I resolve this issue from windows CMD ,I follow such steps--->

1: open CMD (Windows)

2: type show pdbs;

   now u have to unmount the data base which is mounted

3: type alter pluggable database database_Name open;

4: type show pdbs;(for cross check)

It works for me

Suraj Verma
  • 463
  • 6
  • 8
2

have you tried SQL> alter database open; ? after first login?

void
  • 7,760
  • 3
  • 25
  • 43
1

If your database is down then during login as SYSDBA you can assume this. While login command will be executed like sqlplus sys/sys_password as sysdba that time you will get "connected to idle instance" reply from database. This message indicates your database is down. You should need to check first alert.log file about why database is down. If you found it was downed normally then you can issue "startup" command for starting database and after that execute your create user command. If you found database is having issue like missing datafile or something else then you need to recover database first and open database for executing your create user command.

"alter database open" command only accepted by database while it is on Mount stage. If database is down then it won't accept "alter database open" command.

doc123
  • 106
  • 6
1

The same problem takes me here. After all, I found that link, it's good for me.

Source link

CHECK THE STATUS OF PLUGGABLE DATABASE.

SQL> STARTUP; ORACLE instance started.

Total System Global Area 788529152 bytes Fixed Size 2929352 bytes Variable Size 541068600 bytes Database Buffers 239075328 bytes Redo Buffers 5455872 bytes Database mounted. Database opened. SQL> select name,open_mode from v$pdbs;

NAME OPEN_MODE ------------------------------ ---------- PDB$SEED MOUNTED PDBORCL MOUNTED PDBORCL2 MOUNTED PDBORCL1
MOUNTED

WE NEED TO START PDB$SEED PLUGGABLE DATABASE in UPGRADE STATE FOR THAT

SQL> SHUTDOWN IMMEDIATE;

Database closed. Database dismounted. ORACLE instance shut down.

SQL> STARTUP UPGRADE;

ORACLE instance started.

Total System Global Area 788529152 bytes Fixed Size 2929352 bytes Variable Size 541068600 bytes Database Buffers 239075328 bytes Redo Buffers 5455872 bytes Database mounted. Database opened.

SQL> ALTER PLUGGABLE DATABASE ALL OPEN UPGRADE; Pluggable database altered.

SQL> select name,open_mode from v$pdbs;

NAME OPEN_MODE ------------------------------ ---------- PDB$SEED MIGRATE PDBORCL MIGRATE PDBORCL2 MIGRATE PDBORCL1
MIGRATE

Tri Pham
  • 66
  • 3
1

As the error states - the database is not open - it was previously shut down, and someone left it in the middle of the startup process. They may either be intentional, or unintentional (i.e., it was supposed to be open, but failed to do so).

Assuming that's nothing wrong with the database itself, you could open it with a simple statement. (Since the question is asked specifically in the context of SQLPlus, kindly remember to put a statement terminator(Semicolon) at the end mandatorily, otherwise, it will result in an error. The semicolon character is a statement terminator. It is a part of the ANSI SQL-92 standard.)

ALTER DATABASE OPEN;
Sreedhar S
  • 699
  • 9
  • 21
  • Its already opened but still getting the same error while making connection in Oracle SQL Developer software. https://stackoverflow.com/questions/70706962/oracle-db-service-is-already-opened-but-still-getting-database-not-open-error – Kamlesh Jan 14 '22 at 07:37
0

please run this script

ALTER DATABASE OPEN
harun ugur
  • 1,718
  • 18
  • 18
0
  1. Open SQLPLUS and login with sys as sysdba.
  2. After that run alter pluggable database <<database_name>> open;

This Worked for me .

0

While working on SQL developer tool I received the error while connecting to my pdb

ORA-01109 database not open

I followed these steps to solve this issue:

  • Logged in as a sys user
  • ALTER DATABASE OPEN throws an error:- ORA-01531: a database already open by the instance
  • changed container to pdb1:- ALTER SESSION SET CONTAINER=pdb1

Problem Solved!

Vineet Singh
  • 309
  • 5
  • 12
-1

il faut faire

SQL> STARTUP FRORCE