ITPub博客

首页 > 数据库 > Oracle > OCP课程42:管理II之核心概念和工具

OCP课程42:管理II之核心概念和工具

原创 Oracle 作者:stonebox1122 时间:2016-02-26 11:20:13 0 删除 编辑

课程目标:

  • 使用ASM的数据库的核心概念
  • 配置和管理的工具

1、数据库服务器架构概览

clipboard

数据库服务器包括数据库和实例。实例包括内存和后台进程。

连接是数据库实例和用户进程之间的通信路径。

用户进程表示用户登录到数据库实例的状态。


2、实例与数据库

clipboard[1]

一个实例只能关联一个数据库。RAC是不同服务器的多个实例关联一个数据库。


3、Oracle内存结构

clipboard[2]

clipboard[3]

SGA:一个数据库实例的包括数据和控制信息的共享内存区域

PGA:服务器或者后台进程的数据和控制信息的私有内存区域,每个服务器进程和后台进程都有自己的PGA。


4、进程架构

clipboard[4]

Oracle数据库有三种主要进程:

  • 用户进程,运行应用程序或者Oracle工具产生
  • 数据库进程,包括服务器进程和后台进程,服务器进程用于处理用户进程请求
  • 守护进程,不仅仅用于单个数据库

5、进程架构

clipboard[5]

服务器进程用于:

  • 解析和运行SQL语句
  • 如果需要的数据库不在buffer cache,则从磁盘读入
  • 返回结果

6、填空

clipboard[6]


7、进程启动顺序

clipboard[7]

[root@oracletest1 ~]# cat /etc/init/oracle-ohasd.conf

# Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.

#

# Oracle OHASD startup

start on runlevel [35]

stop  on runlevel [!35]

respawn

exec /etc/init.d/init.ohasd run >/dev/null 2>&1

在Linux 6平台,/etc/init目录下Oracle创建了一个oracle-ohasd.conf文件,增加了Oracle启动命令。

在Windows平台,是以服务的方式来启动。


8、数据库存储架构

clipboard[8]

Oracle数据库必须包含以下三种文件:

  • 控制文件(Control files):包含数据库的信息以及备份的信息
  • 数据文件(Data files):包含数据字典和用户数据
  • 联机重做日志文件(Online redo log files):包含数据的改变信息,保证不丢失数据

Oracle数据库正常稳定运行建议还包括以下文件:

  • 参数文件(Parameter files):包含实例启动时的参数信息
  • 密码文件(Password file):允许用户使用sysdba、sysoper和sysasm角色远程连接到数据库进行管理操作
  • 备份文件(Backup files):用于数据库恢复
  • 归档重做日志文件(Archived redo log files):联机重做日志文件的归档
  • 跟踪文件(Trace files):用于记录服务器进程或者后台进程的错误信息
  • 告警文件(Alert log file):记录数据库运行的信息以及错误

9、Oracle数据库的逻辑结构和物理结构

clipboard[9]

逻辑上,一个数据库包含多个表空间,一个表空间包含多个段,一个段包含多个区,一个区包含多个数据块。

  • 数据块(data blocks):逻辑存储结构中最小的逻辑单位,数据库输入输出操作的最小存储单位,由多个操作系统块构成。
  • 区(extent):由一组连续的数据块构成,是存储分配的最小单位,是表中数据增大的基本单位。
  • 段(segment):由数据区构成,是独立的逻辑存储结构。段是为特定的数据对象分配的一系列数据区,占用磁盘空间。不是所有的数据库对象都会分配段,比如视图、触发器、包。4种主要类型的段:

(1)数据段,创建表时自动创建以表名字命名的数据段

(2)索引段,创建索引时自动创建以索引名字命名的索引段

(3)回滚段:存储undo信息

(4)临时段:SQL语句需要临时工作区(比如排序)就会用到临时段

  • 表空间(tablespace):表空间是数据库的最大逻辑划分区域,用来存放表,索引,回滚段等数据对象,任何数据对象在创建时都必须指定存储在某个表空间中。

表空间与数据文件相对应,一个表空间由一个或多个数据文件组成,一个数据文件只属于一个表空间,单个数据文件最大大小为(2^22-1)*DB_BLOCK_SIZE。如果是大文件表空间,则只有一个数据文件,最大可以到(2^32-1)*32K=128T。


10、自动存储管理ASM

clipboard[10]

ASM主要用于Oracle RAC环境的并发访问,是一个集群文件系统,主要用于存放Oracle数据库的文件,包含数据文件,控制文件,联机日志文件,备份,归档等,不能存放操作系统的文件,比如数据库安装文件,如果要放的话,就需要在ASM上面创建一个ACFS文件系统。我们一般主要使用ASM的磁盘组,类似RAID,做了条带化和镜像。


11、ASM存储组件

clipboard[11]

ASM磁盘可以是物理磁盘或者分区、存储的LUN、LV或者网络文件,多个ASM磁盘构成ASM磁盘组,每个ASM磁盘划分成多个分配单元(AU),分配单元是ASM最小的连续分配磁盘空间,可以设置分配单元为1、2、4、8、16、32或者64M,一个或者多个分配单元构成ASM区(extent),一个或者多个区构成ASM文件。ASM文件只能在一个磁盘组中。


12、ASM实例

clipboard[12]

ASM实例同样也是由进程和内存组成。

ASM的SGA包括:

  • Shared Pool:用于元数据信息
  • Large Pool:用于并行操作
  • ASM Cache:在重平衡操作中用于读写块
  • Free Memory:未分配可用内存

ASM实例默认使用自动内存管理,动态调整SGA各个内存组件的大小,内存总大小取决于ASM管理的磁盘空间,最小推荐值为256MB。

ASM实例有很多进程,有的和数据库实例的进程名称一样,但是可能功能不一样。主要的进程如下:

  • RBAL:协调磁盘组的重平衡活动
  • ARBn:执行实际的重平衡数据区移动,可以有多个进程
  • GMON:磁盘组监控,维护磁盘组成员信息,
  • MARK:标记分配单元不可用,在向脱机磁盘写入失败后,MARK进程将ASM 分配单元标记为过期
  • Onnn:这组进程表示客户机/服务器连接的服务器端。启动实例时将出现这些进程,之后它们将消失,它们形成与ASM 实例的一组连接,用于交换消息,仅在需要时才出现
  • PZ9n:表示一个或多个并行从属进程,当ASM 同时在多台计算机上以集群配置运行时,可以使用该进程提取数据

13、DBA配置工具

clipboard[13]

DBA配置和管理Oracle可以使用以下工具:

  • Oracle Universal Installer(OUI):安装GI和数据库
  • Oracle ASM Configuration Assistan(ASMCA):安装和配置ASM磁盘组、集群文件系统
  • Oracle Database Configuration Assistan(DBCA):创建和删除数据库,管理模版
  • Net Manager(NETMGR):配置监听、服务命名

14、管理框架以及相关的DBA工具

clipboard[14]

数据库管理框架三个主要组件:

  • 数据库实例
  • 监听
  • 管理接口

15、使用Oracle Restar管理数据库

clipboard[15]

使用Oracle Restart:

  • 主机重启或者软硬件故障后重启数据库组件
  • 定期检查监控数据库组件运行情况,如果有失败的组件就重启
  • 只支持单实例
  • 确保数据库组件按依赖顺序启动,例如使用了ASM,则会先去启动ASM实例和挂载磁盘,再启动数据库。当启动数据库实例,会去启动监听,如果监听启动失败,仍然会启动数据库。如果监听后续出现故障,不会去关闭和重启数据库实例
  • 使用crsctl工具启动Oracle Restart
  • 使用srvctl工具启动和停止Oracle Restart管理的组件

16、相

关习题:

(1)Which two statements are true regarding hot patching? (Choose two.)

A. It requires relinking of the Oracle binary .

B. It does not require database instance shutdown.

C. It can detect conflicts between two online patches.

D. It is available for installi ng all patches on all plat forms.

E. It works only in a single database instance environment.

答案:BC

(2)During the installation of Oracle Database 1 1g, you do not set ORACLE_BASE explicitly . Y ou selected the option to create a database as part of the installation. How would this environment variable setting affect the installation?
A. The installation terminates with an error .
B. The installation proceeds with the default value without warnings and errors.
C. The installation proceeds with the default value but it would not be an OF A-compliant database.
D. The installation proceeds with the default value but a message would be generated in the alert log file.

答案:D

(3)In which two aspects does hot patching differ from conventional patching? (Choose two.)
A. It consumes more memory compared with conventional patching.
B. It can be installed and uninstalled via OPatch unlike conventional patching.
C. It takes more time to install or uninstall compared with conventional patching.
D. It does not require down time to apply or remove unlike conventional patching.
E. It is not persistent across instance startup and shutdown unlike conventional patching.

答案:AD

(4)Which two statements are true regarding the starting of the database instance using the following command? (Choose two.)

SQL>STARTUP UPGRADE

A.  It enables all system triggers.

B.  It allows only SYSDBA connections.

C.  It ensures that all job queues remain active during the upgrade process.

D.  It sets system initialization parameters to specific values that are required to enable database upgrade scripts to be run.

答案:BD

(5)In your database, the LDAP_DIRECTORY_SYSAUTH initialization parameter has been set to YES and the users who need to access the database as DBAs have been granted SYSDBA enterprise role in Oracle Internet Directory (OID). SSL and the password file have been configured. A user SCOTT with the SYSDBA privilege tries to connect to the database instance from a remote machine using the command:

$ SQLPLUS scott/tiger@DB01 AS SYSDBA

where DB01 is the net service name.

Which authentication method would be used first?

A.  authentication by password file

B.  authentication by using certificates over SSL

C.  authentication by using the Oracle Internet Directory

D.  authentication by using the local OS of the database server

答案:A

(6)Globalization support is implemented through the text- and character-processing functions provided by which Oracle feature?

A. RSTLNE

B. NLSRTL

C. LISTENER

D. NLSSORT

E. Linguistic sorts

答案:B

(7)What elements of globalization can be explicitly defined using the NLS_LANG environment variable? (Choose all that apply.)

A.  NLS_LANGUAGE

B.  NLS_SORT

C.  NLS_CALENDAR

D.  NLS_CHARACTERSET

E.  NLS_TERRITORY

答案:ADE

(8)Given two different character sets (A and B), which of the following must be true for A to be considered a strict superset of B? (Choose all that apply.)

A. A must contain all of the characters defined in B.

B. A must be Unicode.

C. The encoded values in A must match the encoded values in B for all characters defined in B.

D. A must be a multibyte character set.

E. The encoded values in A must match the encoded values in B for all numeric and alphabetic characters in B.

答案:AC

(9)The NLS_SORT parameter sets the default sort method for which of the following operations?(Choose all that apply.)

A. WHERE clause

B. ORDER BY clause

C. BETWEEN clause

D. NLSSORT function

E. NLS_SORT function

答案:AD

(10)Which view shows all valid values for the NLS_LANGUAGE, NLS_SORT, NLS_TERRITORY, and NLS_CHARACTERSET parameters?

A. V$VALID_NLS_VALUES

B. NLS_VALID_VALUES

C. NLS_VALUE_OPTIONS

D. V$NLS_VALUE_OPTIONS

E. V$NLS_VALID_VALUES

答案:E

(11)Which of the following datatypes store time-zone information in the database?

A. TIMESTAMP

B. DATE

C. TIMESTAMP WITH TIME ZONE

D. TIMESTAMP WITH LOCAL TIME ZONE

E. DATETIME

答案:C

(12)Which of the following are valid settings for the NLS_COMP parameter? (Choose all that apply.)

A. ASCII

B. ANSI

C. BINARY

D. MONOLINGUAL

E. MULTILINGUAL

答案:BC

(13)NLS parameters can be set using the five methods listed. Put the methods in order from highest to lowest according to Oracles order of precedence:

a. Default setting

b. Client environment variable

c. Explicit ALTER SESSION statement

d. Inside SQL function

e. Server initialization parameter

A. b, d, e, a, c

B. e, a, b, c, d

C. d, c, b, e, a

D. a, b, d, c, e

E. d, c, b, a, e

答案:C

(14)What can you determine about the following linguistic sorts based only on their names?

1. GERMAN

2. FRENCH_M

A. 1 is a monolingual sort.

B. 2 is a monolingual sort.

C. 1 is case insensitive.

D. Both 1 and 2 are case insensitive.

E. Case sensitivity is unknown.

答案:A

(15)In a database with the database character set of US7ASCII and a national character set of UTF-8, which data types would be capable of storing Unicode data by default?

A. VARCHAR2

B. CHAR

C. NVARCHAR2

D. CLOB

E. LONG

答案:C

(16)Automatic data conversion will occur if which of the following happens?

A. The client and server have different NLS_LANGUAGE settings.

B. The client and server character sets are not the same, and the database character set is not a strict superset of the client character set.

C. The client and server are in different time zones.

D. The client requests automatic data conversion.

E. The AUTO_CONVERT initialization parameter is set to TRUE.

答案:B

(17)Which of the following NLS_SORT parameter values would result in case-insensitive and accent-insensitive binary sorts?

A. NLS_SORT = BINARY

B. NLS_SORT = BINARY_AI

C. NLS_SORT = BINARY_CI

D. NLS_SORT = BINARY_AI_CI

E. Binary sorts are case insensitive and accent insensitive by default.

答案:B

(18)Which NLS parameter can be used to change the default Oracle sort method from binary to linguistic for the SQL SELECT statement?

A. NLS_LANG

B. NLS_COMP

C. NLS_SORT

D. None of the above

答案:D

(19)Which of the following would be affected by setting NLS_LENGTH_SEMANTICS=CHAR?

A. All objects in the database

B. Tables owned by SYS and SYSTEM

C. Data dictionary tables

D. NCHAR columns

E. CHAR columns

答案:E

(20)Which is not a valid locale definition file type?

A. Language

B. Linguistic sort

C. Calendar

D. Territory

E. Character set

答案:C

(21)How many different calendars does Oracle 11g support?

A. 22

B. 7

C. 6

D. 15

E. 2

答案:B

Oracle supports seven distinct calendars: Gregorian, Japanese Imperial, ROC Official, Persian, Thai Buddha, Arabic Hijrah, and English Hijrah。

(22)Which NLS parameter directly governs linguistic searches?

A. NLS_SEARCH_L

B. NLS_SORT

C. NLS_SEARCH

D. NLS_SORT_L

E. None of the above

答案:B

(23)Case-insensitive sorts are always accent insensitive by default.

A. True

B. False

答案:B

(24)What is the name of the file that identifies the set of available locale definitions?

A. locale.def

B. lxdef.ora

C. lx1boot.nlb

D. lx1boot.ora

E. lang.def

答案:C

(25)Which of the following is not a valid linguistic sort element?

A. Accent expansion

B. Canonical equivalence

C. Reverse secondary sorting

D. Ignorable characters

E. Character rearrangement

答案:A

(26)You installed Oracle Database 11g and are performing a manual upgrade of the Oracle9i database. As a part of the upgrade process, you execute the following script:

SQL>@utlu111i.sql

Which statement about the execution of this script is true?

A.  It must be executed from the Oracle Database 11g environment.

B.  It must be executed only after the SYSAUX tablespace has been created.

C.  It must be executed from the environment of the database that is being upgraded.

D.  It must be executed only after AUTOEXTEND is set to ON for all existing tablespaces.

E.  It must be executed from both the Oracle Database 11g and Oracle Database 9i environments.

答案:C

(27)You notice that a job in a chain has not completed on a nonconstrained RAC database.

Which of these are valid reasons why that might occur?

A. The job priority is 1 and the resource consumer group CPU emphasis allocation is a low percentage.

B. The job affinity is to a service and one node in that service is unavailable.

C. The job affinity is to an instance and that instance is unavailable.

D. There is no service affinity.

E. None of the above.

答案:C

Question 522

The NLS_LANGUAGE parameter specifies the default conventions to be used for which of the following globalization elements?

A. Languages for server messages

B. Day and month names and abbreviations

C. Symbols to represent a.m., p.m., AD, and BC

D. Affirmative and negative response strings (YES, NO)

E. None of the above

F. All of the above

答案:F

(29)The NLS_TERRITORY parameter specifies the default conventions to be used for which of the following globalization elements? (Choose all that apply.)

A. Date format

B. Decimal character

C. Group separator

D. First day of the month

E. None of the above

F. All of the above

答案:ABC

(30)Your database instance is running. You are not able to access Oracle Enterprise Manager Database Control because the listener is not started.

Which tool or utility would you use to start the listener?

A.  Oracle Net Manager

B.  Listener Control utility

C.  Database Configuration Assistant

D.  Oracle Net Configuration Assistant

答案:B

(31)View the Exhibit.

You are creating a database by using Database Configuration Assistant (DBCA). You have chosen the

File System option as the storage mechanism. What would be the result of choosing this option?

Exhibit:

此主题相关图片如下:
clipboard[16]

A. Disk mirroring and striping would be done automatically

B. The database files would be managed by the operating system's file system

C. DBCA would not save the database files by using Optimal File Architecture (OFA)

D. The data files are automatically spread across all available storage devices to optimize performance and resource utilization

答案:B

(32)Which mode of database shutdown requires an instance recovery at the time of the next database startup?

A.ABORT

B.NORMAL

C.IMMEDIATE

D.TRANSACTIONAL

答案:A

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

请登录后发表评论 登录
全部评论

注册时间:2013-12-13

  • 博文量
    204
  • 访问量
    1080035