Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
54 views

Database Administration: Responsibilities of Dba

Uploaded by

avk.oracle
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views

Database Administration: Responsibilities of Dba

Uploaded by

avk.oracle
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 18

DATABASE ADMINISTRATION

RESPONSIBILITIES OF DBA. 1-instal and update the oracle application softwares. 2.start and stop the oracle instance. 3.maintain security policies, such as control user access to resources and information. 4- tunes the database. 5. Perform the physical database design. 6- be on call when problems occur with the database. 7- keeps current with database, operating system and application development techonologies. 8- performs database backup and recovery as required daily, weekly and monthly. 9 - assists developer in designing tables and queries for high efficiency. 10- keep your and users skill up to date. 11- performs future year planning. 12- provides necessary support and guidance to the user and programmers. ---------------------------------------------------------IMPORTANT DBA TASKS (is the database secure enough?) There are four major arias that need to be considering for database security. 1 - traditional backup & recovery mechanism that provide security against losing data due to media failure. 2- security against unauthorized instruction into the system and possible alternation of the data. 3- accident corruption of the data by an authorized user of the system. 4-ability to keep the system running in the event of the destruction of the data center or office in which your database server sits.

----------------------------------------------------------SUGGESTION TO MAKE DATABASE SECURE 1-change the default oracle password, because the most of the people know the default password of administration level user are system/manger, internal/oracle, sys/chang_on_install. 2- keeps the users privileges or rights to the minimum with respect to job title. 3- avoid easy password. 4- keeps changes your password after some time provide. 5- keeps the backup media very secure and away from data center. -----------------------------------------------------------

ORACLE MEMORY STRUCTURE


ORACLE INSTANCE SGA (SYSTEM GLOBAL AREA)
DATABASE BUFFER CACHE REDO LOG BUFFER SHARED POOL

RECORD INSERT

RECOVERY S S A D D L

SERVER PROCESSOR

35%

CHANGES 20%
PMO N DBWR

COMMANDS 45%
LGWR CKPT

USER PROCESS Paramete r File Password File

SMON

AR CC

DATA FILES
CONTRO L FILES

REDO LOG

FILES

Archive Log file

ORACLE SERVER
Consist of an oracle instance and oracle database.

ORACLE INSTANCE
Consist of memory structure called sga (system global area)

SGA
Consist in memory region, which contains data and control information, where oracle server resides. The sga including shared pool, dtatbase buffer cache and redo log buffer.

SHARED POOL
Used to store information such as the most recently execute sql commands from data dictionary.

DATABASE BUFFER CACHE


It is the most important area when a query is processed; the server process looks for the blocks needed in the database buffer cache. If record not available then dbwr search the information TYPES OF DATABASE BUFFER CACHE There are two types of database buffer cache. 1.cache hit (fast work) 2.cache miss (slow work)

DATABASE BUFFER CACHE LISTS

Database buffer cache has two lists 1- LRU (list recent used) mru (most recent used end) Lru (least recent used end) 2- Dirty list (image of blocks before reuse)

SERVER PROCESS
When user process connect the front-end tool in oracle database server, basically connected sga. This is called server process. We do not directly connected sga. Firstly we create a server process then he transfers sga. SERVER PROCESS HAS THREE STEPS. 1- Parsing User process sends the query to server process to check syntax, validity of commands. 2- Execute

The processing of the query, server process prepare to database. 3- Fetch To transfer result of query to the users

BACKGROUND PROCESS
1- Database writer (DBWR) Responsibilities for writing change the data to the database buffer cache. 2- Log writer (LGWR) Records change registered in the redo log buffer to database. 3- System Monitor (SMON) Its primary function is to check for consistency and initiate recovery of database when the database is opened. 4- Process Monitor (PMON) Cleanup the resources, if one of the process fail. NOTE= if above four process are damaging then sga will also damage automatically order that database is damage and then again restart. 5- Check Point (CKPT) To check any task perform to control all dirty database buffer covered by the log being ckpt are written to the data files by dbwr. 6- Archived (ARC) Make duplicate files of any information in off line media.

DATABASE FILES
An oracle database has consisted of the following types of file. 1- Data File Store the data dictionary, user objects and before image of data that are modified by current transactions. A database has at least one data file. 2- Control file Contain the information needed to maintain and verify database integrity. Oracle name information in control file. If control file damage then never database start. At least one control file needed for database. 3- Redo log file

Contain a record of damage made to database to ensure reconstruction of database in case of failure. A database requires at least two redo log files.

OTHER KEY PHYSICAL STRUCTURE


1- Parameter File Use to define the characteristics of an oracle instance, how much area cover by sga, memory information, all names of control file in parameter files. 2- Password file Use to authenticated privileged database users. 3- Archived Log File Off line copies of the redo log files that may be necessary to recover from media failure.

STARTING SERVER MANAGER IN LINE MODE.


ON UNIX > SVRMGR1 (IN RUN OPTION) ORACLE 8 ON WINDOW NT/2000/XP > SVRMGR30 (IN RUN OPTION) SVRMGR> CONNECT SYS/ORACLE AS SYSDBA; STARTUP AND SHUTDOWN STAGES Open STARTUP
No mount Shutdown

ONLY FOR

Mount

SHUTDOWN

Database administrator can start database in one of three following different states. 1- No Mount This state is used to create the database. (Instance started). 2- Mount This is used to alter file structured, modify control file, data recovery. (Control file open for dba).

3- Open In this state the database is available to all users. Svrmgr>connect sys/oracle as sysdba; Svrmgr>startup; If the instance already started, force option can be used. Svrmgr> startup force; Svrmgr>startup mount force; Svrmgr>startup force nomount; Mount the database if database already in no mount state. Then Svrmgr>alter database mount; Svrmgr>alter database open;
RESTRICTED SESSION

DBA not want to allow ordinary user to connect the database. SVRMGR>startup restricts; Enabling restricted session in open database. Svrmgr> alter system enable restricted session; Svrmgr> alter system disable restricted session;
SHUTTING DOWN THE DATABASE

It is also responsibility of dba to shutdown the database is not available to all users. Following commands can be used to shutdown the database in server manager. 1- Shutdown normal 2- Shutdown transactional 3- Shutdown immediately 4- Shutdown abort
Shutdown normal

Shutdown normal is default option in database will make the dba to wait for all other users to finish but they are doing before database will actually close. In shutdown normal no new connection are allowed. Svrmgr> shutdown or Svrmgr> shutdown normal;

Shutdown transaction
Its used to bring down the database as soon as the users complete their current transaction. This option waits for current transaction, which are not completed. When all transaction completed then close the database.

Svrmgr> shutdown immediate;

Shutdown immediate
In which oracle server doesnt wait for currently connected users to log off from the database. Svrmgr>shutdown immediate;

Shutdown abort
In which current client sql statements being processed by the oracle server are not completed and abort. Svrmgr> shutdown abort;

DATABASE CREATION
It is very important task. But this is not usual task. Creating a database is multiple steps operation, which must be performed carefully. When you can create database with two methods. One is manually and other is gui (graphic user interface). Oracle database can be altered after creation, more files can be added, and size can be changed. Some modification is not allowed after creation of database like db_block_size cannot be changed.

BEFORE CREATING A DATABASE


HARDWARE RESOURCES, MEMORY AND DISK SPACE OPERATING SYSTEM PRIVILAGES LOCATION AND SIZE OF FILE PREPAREING PARAMETER FILE ORACLE SOFTWARE EXISTING DATABASE BACKUP STEPS OF CREATE DATABASE MANUALLY NOTE:. THE MINIMUM REQUIREMENT OF DATABASE CREATION IS THAT IT MUST HAVE ONE DATA FILE, ONE CONTROL FILE AND TWO REDO LOG GROUPS AND ATLEAST ONE MEMBER IN EACH GROUP. 1. CREATE A DIRECTORY AT ANY LOCATION FOR EXAMPLE D:\MYDATABASE\ 2. COPY INITORCL.ORA FILE FROM DEFAULT LOCATION TO ABOVE LOCATION. FOR EXAMPLE D:\MYDATABASE\INIT.ORA NOW MODIFY INIT.ORA FILE REQURIED. SOME PARAMETER SHOULD BE CHANGED FOR BETTER MANAGEMENT. FOR EXAMPLE DB_NAME= DYNAMIC CONTROL_FILE= E:\MYDATABASE\CONTROL.ORA

REMOTE_LOGIN_PASSWORDFILE=SHARED 3. NOW RUN SERVER MANGER OR SQL/PLUS AND STARTUP INSTANCE IN NOMOUNT STATE. SVRMGR> STARTUP NOMOUNT PFILE=E:\MYDATABASE\INITORCL.ORA FORCE; THEN SVRMGR>CREATE DATABASE DYNAMIC DATAFILE E:\MYDATABASE\DATAFILE1.ORA SIZE 20 M LOGFILE GROUP 1 E:\MYDATABASE\LOG1.RDO SIZE 500 K, GROUP 2 E:\MYDATABASE\LOG2.RDO SIZE 500 K;

Table spaces
Bit Byte Block Extend Segment Table space Database 8bit =1 byte 512 bytes = 1 block 5 block = 1 extend 1 extend = segments segments = tables spaces table space = database

Definition of table space The smallest pieces of the segments in database are called table space. Every table space has one data file. Types of table space 1- System table space 2- User data 3- Temporary data 4- Rollback data System table space Their users for all user of database its work by default. Its data file name is sys1orcl.ora.

User data Its user for giving space to other users Its data file name is usr1orcl.ora Temporary data If space full that will use the user then dba assign temporary space given by temporary data. Its data file name is temp1orcl.ora Rollback data In this table space has keep old image of the data. Its data file name is rbs1orcl.ora

Objective:
Describing the logical structure of the database Creating Tablespaces Changing the size of Tablespaces using different methods Changing the status and storage settings of Tablespaces Relocating Tablespaces Preparing necessary Tablespaces

TYPES OF TABLESPACE
1-SYSTEM Tablespaces contains: Data dictionary information SYSTEM rollback segment 2-Non-SYSTEM Tablespaces contains: Rollback segments Temporary segments Application data Application indexes

Creating Tablespaces
CREATE TABLESPACE ADNANQASIR

DATAFILE C:\ORANT\DATABASE\NEWDATA1.dbf SIZE 100M, C:\ORANT\DATABASE\NEWDATA2.dbf SIZE 100M MINIMUM EXTENT 500K DEFAULT STORAGE (INITIAL 500K NEXT 500K MAXEXTENTS 500 PCTINCREASE 0);

Storage Parameters
The following parameters influence the segment storage allocation: INITIAL NEXT MAXEXTENTS MINEXTENTS PCTINCREASE

Temporary Tablespace
Used for sort operations Cannot contain any permanent objects
CREATE TABLESPACE sort DATAFILE /DISK2/sort01.dbf SIZE 50M MINIMUM EXTENT 1M DEFAULT STORAGE (INITIAL 2M NEXT 2M MAXEXTENTS 500 PCTINCREASE 0) TEMPORARY;

Adding Data Files to a Tablespace


ALTER TABLESPACE ADNANQASIR ADD DATAFILE /DISK5/app03.dbf SIZE 200M;

Enabling Automatic Extension of Data Files


ALTER TABLESPACE ADNANQASIR ADD DATAFILE

/DISK6/app04.dbf SIZE 200M AUTOEXTEND ON NEXT 10M MAXSIZE 500M;

Changing the Size of Data Files Manually


ALTER DATABASE DATAFILE C:\ORANT\DATABASE\NEWDATA1.dbf RESIZE 50M;

Changing the Storage Settings


ALTER TABLESPACE ADNANQASIR MINIMUM EXTENT 2M; ALTER TABLESPACE ADNANQASIR DEFAULT STORAGE (INITIAL 2M NEXT 2M MAXEXTENTS 999);

OFFLINE Status The tablespace that is offline is not


available for data access. The SYSTEM tablespace and any tablespace with active rollback segments cannot be taken offline.
ALTER TABLESPACE app_data OFFLINE;

Moving Data Files: ALTER TABLESPACE


The tablespace APP_DATA must be offline. The target data files must exist.
ALTER TABLESPACE app_data RENAME DATAFILE /DISK4/app01.dbf TO /DISK5/app01.dbf;

Moving Data Files: BY OPERATING SYSTEM (DOS)


MOVE C:\ORANT\DATABASE\NEWDATA2.DBF E:\MYDATABASE\NEWDATA2.DBF

Moving Data Files: ALTER DATABASE


The database must be mounted. The target data file must exist.
ALTER DATABASE RENAME FILE /DISK1/system01.dbf TO /DISK2/system01.dbf;

The READ-ONLY Tablespace Status


ALTER TABLESPACE app_data READ ONLY;

The tablespace APP_DATA is only available for read operations.

Making Tablespace Read-Only


The tablespace must be online. No active transactions are allowed. The tablespace must not contain active
rollback segments. The tablespace must not currently be involved in an online backup.

Dropping Tablespaces
The following statement removes the APP_DATA tablespace and all its contents.
DROP TABLESPACE app_data INCLUDING CONTENTS;

Obtaining Tablespace Information (Select * from v$dba_tablespace)


DBA_TABLESPACES TABLESPACE_NAME NEXT_EXTENT MAX_EXTENTS PCT_INCREASE MIN_EXTLEN STATUS CONTENTS

Obtaining Data File Information


DBA_DATA_FILES FILE_NAME TABLESPACE_NAME BYTES AUTOEXTENSIBLE MAXBYTES INCREMENT_BY

Storage Structure and Relationships Objective:


Listing the different segment types and their uses Controlling the use of extents by segments Stating the use of block space utilization parameters by objects Obtaining information about storage structures from the data dictionary Locating the segments by considering fragmentation and life-spans

Types of Segments
Table Table partition Cluster Index

Index-organized table Index partition Rollback segment Temporary segment LOB segment LOB index Nested table Bootstrap segment

Extent Allocation and Deallocation


Allocated when the segment is +Created +Extended +Altered Deallocated when the segment is Dropped Altered Truncated Automatically resized (rollback segments only)

Database Block: Review


Minimum unit of I/O Consists of one or more O/S blocks Set by DB_BLOCK_SIZE Set at database creation

Database Block Contents

Block Space Utilization Parameters

Block Space Usage


PCTFREE=20 PCTUSED=40

Inserts 1

Data Dictionary Views


Used extents DBA_EXTENTS 2-freextents DBA_FREE_SPACE Segments DBA_SEGMENTS Data files DBA_DATA_FILES Tablespaces DBA_TABLESPACES

Querying Segment Information


DBA_SEGMENTS General information
OWNER SEGMENT_NAME SEGMENT_TYPE TABLESPACE_NAME

Size
EXTENTS BLOCKS

Storage settings
INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS MAX_EXTENTS PCT_INCREASE

Organizing Tablespaces Based on Tablespace Usage Fragmentation Fragmentation SYSTEM Data dictionary Zero TOOLS Applications Very low Propensity DATA Data segments Low
n

INDEXn RBSn TEMPn

Index segments Rollback segments Temporary segments

Low High Very high*

Relevant only if tablespace PERMANENT

You might also like