译自ORACE 11g官网
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.
为了使用户可以访问数据库,典型的情况是手动启动实例、挂载并打开数据库。此任务可以在sql*plus下执行STARTUP命令,可以用OEM,或是用SRVCTL命令完成;如图13-3展示了数据库从shutdown到open状态的一个过程;
--SRVCTL 使用链接:http://docs.oracle.com/cd/E11882_01/server.112/e25494/restart005.htm#ADMIN12726
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.
数据库从关闭到打开会经历以下几个阶段:
1. 实例启动到nomount状态(实例已经启动,但是跟数据库还没有发生联系)
2. 挂载数据库(通过控制文件上的记录信息使实例和数据库发生联系,该阶段用户不能访问数据库)
3. 打开数据库(实例和打开状态的数据库发生关联,相应权限的用户可以访问相应的数据)
See Also:
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
orSYSOPER
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.
用管理员权限连接到数据库
具有管理员权限的用户才可以启动和关闭数据库,普通用户对数据库的当前状态没有控制权依;依据操作系统,下列情况能够为用户建立管理员权限:
l 如果用户时操作体统的管理员那么可以以管理员的权限连接到数据库;
l 用户被赋予了SYSDBA和SYSOPER系统权限并且数据库使用密码文件通过网络去验证管理员权限
SYSDBA和SYSOPER是特殊的系统权限,即使数据库没打开也可以访问数据库实例。这些权限控制不隶属与数据库本身。当你以SYSDBA系统权限连接时,相当于在SYS用户所拥有的概要文件下。当你以SYSOPER系统权限连接时,相当于在一个public概要文件下(SYSOPER权限是SYSDBA的子权限)
See Also:
"Overview of Database Security" to learn about password files and authentication for database administrators
Oracle Database Administrator's Guide to learn about
SYSDBA
andSYSOPER
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 theSPFILE
orPFILE
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.
实例怎样启动(NOMOUNT状态)
数据库开启一个实例需要执行下列步骤:
1. 依照特定的平台在默认位置下找服务器变量文件<spfile)>(在Unix/Linux下的路径为$ORACLE_HOME/dbs目录,在WINDOWS上的路径为$ORACLE_HOME\database),如果找不到,就找文本格式的初始化变量文件<pfile>(在启动命令STARTUP中指定SPFILE或PFILE变量替代默认值)。
2. 读该文件决定初始化变量的值。
3. 根据初始化变量的设置分配SGA。
4. 启动后台进程。
5. 打开告警日志文件(alert log)和跟踪文件并用有效的参数语法把这些明确指定的变量设置写进alert log中。
在此阶段(NOMOUNT状态),实例与数据库没有发生关联,Scenarios that require a NOMOUNT state include database creation andcertain backup and recovery operations(此句暂时理解有问题,请读者暂时自己理解)。
See Also:
Oracle Database Administrator's Guide to learn how to manage initialization parameters using a server parameter file