理解Database和Instance

    学习Oracle的关键是熟悉Oracle体系结构。今天开始了Oracle体系结构之旅,顺带记录学习笔记,写写博客,防止忘记。

    1.Oracle体系结构基础

       1.1数据库database和实例instance

            1.1.1数据库database

                    这里的数据库指的是存放在磁盘中的数据库文件,比如数据文件、控制文  

                  件、日志文件等。                  

[oracle@ENMOEDU ENMOEDU]$ pwd
/u01/app/oracle/oradata/ENMOEDU
[oracle@ENMOEDU ENMOEDU]$ ls -lh
total 2.3G
-rw-r----- 1 oracle oinstall 9.3M Jan 20 12:19 control01.ctl
-rw-r----- 1 oracle oinstall 101M Jan 20 12:19 example01.dbf
-rw-r----- 1 oracle oinstall 51M Jan 20 12:18 redo01.log
-rw-r----- 1 oracle oinstall 51M Jan 20 12:19 redo02.log
-rw-r----- 1 oracle oinstall 51M Jan 20 12:18 redo03.log
-rw-r----- 1 oracle oinstall 601M Jan 20 12:19 sysaux01.dbf
-rw-r----- 1 oracle oinstall 721M Jan 20 12:19 system01.dbf
-rw-r----- 1 oracle oinstall 61M Jan 20 12:18 temp01.dbf
-rw-r----- 1 oracle oinstall 611M Jan 20 12:19 undotbs01.dbf
-rw-r----- 1 oracle oinstall 74M Jan 20 12:19 users01.dbf

                     如上,控制文件为.ctl;日志文件为.log;数据文件为.dbf。 

              1.1.2实例instance

                     这里的实例指的是进程和内存区域。

                     1.1.2.1查看系统内存分配及信号量:                                     

[oracle@ENMOEDU ~]$ ipcs

------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x00000000 3604481 root 644 52 2
0x00000000 3637251 root 644 16384 2
0x00000000 3670020 root 644 268 2

------ Semaphore Arrays --------
key semid owner perms nsems

------ Message Queues --------
key msqid owner perms used-bytes messages                    

                    如上,此为实例运行前,系统内存分配及信号量状况。

[oracle@ENMOEDU ~]$ ipcs

------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x00000000 3604481 root 644 52 2
0x00000000 3637251 root 644 16384 2
0x00000000 3670020 root 644 268 2
0x00000000 3899398 oracle 640 4096 0
0x00000000 3932167 oracle 640 4096 0
0x6265bc50 3964936 oracle 640 4096 0

------ Semaphore Arrays --------
key semid owner perms nsems
0x10b08078 262145 oracle 640 154

------ Message Queues --------
key msqid owner perms used-bytes messages

                    运行sqlplus并启动instance后,对比之后可以看到,Shared Memory  

                 Segments增加了3个Oracle相关的段。Semaphore Arrays也增加了一个。

                 这些增加的即是instance在内存中的分配表现。

                    1.1.2.2查看系统进程状况                     

[oracle@ENMOEDU ~]$ ps -ef|grep ora_
oracle 5418 5319 0 21:23 pts/3 00:00:00 grep ora_

                      实例运行前,ps命令没有查到oracle相关服务进程。

[oracle@ENMOEDU ~]$ ps -ef|grep ora_
oracle 5525 1 0 21:28 ? 00:00:00 ora_pmon_ENMOEDU
oracle 5527 1 0 21:28 ? 00:00:00 ora_psp0_ENMOEDU
oracle 5530 1 0 21:28 ? 00:00:00 ora_vktm_ENMOEDU
oracle 5534 1 0 21:28 ? 00:00:00 ora_gen0_ENMOEDU
oracle 5536 1 0 21:28 ? 00:00:00 ora_diag_ENMOEDU
oracle 5538 1 0 21:28 ? 00:00:00 ora_dbrm_ENMOEDU
oracle 5540 1 0 21:28 ? 00:00:00 ora_dia0_ENMOEDU
oracle 5542 1 0 21:28 ? 00:00:00 ora_mman_ENMOEDU
oracle 5544 1 0 21:28 ? 00:00:00 ora_dbw0_ENMOEDU
oracle 5546 1 0 21:28 ? 00:00:00 ora_lgwr_ENMOEDU
oracle 5548 1 0 21:28 ? 00:00:00 ora_ckpt_ENMOEDU
oracle 5550 1 0 21:28 ? 00:00:00 ora_smon_ENMOEDU
oracle 5552 1 0 21:28 ? 00:00:00 ora_reco_ENMOEDU
oracle 5554 1 0 21:28 ? 00:00:00 ora_mmon_ENMOEDU
oracle 5556 1 0 21:28 ? 00:00:00 ora_mmnl_ENMOEDU
oracle 5558 1 0 21:28 ? 00:00:00 ora_d000_ENMOEDU
oracle 5560 1 0 21:28 ? 00:00:00 ora_s000_ENMOEDU
oracle 5575 1 0 21:28 ? 00:00:00 ora_qmnc_ENMOEDU
oracle 5589 1 0 21:28 ? 00:00:00 ora_cjq0_ENMOEDU
oracle 5601 1 0 21:28 ? 00:00:00 ora_q000_ENMOEDU
oracle 5603 1 0 21:28 ? 00:00:00 ora_q001_ENMOEDU
oracle 5659 1 0 21:32 ? 00:00:00 ora_j000_ENMOEDU
oracle 5661 1 0 21:32 ? 00:00:00 ora_j001_ENMOEDU
oracle 5666 5319 0 21:32 pts/3 00:00:00 grep ora_

                        实例运行后,再次对比之前ps命令结果,多出了23个ora_开头的进程,

                      这些进程即是实例的一部分。

                         关闭实例后(shutdown),再次运行ipcs和ps命令,结果又回到了实例

                      运行前的状况。

                          从这里可以通过验证,体会到instance即为内存和进程组成。

              1.1.3总结

                      Oracle体系结构中Database和instance概念容易混淆,不过通过区别分析,加以实机命令输出验证,可以较为清晰理解。

                      如下是Oracle体系结构的简单概要图,后续文章将继续分享学习笔记。谢谢关注此博客!!!

                      NewImage

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/493318/viewspace-1073290/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/493318/viewspace-1073290/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值