Heim  >  Artikel  >  Datenbank  >  oracle nomount mount open直接的关系

oracle nomount mount open直接的关系

WBOY
WBOYOriginal
2016-06-07 15:31:17992Durchsuche

startup nomount startup mount startup open (startup的默认选项) 其他常用的参数:read only ,read write ,force,restrict 这些参数可以一起使用,比如 startup 与 startup open read write 是一样的效果。 Oracle的启动过程:启动实例 - 装载数据库 - 打开

  startup nomount

  startup mount

  startup open (startup的默认选项)

  其他常用的参数:read only ,read write ,force,restrict

  这些参数可以一起使用,比如 startup 与 startup open read write 是一样的效果。

  Oracle的启动过程:启动实例  -> 装载数据库 -> 打开数据库

  与之对应的读取相应文件的顺序: 参数文件 -> 控制文件 -> 数据文件

  我们验证一下这些步骤的区别:

  startup nomount

  使用nomount方式启动数据库时,表示只启动数据库实例,不装载数据库,不打开数据库

  这时只读取参数文件,主要有两部分工作:一是分配内存SGA区,二是启动Oracle后台进程

  如下我们修改oracle参数文件的名称,并以nomount 的方式启动数据库

  这里需要将pfile,spfile 都进行修改,数据库默认使用spfile启动,在找不到spfile时用pfile启动。

  [oracle@localhost dbs]$ pwd

  /oracle/orc10g/product/10.1.0/db_1/dbs

  [oracle@localhost dbs]$ mv initorcl.ora initorcl1.ora

  [oracle@localhost dbs]$ mv spfileorcl.ora spfileorcl1.ora

  SYS@orcl>shutdown abort

  ORACLE instance shut down.

  SYS@orcl>startup nomount

  ORA-01078: failure in processing system parameters

  LRM-00109: could not open parameter file '/oracle/orc10g/product/10.1.0/db_1/dbs/initorcl.ora'

  SYS@orcl>

  #保持参数文件正确,修改控制文件名称

  [oracle@localhost orcl]$ pwd

  /oracle/orc10g/oradata/orcl

  [oracle@localhost orcl]$ mv control01.ctl control01a.ctl

  [oracle@localhost orcl]$ mv control02.ctl control02a.ctl

  [oracle@localhost orcl]$ mv control03.ctl control03a.ctl

  .....

  SYS@orcl>startup nomount

  ORACLE instance started.

  Total System Global Area 167772160 bytes

  Fixed Size 778212 bytes

  Variable Size 61874204 bytes

  Database Buffers 104857600 bytes

  Redo Buffers 262144 bytes

  SYS@orcl>

  在nomount的方式下修改控制文件名称,并没有报错。说明在nomount的方式下,并没有读取控制文件。

  继续以上的步骤,我们以mount的方式启动:

  SYS@orcl>alter database mount;

  alter database mount

  *

  ERROR at line 1:

  ORA-00205: error in identifying controlfile, check alert log for more info

  装载数据库时,需要读取控制文件确定数据文件的位置。

  继续上面的例子,我们将控制文件修改正确,使数据库可以正确的找到控制文件,

  我们修改数据文件的名称.

  [oracle@localhost orcl]$ mv tp_test.dbf tp_test1.dbf

  .....

  SYS@orcl>startup mount

  ORACLE instance started.

  Total System Global Area  167772160 bytes

  Fixed Size                   778212 bytes

  Variable Size              61874204 bytes

  Database Buffers          104857600 bytes

  Redo Buffers                 262144 bytes

  Database mounted.

  虽然我修改了数据文件,但是在mount的方式下,并没有报错。说明在mount的方式下,启动过程只读取了参数文件和控制文件。

  下面我们打开数据库。

  SYS@orcl>alter database open

  2 ;

  alter database open

  *

  ERROR at line 1:

  ORA-01157: cannot identify/lock data file 5 - see DBWR trace file

  ORA-01110: data file 5: '/oracle/orc10g/oradata/orcl/tp_test.dbf'

  提示我们找不到tp_test.dbf这个文件了。

  至此我们大概的了解了数据库的启动过程以及启动过程中每一步骤的所做的工作和读取的文件。

  总结如下:oracle按照如下过程启动数据库

  nomount

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

  启动实例   |  mount

  (参数文件)  |---------------

  | 装载数据库    |  open

  (控制文件)     |-----------

  | 打开数据库

  (数据文件)

  1.nomount方式下还没有读取控制文件,该选项用于在数据库的控制文件全部损坏,需要重新创建数据库控制文件或创建一个新的数据库时使用。

  2.mount 选项下并没有打开数据文件,该选项可以用来修改数据库的运行模式或进行数据库恢复。

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Vorheriger Artikel:oracle常用sql语句(综合)Nächster Artikel:Oracle 物化视图