Database Administration: Responsibilities of Dba
Database Administration: Responsibilities of Dba
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. -----------------------------------------------------------
RECORD INSERT
RECOVERY S S A D D L
SERVER PROCESSOR
35%
CHANGES 20%
PMO N DBWR
COMMANDS 45%
LGWR CKPT
SMON
AR CC
DATA FILES
CONTRO L FILES
REDO LOG
FILES
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 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.
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.
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.
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;
Dropping Tablespaces
The following statement removes the APP_DATA tablespace and all its contents.
DROP TABLESPACE app_data INCLUDING CONTENTS;
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
Inserts 1
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