Presentation is loading. Please wait.

Presentation is loading. Please wait.

3 Managing an Oracle Instance. Objectives Setting up operating system and password file authentication Creating the parameter file Starting up an instance.

Similar presentations


Presentation on theme: "3 Managing an Oracle Instance. Objectives Setting up operating system and password file authentication Creating the parameter file Starting up an instance."— Presentation transcript:

1 3 Managing an Oracle Instance

2 Objectives Setting up operating system and password file authentication Creating the parameter file Starting up an instance and opening the database Closing a database and shutting down the instance Getting and setting parameter values Managing sessions Monitoring ALERT and trace files Setting up operating system and password file authentication Creating the parameter file Starting up an instance and opening the database Closing a database and shutting down the instance Getting and setting parameter values Managing sessions Monitoring ALERT and trace files

3 User process Server process PGA Password file ALERT file Parameter file Overview Control files Data files Redo log files Instance SGA Shared pool

4 Database Administrator Users Automatically created Automatically created Granted the DBA role Granted the DBA role The two database administrator users SYS and SYSTEM are:

5 User SYS and SYSTEM SYS Password: change_on_install Owner of the database data dictionary SYS Password: change_on_install Owner of the database data dictionary SYSTEM Password: manager Owner of additional internal tables used by Oracle tools

6 Remote database administration Local database administration YesYes NoNo Do you have a secure connection? Do you want to use OS authentication? Use OS authentication Use a password file Authentication Methods

7 Operating System Authentication Set up the user to be authenticated by the operating system. Set REMOTE_LOGIN_PASSWORDFILE (in init.ora) to NONE. Use the following commands to connect to a database: Set up the user to be authenticated by the operating system. Set REMOTE_LOGIN_PASSWORDFILE (in init.ora) to NONE. Use the following commands to connect to a database: CONNECT / AS SYSDBA CONNECT / AS SYSOPER

8 Using Password File Authentication Create the password file using the password utility: Set REMOTE_LOGIN_PASSWORDFILE (init.ora) to EXCLUSIVE or SHARED Use the following command to connect to a database: Create the password file using the password utility: Set REMOTE_LOGIN_PASSWORDFILE (init.ora) to EXCLUSIVE or SHARED Use the following command to connect to a database: $orapwd file=$ORACLE_HOME/dbs/orapwU15\ password=admin entries=5 $orapwd file=$ORACLE_HOME/dbs/orapwU15\ password=admin entries=5 CONNECT INTERNAL/ADMIN

9 Changing the Internal Password Use the password utility on NT and UNIX to delete and create the password file. or Use the ORADIM80 utility on NT to delete and create a new password file. Use the password utility on NT and UNIX to delete and create the password file. or Use the ORADIM80 utility on NT to delete and create a new password file.

10 Uses of Parameters init.orainit.ora Size the SGASize the SGA Set database and instance defaultsSet database and instance defaults Set user or process limitsSet user or process limits Define various physical attributes (e.g., database block size)Define various physical attributes (e.g., database block size) Specify control files, datafiles, redo log files, etc.Specify control files, datafiles, redo log files, etc.

11 The Initialization Parameter File SVRMGR> CONNECT / AS SYSDBA SVRMGR> STARTUP PFILE=/DISK1/initU15.ora SVRMGR> CONNECT / AS SYSDBA SVRMGR> STARTUP PFILE=/DISK1/initU15.ora initU15.ora Instance SGA Shared pool Library cache Redo log buffer PMONDBWR SMON LGWRCKPTARCH Database buffer cache Data dictionary cache

12 Parameter File Example # Initialization Parameter File: initU15.ora db_name = U15 control_files = (/DISK1/control01.con, /DISK2/control02.con) db_block_size = 8192 db_block_buffers = 2000 shared_pool_size = 30000000 log_buffer = 64K processes = 50 db_files = 100 log_files = 10 max_dump_file_size = 10240 background_dump_dest = (/home/disk3/user15/BDUMP) user_dump_dest = (/home/disk3/user15/UDUMP) core_dump_dest = (/home/disk3/user15/CDUMP) rollback_segments = (r01,r02,r03,r04,r05,r06,r07,r08)... # Initialization Parameter File: initU15.ora db_name = U15 control_files = (/DISK1/control01.con, /DISK2/control02.con) db_block_size = 8192 db_block_buffers = 2000 shared_pool_size = 30000000 log_buffer = 64K processes = 50 db_files = 100 log_files = 10 max_dump_file_size = 10240 background_dump_dest = (/home/disk3/user15/BDUMP) user_dump_dest = (/home/disk3/user15/UDUMP) core_dump_dest = (/home/disk3/user15/CDUMP) rollback_segments = (r01,r02,r03,r04,r05,r06,r07,r08)...

13 OPEN MOUNT NOMOUNT SHUTDOWN All files opened as described by the control file for this instance. Control file opened for this instance. Instance started. SHUTDOWN STARTUP Startup and Shutdown in Stages

14 Startup and Shutdown (cont.) Starting an instance includes: Reading the parameter file Reading the parameter file Allocating the SGA Allocating the SGA Starting the background processes Starting the background processes Opening the ALERT and trace files Opening the ALERT and trace files

15 STARTUP Command STARTUP PFILE=/DISK1/initU15.ora Start up the instance, and open the database. STARTUP [FORCE][RESTRICT][PFILE = filename] [OPEN [RECOVER][database] | MOUNT | NOMOUNT]

16 STARTUP Command OPEN: enables users to access the database MOUNT: mounts the database for certain activities but does not allow user access to db NOMOUNT: creates SGA + bg processes; no access to database FORCE: aborts the running instance before performing a normal startup RESTRICT: restricted access RECOVER: begins media recovery

17 ALTER DATABASE Command Change state of the database from NOMOUNT to MOUNTChange state of the database from NOMOUNT to MOUNT ALTER DATABASE database MOUNT ALTER DATABASE database MOUNT Open the database as a read-only databaseOpen the database as a read-only database ALTER DATABASE database OPEN READ ONLYALTER DATABASE database OPEN READ ONLY

18 Opening a Database in Read- Only Mode Any database can be opened as a read-only databaseAny database can be opened as a read-only database A read-only database can be used to:A read-only database can be used to: Execute queriesExecute queries Execute disk sortsExecute disk sorts Take datafiles offline and onlineTake datafiles offline and online Perform recovery of offline data filesPerform recovery of offline data files

19 Shutdown mode: A AbortI Immediate T TransactionalN Normal Shutdown Options TXXOOTXXOO IXXXOIXXXO AXXXXAXXXX Shutdown Mode Allow new connections Wait until current sessions end Wait until current transactions end Force a checkpoint and close files NXOOONXOOO YES NO

20 Shutdown Time Immediate Transactional Time 4 3 1 Normal Abort 2

21 Oracle Memory and Background Processes : Connecting to a Shared Server Red lines trace the path between the client and the instance

22 Oracle Memory and Background Processes : Connecting to a Dedicated Server Red lines trace the path between the client and the instance

23 Oracle Memory : PGA & SGA The PGA has private areas for each application The SGA is allocated when the instance starts up

24 Oracle Memory : SGA Components The shared pool stores parsed SQL commands for possible reuse The buffer cache stores data blocks read from the datafiles

25 Oracle Memory : SGA Components The cursor pool is optional and provides extra memory for program cursors The redo log buffer stores all changes to data before the changes are written to the datafiles The large pool is optional and adds more memory for better response time

26 Background Processes : PMON & SMON PMON (Process Monitor) cleans up remaining resources after the server and user processes end SMON (System Monitor) handles recovery if needed, cleans up old temporary tables, and restores space

27 Background Processes : DBWn & CKPT DBWn (Database Writer) writes modified buffers to the datafiles CKPT (Checkpoint Process) signals the DBWn process and assigns SCN

28 Background Processes : ARCn & LGWR ARCn (Archiver) copies redo log files to archive log files LGWR (Log Writer) writes redo log buffers to the redo log files

29 Background Processes : RECO & LMS RECO (Recoverer Process) fixes errors if changes across distributed databases fail LMS (Lock Manager Service) handles updates that affect data in multiple clustered databases

30 Dynamic Performance Views Maintained by the Oracle Server and continuously updated Contain data on disk and memory structures Contain data that is useful for performance tuning Have public synonyms with the prefix V$ Maintained by the Oracle Server and continuously updated Contain data on disk and memory structures Contain data that is useful for performance tuning Have public synonyms with the prefix V$

31 OPEN MOUNT NOMOUNT Data dictionary Accessing Dynamic Performance Views Dynamic performance views reading data from disk Dynamicperformance views reading from memory SHUTDOWN

32 Example V$PARAMETER V$SGA V$OPTION V$PROCESS V$SESSION V$VERSION V$INSTANCE Control file SGA V$THREAD V$CONTROLFILE V$DATABASE V$DATAFILE V$DATAFILE_HEADER V$LOGFILE

33 Displaying Current Parameter Values Use the Server Manager command: SHOW PARAMETER control Query the dynamic performance view V$PARAMETER: SELECT name FROM v$parameter WHERE name LIKE ‘%control%’; SELECT name FROM v$parameter WHERE name LIKE ‘%control%’;

34 Dynamic Initialization Parameters ALTER SESSION SET SQL_TRACE=true; Some initialization parameters can be modified while an instance is running. ALTER SYSTEM SET TIMED_STATISTICS=true; ALTER SYSTEM SET SORT_AREA_SIZE=131072 DEFERRED;

35 Enable and Disable Restricted Session Use the STARTUP command to restrict access to a database: STARTUP RESTRICT Use the ALTER SYSTEM command to place an instance in restricted mode: ALTER SYSTEM ENABLE RESTRICTED SESSION;

36 Terminating Sessions SELECT sid, serial# FROM v$session WHERE username=‘SCOTT’; 1. Identify which session to terminate with the dynamic performance view V$SESSION: 2. Execute the ALTER SYSTEM command: ALTER SYSTEM KILL SESSION ‘7,15’;

37 Trace Files Trace files can be written by server and background processes. Oracle dumps information about errors in trace files. The ALERT file consists of a chronological log of messages and errors. Server process tracing can be enabled or disabled by: – An ALTER SESSION command – The parameter SQL_TRACE Trace files can be written by server and background processes. Oracle dumps information about errors in trace files. The ALERT file consists of a chronological log of messages and errors. Server process tracing can be enabled or disabled by: – An ALTER SESSION command – The parameter SQL_TRACE

38 Controlling the Trace File User process Server process USER_DUMP_DESTBACKGROUND_DUMP_DEST ALERT file Instance SGA Shared pool

39 Guidelines Check the ALERT file periodically to: Detect internal errors (ORA-600) and block corruption errors Monitor database operations View the nondefault initialization parameter Check the ALERT file periodically to: Detect internal errors (ORA-600) and block corruption errors Monitor database operations View the nondefault initialization parameter

40 Summary Creating the parameter file Starting up and shutting down an instance Understanding the use of dynamic performance views Manage sessions Describing the use of trace files Creating the parameter file Starting up and shutting down an instance Understanding the use of dynamic performance views Manage sessions Describing the use of trace files


Download ppt "3 Managing an Oracle Instance. Objectives Setting up operating system and password file authentication Creating the parameter file Starting up an instance."

Similar presentations


Ads by Google