Oracle Database Instance - Oracle 实例篇 1

前言:在 Oracle Memory Architecture - Oracle 体系结构篇 1 里面有关于实例的涉及,大家可以参考。

Oracle Memory Architecture - Oracle 体系结构篇 1  http://blog.csdn.net/u010993297/article/details/9352695

1. Database Instance Configurations

有下面两种配置:

>>Single-instance configuration

A one-to-one relationship exists between the database and an instance.

>>Oracle Real Application Clusters (Oracle RAC) configuration

A one-to-many relationship exists between the database and instance.

见下图:

                                                                                     图 1  Database instance configurations

 

Whether in a single-instanceor Oracle RAC configuration, a database instance is associated withonly one database at a time. You can start a database instance and mount (associate the instance with) one database, but not mount two databases simultaneously with the same instance.

--不论是单实例或者是多实例的配置,一个数据库实例每次只能关联一个数据库。

还有另外一种情况就是多个实例可以运行在同一个计算机上。每一个实例访问自己的数据库。

Multiple instances can run concurrently on thesame computer, each accessing itsown database. For example, a computer can host two distinct databases: prod1 and prod2. One database instance manages prod1, while a separate instance manages prod2.

2.Duration of an Instance

An instance begins when it is created with the STARTUP command and ends when it is terminated. During this period, an instance can associate itself with one and only one database. Furthermore, the instance can mount a database only once, close it only once, and open it only once. After a database has been closed or shut down, you must start a different instance to mount and open this database.

--我们来做一个实验,看下面的过程:

SQL> startup

ORACLE instance started.

 

Total System Global Area 468729856 bytes

Fixed Size                 1333556 bytes

Variable Size            440403660 bytes

Database Buffers          16777216 bytes

Redo Buffers              10215424 bytes

Database mounted.

Database opened.       

--startup命令打开数据库,实例已创建,数据库mount之后打开。

 

SQL> SELECT

    TO_CHAR(STARTUP_TIME,'MON-DD-RR HH24:MI:SS')

    AS "Inst Start Time" FROM V$INSTANCE;

 

Inst Start Time

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

AUG-07-13 22:37:26

--查询实例启动的时间

 

SQL>ALTER DATABASE CLOSE;

Databasealtered.

Theinstance closes the database, leaving it in a mounted state. The instance canread and write to the control file but not the data files.

--数据库实例被关闭,数据库处于mount状态,可以读写控制文件,但是不可以读写数据文件。如下所示:

SQL>select name from v$datafile;

NAME                                      

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

D:\APP\MALATA\ORADATA\ORCL\SYSTEM01.DBF

D:\APP\MALATA\ORADATA\ORCL\SYSAUX01.DBF

D:\APP\MALATA\ORADATA\ORCL\UNDOTBS01.DBF

D:\APP\MALATA\ORADATA\ORCL\USERS01.DBF

D:\APP\MALATA\ORADATA\ORCL\EXAMPLE01.DBF

SQL>select * from scott.emp;

select* from scott.emp

ERRORat line 1:

ORA-01219:database not open: queries allowed on fixed tables/views only

 

SQL>alter database open;

alterdatabase open

*

ERRORat line 1:

ORA-16196:database has been previously opened and closed

Theinstance attempts to reopen the database that it previously closed. OracleDatabase issues an error because the same instance cannot open a databasetwice.

--同一个实例不能打开两次数据库。

 

SQL>SHUTDOWN IMMEDIATE;

ORA-01109:database not open

Database dismounted.     

ORACLEinstance shut down.

Atthis stage, the only option for the instance is to shut down, ending the lifeof this instance.

--关闭数据库,实例终止。

 

SQL> startup     

ORACLEinstance started.

The  startup command creates a new instance and mounts and open the database.

--startup命令开启数据库,创建一个新的实例,mount,然后打开数据库。

SQL>SELECT  TO_CHAR(STARTUP_TIME,'MON-DD-RRHH24:MI:SS')  AS "Inst Start Time" FROMV$INSTANCE;

Inst Start Time

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

AUG-07-13 23:18:49

Thisquery shows the time that the current instance was started. The  different start timeshows that this instance is different from the one that shut down the database.

--这次我们看到了与上面开始时记录的不同的实例开始时间。

 

待续。。。。

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值