You are on page 1of 32
Objectives ‘After completing this lesson, you should be able to: + Start and stop the Oracle database and components Use Oracle Enterprise Manager + Access a database with SQL*Plus + Modify database initialization parameters + Describe the stages of database startup + Describe database shutdown options View the alert log + Access dynamic performance views Management Framework Oracle Database 11g Release 2 management framework ‘components: + Database instance + Listener + Management interface: Database Control Database Patabase Ustener jement interface 68 Management Framework “There ae tse major components ofthe Oracle database management ramewak +The database instance thats being managed Alistener that allows connections tothe database + The management interface. This may be either a management agent running on the node where the database server runs (which connects it fo Oracle Enterprise Manager Grid Control) or the stand-alone Oracle Enterprise Manager Database CContral. Ths i also refered to as the Database Console, Each of these components must be started before you can use the services of the {component and must be shut down cleanly when shutting dawn the server hosting the Oracle database Starting and Stopping Database Control fcr) set onacta exp = orci ‘Copyzight. (c) 1986, 2009 Oracle Corporation. Ali righte reserved ‘betps//noat 01 exanple.com!1150/an/conscle/sbostappl ication (cr\_enctt atop aeontote ‘netpe://hoat03.exanple.con: i158 /en/e stopped. Starting and Stopping Database Control Cracie Database provides Database Control, which is a stand-alone management console for databases that are nol connected to the Grid Control framework. Each dalabase that ‘managed with Database Control nas a separate Database Control instalation; from any one Database Control, you can manage only one dalabase. Before using Dalabase Cort, ‘ensure that a cbeonsole process is started, + Command to start the dbconsole process: emt stat doconsole + Command a stop the dbconsole process: emt stop dbcarsole + Command to view the status of the dbconsole process: emct status doconsole Note: You may nese to navigate to your SORACLE HOME!bin directory it this crectory is not in your operating system (OS) path. There are two SORACLE HOME locations t Grd Infrastructure is installed and both contain tne emt! uilty. The emt uty shoul always be invoked using the Oracle database $ORACLE HOME and not the Grd Infrastructure SORACLE HOME. Database Control uses a server-side agent process, This agent process ‘automatcaly starts and stops when the dbconsole process is stated a stopped, Oracle Enterprise Manager OEE © x 6 Cine 70 Oracle Enterprise Manager \Whon you install the Oracle Dalabase software, the Oracle Universal Instaer (OU) also installs Oracle Enloroise Manager (Enterprise Manager). ls Web-based Dalabase Control serves as the primary tool for managing your Oracle database, Enterprise Manager provides a graphical interface for doing almost any task that you need to do as a database administrator (DBA). Viewing alert summaries and performance graphs, ‘realing and modifying objecs, and performing backup and recovery ae some ofthe things that you ean do with Entorpise Manager. In most cases, you can cick inks in Enterprise Manager to find more speci information about the contents ofa page. Note: n Oracle Database 11g Release 2, the URL to access Enterprise Manager uses HTTPS (instead of HTTP) as the protocol to enable a secure connection. To reach the Enterprise Manager dbconsole, you must therefore enter a URL in the flowing format hitpsiimachine_name:portiem For the fst database that you create on a machine, the defauit port number for accessing Enterprise Manager Database Control is 1158. Iti possible to have afferent numbers, especialy if thro are muliple databases on the same host. To determine the port number, check the portlstini fle, Ports for some Oracle Database applicalons are listed in the Pertstin fle, which is located in the SORACLE_HOME/install directory Database Home Page [eeccnterem nner a =a cc" sims Sans, x EG saat Property pages e ams AE Nom sent ans LR Al ” Database Home Page ‘The Database Home page displays the current state ofthe database by displaying a series of matics that portray tne overal health ofthe database. Wit the property pages (also refrred to {88 fabs), you can access the Performance, Avalablty, Server, Schema, Data Movement, and Software and Support pages for managing your database You can view the folowing performance and status information about your database instance on the Database Home page! Instance name, database version, Oracle home location, mediarecovery options, and ‘other pertinent instance data Curent instance avaiabilily ‘Outstanding alerts Session-elated and Seated performance information Koy space-isage metres Drildown links (for example, LISTENER ) to provide increasing la sof deta: Other Oracle Tools > SalPie + SQL*Plus provides an additional interface 8 stain to your database so that you can ar tog — Perform database management operations Pert ews — Execute SAL commands to query, insert, update, and delete data in your database + SQL Developer: = Is a graphical user interface for accessing your Instance of Oracle Database — Supports development in both SQL and PLISQL = Is available in the default installation of Oracle Database 72 Other Oracle Tools In adeltion to Enterrise Manager, you can use SQL“Plus and SQL Developer to issue SAL sialements. These tools enable you to perform many of the database management operations as wo as to selec, inset, update, or delete data inthe database, SSOL*PIus is a command ine program that you use to submit SAL and PLISQL statements to ‘an Oracie database, You can submit statements interactively of as SQL*PLs.scrpls, SQL'Pius is insaled with the database and is located In your SORACLE_ HOMEVbin ‘rectory tart menu on @ Windows cle ‘You can star SQL“Plus from the commandline, or from the ‘SQL Developer is graphical user interface for accessing your instance of Oracle Database ‘SQL Developer suppers development in both the SQL and PLSOL languages. tis available in the defaut instalation of Oracle Database, With SQL Developer, you can browse database: objects, un SOL statements and SQL scrips, and eat and debug PLISQL statements. You ‘an also run any numberof provided reports, as well as create and save your own, Nolo: This course uses Enterprise Manager and SOL'Plus. Using SQL*Plus SQL*Plus is: + Acommand-line tool + _Used interactively or in batch mode (Cheap br SSQL'Pls: Release 1120.0 Progucon on Tha dun 189504492009 Cop () 19822008, Ora Nights oso, Ener Password Connected to race Database 11g Enlerprse Eaton Roleaso 11.20.10 Preducton With ne Partning, Atami Slorage Maragerert, LAP, Data Meng and Real Appcton esing options SQL> sole lst rae fom employes: LAST NAME oe rd 73 Using SQL*Plus ‘You can use the commands interface of SAL“Plus to execute SOL. and PLISQL commands to Enter, et, run, store, retrieve, and save SQL commands and PLISQL blocks Format, calculate, store, and print query results, List column defnitons for any table, ‘Send messages fo and accept responses from an end user , Perform database. ‘administration To stan Sat Pius: + Open a terminal window. At the commandtine prompt, enter the SQL“Plus command inthe folowing form (C saipus h@orel or Csqilus noieg or CA sqiplus as sysdba + fyou use the NOLOG option, you must enter CONNECT followed by the usemame you want to connect as, SQL> connect + When promptod, enter the user's password. SQL“Plus slats and connect othe ofault database Initialization Parameter Files 1B Startup ‘er Log epfileorcl.ora Anitorel.ora 74 Initialization Parameter Files When you start the instance, an initalization parameter fle is read. There are two types of parameter fos. ‘Server parameter fle (SPFILE): Ths isthe preferred type of inialzation parameter fe. It Is a binary fle that can be writen to and read by the database server and must not be ‘edted manual. It esides on the server on which the Oracle instance Is executing: is Persistent across shutdown and startup. The default name of this fle, which is Automatically sought at startup, is spfle ora SQL> Startup splile=:spflocc ra Text intalzaton parameter fle: This type of initialization parameter fle can be read by the database server, butt is not writen to by the server The intalzation parameter settings ‘must be set and changed manually by using a text editor so that they are persistent across Shutdown and starup. The defauit name of this file (which is automaticaly sought at startup fan SPFILE 's not found) is teSID> ora, iis recommended that you create an SPFILE as a dynamic way to maintain intaization parameters. + SQL> Connect system/manager as sysdba + SQL> Startup ple=cntore ora ‘SQL> oreate spi fom pfie=¢ntorel ora + SQL> create pfie from spfie; + SQL> create spi rom pfie Simplified Initialization Parameters Basic ‘Advanced ‘CONTROL_PILES DB_CACHE_SIZE DB_BLOCK_SIZE DB_FILE_MULTIBLOCK PROCESSES _READ_COUNT UNDO_TABLESPACE ‘SHARED_POOL_SIZE 75 Simplified Initialization Parameters Inaization parameters are of two types: basic and advanced, In the majorty of cases, its novessary to set and tune only the 30 basic parameters to got reasonable performance from the database. In rare situations, modification of the advanced parameters may be needed to achieve optimal performance. There are about 341 parameters. A basic parameter is defined as one that you are likely to set to keep your database running with good performance. Al other parameters are considered to be advanced. ‘SqD> select name from vSparameter where isbasic="TRURE’ Examples of basic parameters: Determining the global database name: DB_NAME and DB_OOMAIN Speciying a fast recovery area and size: DB_RECOVERY FILE OEST and DB_RECOVERY FILE_DEST SIZE, Specifying the total size of all SGA components: SGA_TARGET . Specifying the method of undo space management Tablespace’ UNDO_TABLESPACE , COMPATIBLE intalzation parameter and Ireversible compatibity Initialization Parameters: Examples enn [cowrrot_PILes ‘One or more contr fls names. [be_Frues ‘Maximum number of database fas PROCESSES ‘Maximum number of OS user processes that can simultaneously conoct [pe_azock_ srze ‘Slandard database block eze used by all tablespaces: [pe_cacHE_sraE ‘Size of the standard black bfer cache 76 Initialization Parameters: Examples CONTROL FILES parameter: Specifes one or mare control fle names. Oracle strongly recommends that you multiplex and miror conto les. Range of values: from one to eight fle names (with path names), Default value: OS dependent DB_FILES parameter: Species the maximum number of database files that can be opened for this database, Range of values: OS dependent Default vale: 20, PROCESSES parameter: Specifies the maximum number of OS user processas that can simultaneously connect #o an Oracle server, This value should alow for all background processes and user processes. Range of values: fram 6 to an OS-dependent value, Default value: 150, DB_BLOCK SIZE parametor: Species the sizo (i byte) ofan Oracle database block. This value is set at database creation and cannot be subsequently changed. This species the Standard block sizo for the databaso. All tablespaces will uso this size by default Range of values: 2048 1 32768 (OS dependent). Dofault value: 8182 DB_CACHE. SIZE parameter: Species the sizeof the standard block butler cache. Range ‘of values: atleast 16 MB, Defaut value: Of SGA_TARGET Is sot, otherwise the largo of 8 IMB or ( MBepu_count), Initialization Parameters: Examples Poa POA ‘Systam Global rea (SGA) SCA_TARGET (Total size of all SGA components) MEMORY_TARGET (Total size of system-wide usable memory) 7 Initialization Parameters: Examples 'SGA_TARGET specifes the tolal sie of all SGA components. If SGA TARGET is specified, the folowing memory poos are aulomaticaly sized + Butter cache (OB_CACHE_SIZE) + Shared pool (SHARED POOL SIZE) Large poo! (LARGE_POOL_SIZE) + Java pool (JAVA_POOL_ SIZE) + Streams pool (STREAMS. POOL. SIZE) If ese automaticaly tuned memory poo's are set io nonzero values, the values are used as minimum levels by Automatic Shared Memory Management (ASM). You set minimum Values If an application component needs a minmum amaunt of memary to function propery. ‘The folowing pools are manually sized components and are not affected by ASMM: Log buffer, Other butfer caches (such as KEEP and RECYCLE) and other block sizos Fixed SGA and other intemal allocations ‘The memory allocated to these pools is deducted from the total available memory for 'SGA_TARGET when ASMM is enabled Note: The MMON process computes the values ofthe automaticaly tuned memary pools to support ASMM, Initialization Parameters: Examples ome PGR_AGGREGATE_TARGE? |Amount of PGA memory allocated to al server processes: [SHARED Poot size | Sie of shared pool (n bytes) fxr sans ‘Unde space management mode tobe used 78 Initialization Parameters: Examples ‘SHARED _POOL_SIZE parameter: Spacifies the sizeof the shared poo! in bytes. The shared pool coniains objects such as shared cursors, slorod procedures, control stuciures, and parallel execution message buffers. Range of values: OS dependent. Default value: 0 if SGA_TARGET is se, otherwise 128 MB i 64 Dt 48 MB i 22 bi. UNDO_MANAGEMENT parameter: Specifies the undo space management mode that the system should use. When sot to AUTO, the instance is started in Aulomatic Undo Management (AUM) mode. Otherwise, itis started in Rollback Undo (RBU) mode. Ir RBU ‘made, undo space is allocated exteraly as rolback segments. In AUM mode, undo space is allocated extemally as undo Tablespaces, Range of values: AUTO or MANUAL. If the UNDO_MANAGEMENT parameter is omitted when the first instance Is started, the default value AUTO is used Using SQL*Plus to View Parameters 79 Using SQL*Plus to View Parameters The slide shows examples of using SOL"Plus to view parameters. You can query the data \VSPARAMETER dictionary view to find the values of the various parameters. \VSPARAMETER displays tho current parameter values inthe curtent session. You can also use the SHOW PARAMETER command with any sting fo view parameters that contain tha sting “The query in the folowing example is requesting tho name and values of the parameters. Uso a WHERE clause to specity specific pramater names: ‘SQL> SELECT name, value FROM VSPARAMETER WHERE name LIKE poo NAME VALUE shared_pool_sze large_poal size Java_pool size ‘streams_pool_sze shared pool reserved size 8808038, butfer pool koop 8 rows selected Changing Initialization Parameter Values + Static parameters — Can be changed only in the parameter file — Require restarting the instance before taking effect — Account for about 110 parameters + Dynamic parameters: — Can be changed while database is online — Can be altered at: ~ Session level = System level — Are valid for duration of session or based on SCOPE setting = Are changed by using ALTER SESSION and ALTER SYSTEM commands — Account for about 234 parameters 80 Changing Initialization Parameter Values “Thoro are two types of initialization parameters. Slate parameters: Afect the instance or entre database and can be modified only by changing the conten of the int ora othe SPFILE. Static parameters require the database to be shut down and restarted to take effect. They cannot be changed for te current instance, ‘SqD> select name from vSparameter where Issys_modifiabl “ALSE’ Dynamic parameters: Can be changed while database is onine. There are two lypes: ‘Sql> select name from vSparameter where issys_modifiable I= FALSE" Session level parameters affect only a user session. Examples include national language support (NLS) parameters that can be used to specty national language Settings for sorts, date parameters, and soon. You can use these ina given session: they expire when the session ends ‘Systomovel paramotors affect the entre database and all sessions. Examples include modfying the SGA TARGET value and setting archive log destinalions ‘These parameters stay in affct based on the SCOPE specication. To make them permanent, you have to add these parameter sotings to the SPFILE by specifying {he SCOPE=both option or manually eating the PFILE. Dynamic parameters can be changed by using the ALTER SESSION and ALTER SYSTEM commands Changing Parameter Values: Examples SQL> ALTER SESSION ‘SET NLS_DATE_FORMAT ="mon dd yyy’; Session altered. SQL> SELECT SYSDATE FROM dual; SYSDATE [jun 18 2009 ‘SQL> ALTER SYSTEM SET SEC_MAX_FAILED_LOGIN ATTEMPTS=2 COMMENT='Reduce from 10 for tighter security.' SCOPE=SPFILE; System altered. 81 Changing Parameter Values: Examples +The fist statoment inthe side is an example of changing a session evel parameter. The user is setting the session date format to be mon da yyyy AS a result, any queries an the dato wil display dates in that format, Sessionevel parametors can also be satin applications by using PLISQL +The second statement changes the maximum number of fale login attempts before the ‘connection is dropped. It includes a comment and expicity states thatthe change fs to be made only inthe server parameter fe. After the specified numberof falure atlemats, the connection is automatically dropped by the server process. This is not @ dynamic parameter and the Oracie database instance wil nec to be restated before the change. ‘can take effect. Database Startup and Shutdown: :!.":. Credentials > deSiciy At og Database Startup and Shutdown: Credentials When you click either Startup or Shutdown, you are prompted for credentials tal are used for aot logging onto the hast (the computer an which the database resides) and logging in {o the database isa’. You must enter a database account that has the SYSDBA prviege. Enter the credentials, [Ater the credentials Information, you wil then be prompted for the method of startup ot ‘shutdown. You can then cick Advanced Options to change any startup options or shutdown ‘mode as needed. You can alo cick Show SQL to see the SQL statements that are used for startup or shutdown ‘Note: The default option to shut down by using Enterprise Manager is IMMEDIATE, The default when issuing the SHUTDOWN command from SQL"Plus is NORMAL, Starting Up an Oracle Database Instance [Doibavetaoeorerampi ar Go On an [sarap Aavanesd Options e°-- Sp tne nape ee 83 Starting Up an Oracle Database Instance + the database is curently not started when you go tothe Enterprise Manager Database Control page, cick Startup. Then enter the host credentials and, optionally, choose the startup mode, if the Oracle database has been registered witn Oracle Restart, a ‘separate dialog will prompt you withthe choice of using the Server Control (SRVCTL) Utlty or SOL-Pus to start the database instance +The SRVCTL uty isthe recommended utity when using Oracle Ret lity to stat up dependent resources that may be needed. Starting Up an Oracle Database Instanc NOMOUNT OPEN STARTUP NowouNT Instance as) Seana started Instance hasbeen 84 Starting Up an Oracle Database Instance: NOMOUNT When starting the database instance, select the state in which i stars, The folowing scenarios describe aiferent stages of siting up an instance. ‘Aninstance is typical started only in NOMOUNT mode + During database creation, uring re-creation of control les. uring certain backup and recovery scenarios. Starting an instance includes the fllowing tasks ‘Searching SORACLE_HOMEldos fora fle ofa particular name inthis sequence: 4. Search for splo ora 2. spfile.ora isnot found, search fr spe. ora 5. If spfile.ora isnot found, search for nteSI0>.ora This is the fle that contains intalzation parameters for the instance. Speciying the PFILE parameter with STARTUP overrides the default behavior. ‘Allocating the SGA Starting the background processes Opening the alert_Iog fle andthe trace fies Note: SID isthe system ID. which identifies the instance name (for example, ORCL) an Starting Up an Oracle Database Instanc MOUNT OPEN STARTUP Control file ) Gass] ‘opened for this —poous The inatnce hasbeen Nowouxt _| instance Instance started 85 Starting Up an Oracle Database Instance: mount Mounting a database includes the following take: Associating a database with a previously started instance Locating and opening lof the conto files spectied inthe parameter fle + Reacing the contol fies to aban the names and statuses of the data files and online redo log fas (However, no checks are performed to verly the existence of the data les and online ro log fies at this ime.) ‘To perform specific maintenance operations, start an instance and mount a database, but do nol open the database. For example, tho dalabase must be mounted but must not be ‘pened duting the folowing tasks ‘Renaming data fies (Data files for an offline Tablespace can be renamed when the database's open) Enabling and dlsabing onine redo log fle archiving options , Performing ful database recovery Note: A database may be left in MOUNT made even though an OPEN request has been made, This may be because the database neacs to be racovarad in some way, If recovery 's performed while in the MOUNT state, the redo logs are open for reads and the data fles {are open as well o read the blocks needing recovery and fo write blocks f required during recovery. Starting Up an Oracle Database Instanc OPEN OPEN STARTUP | ccwis Teinarcee open] —_| All files opened as described by the control your _|file for this instance Control file opened for this womourt _| instance Instance started 86 Starting Up an Oracle Database Instance: OPEN ‘A.pormal database operation means that an instance is started and the database is mounted land opened. With a normal dotabase operation, any valid user can connect tothe database and perform typical dala access operations. Opening the database includes th following tasks: + Opening the data files + Opening the onine redo log les It any of the data fles oF online redo log fles are not present when you attempt to open the database, tho Oracle server ratums an ator. During this nal stage, the Oracle server verifies tha all data fies and online redo log fies fan be opened, and checks the consistancy of the database. If necessary, the System Montor(SMON) background process intaes instance recovery ‘You can startup a database instance in restricted mode so that itis availabe fo users with administrative prviages only. To start an instance in resticted mode, select the "Restrict access ta database" option on the Advance Startup Options page. Startup Options: Examples + Using the sqiplus ulllty: + Using the sxvct1 utility with Oracle Restart G:\ srvcti start database -d orcl -o mount 87 Startup Options: Examples “The side shows the SQL"Plus syntax o start up tho database, 41. This command starts the instance, associates the database fs to i, and mounts and ‘opens the database 2. Ths command starts the instance and the da 5. Ths command mounts a database from the NOMOUNT stat, 4. This command opens the dalabase from the MOUNT slat, 1a isnot mounted ‘When the database is enabled with Oracle Restart, the srvetutlty can be uted to start the database instance. The sell utty has the advantage that l can algo start all required ‘dependent resources such as the ASM instance, ASM disk groups, and listener Note: The srt! uty is located in both the $ORACLE_HOMEIbin directory for the Grid infastrucure software and the $ORACLE_HOMEIbin directory forthe Oracle database ‘software. You should use the srvctl tly from the Oracie database software when staring the Oracle database. You should use the src! uty from the Grid Infrastructure software ‘when starting the ASM Instance or the listener. Shutting Down an Oracle Database Instance = — ee t_ oS [Slap sataoun nanan STISNR OPS aa [BY startup/shutéoun Contimation ‘pene ane ce soit “rent om na Jee 88 Shutting Down an Oracle Database Instance IF the instance is already stared when you go to the Enterpise Manager Database Control page, click the Shutdown butlan to shut down the instance. You will be prompted ta verfy or enter the host and database credentials. Cick OK to receive the ‘Starup/Shutdoun confirmation diiog If you then lick the Advanced Options button, you can select the made of the ‘shutdown: NORMAL, TRANSACTIONAL, IMMEDIATE, or ABORT, Shutdown Modes lows new connections No | No | No | No Waits unt current sessions end No | No | No Waits unti current transactions end No | No | ves Forces a checkpoint and closes files No | vos | vos | ves Shutdown modes: + A = ABORT I = IMMEDIATE +P = TRANSACTIONAL +N = NORMAL, 89 Shutdown Modes ‘Shutdown modes are progressively more accommodsting of curent actly in this order: ABORT: Performs the least amount of work before shutting down. Because this mode Fequios recovery before startup, use it only when necessary. Its typically used when no ther form of shutdown works, whan there are problems when stating the instance, or when you need to shut down immediately because of an impending situation (such as alice ofa power outage within seconds). IMMEDIATE: ts the most typcaly used option. Uncommitted transactions ar rolled back TRANSACTIONAL: Allows existing transactions to finish, but not starting new transactions NORMAL: Waits for sessions to disconnect It you consider the amount of time that it takes to perform the shutdown, you find that [ABORT is the fastest and NORMAL is the slowest. NORMAL and TRANSACTIONAL can take a ong time depending on the number of sessions and transactions, Shutdown Options (On the way down: + Uncommitted changes rolled back, for IMMEDIATE + Database buffer (On the way up: + No instance recovery During: SHUTDOKN or SHUTDOKN TRANSACTIONAL cache written to sHUTDONN data files IMMEDIATE + Resources released Consistent database 90 Shutdown Options ‘SHUTDOWN NORMAL i the default shutdown modo if no mode Is speciied. A normal database shutdown proceeds with the folowing conditions: No new connections can be made, The Oracle server wai for all users to disconnect before completing the shutéown, + Database and redo butlers are writen to disk, Background processes are terminated and the SGA\s removed from memory. + Tho Oracle server closes and dismounts the database before shutting down the instance, “The next startup does not require an instance recovery, + SHUTDOWN TRANSACTIONAL [A shutdown in TRANSACTIONAL mode prevents lens ‘fom losing data, including results ‘rom their curent acviy, A transactional database shutdown proceeds with the folowing conadtons: 'No lent can star a new transaction on tis patoular instance, + Aclentis disconnected when the cont ends the transaction that is in progress. \Whan al transactions have been completed, a shutdown accurs immediately. he next startup does not requle an instance recovery. Shutdown Options On the way down: During: On the way up: + Modified buffers + Online redo SHUTDOWN ABORT not written to log files used data files Instance failure to reapply + Uncommitted or changes changes not SPARTUP FORCE | . Undo rolled back segments used to roll back uncommitted changes + Resources <— Z-& Inconsistent database released o> 1 Shutdown Options SHUTDOWN ABORT if shutdown in NORMAL, TRANSACTIONAL, and IMMEDIATE modes does not work, you can abort the eurent database instance. Aboring an instance proceeds withthe fellowng conditions: (Current SAL statomonts boing processed by the Oracle sorver are immediataly terminated “The Oracle server does not wai for users who are curently connacted ta the database to disconnect Database and redo bufers are not writen to disk LUncommited taneactions are not rll back. +The instance is terminated without closing the Fles. + Tho database isnot cosed or dismounted. ‘The next startup requires instance recovery, which accu automaticaly Note: Its not advisable to back up a database that isin an inconsistent state Shutdown Options: Examples + Using SQL*Plus: + Using the SRVCTL utility with Oracle Restart Gi\ srvctl stop database -d orcl -o abort Shutdown Options: Examples ‘The side shows examples using both SQL*Plus and the SRVCT. utility to shut down the dotabase, 1. This command inilates @ normal shutdown, The database will not shutdown uni allusers have logged out 2, This command iniates a transactional shutdown. The database will not shutdown ntl all existing trasactons completed 3, This command initiates an immediate shutdown, The uncommited transactions willbe rolled back 4, This command nates a shutdown abort When the database is enabled with Oracle Restart, the SRVCTL utily can be used to shutdown the database insiance Note: The SRVCTL util is located in both the SORACLE_HOMEIbin directory forthe Grid Infrastructure sofware and the SORACLE_HOMEIbin directory for the Oracle database software. You should use the SRVCTL uily from the Oracle database software when Staring the Oracle database. You should use the SRVCTL utily {fom the Grd Infrastructure sofware when starting the ASM Instance or the listener. Viewing the Alert Log [Gm Database Home page > Related Links region > | oa hoon Alert Log Content paved 1 93 Viewing the Alert Log Each database has an alert og fie. The files onthe server withthe database ard is stored in SORACLE. BASE/dagirdomsiedo_name>/hrace by defaut f SORACLE. BASE is set, “The aor feof a database is a chronological log of massages such as the fllowng ‘Any non-tefauitintalzation parameters used at startup + Al intemal erors (ORA-600), block corruption errors (ORA-1S78), and deadlock errors (ORA-60) that occured ‘Administrative operations, such as. the SQL statements CREATE, ALTER, DROP DATABASE, and TABLESPACE, and the Enterprise Manager or SGL*Pius statements STARTUP, SHUTDOWN, ARCHIVE LOG, and RECOVER Soveral messages and errors relating tothe functons of shared server and dispatcher processes + Errors during the automatic refresh ofa materialized iow Oracle Database uses the alert log to keep @ record ofthese events as an atomative to dsplaying the Information on an operator's conso'e. (Many systems aiso display this information on the console.) I an administrative operation I successful, a message is ‘writen in the alert iog as "completed along witha ime stamp, Data Dictionary: Overview SQL> SELECT * FROM dictionary; 94 Data Dictionary: Overview “The Oracle data dictionary is the metadata of the database and contains tne names and anos of al objets inthe database. The eeaon or modeaton of any object cases an date tothe data detonay that refit hase changes. This neraton estore nthe base tales tat are maintained bythe Oracle database, Bt you access these tables by thing pedefineé views ater than reading the tates rect, “The data dictionary Is used ny the Oracle database server fo find information about users, beets constraints, and storage + Is maintained by the Oracle databa modified |s avaiable for use by any user to query information about the database + Is owed by the SYS user Should never be modined drecty using SQL server as object stuctures or definitions are Note: The DICTIONARY data dictionary view (or the DICT synonym for this) contains the names and descriptions of daa dtionary tables and views. Use the DICT COLUMNS view {see the view columns and their defintions. For complete definitions of each view, see the Oracle Database Reference, There are over 1000 views that reference hundreds of bass tables, Data Dictionary Views es DBA [Everything [NA May have additional ‘columns meant fr DBA use only [Everyone | Everything that | 08A_views | Includes user's own abjects the user has. ‘and other objects the user Priveges to has been granted privieges 5 tases Everyone | Everything that | ALi_views [ls usually the same as at the user owns ‘except forthe missing ‘nA column (Some views have abbreviated names as PUBLIC synonyms.) 95 Data Dictionary Views The view prefixes indicate the data (and how much ofthat data) a given user can see, + The global view of everything is accessed only by users with DBA privileges, using the DBA prefix “The nex level of privilege s atthe ALL_ prefix leve, which represents all objects thatthe querying user is prileged to see, whether the user owns them or not. Far example, if USER Anas been granted access to a table owned by USER_B, then USER. A sees that table listed in any ALL_view dealing with tabe names. + Tho USER_prefx represents the smallest scope of vsbilly. This typeof view shows only those objects thatthe querying user owns (Inti, those bal are present inthe user's own schema). Generally, each view set is @ subset ofthe higher privileged view set, row-wise and column- wie, Not all views ina given view set have @ corresponding view in the other view sets This is dependent on the nature of the information in the view. For example, there is a DBA_LOCK view, bul there is no ALL_LOCK view. This is because only a OBA would have interest in data about locks. Be sue to choose the appropriate view sotto meet the need that you have. I you have the privilege to access the DBA views, you stil nay want to query only the USER version ofthe view because the results show information on abjets tat you own and you may nol want other objects o be added to your resull sot Data Dictionary: Usage Examples SELECT table name, tablespace name FROM juser_tabl SELECT sequence 1 increment by FROM |all_sequence: WHERE sequence owner IN (‘MDSYS', 'XDB!); ax_value, ‘SELECT USERNAME, ACCOUNT_STATUS FROM [aba_usere WHERE ACCOUNT STATUS = 'OPEN'; DESCRIBE 96 Data Dictionary: Usage Examples srample queries inte side answer the following questions: 4. What are the names ofthe tables (along with the name ofthe tablespace where they reside) that have been created in your schema? 2. Whatis the sigiflcantinformaton about the sequences inthe database that you have access to? What users in this database are curently bie to login? 44, What are the columns ofthe DBA_INDEXES view? This shows you what information you can view about all the indexes inthe database, The folowing isa partial ouput of tis command: ‘SQL> DESCRIBE dba_ndoxes Name Nut Type OWNER NOT NULL ‘VARCHAR2(30) INDEX NAME NOTNULL \VARCHAR?(30) INDEX_TYPE \VARCHAR2(27), TABLE_OWNER NOTNULL \VARCHAR2(30) TABLENAME — NOTNULL ——_VARCHAR2(30), ‘Summary In this lesson, you should have learned how to: + Start and stop the Oracle database and components + Use Oracle Enterprise Manager + Access a database with SQL*Plus + Modify database initialization parameters + Describe the stages of database startup + Describe database shutdown options + View the alert log + Data Dictionary Usage 97 Exercises: 1. You stat the database in a NOMOUNT state and you od some of administrative work then you decided to mount the daiabase using the folowing Command. SQL> ALTER DATABASE MOUNT: tye dalabase fails lo maunt what could be the reason? + Database data fes cannot be accessed. + Database control fes not accessibe. + Database redo lo fles not accossibie. + Database paramoters fle not accessible 2. Which one of the folowing statements is true about the issued command database slartod with SPFILE? 'SQL>ALTER SYSTEM SET DB_CACHE_SIZE=335560677 SCOPE=BOTH + The value of DB_CACHE_SIZE parameters modified only in memory. + The value of DB_CAGHE SIZE parameter is modified ony in PFILE. + The value of DB_CACHE_SIZE parameter 's modified in both SPFILE and PFILE. ‘+ The value of DB_CAGHE_SIZE parameter is modified in both memory and SPFILE. 3. Your database went down abnormally because of power failure; when you Gatabase which stalomentis true regard ths scenaro? tart the Database isnot recoverable Information required for recovery willbe taken from alert log fl. ‘All commited and uncommitted changes ae lost, ‘The uncommitted changes atthe time of falure wl rolled back and the commited changes atthe time of falure are writen to data files. 4. While starting your database, you recsived an errr stating thatthe database cannot find one af the anne redo og le at which stage wil you receive this error? + NOMOUNT state, + MOUNT state * OPEN state, + After completing the first transaction. 5. You ted to access Oracle enterprise manager (Database Conta!) from the web browser and you got error message that page not found, assume thal the database contra configured propery and you entered the corect URL. Explain the possi ‘reason, sugges! two solutions to make the page accessible and give example on how to make the page accessible? 98 6. Explain at least two things happened when you take database down using Shutdown Immedate? 7. Explain atleast two things happened when you start inconsistence database? 5 Configuring the Oracle Network Environment 99

You might also like