Oracle Architecture and Administration

Duties of a database administrator
Now that we have we fairly good understanding about what the Oracle 10g database is used for and how users can interact with it. We now move on to what this book aims to teach you, i.e. basic administration of the Oracle 10g database. A database administrator is a user of the database who has responsibilities that other regular users may not be concerned with. Every database requires at least one database administrator (DBA). If the database is large and needs to handle many thousands of users a group of administrators maybe required. Since managing the database is such an important and responsible task, being an administrator is not always easy. The individual in addition to being able to administer the database should have certain personal strengths such as being proactive, organized and being able to handle well under stressful situations. A DBA should also be able to communicate well. To effectively manage enterprise databases, a DBA must understand business reasons for storing the data in the database and the technical details of how the data is structured and stored. Given below is a list of tasks which the administrator may need to do: • Install, Upgrade and configure the Oracle Database server based on the organizational requirements. • Since systems are not static, the DBA must be able predict growth based on application and data usage patterns. • Understand the logical and physical structure of the particular database. • Ensuring the database is available to the users with minimum or no downtime, by taking backups regularly and creating well-tested recovery strategies. • Helping and creating primary objects such as tables, views and indexes based on the needs of the application developments. • The DBA must be able to design a database that holds accurate and valid data at all times. • Managing users and ensuring the database is accessible to only valid users. Granting the users the privileges they need to perform various actions in the database. • Monitoring and optimizing the performance of the database. • The DBA must be able to design, debug, implement and maintain stored procedures, triggers and user defined functions that are stored. • Security is becoming increasing important with the need for data to be available across the internet. The DBA should ensure that the data is secure and implement rigorous security schemes for the databases to ensure that only authorized users have access to the data. The list above broadly covers various aspects of the administrators work responsibilities. By now you should have gathered that the responsibilities of an administrator are not

easy. However, companies like Oracle Corporation are making this job easier with each new release. Oracle Database 10g is particularly popular for its introduction of new automated and intelligent features that remove and simplify some the burden on the DBA.

The Oracle Architecture A database is a centralized repository of organizational data. A database administrator who is responsible for administering a database should have a complete and thorough understanding of the architecture of the database. The Oracle 10g Database product is made up three main components namely: • The Oracle Server – This is the Oracle database management system that is able to store. It has a physical structure that is visible to the Operating system made up of operating system files and a logical structure that is recognized only the Oracle Server. The Oracle 10g Database Server allows you to create. how they function and how they interact with each other. The technician wouldn't know where to start unless he knows very clearly what the various components of the car are. The Oracle server is made up of an Oracle instance and an Oracle database. The figure 3.1 displays the architecture of the Oracle Database 10g. This is absolutely essential before he can start to find a solution to the problem. the DBA cannot come up with the right solution unless he knows everything he possibly can about the database. structures. The Oracle server consists of physical files and memory components. It is broadly divided into the memory components which form the Oracle instance and the physical database components where different kinds of data are stored. The same goes for a database. • The Oracle database – This is the centralized repository where the data is stored. manage and manipulate data. • The Oracle Instance –Consists of the memory components of Oracle and various background processes. It consists of all the files. manage and retrieve the data in the database. what they do. processes that form Oracle Database 10g. . store. An analogy could be a service technician trying to fix a car that is having a problem. If a user comes to an administrator with a certain problem.

. the name of the database and other size-related parameters needed by the Oracle instance. The instance is the created in memory every-time the database is started.Fig 3. DB_NAME=moviedb Here the name of the database is moviedb. You can also specify the name of the instance. The instance and its components are configured using a file known as the Parameter file. A typical parameter setting would be parameter_name = parameter_value For e. The parameter files hold parameters that can set the sizes of the various buffers and pools of the SGA. In Oracle 10g there are two types of initialization files namely the 'Server Parameter file' (spfile) and 'The Parameter file' (pfile). The instance is associated to only a single database at any time.g.1: Oracle Architecture INSTANCE – MEMORY COMPONENTS Library Cache Large Pool User Process Java Pool Redo Log Buffer Database Buffer Cache Data Dictionary Cache Server Process Streams Pool Shared Pool LGWR DBWR CKPT PMON SMON Redo Log Files Datafiles PHYSICAL FILES OF THE DATABASE Control Files The Oracle Instance The Oracle instance is made up of a number of memory-related components and background processes. The memory components of the Oracle Database 10g are also known as the System Global Area (SGA).

The Database Buffer Cache – An area in memory that holds all the blocks read in from disk for query or modification. The oldest blocks are the first ones to leave. Other caches that can be created in addition to the default database buffer cache. The Keep cache is used to hold such. are modified in memory and are written back to disk periodically. The size of the Keep cache can be specified by the DB_KEEP_CACHE_SIZE initialization parameter. However it is possible to set the overall size of the Shared pool by using the SHARED_POOL_SIZE initialization parameter. This is the default buffer cache. The Shared Pool – The contents of this memory area are shared by multiple users and hence the name shared pool. This buffer is managed in a manner that free blocks are always made available for new blocks being read into memory. It contains are transferred periodically from memory to the online redo log files on disk by the Log Writer (LGWR) background process. Blocks that need to be modified. since they are frequently accessed. The blocks that are part of the Database buffer cache are sized by the DB_BLOCK_SIZE initialization parameter. The size of the default database buffer cache is sized by the DB_CACHE_SIZE initialization parameter. . blocks are not released as quickly as they would have in the default cache. Oracle uses the technique known as LRU algorithm. The Recycle cache on the otherhand is used to hold blocks of objects that should be released as soon as they are used if it is unlikely that they will be reused. Two specific caches form the shared pool. The contents of the database buffer cache are shared by multiple user processes. to create space for new in-coming blocks that need room in buffer cache. Modified blocks that have not yet been written to disk are known as dirty blocks. You can specify which cache will be used by an object when the object is created. Though they are also subject to the LRU algorithm. The SGA is made up of the • Redo Log Buffer • The Database Buffer cache • The Shared Pool • The Java Pool • The Large Pool • The Streams Pool Redo Log Buffer – A circular buffer that stores all changes made in the database. They are the Keep and Recycle cycle buffers. The sizes of the two caches are not set individually and are automatically determined by the Oracle Server.Memory Components of the SGA The Oracle Instance is made up of the System Global area (SGA) and the background processes. There maybe certain blocks that should be retained in memory for a longer period of time. The contents of the database buffer cache are written to datafiles on disk by the Database Writer (DBWR) background process. The size of the redo log buffer is determined by the LOG_BUFFER initialization parameter. Blocks from standard and frequently accessed packages should be placed in the keep cache. The contents of the redo log buffer are essential for instance recovery purposes.

It is also used by the Recovery Manager (RMAN) for its functioning when the BACKUP_DISK_IO =n and BACKUP_TAPE_IO_SLAVE=TRUE initialization parameters have been set. LARGE_POOL_SIZE. The size of this memory area is determined by the LARGE_POOL_SIZE initialization parameter. The Data Dictionary Cache – Sometimes referred to as the Row Cache. which is on a first-in first-out basis. If one is found it is reused. This cache prevents SQL statements from being repeatedly parsed thus improving performance during execution of SQL statements. It is used for handling large I/O requests of server processes. a new feature known as Automatic Shared Memory Management has been introduced. The Streams Pool – This memory area is used by the Oracle Streams Product for its functioning. When a statement is executed. The database then uses this value to redistribute memory between the various memory components based on the current workload. . their execution plans and stored procedures. the SHARED_POOL_SIZE. • The Large Pool – This is an optional pool. In Oracle 10g. Oracle looks for an identical statement / execution plan in the library cache. privileges and other relevant information that is frequently accessed. Typical information stored in this cache is user account information. index and other object definitions. table. The Java Pool – This memory area is used by all session-specific Java code and data within the Java Virtual Machine (JVM). Automatic Shared Memory Management In Oracle 10g.• Library Cache –It is responsible for storing and reusing frequently used SQL statements. The parameter that needs to be configured for automatic shared memory management is the SGA_TARGET initialization parameter. Its size is determined by the JAVA_POOL_SIZE initialization parameter. This pool does not use the LRU algorithm. If you set the value for SGA_TARGET to a value greater than zero then the total amount of memory to be allocated for the auto-tuned parameters is obtained by subtracting the SGA_TARGET value from the total amount of memory for manual SGA parameters. Its main functions are to provide memory for session memory (UGA) for the shared server environment. Reads that are made to the data dictionary information in the datafiles are also called recursive reads. JAVA_POOL_SIZE and DB_CACHE_SIZE are known as the auto-tuned SGA parameters. The library cache also holds frequently accessed PL/SQL blocks. Using this feature all you need to specify is the total amount of memory that will be used by all the SGA components. if not a new parse tree and execution plan are created. parallel execution message buffers (when PARALLEL_AUTOMATIC_TUNING is set to TRUE). The cache consists of blocks that hold data dictionary information read in from the datafiles. This cache is also managed using the Least Recently Used (LRU) Algorithm.

• Timeout occurs • Tablespace is taken offline in normal or immediate mode. The DBWR writes to the datafiles when one of the following events occur in the database: • Normal or incremental checkpoint • The number of dirty buffers reaches a pre-defined threshold value • The server process scans a pre-defined number of blocks looking for free space needed by new blocks being read in. the Log Writer (LGWR). Other background processes can be started based on certain additional functionality required in the database.. This background process is mandatory. There are 5 mandatory background processes in Oracle 10g.Setting the SGA_TARGET to a value of zero will result in disabling automatic shared memory management. BEGIN BACKUP command.. • Every three seconds • Just before the DBWR writes from the database buffer cache to the datafiles. Log Writer (LGWR) . • The Redo Log Buffer is one-third full. It transfers redo entries that have been written to the redo log buffer to the online redo log files present on disk. • Tablespace is made read-only • Dropping or truncating a table • Online backup is done on a tablespace using ALTER TABLESPACE. Its function is to transfer modified blocks from the database buffer cache to the datafiles. • More than 1MB of changes (updations) has been made in the database. These are the Database Writer (DBWR). the System Monitor (SMON) and the Process Monitor (PMON). The LGWR writes to the online redo log files when one of the following events occur in the database: • A commit is issued. Background Process Database Writer (DBWR) Description and Function This background process is mandatory. Given below is a list of the most commonly started background process and the actions they are responsible for in the database. Background Processes The background processes of the Oracle instance are responsible for performing asynchronous I/O functions between the Oracle Instance and the physical files of the Oracle database that exist on disk. The ASSM feature uses the MMAN background process. which is responsible for coordinating the sizes of the various pools dynamically based on the current workload in the database. the Checkpoint process (CKPT).

This process is therefore responsible for synchronizing the database. When a checkpoint occurs the Checkpoint (CKPT) background process updates the headers of the datafiles and control files to indicate the most recent checkpoint. When a user connects to the database.Checkpoint (CKPT) This background process is mandatory. The PMON background process is responsible for cleaning the resources such locks on tables being held by failure user processes. Users connect to the (PMON) database to access data. the event is referred to as a CHECKPOINT. such as if a shutdown is performed using the ABORT option. System Monitor This background process is mandatory. Instance failure occurs during an abnormal shutdown of the database. If the user terminates his/her session abnormally. It is responsible for (SMON) performing recovery in the event of an instance failure. It can be started when you wish to operate the database in an archivelog mode. This mode of database operation allows for complete recovery of the database in an event of a failure. resources that were being used by the user session continue to remain attached until the PMON background process cleans it up. During instance recovery the SMON process performs a roll forward operation. Certain additional functions performed by the System Monitor involve coalescing of free space in dictionary-managed datafiles and releasing temporary segments that are created in the datafiles. When the contents of the database buffer cache are transferred to the datafiles by the DBWR background process. The other optional processes in Oracle 10g are the : CJQ0 – Coordinator Job Queue background process Dnnn – Dispatcher process Pnnn – Parallel Query Slaves QMNn – Advanced Queuing RECO – Recoverer Snnn – Shared Server Processes . The process also restarts dead dispatcher processes. a process known as a User process is started on behalf of the user on the client machine. This step maybe followed by a rollback during which time either the SMON or individual user processes undo all the changes that were uncommitted during the time of failure. Process Monitor This background process is mandatory. The ARCH background process transfers the contents of the online redo log files to archival media which could be disk or tape. During this step all committed transactions that were not written out to the datafiles at the time of failure were be completed. Archiver (ARCH) This is an optional background process.

a large number of server processes would need to be active. The disadvantage of this is that in an OLTP environment where there can be many thousands of users accessing the database simultaneously. A one-to-one ratio is not maintained as in the dedicated server mode. It contains data and control information held by a single server process or background process. The PGA is used to process SQL statements and to hold logon and other session information. The contents of the PGA however vary in dedicated and shared server environments. The server process communicates with the Oracle server using the Oracle Program Interface (OPI). iSQL*Plus and a front-end database interface tool. Server Processes Server processes are created in Oracle to handle requests made by user processes. • The Program Global Area (PGA) This is memory area that is associated with a server process. The user has to first supply proper authentication credentials. The shared server environment is discussed as a separate chapter in this book. A one-to-one ratio is maintained between user and server processes.MMON – Memory Monitor MMAN and MMNL. This memory area is not shared by server processes. a server process is created on behalf of the user process. The server process remains attached to the user process as long as the user process is active. It is created when a user process is created and is released when the user process is terminated. Based on the mode in which a database operates either a 1:1 ratio or m:n exists between user and server processes. In Oracle. Server processes are always started on the Server side. The server process is responsible for satisfying all requests made by the user process and responding with appropriate results. In the event that a user process is terminated abnormally the PMON background process cleans up the resources that were held by the user process. the instance can operate in one of two modes: • Dedicated server mode: Once a user process is started. This mode of operating is particularly useful in large multi-user online transaction processing (OLTP) environments. User Processes A user trying to access data in the database needs to make a connection with the database using an appropriate tool such as SQL*Plus. A user process can be serviced by any available server process. The contents of the PGA include: . Shared Server Mode: In this environment a pool of shared server processes satisfy the required of user processes. A connection is a communication pathway created between a user process and the Oracle Server. where many users concurrently access the database using short transactions. The server process remains idle during periods of inactivity. This process remains active till the user completes the session. They are responsible for responding to the user process with appropriate results. Once the user's credentials are validated a user session is established and a user process is created on the client-side to act on behalf of the user.

The Oracle database has a physical and a logical structure. In order to access the data that is physically stored in the datafiles and reduce the overhead of disk I/O. In a shared server environment. If any one of the control files is unavailable the database is shutdown. The number of private SQL areas that a user process can allocate is limited to the OPEN_CURSORS initialization parameter that takes a default value of 50.• • • Private SQL area – contains bind information and runtime memory structures. The private SQL area is in turn made up the Persistent area that contains bind information and a Runtime area that is created as soon as an execute request is initiated. Hence it recommended that multiple copies of the control file are maintained in the database on separate disks. blocks from the datafiles are read into the database buffer cache in memory. the Oracle Server is made up of the Oracle Database and Oracle Instance. All the data of the database is stored in the physical files. The physical structure of the database is made up of the operating system files that comprise the database. SQL Work area – This memory area is used for operations such as Sorting. o The database identifier and name o Timestamp of database creation o Tablespace names o Names and locations of data files and online redo log files o Current online redo log file sequence number o Checkpoint information as and when checkpoints are made o Begin and end of undo segments o Redo log archive information o Backup information generated by the recovery manager utility. The control file keeps a record of the names. Once they are modified or are no longer needed they are written back to the datafiles. • . In a shard server environment. It also hold other control information necessary to keep the database functioning. In Oracle Database 10g. All objects created in the database by users have their data physically stored in the datafiles. Hashjoins. Storage management is a one of the primary functions of the database administrator. there are three types of files namely: • Datafiles – These files contain the data of the database. The following is a list of the entries maintained in the control file. Each session that issues a SQL statement has a private SQL area. this memory area is located in the SGA and is shared by server processes. Session Memory – This is a memory area that holds a session's variables and session-related information. it is located in the System Global area. Bitmap Merge and Bitmap Create operations. size and locations different physical files of the database. The Physical Files of the Database Recalling an earlier discussion. Control Files – This is a very important file that is required for the Oracle database to function. In a dedicated server environment the Private SQL area is created in the Program Global Area (PGA) of their server process. Datafiles contain the data dictionary and user created data.

Multiplexing is maintaining multiple copies or additional members. GROUP2 has two members Rlog2a and Rlog2b. These redo logs files are known as redo groups. Now. When the LGWR performs a write. When the group becomes filled. it starts writing simultaneously to Rlog2a and Rlog2b. Oracle recommends that redo logs be multiplexed. There are two disks DISK1 and DISK2. These changes are referred to as redo entries. There are two redo log groups GROUP1 and GROUP2. it first writes simultaneously to Rlog1a and Rlog1b. The contents of the members are identical. Members of the redo log files should be off the same size and placed on separate disks. each group should have more than one member. Any change made in the database is first recorded in the online redo log buffer before it is actually implemented. . the data is still available in a member on another disk. In other words. Hence even if modified blocks were not written in the event of an instance failure. Instance failure can occur when the contents of the SGA are lost such as in the event of a power outage or an abnormal shutdown of the database. if one of the disks is lost as a result of failure. This will prevent loss of redo data in the event of the loss of a disk. Since the redo log files are very important for recovery purposes. DISK1 Rlog1a Rlog2a LGWR GROUP1 DISK2 Rlog1b GROUP2 Rlog2b Redo log groups are used in a circular fashion. MAXLOGHISTORY. the changes can be recovered by using the online redo log files. • Redo Log Files – These files contain a record of all the changes made in the database.This file is size by the values specified for a number of parameters during database creation. namely MAXLOGMEMBERS. Redo entries can be used to recover the database in the event of an instance failure. In Oracle 10g. MAXLOGFILES. MAXDATAFILES and MAXINSTANCES. Consider the figure. GROUP1 has two members Rlog1 and Rlog1b. a minimum of two redo logs should be available.

There are two kinds of parameter files available. the database is responsible for validating user credentials. Other physical files relevant to the database include: The password file – This file is used to hold the names of privileged users who have been granted the SYSDBA and SYSOPER roles. Archive files can be created on disk and transferred to tape to create space for new archive files. When a database operates in archivelog mode. This file is very useful in the event of a failure and is used for recovery purposes. The second kind of file is called Parameter file (pfile) which has been around for a while now. which allows you to specify the values to parameters that can be enforced without bouncing the database as well as after re-starting the database. The archive files – These are files that can be created by a process known as archiving. the contents of the redo log file are transferred to an offline file known as the archive file. The event when LGWR stops writing to one file and starts writing to another is called a Log Switch. It holds parameters and their values however any change to a parameter's values requires you to bounce or restart the database.Since the contents of the redo log files are very important for recovery purposes. Usually complete recovery up to the point of failure is possible if all archive files are available. you can transfer the redo entries to another media before overwriting them. shutdown or recovering the database. The parameter file – The parameter file is a file which contains a number of parameters that can be used to configure the Oracle 10g instance. This process is known as archiving. These are called persistent parameters. Archiving helps achieve complete recovery in the event of media failures. These roles contain the privileges needed to perform actions such as a startup. The first one is called the Server parameter file (spfile) introduced in Oracle 9i. . The password will is used only when you use database authentication i. Archiving can be done automatically every-time a redo log file becomes full and LGWR starts writing to another file.e.

known as the spfileSID.Parameter Files in Oracle The Oracle 10g server is made up of the Oracle Instance and the Oracle database. It is therefore very important the Oracle instance be configured properly. parameters associated with archiving and so on. The basic parameters are a list of parameters that are sufficient for day-to-day interaction. the number of processes the can concurrently access the instance. • The Static parameter file. Most actions are first performed in memory and then transferred to disk. Most parameters have default values. Various memory structures and background processes are started. A comprehensive list of initialization parameters has been displayed along with a brief description. In Oracle 10g. The initialization parameter file specifies information such as the values for various memory structures of the instance. The most important ones being: Initialization Parameter Compatible Processes Description Refers to the version of the server with which the instance should be compatible. PFILE. When a database administrator starts the Oracle database. Each parameter has a name and a value. The maximum number of operating system processes that can connect simultaneously to the instance. the first step involves creating the instance in memory. SPFILE. To create the instance the Oracle server uses a file known as the Initialization Parameter File. The Oracle instance is created in real memory. known as the initSID.ora file The initialization parameter file consists of a list of parameters. Sessions Pga_aggregate_target Nls_language Nls_territory Db_domain Shared_servers . Explicit values can also be assigned to the parameters. There are two types of initialization parameter files. the number of initialization parameters to be configured has been greatly reduced compared to previous versions of Oracle.ora file • Persistent parameter file. Parameters have been categorized into basic and advanced parameters. the database name.

Each entry in the PFILE shows the values parameter_name = parameter_value Where parameter_value can consist of a single value or a list of values separated by commas and enclosed in single quotes. A parameter can be commented in the parameter file by using the #. The Static Parameter File (PFILE) The PFILE can be created when a database is creating using the Database Configuration Assistant and manually. the previous value present in the parameter file will be used. Select Database Control Home Page -> Instance Section -> All Initialization Parameters link. An example of a dynamic change that will affect the current instance could be: ALTER SYSTEM SET SGA_TARGET = 300. . Dynamic changes are done by using the ALTER SYSTEM command. It is possible to dynamically change certain initialization parameter. Parameters can be specified in any order. The change will however only affect the current instance.Instance_number Cluster_database Db_block_size Sga_Target Control_files Db_name Db_recovery_file_dest Remote_listener Db_recovery_file_dest_size Db_create_online_log_dest_n Db_create_File_des Log_archive_Dest_n Log_archive_dest_state_n Remote_login_passwordfile Db_unique_name A list of the initialization parameters are their values can be viewed from the Enterprise Manager Console. When the database is restarted. This file is a text file which can be read and modified. This change will affect only the current instance.

you can set the SCOPE option. This option is not available when you create a database manually using the CREATE DATABASE command. you are given the option of creating an SPFILE for the database. When changing a parameter dynamically. since it is located on the server side. Using the spfile you can modify parameters such that the change will not only affect the current instance but also affect future instances of the database. Persistent Parameter File (spfile) The persistent parameter file often called the spfile was introduced in Oracle 9i. It is possible to create multiple initialization parameters files however only one will be active at any time. The values taken by the SCOPE option are MEMORY. It can be quite difficult to remember the names of all the parameters and set them properly. The spfile cannot be modified by the user and any manual change to the file will render it useless. When using the Database Configuration Assistant. By default the parameter file is located in the %ORACLE_HOME%\dbs directory. An example of a dynamic change only affecting the spfile is displayed below. Given below is a sample extract from a spfile file. SPFILE or BOTH. It has a name like initSID. If you set SCOPE=BOTH then the change will affect both the current instance and will affect future instances for the database.Any permanent change you make to a parameter requires that the database be restarted. The CREATE DATABASE command has not been discussed in the book and more information about it can be retrieved from the Oracle Documentation. If you set SCOPE=SPFILE the change will be made in the parameter file and will come into effect when the database is restarted. There is a sample file created in the Oracle database. Hence the term persistent. In the case of the static parameter file any permanent change to a parameter would require a bounce of the database. If you are using the SPFILE file. When you set SCOPE=MEMORY. It is located at the server-side. it can be backed up using Recovery Manager. It is also located in the %ORACLE_HOME%\dbs directory.ora where SID is the system identifier of the database. The complete syntax of its usage is displayed below: ALTER SYSTEM [SET|RESET] parameter_name=parameter_value [COMMENT 'text'] [SCOPE = MEMORY|SPFILE|BOTH] [SID='sid' | '*'] . ALTER SYSTEM SET SGA_TARGET=300M SCOPE=SPFILE. which can be copied and modified based on your requirements. The value BOTH is the default. The ALTER SYSTEM command and the SPFILE file The ALTER SYTEM SET command is used to modify the values of instance parameters after the instance has been created. the change you are making will only affect the current instance.

only the PFILE can be created. CREATING THE PARAMETER FILES As mentioned earlier it the DBCA tool gives us the option of creating an SPFILE. If you wish to create an SPFILE using a PFILE you can do so by issuing the command: CREATE SPFILE [= 'location of the spfile'] FROM PFILE [= 'location of the pfile'] . It is possible to create the PFILE from the SPFILE by using the command: CREATE PFILE FROM SPFILE. both for the current and future instances. However when a database is created manually. SCOPE: Determines if the change should be made in MEMORY. If you do not specify the location. Modify the size of the default database buffer cache to 20M. during database creation. The parameter values from the Persistent parameter file can be viewed by issuing a query against V$SPPARAMETER data dictionary view. Retrieving the initialization parameter values using the data dictionary Parameter values stored in the Static parameter file can be viewed using the V$PARAMETER view. SPFILE or both areas MEMORY: The change affects only the current running instance SPFILE: The change affects only the SPFILE file BOTH: The change affects both the current instance and the SPFILE. for the database. which is optional it will be created in the default location %ORACLE_HOME%\dbs directory. 'sid': Specific SID to be used in altering the SPFILE '*': Uses the default SPFILE RESET: This causes the parameter to revert to its default value Example of dynamic changes the may or may not affect the changes: 1. ALTER SYSTEM SET DB_CACHE_SIZE=20M SCOPE=BOTH. SID : Identifies the system identifier (ORACLE_SID) for the SPFILE being used currently. An editable parameter file will be created in its default location if a path is not specified. .Parameter_name : the name of the parameter to be changed Parameter_value : the new value to be assigned to the parameter COMMENT: A comment to be added to the SPFILE next to the parameter that is being altered.

It is at this point that the Oracle server verifies the consistency of the database. putting a database in archivelog mode. This phase has to be performed so that users of the database can access the data in the database. The files that are opened are the online datafiles and the online redo log files. an error will be reported and the database will not be opened. 1) Instance Creation – This is the first step in starting the database. (spfile or pfile depending on the options used in the STARTUP command) and the System Global Area (SGA) is configured. 3) Opening the database – This is the last stage in starting a database. The control file contains information about the other files of the database.g. location and synchronizing information. The control files of the database are opened and read. it will be detected at this point and the SMON background process will perform instance recovery. The first involves creation of the Oracle instance in memory. the optional background processes and so on. and various sizes for the memory pools. During instance creation. When a database is started three important steps are executed. 2) Mounting the Database – After instance creation. the files are opened and made available to the users. Starting up a database should be done by a privileged user.Lesson 4: Starting and Stopping the Oracle Database STARTING THE DATABASE A database needs to be started before it can be accessed by users. followed by mounting the database where the control files are read and finally opening the database where all the data stored in the database is accessible to the users of the database. a database is associated with its previously started instance. Users who have been granted the SYSDBA or SYSOPER roles can perform a startup or a shutdown of the database. If any of the files are unavailable. Once the control file has been read and the location of the physical files of the database identified after mounting. This information is needed for the next stage of startup which is opening of the database. During mounting. The alert log file and other trace files are also started. For e. The initialization parameter file is read. the mandatory and optional background processes are started. To get a complete understanding let us deal with each stage individually. When a database is mounted a database administrator can perform certain maintenance or administrative tasks. their status. In case the database was shutdown improperly the last time. The parameter file identifies the name of the database. renaming datafiles or performing a full database recovery requires the database to be mounted. STARTUP command The syntax of the STARTUP command with its important options has been displayed: STARTUP [FORCE] [RESTRICT] [PFILE= filename] [OPEN [RECOVER] [database] [READ ONLY] | MOUNT | NOMOUNT] . the database is mounted.

you can use this option to abort the running instance and perform a normal startup. This is the default option. issue: ALTER DATABASE [database_name] OPEN. issue: ALTER DATABASE [database_name] MOUNT. issue: . This option can be used is you wish to perform some kind of maintenance on the database such as an export and import. Current state of the database: MOUNT To change it to the OPEN state. RECOVER: used to perform media recovery when starting the database. DML statements are not allowed in the database. PFILE=filename: this option starts up the database using the static non-default parameter file to startup the database.FORCE: Used when a startup does not occur as a result of some kind of problem. only the instance is created. To change it to the OPEN state directly. You can also start a database using the EM Console. Current state of the database: NOMOUNT To change it to the MOUNT state. You may have to use this option for certain operations such as when creating a database manually. RESTRICT: This option is used when you want only users who possess the RESTRICTED SESSION privilege to access the database. OPEN [database_name]: The instance will be created. MOUNT: The instance will be created and the database mounted. database will be mounted and then opened for all the users. It is not possible to re-issue the STARTUP command with the MOUNT or OPEN options. The option can be used for performing certain maintenance tasks. The SGA will be created in memory and the background processes will be started. In order to then mount / open the database you can use the following ALTER DATABASE command. You can optionally specify the database name. NOMOUNT: Only the instance is created. READ ONLY: used to open the database for queries only. The ALTER DATABASE Command If you have started the database using the NOMOUNT option.

three phases complementary to the startup are performed in the reverse order. dismounted and the instance released. At this time. READ WRITE – the database is opened for normal read and writes. dismounted and the instance released.ALTER DATABASE [database_name] OPEN. No instance recovery will be performed during subsequent startup. A checkpoint is performed on all the databases and the files are closed. all currently active transactions will be allowed to complete. the instance is shutdown down. The SHUTDOWN command The syntax of the SHUTDOWN command SHUTDOWN [NORMAL | IMMEDIATE | TRANSACTIONAL | ABORT] NORMAL: This is the default mode for shutting down the database. TRANSACTIONAL – When the database is shutdown using this option. . After the transactions have been rolled back the user sessions are terminated. You can either perform a proper or improper shutdown. ABORT – When the database is shutdown using this option. The SGA no longer exists in memory and all background processes are stopped. this involves performing a checkpoint on all available datafiles and closing the files. No new user connections will be allowed. No instance recovery will be performed during subsequent startup. No checkpointing is done. the Oracle server automatically rolls back all currently active transactions. SHUTTING DOWN THE DATABASE A database may be shutdown to make it unavailable for use. The Oracle server waits for all currently connected users to disconnect their sessions. The database is then closed. It is possible to open a database in a read only or read write mode using the ALTER DATABASE command. No new connections are permitted. All user connections are abnormally terminated. No new connections are allowed. The database is not closed or dismounted. ALTER DATABASE OPEN [READ ONLY | READ WRITE]. Finally the instance that was created in memory is released. IMMEDIATE: When a database is shutdown in this mode. the control file is synchronized and closed. an instance recovery will not need to be done during the subsequent startup. As soon as a user's transaction completes the user is automatically disconnected. First the database is closed. Where: READ ONLY – only queries are allowed on the database. During a proper shutdown. When a database is shutdown is this mode. The database is then closed. To startup the database in a read only or read write mode from a NOMOUNT or MOUNT stage you can issue. Next the database is dismounted. This is a case of an improper shutdown.

ora. The file contains errors both fatal ORA-600 errors and warnings about impending error situations. Example: SPFILE=<location of the SPFILE> Diagnostic Files of an Oracle Database The ALERT log file An important function of a database administrator is to ensure that the database is running properly without errors. Every entry in the alert file contains a timestamp. It also contains values of non-default initialization parameters. These trace files are created in the location specified by the BACKGROUND_DUMP_DEST initialization parameter file.ora file on the server side will be used. If one cannot be found the initSID. by default the spfileSID. Since the file contains very important information a database administrator must view its contents at least once a day. The name of the trace file depends on the background process that created it. To do so. Oracle will look for a default SPFILE on the server side. If the database has an spfile. The most important file that contains information about errors and changes affecting the database is the ALERT log file.ora will be used to configure the instance.ora If the SPFILE for a database is not located in its default location %ORACLE_HOME%\dbs. This file is located in the directory path specified by the BACKGROUND_DUMP_DEST initialization parameter. If the spfileSID. It contains a record of all structural changes made to the database such as creation of a tablespace. The file has a name similar to alert<sid>. Startup Command and Parameter files The command that is used to startup a database is: SQL> STARTUP. A typical trace file created by a . It can also contain checkpoint and day-to-day operational information such as startups and shutdowns and when an instance recovery occurs during startup. the next startup will require an instance recovery to be performed by the SMON background process. you issue the STARTUP command with the PFILE='filename' option as shown: SQL> STARTUP PFILE='location of the parameter_file\init<SID>.ora file does not exist. Error information is usually recorded automatically by the Oracle Server as and when an error occurs in diagnostic files. Background Trace Files Background trace files are created whenever an error is encountered by a background process.However. then an entry in the PFILE pointing to it location can be specified. There may be times when you wish to startup the database using the PFILE.

A user may initiate tracing in a session by setting the SQL_TRACE initialization parameter to TRUE.trc. Background trace file contains information that can be used for diagnosing and troubleshooting problems associated with the background process.background process would have a name like sid_processname_PID.trc. where ORCL is the name of the SID. The trace file has a naming convention of sid_ora_pid.SET_SQL_TRACE_IN_SESSION packaged procedure. A user trace file will be created in the location specified by the USER_DUMP_DEST initialization parameter. In this case all user sessions will be traced. To initiate SQL tracing at an instance level. User Trace Files A user can initiate SQL tracing to determine performance statistics for the SQL statements in a session. A trace file created by the DBWR would typically have a name like ORCL_DBWR_1011.User trace files may contain user error information too.trc. you can issue set the SQL_TRACE initialization parameter to TRUE. A database administrator can initiate SQL tracing in a particular session by using the DBMS_SYSTEM. To initiate SQL tracing in a session. a user can issue: ALTER SESSION SET SQL_TRACE=TRUE. and 1011 is a process identifier. .

/emctl start dbconsole Stopping the Database Control on UNIX You can stop database control utility by issuing: . You can configure Database Control from the database configuration assistant (DBCA) when a new database is being created or reconfigure and existing database. application servers. databases. you can monitor a single Oracle Database instance or a clustered database. The database control is installed and available with every Oracle Database 10g installation. It is a web-based application for managing the Oracle 10g database. HTTP servers and Web applications are easily accessible and managed using the Enterprise Manager.Lesson 6: Enterprise Manager Database Control Enterprise Manager is a web-based integrated management solution provided by Oracle. listeners. Enterprise manager provides two configurations with which to monitor your database: Database Control and Grid Control. including hosts. Enter the command: $PROMPT> . The Oracle Enterprise Manager 10g Database Control is one of the main functional areas of the entire Enterprise Manager framework. Using the Database Control. you can use the emctl command-line utility that is found in the ORACLE_HOME/bin directory. All components and services of the enterprise. Controlling the Database Control on UNIX To control the Database Control.

Select Services from the Start -> Settings -> Administration Tools menu 2. Select Services from the Start -> Settings -> Administration Tools menu 2. Stop the Service OR To stop the database control using the MS-DOS prompt Enter $PROMPT>%ORACLE_HOME%\BIN\emctl stop dbconsole Launching Enterprise Manager Database Control The Enterprise Manager console has become a database administrator's most useful and resourceful companion in Oracle 10g. 1.$PROMPT> . users). you will be displayed the Database Home page. backup and recovering the database. . Using the interface The Oracle Enterprise Manager Database Control. cloning a database and so on. The SYS or SYSTEM user accounts are administrative accounts that can be used when trying to logon to the EM console. is used to perform administrative tasks such as creating schema objects (tables. Its web-based interface has greatly simplified database administration. tablespaces./emctl stop dbconsole Controlling the Database Control on Windows To start the database control on Windows you would need to start a service in the following manner. Locate the Database Control service. OracleDBConsoleDatabase_name 3. Locate the Database Control service. proactive maintenance. managing user accounts. 1. OracleDBConsoleDatabase_name 3. Start the service OR To start the database control using the MS-DOS prompt Enter $PROMPT>%ORACLE_HOME%\BIN\emctl start dbconsole To stop the database control on Windows To stop the database control on Windows you would need to start a service in the following manner. After successful logon into the EM console. performance tuning.

the maintenance tab can be accessed to perform backups of the database. allowing a database administrator to perform all administrative actions with ease. These are categorized based on management tasks. This web-based interface provided for database administration is complete in itself. For e. and its related links provide a DBA with a wealth of information about the database's environment and health.g.The various sections of the Database Home page. The suggested related links can be accessed to obtain further information. . Property pages exist on each home page.

Sign up to vote on this title
UsefulNot useful