DATABASE ADMINISTRATION

RESPONSIBILITIES OF DBA. 1-instal and update the oracle application software’s. 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.

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

The sga including shared pool. ORACLE INSTANCE Consist of memory structure called sga (system global area) SGA Consist in memory region. basically connected sga. 1. Firstly we create a server process then he transfers sga. dtatbase buffer cache and redo log buffer.Execute .cache hit (fast work) 2.ORACLE SERVER Consist of an oracle instance and oracle database.LRU (list recent used) mru (most recent used end) Lru (least recent used end) 2. 1. 2.Parsing User process sends the query to server process to check syntax.Dirty list (image of blocks before reuse) SERVER PROCESS When user process connect the front-end tool in oracle database server. This is called server process. If record not available then dbwr search the information TYPES OF DATABASE BUFFER CACHE There are two types of database buffer cache. We do not directly connected sga. validity of commands. DATABASE BUFFER CACHE It is the most important area when a query is processed. which contains data and control information. where oracle server resides. the server process looks for the blocks needed in the database buffer cache. SERVER PROCESS HAS THREE STEPS.cache miss (slow work) DATABASE BUFFER CACHE LISTS Database buffer cache has two lists 1. SHARED POOL Used to store information such as the most recently execute sql commands from data dictionary.

2. if one of the process fail.Process Monitor (PMON) Cleanup the resources.Log writer (LGWR) Records change registered in the redo log buffer to database.Control file Contain the information needed to maintain and verify database integrity. Oracle’ name information in control file.Archived (ARC) Make duplicate files of any information in off line media. 3. 6.Data File Store the data dictionary.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. 5. A database has at least one data file.System Monitor (SMON) Its primary function is to check for consistency and initiate recovery of database when the database is opened. 4. 2.Database writer (DBWR) Responsibilities for writing change the data to the database buffer cache. user objects and before image of data that are modified by current transactions. NOTE= if above four process are damaging then sga will also damage automatically order that database is damage and then again restart. server process prepare to database. DATABASE FILES An oracle database has consisted of the following types of file. At least one control file needed for database. 3.The processing of the query. 1.Fetch To transfer result of query to the users BACKGROUND PROCESS 1.Redo log file . If control file damage then never database start. 3.

2. 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.Parameter File Use to define the characteristics of an oracle instance. STARTING SERVER MANAGER IN LINE MODE. (Control file open for dba). memory information. modify control file. A database requires at least two redo log files. ON UNIX > SVRMGR1 (IN RUN OPTION) ORACLE 8 ON WINDOW NT/2000/XP > SVRMGR30 (IN RUN OPTION) SVRMGR> CONNECT SYS/ORACLE AS SYSDBA. . 1. OTHER KEY PHYSICAL STRUCTURE 1. 2. (Instance started). 3.Contain a record of damage made to database to ensure reconstruction of database in case of failure. all names of control file in parameter files.Archived Log File Off line copies of the redo log files that may be necessary to recover from media failure. data recovery.Mount This is used to alter file structured.No Mount This state is used to create the database. how much area cover by sga.Password file Use to authenticated privileged database users.

1. When all transaction completed then close the database. SHUTTING DOWN THE DATABASE It is also responsibility of dba to shutdown the database is not available to all users.Shutdown immediately 4.3. Svrmgr> shutdown or Svrmgr> shutdown normal.Open In this state the database is available to all users. Svrmgr>connect sys/oracle as sysdba. Svrmgr>startup mount force. Svrmgr> startup force. In shutdown normal no new connection are allowed. This option waits for current transaction. Mount the database if database already in no mount state. Enabling restricted session in open database. Svrmgr>startup force nomount. Following commands can be used to shutdown the database in server manager. RESTRICTED SESSION DBA not want to allow ordinary user to connect the database. which are not completed. SVRMGR>startup restricts. If the instance already started. . Svrmgr> alter system disable restricted session.Shutdown normal 2. Then Svrmgr>alter database mount. force option can be used. Svrmgr> alter system enable restricted session.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. Shutdown transaction It’s used to bring down the database as soon as the users complete their current transaction. Svrmgr>startup. Svrmgr>alter database open.Shutdown transactional 3.

FOR EXAMPLE DB_NAME= DYNAMIC CONTROL_FILE= ‘E:\MYDATABASE\CONTROL. SOME PARAMETER SHOULD BE CHANGED FOR BETTER MANAGEMENT.ORA FILE FROM DEFAULT LOCATION TO ABOVE LOCATION. Oracle database can be altered after creation. ONE CONTROL FILE AND TWO REDO LOG GROUPS AND ATLEAST ONE MEMBER IN EACH GROUP.ORA FILE REQURIED. which must be performed carefully. One is manually and other is gui (graphic user interface). 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:. FOR EXAMPLE D:\MYDATABASE\INIT. Some modification is not allowed after creation of database like db_block_size cannot be changed.Svrmgr> shutdown immediate. Svrmgr> shutdown abort. Shutdown immediate In which oracle server doesn’t wait for currently connected users to log off from the database. THE MINIMUM REQUIREMENT OF DATABASE CREATION IS THAT IT MUST HAVE ONE DATA FILE.ORA NOW MODIFY INIT. Svrmgr>shutdown immediate. Shutdown abort In which current client sql statements being processed by the oracle server are not completed and abort. BEFORE CREATING A DATABASE HARDWARE RESOURCES. Creating a database is multiple steps operation.ORA’ . 1. DATABASE CREATION It is very important task. But this is not usual task. and size can be changed. When you can create database with two methods. more files can be added. CREATE A DIRECTORY AT ANY LOCATION FOR EXAMPLE D:\MYDATABASE\ 2. COPY INITORCL.

Temporary data 4. .Rollback data System table space Their users for all user of database its work by default. NOW RUN SERVER MANGER OR SQL/PLUS AND STARTUP INSTANCE IN NOMOUNT STATE. SVRMGR> STARTUP NOMOUNT PFILE=E:\MYDATABASE\INITORCL.RDO’ SIZE 500 K.System table space 2.ORA’ SIZE 20 M LOGFILE GROUP 1 ‘E:\MYDATABASE\LOG1.ora.REMOTE_LOGIN_PASSWORDFILE=SHARED 3. Types of table space 1.RDO’ SIZE 500 K. Its data file name is sys1orcl.ORA FORCE. GROUP 2 ‘E:\MYDATABASE\LOG2.User data 3. 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. THEN SVRMGR>CREATE DATABASE DYNAMIC DATAFILE ‘E:\MYDATABASE\DATAFILE1. Every table space has one data file.

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

dbf’ SIZE 100M.DATAFILE ‘C:\ORANT\DATABASE\NEWDATA1.dbf’ SIZE 100M MINIMUM EXTENT 500K DEFAULT STORAGE (INITIAL 500K NEXT 500K MAXEXTENTS 500 PCTINCREASE 0). Adding Data Files to a Tablespace ALTER TABLESPACE ADNANQASIR ADD DATAFILE ‘/DISK5/app03. 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. ‘C:\ORANT\DATABASE\NEWDATA2. Enabling Automatic Extension of Data Files ALTER TABLESPACE ADNANQASIR ADD DATAFILE .dbf’ SIZE 50M MINIMUM EXTENT 1M DEFAULT STORAGE (INITIAL 2M NEXT 2M MAXEXTENTS 500 PCTINCREASE 0) TEMPORARY.dbf’ SIZE 200M.

dbf’ RESIZE 50M.dbf’. • The SYSTEM tablespace and any tablespace with active rollback segments cannot be taken offline. Moving Data Files: ALTER TABLESPACE •The tablespace APP_DATA must be offline. ALTER TABLESPACE ADNANQASIR DEFAULT STORAGE (INITIAL 2M NEXT 2M MAXEXTENTS 999).‘/DISK6/app04. ALTER TABLESPACE app_data RENAME DATAFILE ‘/DISK4/app01. Changing the Size of Data Files Manually ALTER DATABASE DATAFILE ‘C:\ORANT\DATABASE\NEWDATA1.dbf’ TO ‘/DISK5/app01. ALTER TABLESPACE app_data OFFLINE. OFFLINE Status •The tablespace that is offline is not available for data access.dbf’ SIZE 200M AUTOEXTEND ON NEXT 10M MAXSIZE 500M. . •The target data files must exist. Changing the Storage Settings ALTER TABLESPACE ADNANQASIR MINIMUM EXTENT 2M.

Dropping Tablespaces The following statement removes the APP_DATA tablespace and all its contents.DBF Moving Data Files: ALTER DATABASE •The database must be mounted. Making Tablespace Read-Only •The tablespace must be online. The tablespace APP_DATA is only available for read operations. •The target data file must exist. • The tablespace must not currently be involved in an online backup. . The READ-ONLY Tablespace Status ALTER TABLESPACE app_data READ ONLY. • No active transactions are allowed.Moving Data Files: BY OPERATING SYSTEM (DOS) MOVE C:\ORANT\DATABASE\NEWDATA2.dbf’. • The tablespace must not contain active rollback segments. ALTER DATABASE RENAME FILE ‘/DISK1/system01. DROP TABLESPACE app_data INCLUDING CONTENTS.dbf’ TO ‘/DISK2/system01.DBF E:\MYDATABASE\NEWDATA2.

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 .

Sign up to vote on this title
UsefulNot useful