首页 什么是Oracle数据库实例

什么是Oracle数据库实例

举报
开通vip

什么是Oracle数据库实例13 Oracle Database Instance http://docs.oracle.com/cd/E11882_01/server.112/e25789/startup.htm This chapter explains the nature of an Oracle database instance, the parameter and diagnostic files associated with an instance, and what occurs during instance crea...

什么是Oracle数据库实例
13 Oracle Database Instance http://docs.oracle.com/cd/E11882_01/server.112/e25789/startup.htm This chapter explains the nature of an Oracle database instance, the parameter and diagnostic files associated with an instance, and what occurs during instance creation and the opening and closing of a database. This chapter contains the following sections: Introduction to the Oracle Database Instance Overview of Instance Startup and Shutdown Overview of Checkpoints Overview of Instance Recovery Overview of Parameter Files Overview of Diagnostic Files Introduction to the Oracle Database Instance A database instance is a set of memory structures that manage database files. A database is a set of physical files on disk created by the CREATE DATABASE statement. The instance manages its associated data and serves the users of the database. Every running Oracle database is associated with at least one Oracle database instance. 每个正在运行的Oracle数据库,都伴随着至少一个Oracle数据库实例。 Because an instance exists in memory and a database exists on disk, an instance can exist without a database and a database can exist without an instance. Database Instance Structure When an instance is started, Oracle Database allocates a memory area called the system global area (SGA) and starts one or more background processes. The SGA serves various purposes, including the following: 当一个数据库实例开始运行,Oracle系统还会分配一个内存区域,称为SGA,并开始一个或数个后台进程。 SGA的功能包括: 维护内部数据的结构,这些数据被大量的进程和线程同时访问 为从硬盘获取的数据块提供缓存 在写入在线重做日志文件之前,缓存重做数据 存储SQL处理 方案 气瓶 现场处置方案 .pdf气瓶 现场处置方案 .doc见习基地管理方案.doc关于群访事件的化解方案建筑工地扬尘治理专项方案下载 Maintaining internal data structures that are accessed by many processes and threads concurrently Caching data blocks read from disk Buffering redo data before writing it to the online redo log files Storing SQL execution plans The SGA is shared by the Oracle processes, which include server processes and background processes, running on a single computer. The way in which Oracle processes are associated with the SGA varies according to operating system. SGA由在单一计算机上运行的包括服务器进程和后台进程的Oracle进程共享。Oracel进程与SGA关联,不同的操作系统有不同的处理方式 A database instance includes background processes. Server processes, and the process memory allocated in these processes, also exist in the instance. The instance continues to function when server processes terminate. 数据库实例包含后台进程。服务器进程以及为这些进程分配的内存,也存在在这一实例中。服务器进程中止后,实例依然存在。 Figure 13-1 shows the main components of an Oracle database instance. Figure 13-1 Database Instance Description of "Figure 13-1 Database Instance" See Also: "Overview of the System Global Area" "Overview of Background Processes" Database Instance Configurations You can run Oracle Database in either of the following mutually exclusive 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 instances. Figure 13-2 shows possible database instance configurations. Figure 13-2 Database Instance Configurations Description of "Figure 13-2 Database Instance Configurations" Whether in a single-instance or Oracle RAC configuration, a database instance is associated with only 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. 不管哪种配置 方法 快递客服问题件处理详细方法山木方法pdf计算方法pdf华与华方法下载八字理论方法下载 ,一个数据库实例,最多只能对应一个数据库。 Note: This chapter discusses a single-instance database configuration unless otherwise noted. Multiple instances can run concurrently on the same computer, each accessing its own database. For example, a computer can host two distinct databases: prod1 and prod2. One database instance manages prod1, while a separate instance manages prod2. See Also: Oracle Real Application Clusters Administration and Deployment Guidefor information specific to Oracle RAC 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. Table 13-1 illustrates a database instance attempting to reopen a database that it previously closed. Table 13-1 Duration of an Instance Statement Explanation 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. The STARTUP command creates an instance, which mounts and opens the database. SQL> SELECT TO_CHAR(STARTUP_TIME,'MON-DD-RR HH24:MI:SS') AS "Inst Start Time" FROM V$INSTANCE; Inst Start Time ------------------ JUN-18-11 13:14:48 This query shows the time that the current instance was started. SQL> SHUTDOWN IMMEDIATE The instance closes the database and shuts down, ending the life of this instance. SQL> STARTUP Oracle instance started. . . . The STARTUP command creates a new instance and mounts and open the database. SQL> SELECT TO_CHAR(STARTUP_TIME,'MON-DD-RR HH24:MI:SS') AS "Inst Start Time" FROM V$INSTANCE; Inst Start Time ------------------ JUN-18-11 13:16:40 This query shows the time that the current instance was started. The different start time shows that this instance is different from the one that shut down the database. 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, the SID is used by default to locate the parameter file, which is used to locate relevant files such as the database control files. On most platforms, the ORACLE_SID environment variable sets the SID, whereas the ORACLE_HOME variable sets the Oracle home. When connecting to an 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. See Also: "Service Names" Oracle Database Administrator's Guide to learn how to specify an Oracle SID Overview of Instance Startup and Shutdown A database instance provides user access to a database. This section explains the possible states of the instance and the database. Overview of Instance and Database Startup In a typical use case, you manually start an instance and then mount and open the database, making it available for users. You can use the SQL*Plus STARTUP command, Oracle Enterprise Manager (Enterprise Manager), or the SRVCTL utility to perform these steps. Figure 13-3 shows how a database progresses from a shutdown state to an open state. Figure 13-3 Instance and Database Startup Sequence Description of "Figure 13-3 Instance and Database Startup Sequence" A database goes through the following phases when it proceeds from a shutdown state to an open database state: Instance started without mounting database The instance is started, but is not yet associated with a database. "How an Instance Is Started" explains this stage. Database mounted The instance is started and is associated with a database by reading its control file (see "Overview of Control Files"). The database is closed to users. "How a Database Is Mounted" explains this stage. Database open The instance is started and is associated with an open database. The data contained in the data files is accessible to authorized users. "How a Database Is Opened" explains this stage. See Also: "Oracle Enterprise Manager" Oracle Database 2 Day DBA and Oracle Database Administrator's Guide to learn how to start an instance Oracle Database Administrator's Guide to learn how to use SRVCTL Connection with Administrator Privileges Database startup and shutdown are powerful administrative options that are restricted to users who connect to Oracle Database with administrator privileges. Normal users do not have control over the current status of an Oracle database. Depending on the operating system, one of the following conditions establishes administrator privileges for a user: The operating system privileges of the user enable him or her to connect using administrator privileges. The user is granted the SYSDBA or SYSOPER system privileges and the database uses password files to authenticate database administrators over the network. SYSDBA and SYSOPER are special system privileges that enable access to a database instance even when the database is not open. Control of these privileges is outside of the database itself.When you connect with the SYSDBA system privilege, you are in the schema owned by SYS. When you connect as SYSOPER, you are in the public schema. SYSOPER privileges are a subset of SYSDBA privileges. See Also: "SYS and SYSTEM Schemas" "Overview of Database Security" to learn about password files and authentication for database administrators Oracle Database Administrator's Guide to learn about SYSDBA and SYSOPER How an Instance Is Started When Oracle Database starts an instance, it performs the following basic steps: 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) Reads the parameter file to determine the values of initialization parameters Allocates the SGA based on the initialization parameter settings Starts the Oracle background processes Opens the alert log and trace files and writes all explicit parameter settings to the alert log in valid parameter syntax At this stage, no database is associated with the instance. Scenarios that require a NOMOUNT state include database creation and certain backup and recovery operations. See Also: Oracle Database Administrator's Guideto learn how to manage initialization parameters using a server parameter file 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. If Oracle Database allows multiple instances to mount the same database concurrently, then the CLUSTER_DATABASE initialization parameter setting can make the database available to multiple instances. Database behavior depends on the setting: If CLUSTER_DATABASE is false (default) for the first instance that mounts a database, then only this instance can mount the database. If CLUSTER_DATABASE is true for the first instance, then other instances can mount the database if their CLUSTER_DATABASE parameter settings are set to true. The number of instances that can mount the database is subject to a predetermined maximum specified when creating the database. See Also: Oracle Database Administrator's Guide to learn how to mount a database Oracle Real Application Clusters Administration and Deployment Guide for more information about the use of multiple instances with a single database How a Database Is Opened Opening a mounted database makes it available for normal database operations. Any valid user can connect to an open database and access its information. Usually, a database administrator opens the database to make it available for general use. 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 (see "Online and Offline Tablespaces"), 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 See Also: "Data Repair" Read-Only Mode By default, the database opens in read/write mode. In this mode, users can make changes to the data, generating redo in the online redo log. Alternatively, you can open in read-only mode to prevent data modification by user transactions. Note: By default, a physical standby database opens in read-only mode. See Oracle Data Guard Concepts and Administration. Read-only mode restricts database access to read-only transactions, which cannot write to data files or to online redo log files. However, the database can perform recovery or operations that change the database state without generating redo. For example, in read-only mode: Data files can be taken offline and online. However, you cannot take permanent tablespaces offline. Offline data files and tablespaces can be recovered. The control file remains available for updates about the state of the database. Temporary tablespaces created with the CREATE TEMPORARY TABLESPACE statement are read/write. Writes to operating system audit trails, trace files, and alert logs can continue. See Also: Oracle Database Administrator's Guideto learn how to open a database in read-only mode Database File Checks If any of the data files or redo log files are not present when the instance attempts to open the database, or if the files are present but fail consistency tests, then the database returns an error. Media recovery may be required. See Also: "Backup and Recovery" Overview of Database and Instance Shutdown In a typical use case, you manually shut down the database, making it unavailable for users while you perform maintenance or other administrative tasks. You can use the SQL*Plus SHUTDOWN command or Enterprise Manager to perform these steps. Figure 13-4 shows the progression from an open state to a consistent shutdown. Figure 13-4 Instance and Database Shutdown Sequence Description of "Figure 13-4 Instance and Database Shutdown Sequence" Oracle Database automatically performs the following steps whenever an open database is shut down consistently: Database closed The database is mounted, but online data files and redo log files are closed. "How a Database Is Closed" explains this stage. Database unmounted The instance is started, but is no longer associated with the control file of the database. "How a Database Is Unmounted" explains this stage. Database instance shut down The database instance is no longer started. "How an Instance Is Shut Down" explains this stage. Oracle Database does not go through all of the preceding steps in an instance failure or SHUTDOWN ABORT, which immediately terminates the instance. See Also: Oracle Database 2 Day DBAand Oracle Database Administrator's Guide to learn how to shut down a database Shutdown Modes A database administrator with SYSDBA or SYSOPER privileges can shut down the database using the SQL*Plus SHUTDOWN command or Enterprise Manager. The SHUTDOWN command has options that determine shutdown behavior. Table 13-2 summarizes the behavior of the different shutdown modes. Table 13-2 Shutdown Modes Database Behavior ABORT IMMEDIATE TRANSACTIONAL NORMAL Permits new user connections No No No No Waits until current sessions end No No No Yes Waits until current transactions end No No Yes Yes Performs a checkpoint and closes open files No Yes Yes Yes The possible SHUTDOWN statements are: SHUTDOWN ABORT This mode is intended for emergency situations, such as when no other form of shutdown is successful. This mode of shutdown is the fastest. However, a subsequent open of this database may take substantially longer because instance recovery must be performed to make the data files consistent. Note: Because SHUTDOWN ABORT does not checkpoint the open data files, instance recovery is necessary before the database can reopen. The other shutdown modes do not require instance recovery before the database can reopen. SHUTDOWN IMMEDIATE This mode is typically the fastest next to SHUTDOWN ABORT. Oracle Database terminates any executing SQL statements and disconnects users. Active transactions are terminated and uncommitted changes are rolled back. SHUTDOWN TRANSACTIONAL This mode prevents users from starting new transactions, but waits for all current transactions to complete before shutting down. This mode can take a significant amount of time depending on the nature of the current transactions. SHUTDOWN NORMAL This is the default mode of shutdown. The database waits for all connected users to disconnect before shutting down. See Also: Oracle Database 2 Day DBA and Oracle Database Administrator's Guide to learn about the different shutdown modes SQL*Plus User's Guide and Reference to learn about the SHUTDOWN command How a Database Is Closed The database close operation is implicit in a database shutdown. The nature of the operation depends on whether the database shutdown is normal or abnormal. How a Database Is Closed During Normal Shutdown When a database is closed as part of a SHUTDOWN with any option other than ABORT, Oracle Database writes data in the SGA to the data files and online redo log files. Next, the database closes online data files and online redo log files. Any offline data files of offline tablespaces have been closed already. When the database reopens, any tablespace that was offline remains offline. At this stage, the database is closed and inaccessible for normal operations. The control files remain open after a database is closed. How a Database Is Closed During Abnormal Shutdown If a SHUTDOWN ABORT or abnormal termination occurs, then the instance of an open database closes and shuts down the database instantaneously. Oracle Database does not write data in the buffers of the SGA to the data files and redo log files. The subsequent reopening of the database requires instance recovery, which Oracle Database performs automatically. How a Database Is Unmounted After the database is closed, Oracle Database unmounts the database to disassociate it from the instance. After a database is unmounted, Oracle Database closes the control files of the database. At this point, the instance remains in memory. How an Instance Is Shut Down The final step in database shutdown is shutting down the instance. When the database instance is shut down, the SGA is removed from memory and the background processes are terminated. In unusual circumstances, shutdown of an instance may not occur cleanly. Memory structures may not be removed from memory or one of the background processes may not be terminated. When remnants of a previous instance exist, a subsequent instance startup may fail. In such situations, you can force the new instance to start by removing the remnants of the previous instance and then starting a new instance, or by issuing a SHUTDOWN ABORT statement in SQL*Plus or using Enterprise Manager. See Also: Oracle Database Administrator's Guidefor more detailed information about database shutdown Overview of Checkpoints A checkpoint is a crucial mechanism in consistent database shutdowns, instance recovery, and Oracle Database operation generally. The term checkpoint has the following related meanings: A data structure that ind
本文档为【什么是Oracle数据库实例】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_139816
暂无简介~
格式:doc
大小:311KB
软件:Word
页数:25
分类:互联网
上传时间:2013-08-24
浏览量:32