Presentation is loading. Please wait.

Presentation is loading. Please wait.

Oracle8/8i Database Administration

Similar presentations


Presentation on theme: "Oracle8/8i Database Administration"— Presentation transcript:

1 Oracle8/8i Database Administration
Draft V0.7 4/15/2002

2 Course Objectives Starting up and Shutting down database
Creating an Oracle Database Managing Oracle database files Managing tablespces,segments,extexts and block Managing users,privileges and resources Using National Language Support

3 Oracle 8i Database Family
• Oracle8i Lite - Mobile internet computing • Personal Oracle8i ideal for consultants, developers and students • Oracle8i pre-tuned and pre-configured for today’s dynamic workgroup and line-of-business environments • Oracle8i Enterprise Edition for developing and deploying mission-critical enterprise intranet and Internet applications • Oracle8i Options - A Platform for Any Intranet or Internet Application

4 Oracle 8i Options Oracle8i Options - A Platform for Any Intranet or Internet Application Creating intranet and Internet applications presents a new set of challenges and requirements for developers. Internet-savvy applications need to run on any platform without high management overhead. They have to be inviting, and rich in multimedia content. They have to be interactive, yet highly automated to provide smooth, reliable, and secure transactions over the Web. They’ll be distributed across timezones, so they have to be available all the time. And they have to be flexible enough to serve an increasingly mobile workforce.

5 Database Administration Tasks
Managing database availability Planning and creating database Managing physics structure Managing storage base on design managing security Network administration Backup & Recovery Database tuning

6 Database Architectural Components

7 Database Architectural Components
Server Process Sql Net User Process Net8 -- GID – Global ID (Ex: ) SID – System ID (Ex: ORCL)

8 Database Architectural Components
User Process Run on the client machine Is spawned when a tool or an application is invoked Sql plus ,Server Manager,OEM,Designer,Developer includes the User Program Interface (UPI) Calls to the Oracle Server

9 Database Architectural Components
Server Process Run on the Sever machine (host) Services a single user process in dedicated server configuration Users an exclusive PGA Include Oracle Program interface (OPI) Process calls by client Returns to the client

10 Database Architectural Components
Oracle Instance Oracle Server consists of Oracle Instance and Oracle database Memory Structure SGA & Background Process Identified by setting ORACLE_SID , can open and use only one database at any point of time

11 ORA 7/8 : Architectural Components

12 Database Architectural Components
System Global Area - SGA Shared Pool : used to store information such as the most SQL & data from data dictionary Database Buffer Cache : used to store the most recently used data Redo Log Buffer : used to register changes made to the database

13 SGA – Process, PGA

14 Glossary : SGA

15 SGA

16 Process Database Files Control Files Redo Log Files (Parameters File)

17 Database Architectural Components
Processing a Query Parse - check & compile the statement in the Shared Pool Execute - Prepare to retrieve data Fetch - retrieve the data rows The Shared Pool Size defined by : SHARED_POOL_SIZE Library Cache : Text,parse tree,execution plan of Sql statement Data Dictionary Cache : Contains table and column definitions and privileges ,user,password also known as Dictionary cache or row cache.

18 Database Architectural Components
Database Buffer Cache • Stores the most recently used blocks • Number of buffers defined by DB_BLOCK_BUFFERS • Size of the buffer based on DB_BLOCK_SIZE The Oracle Server use a Least Recently Used (LRU) algorithm to age out buffers that have not been accessed recently to make away for new blocks to be accommodated in the buffer cache.

19

20 Database Architectural Components
Redo Log Buffer • Size defined by LOG_BUFFER • Records changes made though the instance • Used sequentially • Circular buffer

21 PGA – Program / Process Program Global Area (PGA)
• Also know as Process global area only for one process • not shared and not writable. • Contains - Sort area (sort rows before data returned to the user) - Session information (User privileges for the session) - Cursor State (Cursor used by the session) - stack space (session variables)

22 Architectural Components – Data Flow
Processing a DML Statement Instance 3. Place locks on data Update emp SET sal=sal* 1.1 WHERE empno=7369 SGA Library Cache 4. Before (Rollback)/ After image new value Server Process 2. Copy data to db buffer DB Buffer Redo Log Data dictionary 5. Before image - rollback block updated to data block and marked as Dirty Buffers Control File 1. Data & Rollback Blocks Data File Log File

23 Background Process Database Writer (DBWR) Log Writer (LGER)
System Monitor (SMON) (recovery and space management) Process Monitor (PMON) (cleans transactions) Check point (CKPT) Archive (ARCH) Recover (RECO) (On the distributed database system) Lock Processes (LCK0-9) - For parallel, for remote database Server Process (S000-S999) (MTS) Dispatcher Process (D000-D999). (MTS)

24 Database Architectural Components
Background Process Database Writer (DBWR) Write dirty buffers from database buffer cache to the data file Trigger Event 1. When dirty buffers reaches a threshold value 2. When no more free buffers 3. A timeout occurs 4. A checkpoint

25 LGWR – Log Writer Background Process Log Writer (LGWR) Trigger Event
Write log buffer into redo log files,write redo log sequence number to data file and control file and tells DBWR to write dirty buffers to disk Trigger Event 1. When redo log buffer is one - third full 2. When timeout occurs (3 seconds) 3. Before DBWR active 4. When a transaction commits

26 Database Architectural Components

27 Tablespace : SYSEM, USERS

28 Logical View vs. Physical View
Segment Extent Tablespace

29 Snapshot Show GUI Viewpoint

30 MEORCL Instance Name: (ORCL)

31 MEORCL – Instance Name

32 Help

33 Glossary: Segment

34 Rollback Segment

35 Physical Files – ORACLE
Database Files Data files - store the data dictionary,user objects before/after images for the transactions (at least 1) Redo log files - changes made to the database for later recovery (at least 2) Control files - contain the information need to maintain and verify database integrity (at least 1) Parameter file - define the characteristics of the Oracle Instance Password file - used to authenticate privileged database user Archived redo log files - offline copies of redo log files that may be necessary to recovery from media failures

36 2. Managing an Oracle Instance
Objectives • Setting up system and password file • Creating the parameter • Starting up an instance and opening the database • Closing a database and shutting down database • Getting and setting parameter values • Managing sessions • Monitoring ALTER and trace files

37 Managing an Oracle Instance
Connect as internal / sysdba The ability to connect as internal is provided for backward compatibility. In the future, the DBA can connect to the database for the purposes of administration using the connect name/pass as sysdba command. The sysdba keyword denotes a collection of privileges that are akin to those privileges granted with the internal keyword.

38 Managing an Oracle Instance
Sysdba/sysoper osdba/osoper The sysoper/osoper privilege handles administration of the following privileges: Starting and stopping the Oracle instance Mounting or opening the database Backing up the database Initiating archival of redo logs Initiating database recovery operations Changing database access to restricted mode . The sysdba privilege administers certain other privileges as well. The sysoper/osoper privilege All system privileges granted with admin option The create database privilege Privileges required for time-based database recovery

39 Managing an Oracle Instance
Database Startup - Start an instance (INITSID.ORA) - Mount the database (Control File) - Open the database (Data Files) Database Shutdown - Close the database - Dismount the database - Shutdown the instance

40 Managing an Oracle Instance
Database Startup Start an instance - Reading the parameter file - Allocate SGA - Starting the Background Process - Open the trace and the ALERT file Mounting the database - Reading the control file - Associating a database - obtain the names and status of data & log files for renaming data file,enable,disable archive and performing full database recovery Opining the database - Opening the online data file - Opening the online redo logfiles - check the consistency of the database SMON initiates the instance recovery

41 Startup – Instance Database Startup Command
STARTUP [force] [restrict] [pfile=filename] [exclusive | parallel | shared] [open [recovery] [database] | mount | nomount ] Change Status ALTER database {mount | open} Troubleshooting (Start Oracle Services) ORA : TNS : lost contact ORA : Windows 32 bits drive unable to spawn new oracle task

42 SVRMGRL– StartUp /Shutdown

43 Connect Internal/PWD

44 Shutdown Database Shutdown Options Shutdown mode A I T N
Allow new connection n n n n Wait until session end n n n y Wait until the transactions n n y y Force a checkpoint and close n y y y SHUTDOWN [NORMAL | TRANSACTIONAL | IMMEDIATE | ABORT]

45 Managing an Oracle Instance
Demo & Practice - Database Startup & Shutdown

46 Managing an Oracle Instance
Database Administrator Users SYS and System are - automatically created - Granted the DBA role SYS Password change_on_install - Owner of the data dictionary System - Password manager - Owner of the additional internal tables used by Oracle Tools Create additional User for daily DBA activities

47 Managing an Oracle Instance
Operating System Authentication • Setup the user to be authenticated by the OS • Set REMOTE_LOGIN_PASSWORDFILE=NONE • Use the following command to connect to the database CONNECT / AS SYSDBA CONNECT / AS SYSOPER Unix - the user must be the Unix group user DBA - View /etc/group and /etc/password to determine the member of Unix group Windows NT - Create group called ORA_<SID>_DBA and ORA_<SID>_OPER - Add NT the CONNECT INTERNAL User to the group

48 Managing an Oracle Instance
Using Password File Authentication • Create the password file using Password v$pwfile_users orapwd (80) file=<filename> password =<password> entried= <entries> filename - password file password - password Entries - max no of dba • Set REMOTE_LOGIN_PASSWORDFILE to EXCLUSIVE or SHARED Exclusive - only one instance names other than SYS SYSTEM Shared - more than one instance but only recognized SYS and Internal • On Unix $ORACLE_HOME/dbs On Windows NT %OARCLE_HOME%\DATABASE

49 Managing an Oracle Instance
Changing the internal Password • Use the password utility on NT and UNIX to delete and create the password file or • Use the ORADIM utility on NT to delete and create a new password file NT - Delete password file C:\ >ORADIM -DELETE -SID sid - Recreate c:\>ORADIM80 -NEW -SID sid -INTPWD pwd - MAXUSER n

50 Managing an Oracle Instance
The Initialization Parameter File • Refereed to as the init<SID>.ora file • Locate in $ORACLE_HOME/dbs on UNIX %ORACLE_HOME%/database on NT Using of parameter : - size the SGA to optimize performance - set instance and database default & limit - define the physics attributes of the database (db block) - specify control, archive & trace file location Rule to specify the parameter - format keyword=value - the server has a default for each value - # to commit the parameter,double quotation for char. - IFILE to include additional parameter Note : OEM starting a remote database requires the parameter files to be stored on the computer that running the OEM

51 Init.ORA – Parameter The Initialization Parameter File
DEMO - Parameter file example - How to modify the Init.ora file - the important parameter

52 Shutdown and then StartUp
Dynamic Performance Views Maintained by the Oracle Server Contain the data that useful for performance tunning Contain data on the disk and memory struceures v_$ but oracle provide public Synonyms v$ the view v$FIXED_TABLE display all the views info. Accessing Dynamic Performance views OPEN Data dictionary MOUNT NOMOUNT Disk SHUTDOWN memory

53 Startup an Instance NoMount / Mount / Open

54 Managing an Oracle Instance
Dynamic Performance Views V$PARAMETER V$SGA V$OPTION V$PROCES V$SESSION V$VERSION V$INSTANCE SGA V$THERAD V$CONTROLFILE V$DATABASE V$DATAFILE V$DATAFILE_HEADER V$LOGFILE Control File

55 Managing an Oracle Instance
Displaying Current Parameter Values . Use the server Manager / SHOW PARAMETER . Query the v$parameter

56 Managing an Oracle Instance
Dynamic initialization Parameter Some initialization parameter can be modified while the instance is running ALTER SESSION SET SQL_TRACE=true; ALTER SYSTEM SET TIMEDSTATISTICS=true; ALTER SYSTEM SET SORT_AREA_SIZE=131072; ALTER SESSION modifies only the value of current session ALTER SYSTEM Changes the global values DEMO - Check the v$parameter

57 Managing an Oracle Instance
Enable and disable restricted Session START RESTRICT ALTER SYSTEM ENABLE RESTRICTED SESSION; Usage : - structure maintenance - database export import

58 Managing an Oracle Instance
Terminating Session 1. Identify the user session from V$SESSION SELECT sid ,serial# from v$session; 2. Execute the ALTER SYSTEM command ALTER SYSTEM KILL SESSION ‘8,16’;

59 Managing an Oracle Instance
Trace files - trace file can be written by server and background process - Oracle dumps the information in trace files - the ALERT file consist of a all the messages and errors - Server process tracing can be enable & disabled by ALTER SESSION set SQL_TRACE=TRUE; Parameters: BACKGROUND_DUMP_DEST USER_DEMP_DEST MAX-DUMP_SIZE alter<SID>.LOG UNIX $ORACLE_HOME/RDBMS/LOG NT %ORACLE_HOME%/RDBMS/TRACE

60 Managing an Oracle Instance
Guidelines for the ALERT file . Detect internal errors (ORA-00600) and block corruption errors. . Monitor database operations STARTUP,SHUTSOWN,ARCHIVE LOG,RECOVER . View the nondefault initialization parameter

61 Managing an Oracle Instance
Summary . Starting up and shutdown an instance . Understanding the use of dynamic performance views . Describing the use of trace files

62 PDF /Book

63 PDF / Read it to get Concepts

64 Q&A :Index

65

66 Clustered vs. Non-Clusterd

67

68 Q&A : SQLplus

69 Questions & Answer???


Download ppt "Oracle8/8i Database Administration"

Similar presentations


Ads by Google