Oracle Architectural Components

简介:
  • Identify the main components of the Oracle system global area. What are the subcomponents of each, and what are their roles?
SOLUTION: The System Global Area, or SGA, consists of several different items: the  buffer cache shared pool , and  redo log buffer , as well as a few other items that will be discussed later in the unit. The following subtopics explain the primary components of the Oracle SGA. The buffer cache memory structure consists of buffers the size of database blocks that store data needed by SQL statements issued in user processes. A database block is the most granular unit of information storage in Oracle, in which Oracle can place several rows of table data. The buffer cache has two purposes: to improve performance for subsequent repeated  select  statements on the same data, and to allow Oracle users to make data changes quickly in memory. Oracle writes those data changes to disk later. The shared pool has two mandatory structures and one optional structure in the Oracle shared pool. The first required component is the  library cache , used for storing parsed SQL statement text and the statement’s execution plan for reuse. The second is the  dictionary cache , sometimes also referred to as the  row cache , which is used for storing recently accessed information from the Oracle data dictionary, such as table and column definitions, usernames, passwords, and privileges. (If you don’t know what the data dictionary is, you’ll find more out about it later in this chapter.) These two components are designed to improve overall Oracle performance in multiuser environments. The optional shared pool structure contains session information about user processes connected to Oracle.  The redo buffer temporarily stores in memory the redo entry information generated by DML statements run in user sessions until Oracle writes the information to disk. DML statements include  update delete , and  insert  statements run by users. What is a redo entry? It is a small amount of information produced and saved by Oracle to reconstruct, or redo, changes made to the database by  insert update delete create alter , and  drop  statements. If some sort of failure occurred, the DBA can use redo information to recover the Oracle database to the point of database failure.
  • Describe the role of the DBW0 process
SOLUTION: Called the  database writer  process, the DBWR background process writes dirty data blocks from buffer cache to disk. The writes are done when the server process needs to make room in the buffer cache to read more data in for user processes, when DBWR is told to write data to disk by the LGWR process, or every three seconds due to a timeout. The event that causes LGWR to tell DBWR to write to disk is called a  checkpoint . You will learn more about checkpoints in Chapter 7. Because Oracle8i allows multiple database writers to run on the host machine, the DBWR process is sometimes referred to as  DBW0 , where  0  can be any digit between 0 and 9, representing one of several DBWR processes running in Oracle.
  • Describe the role of the LGWR process
SOLUTION: Called the  log writer  process, the LGWR background process writes redo log entries from the redo log buffer to online redo log files on disk. LGWR has some other specialized functions related to the management of redo information that you will learn about in Chapter 7. LGWR also tells DBWR to write dirty buffers to disk at checkpoints, as mentioned earlier.
    1. What are the filesystem components of an Oracle database?
SOLUTION: Oracle disk resources are broken into two categories: physical and logical. Oracle physical disk resources include  control files ,  datafiles ,and  redo log files . Logical disk resources include  tablespaces ,  segments , and  extents.  Two additional resources are the init.ora file and the password file.
    1. Why does the Oracle database need two online redo logs
Solution: LGWR writes to redo logs in a sequential manner such that, when one fills, LGWR starts writing to the next one. When the last online log fills, LGWR overwrites the contents of the first and starts the process anew. When redo logs are being archived, ARC0 archives the filled log while LGWR writes new redo to the other.
    1. What purpose does the control file serve in the database?
SOLUTION: the control file identifies the filesystem location for all Oracle-related database files and online redo logs. When Oracle attempts to open the database, it first looks in the control file to figure out where all of its database file components are. Without the control file, Oracle wouldn’t know where to find its files!
    1. How does Oracle know where to find the control file when the instance starts?
SOLUTION: The location of the control file is passed to Oracle in the init.ora file via the CONTROL_FILES parameter.
  1. What purpose does a password file serve?
SOLUTION: A password file is used to secure the DBA’s ability to login from machines other than the one hosting the Oracle database and perform privileged operations such as startup or shutdown. This file is not required on your system unless you want to perform remote database administration.   Practice for Section
    1. Describe the purpose of the tnsnames.ora file. Find this file on a machine containing the Oracle client software. Review the contents of the tnsnames.ora file you located.
SOLUTION: tnsnames.ora is used for resolving an Oracle connect string to determine where to find the host machine and other vital information required for connecting remotely to an Oracle database. This file is usually found in the network/admin directory under the Oracle software home directory.
  1. Open your Oracle8i generic documentation on the Oracle software distribution CD-ROM. In it, review the Oracle8i Error Messages and the Net8 Administrators Guide documents to identify the resolutions to the following error messages:
    1. ORA-3113
    2. TNS-03505
    3. TNS-12203
    4. TNS-12224 or TNS-12541
    5. TNS-12500
SOLUTION: ORA-3113 means unexpected end of file on communications channel. This means that you have been disconnected from Oracle unexpectedly. There could be many causes for this error. A network process may have failed, or the Oracle server itself may have failed. To resolve the issue, you must try to reconnect to the database. Your attempt to do so may result in another failure, which will most likely tell you more about the root cause of the problem. TNS-03505 means TNS could not resolve service name. This means that Net8 couldn’t resolve your connect string supplied for login. The connect string may have been mistyped, or it may not exist in your local copy of tnsnames.ora. If you are using Oracle Names, the connect string may not have a corresponding connect descriptor in the Names server. TNS-12203 TNS means was unable to connect to destination. The name of the machine hosting Oracle configured for the connect descriptor is most likely incorrect. Check it out in your tnsnames.ora file or in the Oracle Names server, and correct the hostname. Sometimes, you get this problem in TCP/IP when the domain-names service used to translate hostnames to IP addresses doesn’t contain the hostname specified, or when there is no DNS server for your network. In this case, you can usually specify the IP address rather than the hostname in your connect descriptor to fix the problem. TNS-12224 or TNS-12541 means TNS found no listener on the host. Check to make sure the listener is running. If not, then start it. If the listener is running, ensure that your listener is tuned into port 1521 or that the port in your connect descriptor in tnsnames.ora or Oracle Names matches the port your listener is tuned to. TNS-12500 means the TNS listener failed to start a dedicated server process. The SID_LIST configured for the listener process in listener.ora may not contain the right information for the Oracle SID on the machine hosting the listener and the Oracle database. SID_LIST is a list of Oracle SIDs for which the listener monitors user connection requests. Alternatively, there may be an error in the connect descriptor in tnsnames.ora or in Oracle Names for this connect string.
    1. Describe how user processes get connected to a server when dedicated servers are used. What is the difference between prespawned dedicated servers and shared servers?
SOLUTION: User process first must resolve connect string given in SQL*Plus or other Oracle client into a connection description, which in turn contains host machine and Oracle database to connect to. This information is then passed onto the network where it is heard by the listener process. The listener responds to the Oracle client by either spawning a new dedicated server process for the client to use, or by assigning the user to a prespawned dedicated server. Although prespawned dedicated servers and shared servers are the same in that both are running on the host system before the user tried to connect, they are different because prespawned dedicated servers still handle work for only one user, while shared servers handle work for many users.
    1. Describe how user processes get connected to a server when MTS is used.
SOLUTION: User process first must resolve connect string given in SQL*Plus or other Oracle client into a connection description, which in turn contains host machine and Oracle database to connect to. This information is then passed onto the network where it is heard by the listener process. The listener responds by passing the user process request to a dispatcher. The dispatcher then assigns the user to a shared server according to which shared server has the lightest load.
  1. (BONUS) Can you identify any potential issues with performance implications related to the use of shared versus dedicated servers? (HINT: Where might bottlenecks lie in each architecture?)
SOLUTION: First, shared servers may be overloaded due to a limited number of shared servers running on the machine, thus reducing overall performance because users have to wait for the shared server to give their process some attention. Another performance bottleneck in dedicated server architecture is that too many users connected to the machine could cause the host machine to run out of real memory. This degrades performance for all users because database SGA will get swapped to virtual memory.  
  • Enable the AUTOTRACE feature in SQL*Plus as follows.
  1. Move to the $ORACLE_HOME/sqlplus/admin directory on your machine.
  2. Run SQL*Plus from the command line in that directory as the SYS or INTERNAL user.
  3. Run the plustrce.sql script by issuing "@plustrce.sql" at the SQL prompt.
  4. Log out of SQL*Plus.
  5. Change directories to $ORACLE_HOME/rdbms/admin
  6. Log back into SQL*Plus as another user to which the DBA role is granted.
  7. Run the utlxplan.sql script by issuing "@utlexplan.sql" at the SQL prompt
  8. Issue the SET AUTOTRACE ON command at the SQL prompt.
SOLUTION: The net results for this set of steps is that users can enable the AUTOTRACE feature in SQL*Plus.
  • Issue the SELECT * FROM USER_TABLES command in SQL*Plus. Then review the contents of the statement execution plan to get an understanding of the results of the RDBMS parsing operations happening behind the scenes.
SOLUTION: The output from this command that users will likely care about is shown below. Execution Plan ---------------------------------------------------------- 0 SELECT STATEMENT Optimizer=CHOOSE 1 0 NESTED LOOPS 2 1 NESTED LOOPS (OUTER) 3 2 NESTED LOOPS (OUTER) 4 3 NESTED LOOPS 5 4 TABLE ACCESS (BY INDEX ROWID) OF 'OBJ$' 6 5 INDEX (RANGE SCAN) OF 'I_OBJ2' (UNIQUE) 7 4 TABLE ACCESS (CLUSTER) OF 'TAB$' 8 7 INDEX (UNIQUE SCAN) OF 'I_OBJ#' (NON-UNIQUE) 9 3 TABLE ACCESS (BY INDEX ROWID) OF 'OBJ$' 10 9 INDEX (UNIQUE SCAN) OF 'I_OBJ1' (UNIQUE) 11 2 TABLE ACCESS (CLUSTER) OF 'SEG$' 12 11 INDEX (UNIQUE SCAN) OF 'I_FILE#_BLOCK#' (NON-UNIQUE) 13 1 TABLE ACCESS (CLUSTER) OF 'TS$' 14 13 INDEX (UNIQUE SCAN) OF 'I_TS#' (NON-UNIQUE) Statistics ---------------------------------------------------------- 0 recursive calls 0 db block gets 171 consistent gets 0 physical reads 0 redo size 4281 bytes sent via SQL*Net to client 661 bytes received via SQL*Net from client 4 SQL*Net roundtrips to/from client 1 sorts (memory) 0 sorts (disk) 9 rows processed  
  • Now, review the contents from the statistics listing. Identify which of the following items are shown as output in this context:
  1. Redo entry size
  2. Network roundtrips
  3. Time it took the listener to connect the user with a server
  4. Frequency of DBW0 write activity
  5. BONUS: For those items you could not find in the statistical output for AUTOTRACE, determine where you can find that information. (HINT – issue SELECT NAME FROM DICT WHERE SUBSTR(‘TABLE_NAME’,1,1) = ‘V’)
SOLUTION: You can find both redo entry size and network roundtrips in the statistics given by AUTOTRACE. You cannot find information about the time it took for the listener to connect a user with the server or the frequency of DBW0 write activity behind the scenes. Information about are captured as statistics in the V$SYSSTAT performance view, where the contents of the name column are prefixed with DBWR. For information about connecting users with servers, you can find that for MTS environments in the V$DISPATCHER_RATE view.
  • Determine where you can find information about rollback segments on your database. (HINT – issue SELECT NAME FROM DICT WHERE SUBSTR(‘TABLE_NAME’,1,1) = ‘V’). List all associated views.
SOLUTION: V$ROLLNAME V$ROLLSTAT DBA_ROLLBACK_SEGS
  • Determine where you can find information about locks in your database. (HINT – issue SELECT NAME FROM DICT WHERE SUBSTR(‘TABLE_NAME’,1,1) = ‘V’). List all associated views.

SOLUTION: V$LOCK V$LOCKED_OBJECT V$LOCKS_WITH_COLLISIONS V$LOCK_ACTIVITY V$LOCK_ELEMENT'



本文转自maclean_007 51CTO博客,原文链接:http://blog.51cto.com/maclean/1278213

相关文章
|
SQL Oracle 安全
Oracle Database Vault Access Control Components
Oracle Database Vault Access Control Components
169 0
|
SQL Oracle Java
关于oracle invalid components问题的解决
升级生产的DB,有一些预检查条件,这些需要提前修复,以便在升级的时候不会成为影响进度的绊脚石。 生产中的components有一些显示是invalid状态,从dba_registry中可以查到。
1009 0
|
5月前
|
Oracle 关系型数据库 Linux
【赵渝强老师】Oracle数据库配置助手:DBCA
Oracle数据库配置助手(DBCA)是用于创建和配置Oracle数据库的工具,支持图形界面和静默执行模式。本文介绍了使用DBCA在Linux环境下创建数据库的完整步骤,包括选择数据库操作类型、配置存储与网络选项、设置管理密码等,并提供了界面截图与视频讲解,帮助用户快速掌握数据库创建流程。
488 93
|
4月前
|
Oracle 关系型数据库 Linux
【赵渝强老师】使用NetManager创建Oracle数据库的监听器
Oracle NetManager是数据库网络配置工具,用于创建监听器、配置服务命名与网络连接,支持多数据库共享监听,确保客户端与服务器通信顺畅。
287 0
|
7月前
|
存储 Oracle 关系型数据库
服务器数据恢复—光纤存储上oracle数据库数据恢复案例
一台光纤服务器存储上有16块FC硬盘,上层部署了Oracle数据库。服务器存储前面板2个硬盘指示灯显示异常,存储映射到linux操作系统上的卷挂载不上,业务中断。 通过storage manager查看存储状态,发现逻辑卷状态失败。再查看物理磁盘状态,发现其中一块盘报告“警告”,硬盘指示灯显示异常的2块盘报告“失败”。 将当前存储的完整日志状态备份下来,解析备份出来的存储日志并获得了关于逻辑卷结构的部分信息。
|
5月前
|
SQL Oracle 关系型数据库
Oracle数据库创建表空间和索引的SQL语法示例
以上SQL语法提供了一种标准方式去组织Oracle数据库内部结构,并且通过合理使用可以显著改善查询速度及整体性能。需要注意,在实际应用过程当中应该根据具体业务需求、系统资源状况以及预期目标去合理规划并调整参数设置以达到最佳效果。
406 8
|
7月前
|
SQL Oracle 关系型数据库
比较MySQL和Oracle数据库系统,特别是在进行分页查询的方法上的不同
两者的性能差异将取决于数据量大小、索引优化、查询设计以及具体版本的数据库服务器。考虑硬件资源、数据库设计和具体需求对于实现优化的分页查询至关重要。开发者和数据库管理员需要根据自身使用的具体数据库系统版本和环境,选择最合适的分页机制,并进行必要的性能调优来满足应用需求。
377 11
|
7月前
|
Oracle 关系型数据库 数据库
数据库数据恢复—服务器异常断电导致Oracle数据库报错的数据恢复案例
Oracle数据库故障: 某公司一台服务器上部署Oracle数据库。服务器意外断电导致数据库报错,报错内容为“system01.dbf需要更多的恢复来保持一致性”。该Oracle数据库没有备份,仅有一些断断续续的归档日志。 Oracle数据库恢复流程: 1、检测数据库故障情况; 2、尝试挂起并修复数据库; 3、解析数据库文件; 4、导出并验证恢复的数据库文件。
|
7月前
|
存储 Oracle 关系型数据库
【赵渝强老师】Oracle RMAN的目录数据库
Oracle RMAN默认将备份元信息存储在控制文件中,但控制文件损坏或丢失会导致恢复失败,且备份增多会使控制文件无限增长。为解决这些问题,Oracle引入了RMAN目录数据库(Catalog Database),专门用于存储RMAN备份的元信息。使用目录数据库可提升备份管理效率,支持多数据库共享、长期备份历史记录存储,并可保存RMAN脚本。本文详细介绍了如何创建目录数据库、注册目标数据库及其操作步骤。
215 0
|
10月前
|
Oracle 安全 关系型数据库
【Oracle】使用Navicat Premium连接Oracle数据库两种方法
以上就是两种使用Navicat Premium连接Oracle数据库的方法介绍,希望对你有所帮助!
2097 28

推荐镜像

更多