温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

oracle中怎么查询实例名与实例状态

发布时间:2021-07-26 16:48:03 来源:亿速云 阅读:659 作者:Leah 栏目:数据库

这篇文章给大家介绍oracle中怎么查询实例名与实例状态,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。

  

一、查看实例名、表等

  [oracle@shoubashou.com ~]$ sqlplus scott/tiger@orcl

  SQL> show user;

  USER is "SCOTT"

  SQL> select * from tab;

  TNAME TABTYPE CLUSTERID

  ------------------------------ ------- ----------

  BONUS TABLE

  DEPT TABLE

  EMP TABLE

  SALGRADE TABLE

  SQL> conn sys/oracle@orcl as sysdba

  Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.3.0

  Connected as sys@orcl AS SYSDBA

  SQL> select name from v$database;

  NAME

  ---------

  ORCL

  SQL> select * from global_name; #数据库全局名称

  GLOBAL_NAME

  --------------------------------------------------------------------------------

  ORCL

  SQL> show parameter global_names;

  NAME TYPE VALUE

  ------------------------------------ ----------- ------------------------------

  global_names boolean FALSE

  SQL> select status from v$instance;

  STATUS # 手把手

  ------------

  OPEN

  

二、启动几个阶段状态实验

  1. nomount

  SQL> startup nomount

  ORACLE instance started.

  Total System Global Area 1286066176 bytes

  Fixed Size 2228024 bytes

  Variable Size 352321736 bytes

  Database Buffers 922746880 bytes

  Redo Buffers 8769536 bytes

  SQL> select status from v$instance;

  STATUS

  ------------

  STARTED

  SQL> select open_mode from v$database;

  select open_mode from v$database

  *

  ERROR at line 1:

  ORA-01507: database not mounted

  2. mount

  SQL> alter database mount;

  Database altered.

  SQL> select status from v$instance;

  STATUS

  ------------

  MOUNTED

  SQL> select open_mode from v$database;

  OPEN_MODE

  --------------------

  MOUNTED

  3.open

  SQL> alter database open ;

  Database altered.

  SQL> select status from v$instance;

  STATUS

  ------------

  OPEN

  SQL> select open_mode from v$database;

  OPEN_MODE

  --------------------

  READ WRITE

  4. close

  SQL> alter database close;

  Database altered.

  SQL> select status from v$instance;

  STATUS

  ------------

  MOUNTED

  SQL> select open_mode from v$database;

  OPEN_MODE

  --------------------

  MOUNTED

  # 数据库open_mode的read only和read write,改变了需要重新启动数据库。

关于oracle中怎么查询实例名与实例状态就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI