database 如何在sqlplus中打开一个已经创建好的数据库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15430428/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 08:54:02  来源:igfitidea点击:

how to open a database in sqlplus which is already created

databaseoraclesqlplus

提问by user2173592

In SQL*plus i can't open the databse which is already created in my computer....

在 SQL*plus 中,我无法打开已在我的计算机中创建的数据库....

the error it shows that "the database is not yet open" and i want to know that in what command is suitable to open database.

错误显示“数据库尚未打开”,我想知道哪个命令适合打开数据库。

回答by Luke Woodward

I assume you're getting an error such as ORA-01219: database not open: queries allowed on fixed tables/views only. In that case, the fix is to connect as SYSand execute ALTER DATABASE OPEN:

我假设您收到了诸如ORA-01219: database not open: queries allowed on fixed tables/views only. 在这种情况下,修复方法是连接为SYS并执行ALTER DATABASE OPEN

C:\Users\Luke>sqlplus / as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Sun Mar 17 10:31:40 2013

Copyright (c) 1982, 2010, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - Production

SQL> select count(*) from user_tables;
select count(*) from user_tables
                     *
ERROR at line 1:
ORA-01219: database not open: queries allowed on fixed tables/views only


SQL> alter database open;

Database altered.

SQL> select count(*) from user_tables;

  COUNT(*)
----------
       935

If you get an error ORA-01507: database not mountedwhen you run ALTER DATABASE OPEN, run ALTER DATABASE MOUNTbefore ALTER DATABASE OPEN.

如果你得到一个错误,ORA-01507: database not mounted当您运行ALTER DATABASE OPEN,运行ALTER DATABASE MOUNTALTER DATABASE OPEN

There might a reason why the database isn't open and/or mounted. Perhaps it failed to open? In that case, ALTER DATABASE OPENis likely to result in an error other than ORA-01507. If so, the folks on https://dba.stackexchange.com/should be able to help you.

数据库未打开和/或未安装可能是有原因的。也许它无法打开?在那种情况下,ALTER DATABASE OPEN很可能会导致除 之外的错误ORA-01507。如果是这样,https://dba.stackexchange.com/ 上的人应该能够帮助您。