3 Copyright © Oracle Corporation, All rights reserved. 管理数据库事例.

Slides:



Advertisements
Similar presentations
4 Copyright © 2005, Oracle. All rights reserved. Managing the Oracle Instance.
Advertisements

Acknowledgments Byron Bush, Scott S. Hilpert and Lee, JeongKyu
3 Managing an Oracle Instance. Objectives Setting up operating system and password file authentication Creating the parameter file Starting up an instance.
Oracle Architecture. Instances and Databases (1/2)
ITEC474 Control File Maintenance
Page Footer Keed Education Oracle Database Administration Basic Copyright 2009 Keed Education BV Version Concept.
INTRODUCTION TO ORACLE DATABASE ADMINISTRATION Lynnwood Brown System Managers LLC Introduction – Lecture 1 Copyright System Managers LLC 2007 all rights.
15 Copyright © 2004, Oracle. All rights reserved. Monitoring and Managing Memory.
1 - Oracle Server Architecture Overview
Harvard University Oracle Database Administration Session 2 System Level.
Managing an Oracle Instance
10 Copyright © 2009, Oracle. All rights reserved. Managing Undo Data.
A Guide to Oracle9i1 Introduction to Oracle9i Database Administration Chapter 11.
Oracle Database Instance Management Oracle 10g. Ebtisam Alabdulqader Outline Management Framework. Managing Oracle instance through the Enterprise Manager.
INTRODUCTION TO ORACLE
RMAN Restore and Recovery
Backup and Recovery Part 1.
Chapter 12 Performing Incomplete Recovery. Background Viewed as one of the more difficult chapters to write Thought it was important to put in material.
ITEC474 Redo Log Files.
Oracle Architecture. Database instance When a database is started the current state of the database is given by the data files, a set of background (BG)
Using RMAN to Perform Recovery
1 Copyright © 2005, Oracle. All rights reserved. Introduction.
Oracle Database Administration
20 Copyright © 2004, Oracle. All rights reserved. Database Recovery.
13 Copyright © Oracle Corporation, All rights reserved. RMAN Complete Recovery.
Managing the Oracle RDBMS Today you will look at the basics, including: –Setting up Enterprise Manager –Using Enterprise Manager –Using Server Manager.
Oracle Database Workshop 1 Presented to IBRI CAS 27-Nov-2011 By Abdullah Alkalbani.
CHAPTER 2 Implementing a Database. Introduction to Creating Databases After you’ve installed the Oracle software, the next logical step is to create a.
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
Basic Oracle Architecture
11 Copyright © Oracle Corporation, All rights reserved. RMAN Backups.
16 Copyright © 2007, Oracle. All rights reserved. Performing Database Recovery.
By Lecturer / Aisha Dawood 1.  You can control the number of dispatcher processes in the instance. Unlike the number of shared servers, the number of.
5 Copyright © 2004, Oracle. All rights reserved. Controlling the Database.
1 Oracle Architectural Components. 1-2 Objectives Listing the structures involved in connecting a user to an Oracle server Listing the stages in processing.
Copyright © Oracle Corporation, All rights reserved. 1 Oracle Architectural Components.
An Oracle server:  Is a database management system that provides an open, comprehensive, integrated approach to information management.  Consists.
IT Database Administration SECTION 01. Starting Up and Shutting Down the Database Database Administration Facilities – A number of tools are available.
Week 3 Lecture 1 The Redo Log Files and Diagnostic Files.
7 Copyright © 2005, Oracle. All rights reserved. Managing Undo Data.
4 Copyright © 2007, Oracle. All rights reserved. Managing the Oracle Instance.
14 Copyright © 2005, Oracle. All rights reserved. Backup and Recovery Concepts.
Oracle 10g Database Administrator: Implementation and Administration Chapter 5 Basic Storage Concepts and Settings.
Creating an Oracle Database. Considerations before creating a DB Planning for Database Creation –Select the standard database block size. –Use an undo.
10 Copyright © Oracle Corporation, All rights reserved. User-Managed Backups.
Chapter 1Oracle9i DBA II: Backup/Recovery and Network Administration 1 Chapter 1 Backup and Recovery Overview MSCD642 Backup and Recovery.
12 Copyright © Oracle Corporation, All rights reserved. User-Managed Complete Recovery.
18 Copyright © 2004, Oracle. All rights reserved. Backup and Recovery Concepts.
6 Copyright © 2007, Oracle. All rights reserved. Performing User-Managed Backup and Recovery.
Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.
8 Copyright © 2007, Oracle. All rights reserved. Using RMAN to Duplicate a Database.
18 Copyright © 2004, Oracle. All rights reserved. Recovery Concepts.
7 Copyright © Oracle Corporation, All rights reserved. Instance and Media Recovery Structures.
14 Copyright © 2005, Oracle. All rights reserved. Backup and Recovery Concepts.
9 Copyright © 2004, Oracle. All rights reserved. Incomplete Recovery.
6 Copyright © 2005, Oracle. All rights reserved. Managing Database Storage Structures.
14 Copyright © 2007, Oracle. All rights reserved. Backup and Recovery Concepts.
4 Copyright © 2004, Oracle. All rights reserved. Managing the Oracle Instance.
5 Copyright © 2005, Oracle. All rights reserved. Managing the Oracle Instance.
Oracle Database Architectural Components
9 Copyright © 2005, Oracle. All rights reserved. Managing Undo Data.
10 Copyright © 2007, Oracle. All rights reserved. Managing Undo Data.
 Database Administration Oracle Database Instance Management Starting Up and Shutting Down أ. ندى الغامدي, أ. ندى الطوالة.
Managing an Oracle Instance
Initialization Parameters
Maintaining Online Redo Log Files
Is 221: Database Administration
Oracle 10g Database Administrator: Implementation and Administration
Performing Database Recovery
Presentation transcript:

3 Copyright © Oracle Corporation, All rights reserved. 管理数据库事例

3-2 Copyright © Oracle Corporation, All rights reserved. 目标 学完这个课程,你应该可以掌握你下内容 : 创建和管理初始化参数 启动和停止数据库事例 监控和使用诊断文件

3-3 Copyright © Oracle Corporation, All rights reserved. spfiledb01.ora Initialization Parameter Files CONNECT / AS SYSDBA STARTUP Oracle Instance SGA Redo Log Buffer Shared Pool Data Dictionary Cache Library Cache DBW0SMONPMONCKPTLGWROthers Database Buffer Cache Java Pool Large Pool

3-4 Copyright © Oracle Corporation, All rights reserved. Initialization Parameter Files Entries are specific to the instance being started Two types of parameters: – 公开 : Having an entry in the file – 隐含 : No entry within the file, but assuming the Oracle default values Multiple initialization parameter files can exist Changes to entries in the file take effect based on the type of initialization parameter file used –Static parameter file, PFILE –Persistent parameter file, SPFILE

3-5 Copyright © Oracle Corporation, All rights reserved.

3-6 Copyright © Oracle Corporation, All rights reserved. PFILE initSID.ora 文本明文文件 可以通过操作系统编辑器来修改 人为手工进行修改 所做的修改在下次启动是生效 只在事例启动的时候打开 默认路径为 $ORACLE_HOME/dbs

3-7 Copyright © Oracle Corporation, All rights reserved. Creating a PFILE Created from a sample init.ora file –Sample installed by the Oracle Universal Installer –Copy sample using operating system copy command –Uniquely identify by database SID Modify the initSID.ora –Edit the parameters –Specific to database needs cp init.ora $ORACLE_HOME/dbs/initdba01.ora

3-8 Copyright © Oracle Corporation, All rights reserved. PFILE Example # Initialization Parameter File: initdba01.ora db_name = dba01 instance_name = dba01 control_files = ( home/dba01/ORADATA/u01/control01dba01.ctl, home/dba01/ORADATA/u02/control01dba02.ctl) db_block_size = 4096 db_cache_size = 4M shared_pool_size = java_pool_size = max_dump_file_size = background_dump_dest = /home/dba01/ADMIN/BDUMP user_dump_dest = /home/dba01/ADMIN/UDUMP core_dump_dest = /home/dba01/ADMIN/CDUMP undo_management = AUTO undo_tablespace = UNDOTBS...

3-9 Copyright © Oracle Corporation, All rights reserved. SPFILE spfileSID.ora 二进制文件 被 Oracle server 来维护 总是驻留在 server 上 Ability to make changes persistent across shutdown and startup Can self-tune parameter values Can have Recovery Manager support backing up to the initialization parameter file

3-10 Copyright © Oracle Corporation, All rights reserved. Creating an SPFILE Created from a PFILE file where – SPFILE-NAME : SPFILE to be created – PFILE-NAME : PFILE creating the SPFILE Can be executed before or after instance startup CREATE SPFILE = ‘ $ORACLE_HOME/dbs/spfileDBA01.ora ’ FROM PFILE = ‘ $ORACLE_HOME/dbs/initDBA01.ora ’ ;

3-11 Copyright © Oracle Corporation, All rights reserved.

3-12 Copyright © Oracle Corporation, All rights reserved.

3-13 Copyright © Oracle Corporation, All rights reserved. SPFILE Example *.background_dump_dest=‘/home/dba01/ADMIN/BDUMP’ *.compatible='9.0.0' *.control_files='/home/dba01/ORADATA/u01/ctrl01.ctl’ *.core_dump_dest=‘/home/dba01/ADMIN/CDUMP’ *.db_block_size=4096 *.db_name='dba01‘ *.db_domain=‘world’ *.global_names=TRUE *.instance_name='dba01' *.remote_login_passwordfile='exclusive‘ *.java_pool_size= ’ *.shared_pool_size= *.undo_management='AUTO' *.undo_tablespace='UNDOTBS'...

3-14 Copyright © Oracle Corporation, All rights reserved. STARTUP Command Behavior Order of Precedence – spfileSID.ora –Default SPFILE – initSID.ora –Default PFILE Specified PFILE can override precedence PFILE can indicate to use SPFILE STARTUP PFILE = $ORACLE_HOME/dbs/initDBA1.ora SPFILE = /database/startup/spfileDBA1.ora

3-15 Copyright © Oracle Corporation, All rights reserved. Modifying Parameters in SPFILE Parameter value changes made by ALTER SYSTEM Specify whether the change is temporary or persistent Delete or reset values ALTER SYSTEM SET undo_tablespace = 'UNDO2'; ALTER SYSTEM SET undo_tablespace = 'UNDO2' SCOPE=BOTH; ALTER SYSTEM RESET undo_suppress_errors SCOPE=BOTH SID='*';

3-16 Copyright © Oracle Corporation, All rights reserved.

3-17 Copyright © Oracle Corporation, All rights reserved.

3-18 Copyright © Oracle Corporation, All rights reserved.

3-19 Copyright © Oracle Corporation, All rights reserved. Starting Up a Database NOMOUNT OPEN MOUNT NOMOUNT SHUTDOWN Instance started STARTUP SHUTDOWN

3-20 Copyright © Oracle Corporation, All rights reserved. Starting Up a Database MOUNT OPEN MOUNT NOMOUNT SHUTDOWN Control file opened for this instance Instance started STARTUP SHUTDOWN

3-21 Copyright © Oracle Corporation, All rights reserved. Starting Up a Database OPEN OPEN MOUNT NOMOUNT SHUTDOWN All files opened as described by the control file for this instance Control file opened for this instance Instance started STARTUP SHUTDOWN

3-22 Copyright © Oracle Corporation, All rights reserved. STARTUP Command Start up the instance and open the database: STARTUP STARTUP PFILE=$ORACLE_HOME/dbs/initdb01.ora

3-23 Copyright © Oracle Corporation, All rights reserved.

3-24 Copyright © Oracle Corporation, All rights reserved.

3-25 Copyright © Oracle Corporation, All rights reserved. ALTER DATABASE Command Change the state of the database from NOMOUNT to MOUNT : Open the database as a read-only database: ALTER DATABASE db01 MOUNT; ALTER DATABASE db01 OPEN READ ONLY;

3-26 Copyright © Oracle Corporation, All rights reserved. Opening a Database in Restricted Mode Use the STARTUP command to restrict access to a database: Use the ALTER SYSTEM command to place an instance in restricted mode: STARTUP RESTRICT ALTER SYSTEM ENABLE RESTRICTED SESSION;

3-27 Copyright © Oracle Corporation, All rights reserved.

3-28 Copyright © Oracle Corporation, All rights reserved.

3-29 Copyright © Oracle Corporation, All rights reserved. Opening a Database in Read-Only Mode Opening a database in read-only mode Can be used to: –Execute queries –Execute disk sorts using locally managed tablespaces –Take datafiles offline and online, but not tablespaces –Perform recovery of offline datafiles and tablespaces STARTUP MOUNT ALTER DATABASE OPEN READ ONLY;

3-30 Copyright © Oracle Corporation, All rights reserved.

3-31 Copyright © Oracle Corporation, All rights reserved. Shutting Down the Database Shutdown mode: A = ABORT I = IMMEDIATE T = TRANSACTIONAL N = NORMAL A No T No Yes I No Yes Shutdown Mode Allow new connections Wait until current sessions end Wait until current transactions end Force a checkpoint and close files N No Yes

3-32 Copyright © Oracle Corporation, All rights reserved. Shutdown Options On the way down: Database buffer cache written to the datafiles Uncommitted changes rolled back Resources released On the way up: No instance recovery During a Shutdown Normal, Shutdown Transactional or Shutdown Immediate Consistent database (clean database)

3-33 Copyright © Oracle Corporation, All rights reserved.

3-34 Copyright © Oracle Corporation, All rights reserved. Shutdown Options On the way down: Modified buffers are not written to the datafiles Uncommitted changes are not rolled back On the way up: Redo logs used to reapply changes Undo segments used to roll back uncommitted changes Resources released During a Shutdown Abort or Instance Failure or Startup Force Inconsistent database (dirty database)

3-35 Copyright © Oracle Corporation, All rights reserved.

3-36 Copyright © Oracle Corporation, All rights reserved. Diagnostic files –Contain information about significant events encountered –Used to resolve problems –Used to better manage the database on a day-to-day basis Several types exist: – alertSID.log file –Background trace files –User trace files Monitoring an Instance Using Diagnostic Files

3-37 Copyright © Oracle Corporation, All rights reserved. Alert Log File alertSID.log file: –Records the commands –Records results of major events –Used for day-to-day operational information –Used for diagnosing database errors Each entry has a time stamp associated with it Must be managed by DBA Location defined by BACKGROUND_DUMP_DEST

3-38 Copyright © Oracle Corporation, All rights reserved.

3-39 Copyright © Oracle Corporation, All rights reserved. Background Trace Files Background trace files –Logs errors detected by any background process –Used to diagnose and troubleshoot errors Created when a background process encounters an error Location defined by BACKGROUND_DUMP_DEST

3-40 Copyright © Oracle Corporation, All rights reserved. User Trace File User trace file –Produced by the user process –Can be generated by a server process –Contains statistics for traced SQL statements –Contains user error messages Created when a user encounters user session errors Location is defined by USER_DUMP_DEST Size defined by MAX_DUMP_FILE_SIZE

3-41 Copyright © Oracle Corporation, All rights reserved. Enabling or Disabling User Tracing Session level: –Using the ALTER SESSION command: ALTER SESSION SET SQL_TRACE = TRUE –Executing DBMS procedure: dbms_system.SET_SQL_TRACE_IN_SESSION Instance level –Setting the initialization parameter: SQL_TRACE = TRUE

3-42 Copyright © Oracle Corporation, All rights reserved.

3-43 Copyright © Oracle Corporation, All rights reserved. Summary In this lesson, you should have learned how to: Create and manage initialization parameter files Start up and shut down an instance Monitor and use diagnostic files

3-44 Copyright © Oracle Corporation, All rights reserved. Practice 3 Overview This practice covers the following topics: Creating an SPFILE Starting up and shutting down the database in different modes

3-45 Copyright © Oracle Corporation, All rights reserved.

3-46 Copyright © Oracle Corporation, All rights reserved.