11. Oracle Instance Architecture

1.Oracle的结构主要包括4部分:

  • Oracle  database  instance
  • Memore Architecture
  • Process Archiitecture
  • Application and oracle net services Architecture 

2.  Oracle database instance 

     当一个实例启动时,Oracle 数据库会被分配一个叫system global area(SGA)内存区域和一些后台进程。

    SGA的作用:

    • 维护大量进程和线程的并发访问的内部数据结构
    • 从磁盘中读出一些数据块进行缓存
    • Buffering redo data before writing it to the online redo log files
    • 存储sql的执行计划

3.Database instance

  

4. Read/Write and Read-Only instance

  每一个数据库实例都是读/写或者只读。 读写(read/write)实例这种事数据库默认的,它可以做DML操作,但是对于只读(Read-only)实例只能进行查询,不能进行DML(update,delete,insert或者merge)

Unlike read/write instances, read-only instances have the following characteristics:

  • Can only open a database that has already been opened by a read/write instance

  • Disable many background processes, including the checkpoint and archiver processes, which are not necessary

  • Can mount a disabled redo thread or a thread without any online redo log

这里可以通过视图v$database 查看字段instance_mode  看看数据库是否为read-only

查看数据库启动时间

SQL> SELECT 
TO_CHAR(STARTUP_TIME,'MON-DD-RR HH24:MI:SS') 
AS "Inst Start Time" FROM V$INSTANCE;

5.数据库目录: 主要是Oracle的家目录:$ORACLE_HOME  还有一个$ORACLE_BASE

6.Oracle System Identifier(SID)

The system identifier (SID) is a unique name for an Oracle database instance on a specific host.

On UNIX and Linux, Oracle Database uses the SID and Oracle home values to create a key to shared memory. Also, Oracle Database uses the SID by default to locate the initialization parameter file, which locates relevant files such as the database control files.

On most platforms, the ORACLE_SID environment variable sets the SID, and the ORACLE_HOME variable sets the Oracle home. When connecting to a database instance, clients can specify the SID in an Oracle Net connection or use a net service name. Oracle Database converts a service name into an ORACLE_HOME and ORACLE_SID.

A traditional read-write Oracle home contains instance-specific files. However, when the Oracle home is read-only, instance-specific files are stored separately in the Oracle base. In either case, files whose names include the SID reside in the dbs subdirectory of the Oracle base configuration directory (ORACLE_BASE_CONFIG). Because of this separation, a user can create a database using software in an existing read-only Oracle home, and then start an instance for this database using software that resides in a new read-only Oracle home.

7.Oracle的启动和关闭

  这里可以参考一下前面写的文档,共有三个阶段

8. Oracle的权限

  Oracle数据库启动和关闭需要管理员权限,正常用户时无法操作这个过程的。oracle内部有几个这样的用户(SYSDBA、SYSOPER、SYSBACKUP、SYSDG、SYSKM)可以操作数据的启动和关闭

9. ORACLE启动过程

  • started阶段
  • mounted阶段
  • opened阶段   

  9.1  How an instance is started?

        它主要是通过以下步骤进行的

      1. Searches for a server parameter file in a platform-specific default location and, if not found, for a text initialization parameter file (specifying STARTUP with the SPFILE or PFILE parameters overrides the default behavior)

      2. Reads the parameter file to determine the values of initialization parameters

      3.  Allocates the SGA based on the initialization parameter settings

      4. Starts the Oracle background processes

              5.Opens the alert log and trace files and writes all explicit parameter settings to the alert log in valid parameter syntax

  9.2   How a Database is mounted?   

    The instance mounts a database to associate the database with this instance. 

    To mount the database, the instance obtains the names of the database control files specified in the CONTROL_FILES initialization parameter and opens the files. Oracle Database reads the control files to find the names of the data files and the online redo log files that it will attempt to access when opening the database.

    In a mounted database, the database is closed and accessible only to database administrators. Administrators can keep the database closed while completing specific maintenance operations. However, the database is not available for normal operations

   9.3  How a Database is opened?

      When you open the database, Oracle Database performs the following actions:

  • Opens the online data files in tablespaces other than undo tablespaces

    If a tablespace was offline when the database was previously shut down, then the tablespace and its corresponding data files will be offline when the database reopens.

  • Acquires an undo tablespace

    If multiple undo tablespaces exists, then the UNDO_TABLESPACE initialization parameter designates the undo tablespace to use. If this parameter is not set, then the first available undo tablespace is chosen.

  • Opens the online redo log files    

参考:

  https://docs.oracle.com/en/database/oracle/oracle-database/21/cncpt/oracle-database-instance.html#GUID-8180290B-A8B5-493D-91F0-EAE677A6A319

posted on 2021-09-28 21:04  太白金星有点烦  阅读(47)  评论(0编辑  收藏  举报

导航