Professional Documents
Culture Documents
5 0
Starting and Stopping Oracle
ODBA10gDB-OCA-05-1
V2: Page 1
Objectives
After completing this lesson, you should be able to start and stop:
EM Database Control Oracle 10g Database Instances iSQL*Plus
ODBA10gDB-OCA-05-2
Objectives
This lesson examines the commands and processes required to start up and shutdown an Oracle database instance, including: Enterprise Manager Database Control The Oracle instance The iSQL*Plus background process Additional topics explored include the use of parameter files for instance tuning and alert logs for monitoring significant database events.
V2: Page 2
EM Database Control
EM Database Control is used for most DBA management tasks The 'emctl' utility manages the 'dbconsole' daemon / background process
ODBA10gDB-OCA-05-3
EM Database Control
The EM Database Control, introduced in Lesson 4, can be used for most database administration tasks. The interface is displayed in a browser as already demonstrated. Before the EM can be displayed, the dbconsole process (for UNIX) or service (for Windows) must be started. The process is automatically created and started up during database creation. Alternatively, the SQL*Plus interface can be used to start and stop the instance. No prestarted program is required to administer the database if SQL*Plus is used.
V2: Page 3
To run the daemon, 'emctl start dbconsole' Server process OracleDBConsole<sid> is started
ODBA10gDB-OCA-05-4
To start the dbconsole process after a system reboot, ensure that the directory is on your path, then issue the command:
OS> emctl start dbconsole
ORACLE_HOME/bin
In Windows, the process can also be started as a service. Administrative Tools, Services to display the services page.
Scroll down to the entry labelled OracleDBConsole<SID>, where <SID> is the database system identifier. Right click the process and select Start from the context menu. The dbconsole service maintains log files in:
<Oracle_Home>/<host>_<SID>/sysman/log
V2: Page 4
The emctl command can also be used for other purposes. See the help screen below:
OS>emctl Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0 Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved. Invalid arguments Unknown command option Usage:: Oracle Enterprise Manager 10g Database Control commands: emctl start| stop| status| setpasswd dbconsole emctl secure <options> emctl set ssl test|off|on em emctl set ldap <host> <port> <user dn> <user pwd> <context dn> blackout options can be listed by typing "emctl blackout" config options can be listed by typing "emctl config" secure options can be listed by typing "emctl secure" ilint options can be listed by typing "emctl ilint" deploy options can be listed by typing "emctl deploy"
EM Agent
Part of the function of the EM database control is delegated to a separate agent process. The agent logs in to the database and passes control information to the EM database control for graphical presentation of performance and status.
V2: Page 5
Starting a Listener
Listener enables database connections Invoked with 'lsnrctl start' command Discussed further in Lesson 13
ODBA10gDB-OCA-05-5
Starting a Listener
A listener process is required to provide a connection mechanism between client processes and the database server. The listener performs the following tasks: receives client connection requests, validates the request, resolves the requested database connection string to an instance spawns a server process to handle SQL requests from the client. To start a listener following a system restart, use the Listener Control utility as below:
$ lsnrctl start C:\> lsnrctl start # Unix/Linux # Windows
The service OracleOracleHomeTNSListener is started. This single listener process can support multiple database instances. Further details are discussed in Lesson 13 Networking.
V2: Page 6
Windows uses OracleService<sid> to contain all instance processes Service must be started to run database
ODBA10gDB-OCA-05-6
The service can also be set to automatically start the associated database instance, using the Windows control panel.
V2: Page 7
ODBA10gDB-OCA-05-7
Target Database Credentials Username Password Connect As Enter a database username e.g. SYSTEM or SYSMAN (which must have SYSDBA or SYSOPER privilege) Enter associated password for database username Select SYSDBA or SYSOPER to change the database status. Check to save this information for future logins (applies to both host and target credentials).
V2: Page 8
Status Screen
ODBA10gDB-OCA-05-8
Status Screen
If the database is down, the status screen displays a corresponding message. The listener status and agent status is also reported by this screen. To start the database, click the Startup button at the top right hand corner of the screen.
V2: Page 9
Startup/Shutdown Confirmation
ODBA10gDB-OCA-05-9
Startup/Shutdown Confirmation
After clicking the startup button on the status screen, a confirmation screen is displayed. To confirm this operation, click the Yes button. The Show SQL button can be used to display the SQL command that will be issued by EM to perform the operation. Many other EM screens also include the same button. SQL commands can also be issued via SQL*Plus to perform the same operation this applies throughout the EM product.
V2: Page 10
Startup Progress
ODBA10gDB-OCA-05-10
Startup Progress
A startup progress screen will be displayed whilst the database instance is started. The database instance will transition through the following stages during startup:
Stage
NOMOUNT
Actions
Parameter file is opened from default (or other) location SGA is initialised according to parameter specifications Background processes are initialised
MOUNT OPEN
Parameter file CONTROL_FILES entry is used to locate and open all control files Data files are located from V$DATAFILES dictionary table. Status (SCN) is checked between control file and datafile header If all files agree, database is opened for normal use If files are out of sync, database recovery may be required (see later lessons)
V2: Page 11
Shutdown Options
ODBA10gDB-OCA-05-11
Shutdown Options
Under normal circumstances, a started database instance can (and should) be left running 24/7. Unattended jobs can be scheduled to execute in off-peak periods. Oracle is installed with several automatic jobs that will not be run if the instance is down. Maintenance operations, including backups of selected tablespaces and datafiles, can also be performed automatically without requiring a database shutdown. If the database instance does need to be shut down, for maintenance on the hardware, the EM Home, General Tab can be used to initiate the operation. Clicking the Shutdown button displays a shutdown confirmation screen. On this screen, the Advanced Options button displays a further list of shutdown modes that can be used. A Browse Sessions button can also be used to display a full list of currently connected processes. These include both user processes and background daemon processes. The following shutdown options can be selected from the advanced screen.
Mode
Normal Transactional Immediate Abort
Usage
Waits for all users to disconnect before shutting down Waits for user to commit (or rollback) before disconnecting the session Disconnects users, rolling back work in progress, then shuts down Shuts down immediately, without writing pending work to disk.
V2: Page 12
Starting iSQL*Plus
ODBA10gDB-OCA-05-12
Starting iSQL*Plus
For open databases, an isqlplus application server process is required in order to accept connection requests. To manage this process, the isqlplusctl command can be used. To start the application server process, use the following command from an OS shell:
isqplusctl start
To shutdown the application server processes, use the following command from an OS shell:
isqplusctl stop
V2: Page 13
Parameter Files
EM>Administration>Database Configuration >All Initialization Parameters > SPFile tab Server Parameter File resides at
<OracleHome>/dbs/SPFILE<SID>.ORA
Parameter Files
To start an instance, a parameter file is required which is used to store memory configuration and other tuning parameters. A starter file is generated as a database is created during software installation or subsequently. Two options for parameter files are provided: SPFILE PFILE A server side parameter file, stored on the database host; binary format A client side parameter file, held in text format
The SPFILE format is preferred, since parameter changes can be made dynamically during instance running. In some cases, these are made and stored automatically by Oracle. In contrast, a PFILE is only read during instance startup. Subsequent parameter file changes require that Oracle is shutdown and restarted in order to recognise the parameter changes.
V2: Page 14
ODBA10gDB-OCA-05-14
V2: Page 15
Alert Log
Rolling log of all significant database events Resides in directory identified by 'background_dump_dest' parameter Contents accessible from EM via Related Links > Alert Log Content
ODBA10gDB-OCA-05-15
Alert Log
An alert log in text format is maintained automatically by the Oracle server, in the directory identified by the background_dump_dest parameter. This file records significant events in the life of the database, including startup and shutdown operations, creation, alteration and deletion of disk area changes to system wide parameters errors in client and server processes The log file can be examined using EM. From the main pages, scroll to the Related Links section at the bottom of the page; select Alert Log Content list.
V2: Page 16
ODBA10gDB-OCA-05-16
Starting ORACLE instance (normal) LICENSE_MAX_SESSION = 0 LICENSE_SESSIONS_WARNING = 0 Picked latch-free SCN scheme 2 Using LOG_ARCHIVE_DEST_10 parameter default value as USE_DB_RECOVERY_FILE_DEST Autotune of undo retention is turned on. IMODE=BR ILAT =18 LICENSE_MAX_USERS = 0 SYS auditing is disabled Wed May 09 17:17:55 2007 ksdpec: called for event 13740 prior to event group initialization Starting up ORACLE RDBMS Version: 10.2.0.1.0. System parameters with non-default values: processes = 150 __shared_pool_size = 83886080 __large_pool_size = 4194304 __java_pool_size = 4194304 __streams_pool_size = 0 spfile = C:\ORACLE\PRODUCT\10.2.0\DB_1\DBS\SPFILEV10G.ORA sga_target = 289406976 control_files = C:\ORACLE\PRODUCT\10.2.0\ORADATA\V10G\CONTROL01.CTL, C:\ORACLE\PRODUCT\10.2.0\ORADATA\V10G\CONTROL02.CTL, C:\ORACLE\PRODUCT\10.2.0\ORADATA\V10G\CONTROL03.CTL db_block_size = 8192 __db_cache_size = 192937984 compatible = 10.2.0.1.0 db_file_multiblock_read_count= 16 db_recovery_file_dest = C:\oracle\product\10.2.0/flash_recovery_area db_recovery_file_dest_size= 2147483648
V2: Page 17
undo_management = AUTO undo_tablespace = UNDOTBS1 remote_login_passwordfile= EXCLUSIVE db_domain = dispatchers = (PROTOCOL=TCP) (SERVICE=v10gXDB) job_queue_processes = 10 audit_file_dest = C:\ORACLE\PRODUCT\10.2.0\ADMIN\V10G\ADUMP background_dump_dest = C:\ORACLE\PRODUCT\10.2.0\ADMIN\V10G\BDUMP user_dump_dest = C:\ORACLE\PRODUCT\10.2.0\ADMIN\V10G\UDUMP core_dump_dest = C:\ORACLE\PRODUCT\10.2.0\ADMIN\V10G\CDUMP db_name = v10g open_cursors = 300 pga_aggregate_target = 96468992 PSP0 started with pid=3, OS id=576 MMAN started with pid=4, OS id=1276 PMON started with pid=2, OS id=1064 DBW0 started with pid=5, OS id=1432 LGWR started with pid=6, OS id=1440 CKPT started with pid=7, OS id=1420 SMON started with pid=8, OS id=1408 RECO started with pid=9, OS id=1404 CJQ0 started with pid=10, OS id=1396 MMON started with pid=11, OS id=1484 MMNL started with pid=12, OS id=1488 Wed May 09 17:17:57 2007 starting up 1 dispatcher(s) for network address '(ADDRESS=(PARTIAL=YES)(PROTOCOL=TCP))'... starting up 1 shared server(s) ... Wed May 09 17:18:00 2007 alter database mount exclusive Wed May 09 17:18:05 2007 Setting recovery target incarnation to 2 Wed May 09 17:18:05 2007 Successful mount of redo thread 1, with mount id 2703632776 Wed May 09 17:18:05 2007 Database mounted in Exclusive Mode Completed: alter database mount exclusive Wed May 09 17:18:06 2007 alter database open Wed May 09 17:18:08 2007 Thread 1 opened at log sequence 5 Current log# 1 seq# 5 mem# 0: C:\ORACLE\PRODUCT\10.2.0\ORADATA\V10G\REDO01.LOG Successful open of redo thread 1 Wed May 09 17:18:16 2007 MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set Wed May 09 17:18:16 2007 SMON: enabling cache recovery Wed May 09 17:18:26 2007 Successfully onlined Undo Tablespace 1. Wed May 09 17:18:26 2007 SMON: enabling tx recovery Wed May 09 17:18:27 2007 Database Characterset is WE8MSWIN1252 replication_dependency_tracking turned off (no async multimaster replication found) Starting background process QMNC QMNC started with pid=16, OS id=480 Wed May 09 17:19:03 2007 Completed: alter database open Wed May 09 17:19:13 2007 ...
V2: Page 18
Summary
and locating
Parameter files Alert logs
ODBA10gDB-OCA-05-17
Summary
________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________
V2: Page 19
Practice 5
Using EM, shut down your database. Try to connect using any of the available interactive SQL*Plus interfaces make notes of the error messages displayed Ensure that all required server processes are running Restart the database and confirm that you can connect now via SQL*Plus Examine the alert log after the restart
ODBA10gDB-OCA--05-18 Copyright Jeremy Russell & Associates, 2007. All rights reserved.
Practice 5
In this practice, you will shutdown and restart your database. ________________________________________________________________________ Using EM, shut down your database (Ch05Shutdown.sql) ________________________________________________________________________ ________________________________________________________________________ Try to connect using any of the available interactive SQL*Plus interfaces make notes of the error messages displayed ________________________________________________________________________ ________________________________________________________________________ Ensure that all required server processes are running ________________________________________________________________________ ________________________________________________________________________ Restart the database (Ch05Startup.sql) and confirm that you can connect now via SQL*Plus ________________________________________________________________________ ________________________________________________________________________ Examine the alert log after the restart. ________________________________________________________________________
V2: Page 20
V2: Page 21