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

stonebox1122發表於2016-02-26

課程目標:

  • 使用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]

[ ~]# 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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章