oracle 如何解决此“ORA-01109:数据库未打开”错误?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27280405/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I resolve this "ORA-01109: database not open" error?
提问by Coffee
I'm trying to create my own database using SQLPlus. So first I log into it as admin:
我正在尝试使用 SQLPlus 创建我自己的数据库。所以首先我以管理员身份登录:
sqlplus sys/sys_password as sysdba
And then I try to create a new user, called sqlzoo :
然后我尝试创建一个名为 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?
为什么给我这样的错误?
回答by Mureinik
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.)
假设数据库本身没有问题,你可以用一个简单的语句打开它:(因为这个问题是在SQLPlus的上下文中专门提出的,请记住强制在最后加上一个语句终止符(分号),否则,它会导致错误。)
ALTER DATABASE OPEN;
回答by Renhuai
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.
我遇到了同样的问题。下面是我解决问题的方法。我正在 Windows 10 上处理 oracle 数据库 12c 可插拔数据库(pdb)。
-- using sqlplus to login as sysdba from a terminal; Below is an example:
-- 使用 sqlplus 从终端以 sysdba 身份登录;下面是一个例子:
sqlplus sys/@orclpdb as sysdba
sqlplus sys/@orclpdb 作为 sysdba
-- First check your database status;
-- 首先检查你的数据库状态;
SQL> select name, open_mode from v$pdbs;
SQL> 从 v$pdbs 中选择名称、open_mode;
-- 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;
SQL> 更改可插入数据库打开;
-- Check the status again.
-- 再次检查状态。
SQL> select name, open_mode from v$pdbs;
SQL> 从 v$pdbs 中选择名称、open_mode;
-- Now your dababase should be open for read/write and you should be able to create schemas, etc.
-- 现在您的 dababase 应该可以读/写,并且您应该能够创建模式等。
回答by Charitha
alter pluggable database orclpdb open;`
更改可插拔数据库 orclpdb 打开;`
worked for me.
对我来说有效。
orclpdb
is the name of pluggable database which may be different based on the individual.
orclpdb
是可插拔数据库的名称,因人而异。
回答by null
have you tried SQL> alter database open;? after first login?
你有没有试过SQL> alter database open; ? 第一次登录后?
回答by doc123
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.
如果您的数据库关闭,那么在以 SYSDBA 身份登录期间,您可以假设这一点。虽然登录命令将像 sqlplus sys/sys_password 作为 sysdba 一样执行,但那时您将从数据库获得“连接到空闲实例”的回复。此消息表明您的数据库已关闭。您应该需要检查第一个 alert.log 文件,了解数据库关闭的原因。如果您发现它正常关闭,那么您可以发出“启动”命令来启动数据库,然后执行您的创建用户命令。如果您发现数据库存在丢失数据文件或其他问题,那么您需要先恢复数据库并打开数据库以执行您的创建用户命令。
"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.
“alter database open”命令仅在数据库处于挂载阶段时被数据库接受。如果数据库关闭,则它不会接受“alter database open”命令。
回答by Tri Pham
The same problem takes me here. After all, I found that link, it's good for me.
同样的问题把我带到这里。毕竟,我找到了那个链接,这对我有好处。
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
MOUNTEDWE 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
SQL> 启动;ORACLE 实例启动。
总系统全局区域 788529152 字节 固定大小 2929352 字节 可变大小 541068600 字节 数据库缓冲区 239075328 字节 重做缓冲区 5455872 字节 数据库已安装。数据库打开。SQL> select name,open_mode from v$pdbs;
名称 OPEN_MODE ------------------------------ ---------- PDB$SEED MOUNTED PDBORCL MOUNTED PDBORCL2 MOUNTED PDBORCL1 已
安装为此,我们需要在升级状态下启动 PDB$SEED 可插拔数据库
SQL>立即关闭;
数据库关闭。数据库已卸除。ORACLE 实例关闭。
SQL> 启动升级;
ORACLE 实例启动。
总系统全局区域 788529152 字节 固定大小 2929352 字节 可变大小 541068600 字节 数据库缓冲区 239075328 字节 重做缓冲区 5455872 字节 数据库已安装。数据库打开。
SQL> ALTER PLUGGABLE DATABASE ALL OPEN UPGRADE; 可插入数据库已更改。
SQL> select name,open_mode from v$pdbs;
名称 OPEN_MODE ------------------------------ ---------- PDB$SEED 迁移 PDBORCL 迁移 PDBORCL2 迁移PDBORCL1
迁移
回答by Sreedhar S
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.)
假设数据库本身没有问题,您可以使用简单的语句打开它。(由于该问题是在SQLPlus的上下文中专门问的,所以记得强制在最后加上一个语句终止符(分号),否则会导致错误。分号字符是一个语句终止符。它是ANSI SQL-92 标准。)
ALTER DATABASE OPEN;
回答by harun ugur
please run this script
请运行这个脚本
ALTER DATABASE OPEN