oracle 10g dba lesson 05 - skilladvance - oracle, java ...a listener process is required to provide...
Post on 25-Jun-2020
3 Views
Preview:
TRANSCRIPT
Lesson 5 – Starting and Stopping Oracle Oracle 10g Database Associate
Copyright © 2007 Jeremy Russell & Associates Ltd. V2: Page 1
000555
ODBA10gDB-OCA-05-1 Copyright Jeremy Russell & Associates, 2007. All rights reserved.
Starting and Stopping Oracle
LESSON 5 – STARTING AND STOPPING ORACLE
This lesson demonstrates the commands required to start and stop a database instance.
Associated processes are also examined, including the database control daemon, the database
listener and the iSQLPlus control daemon.
Oracle 10g Database Associate Lesson 5 – Starting and Stopping Oracle
V2: Page 2 Copyright © 2007 Jeremy Russell & Associates Ltd.
ODBA10gDB-OCA-05-2 Copyright Jeremy Russell & Associates, 2007. All rights reserved.
Objectives
• After completing this lesson, you should be able to start and stop:
– EM Database Control
– Oracle 10g Database Instances
– iSQL*Plus
• Additionally, you will be able to
– Locate and modify parameter files
– Locate and interpret alert logs
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.
Lesson 5 – Starting and Stopping Oracle Oracle 10g Database Associate
Copyright © 2007 Jeremy Russell & Associates Ltd. V2: Page 3
ODBA10gDB-OCA-05-3 Copyright Jeremy Russell & Associates, 2007. All rights reserved.
EM Database Control
• EM Database Control is used for most DBA management tasks
• The 'emctl' utility manages the 'dbconsole' daemon / background process
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 pre-
started program is required to administer the database if SQL*Plus is used.
Oracle 10g Database Associate Lesson 5 – Starting and Stopping Oracle
V2: Page 4 Copyright © 2007 Jeremy Russell & Associates Ltd.
ODBA10gDB-OCA-05-4 Copyright Jeremy Russell & Associates, 2007. All rights reserved.
Starting EMCTL daemon
• To run the daemon, 'emctl start dbconsole'
• Server process OracleDBConsole<sid> is started
Starting EMCTL daemon The operating system “ORACLE_SID” environment variable must be set to the name of the
instance for whom a console daemon is to be started.
Use the following command (in a UNIX/Linux shell or Windows “cmd” session):
C:\> SET ORACLE_SID=orcl # Windows
$ export ORACLE_SID=orcl # UNIX/Linux
To start the dbconsole process after a system reboot, ensure that the ORACLE_HOME/bin
directory is on your path, then issue the command:
OS> emctl start dbconsole
In Windows, the process can also be started as a service. Click Start, Control Panel,
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
Lesson 5 – Starting and Stopping Oracle Oracle 10g Database Associate
Copyright © 2007 Jeremy Russell & Associates Ltd. V2: Page 5
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>
emctl blackout options can be listed by typing "emctl blackout"
emctl config options can be listed by typing "emctl config"
emctl secure options can be listed by typing "emctl secure"
emctl ilint options can be listed by typing "emctl ilint"
emctl 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.
Oracle 10g Database Associate Lesson 5 – Starting and Stopping Oracle
V2: Page 6 Copyright © 2007 Jeremy Russell & Associates Ltd.
ODBA10gDB-OCA-05-5 Copyright Jeremy Russell & Associates, 2007. All rights reserved.
Starting a Listener
• Listener enables database connections
• Invoked with 'lsnrctl start' command
• Discussed further in Lesson 13
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 # Unix/Linux
C:\> lsnrctl start # Windows
The service ‘OracleOracleHomeTNSListener’ is started.
This single listener process can support multiple database instances.
Further details are discussed in Lesson 13 – Networking.
Lesson 5 – Starting and Stopping Oracle Oracle 10g Database Associate
Copyright © 2007 Jeremy Russell & Associates Ltd. V2: Page 7
ODBA10gDB-OCA-05-6 Copyright Jeremy Russell & Associates, 2007. All rights reserved.
Windows – Oracle Service
• Windows uses OracleService<sid> to contain all instance processes
• Service must be started to run database
Windows – Oracle Service
For Microsoft Windows only, an additional service must be started to be able to use the
database.
One process is required for each database instance in use.
The instance runs all server processes as threads within a single OS process.
To start the process, click Start, Control Panel, Administrative Tools, Services to display the
services page.
Scroll down to the entry labelled ‘OracleService<SID>’, where ‘<SID>’ is the database system
identifier. Right click the process and select ‘Start’ from the context menu.
Alternatively, open a command window and enter the command below to start the service:
C:> net start oracleservice<SID>
The service can also be set to automatically start the associated database instance, using the
Windows control panel.
Oracle 10g Database Associate Lesson 5 – Starting and Stopping Oracle
V2: Page 8 Copyright © 2007 Jeremy Russell & Associates Ltd.
ODBA10gDB-OCA-05-7 Copyright Jeremy Russell & Associates, 2007. All rights reserved.
Database Control Startup Credentials
Database Control Startup Credentials Once the “dbconsole” service is running, the database instance can be started using the EM
Database Control.
The following parameters are required to connect to and start the database:
Host credentials
� Username Enter OS account name for Oracle owner e.g. ‘oracle’
or ‘administrator’
� Password Enter OS account password for the selected host
username
Target Database Credentials
� Username Enter a database username e.g. ‘SYSTEM’ or ‘SYSMAN’
(which must have ‘SYSDBA’ or ‘SYSOPER’ privilege)
� Password Enter associated password for database username
� Connect As Select ‘SYSDBA’ or ‘SYSOPER’ to change the database
status.
� Save as Preferred Credential Check to save this information for future logins (applies
to both host and target credentials).
Lesson 5 – Starting and Stopping Oracle Oracle 10g Database Associate
Copyright © 2007 Jeremy Russell & Associates Ltd. V2: Page 9
ODBA10gDB-OCA-05-8 Copyright Jeremy Russell & Associates, 2007. All rights reserved.
Status Screen
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.
Oracle 10g Database Associate Lesson 5 – Starting and Stopping Oracle
V2: Page 10 Copyright © 2007 Jeremy Russell & Associates Ltd.
ODBA10gDB-OCA-05-9 Copyright Jeremy Russell & Associates, 2007. All rights reserved.
Startup/Shutdown Confirmation
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.
Lesson 5 – Starting and Stopping Oracle Oracle 10g Database Associate
Copyright © 2007 Jeremy Russell & Associates Ltd. V2: Page 11
ODBA10gDB-OCA-05-10 Copyright Jeremy Russell & Associates, 2007. All rights reserved.
Startup Progress
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 Actions
NOMOUNT Parameter file is opened from default (or other) location
SGA is initialised according to parameter specifications
Background processes are initialised
MOUNT Parameter file “CONTROL_FILES” entry is used to locate and open all
control files
OPEN 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)
Oracle 10g Database Associate Lesson 5 – Starting and Stopping Oracle
V2: Page 12 Copyright © 2007 Jeremy Russell & Associates Ltd.
ODBA10gDB-OCA-05-11 Copyright Jeremy Russell & Associates, 2007. All rights reserved.
Shutdown Options
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 Usage Normal Waits for all users to disconnect before shutting down
Transactional Waits for user to commit (or rollback) before disconnecting the session
Immediate Disconnects users, rolling back work in progress, then shuts down
Abort Shuts down immediately, without writing pending work to disk.
Lesson 5 – Starting and Stopping Oracle Oracle 10g Database Associate
Copyright © 2007 Jeremy Russell & Associates Ltd. V2: Page 13
ODBA10gDB-OCA-05-12 Copyright Jeremy Russell & Associates, 2007. All rights reserved.
Starting iSQL*Plus
• Requires iSQLPlus Service for Windows
• Manage with isqlplusctl
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
Oracle 10g Database Associate Lesson 5 – Starting and Stopping Oracle
V2: Page 14 Copyright © 2007 Jeremy Russell & Associates Ltd.
ODBA10gDB-OCA-05-13 Copyright Jeremy Russell & Associates, 2007. All rights reserved.
Parameter Files
• EM>Administration>Database Configuration >All Initialization Parameters > SPFile tab
• Server Parameter File resides at
– <OracleHome>/dbs/SPFILE<SID>.ORA
• Can be exported to text file using
– CREATE PFILE FROM SPFILE
• Text PFILE resides at
– <OracleHome>/database/init<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 A server side parameter file, stored on the database host; binary format
� PFILE 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.
Lesson 5 – Starting and Stopping Oracle Oracle 10g Database Associate
Copyright © 2007 Jeremy Russell & Associates Ltd. V2: Page 15
ODBA10gDB-OCA-05-14 Copyright Jeremy Russell & Associates, 2007. All rights reserved.
Parameter File Contents
*.audit_file_dest='C:\oracle/admin/v10g/adump'
*.background_dump_dest='C:\oracle/admin/v10g/bdump'
*.compatible='10.2.0.1.0'
*.control_files='C:\oracle\oradata\v10g\control01.ctl',...
*.core_dump_dest='C:\oracle/admin/v10g/cdump'*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='v10g'*.db_recovery_file_dest='C:\oracle/flash_recovery_area'
*.db_recovery_file_dest_size=2147483648
*.dispatchers='(PROTOCOL=TCP) (SERVICE=v10gXDB)'
*.job_queue_processes=10
*.open_cursors=300*.pga_aggregate_target=96468992
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=289406976
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='C:\oracle/admin/v10g/udump'
Parameter File Contents Parameter settings can be examined via EM.
Select the Administration tab and select the ‘All Initialization Parameters’ link.
This screen displays parameters in groups of 50 values – the drop down list and
Next/Previous links above the table of parameters allows pagination through the list. The
‘Show All’ button can be used to display all parameters.
The ‘Name’ box and other control at the top left of the screen allow wildcard selection on the
parameter name column, limiting the parameters displayed.
To save the current parameter set to a PFILE format, select the ‘Save to File’ button. This
invokes a browser file save sequence, during which you can select the name and location of
the file to be saved (depending on the browser in use).
If changes are made to the value of any parameter, check the ‘Apply changes in current
running instance(s)’ checkbox in order to apply the changes immediately.
If the system running the EM browser is online, the icon can be clicked to display help
from the Oracle TechNet website on the selected parameter.
Oracle 10g Database Associate Lesson 5 – Starting and Stopping Oracle
V2: Page 16 Copyright © 2007 Jeremy Russell & Associates Ltd.
ODBA10gDB-OCA-05-15 Copyright Jeremy Russell & Associates, 2007. All rights reserved.
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
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.
Lesson 5 – Starting and Stopping Oracle Oracle 10g Database Associate
Copyright © 2007 Jeremy Russell & Associates Ltd. V2: Page 17
ODBA10gDB-OCA-05-16 Copyright Jeremy Russell & Associates, 2007. All rights reserved.
Alert Log Contents
Alert Log Examples The extract below has been reformatted for printing purposes
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
Oracle 10g Database Associate Lesson 5 – Starting and Stopping Oracle
V2: Page 18 Copyright © 2007 Jeremy Russell & Associates Ltd.
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
...
Lesson 5 – Starting and Stopping Oracle Oracle 10g Database Associate
Copyright © 2007 Jeremy Russell & Associates Ltd. V2: Page 19
ODBA10gDB-OCA-05-17 Copyright Jeremy Russell & Associates, 2007. All rights reserved.
Summary
• In this lesson, you have learnt about starting and using:
– EM Database Control
– Oracle 10g Database Instances
– iSQL*Plus
• and locating
– Parameter files
– Alert logs
Summary ________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
Oracle 10g Database Associate Lesson 5 – Starting and Stopping Oracle
V2: Page 20 Copyright © 2007 Jeremy Russell & Associates Ltd.
ODBA10gDB-OCA--05-18 Copyright Jeremy Russell & Associates, 2007. All rights reserved.
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
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.
________________________________________________________________________
Lesson 5 – Starting and Stopping Oracle Oracle 10g Database Associate
Copyright © 2007 Jeremy Russell & Associates Ltd. V2: Page 21
This page intentionally left blank
top related