0% found this document useful (0 votes)
10 views13 pages

Dbam 05

This document covers the processes of starting up and shutting down an Oracle database, including commands for various startup modes and shutdown types. It also details the initialization parameter files, their types, and how to create and manage server parameter files, as well as the use of Oracle Managed Files and the alert log. Additionally, it describes the data dictionary and its creation during database setup, along with examples of usage.

Uploaded by

Wajeeha Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views13 pages

Dbam 05

This document covers the processes of starting up and shutting down an Oracle database, including commands for various startup modes and shutdown types. It also details the initialization parameter files, their types, and how to create and manage server parameter files, as well as the use of Oracle Managed Files and the alert log. Additionally, it describes the data dictionary and its creation during database setup, along with examples of usage.

Uploaded by

Wajeeha Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

29/02/16

Database
Administration & Management

Lecture 05

Start-up & Shut Down Database

Initialization Parameter Files

Creating SPFILE

Oracle Managed Files

Alert Log File

Background Trace File

User Trace File

Creating Data Dictionary


29/02/16

Start-up Database
• Starting-up a database creates an instance of that database.

• Normally an instance starts-up by mounting and opening


database. However other options exist.

• An instance can be started using:


• SQL Plus
• Recovery Manager
• Enterprise Manager

• To start an instance, database must reads initialization


parameters at startup

Start-up Database
• Connect with SQL Plus as SYSDBA to start-up.

• Starting an instance and Mounting & Opening Database:


• STARTUP
(normal database operation; instance started; database is mounted and
opened. Valid users can connect to database and perform access
operations)

• Starting an instance and Mounting a Database:


• STARTUP MOUNT
(starting database without opening it; allows to perform maintenance
operations. For example enabling disabling redo log archiving options. To
perform full database recovery)
29/02/16

Start-up Database
• Starting an instance without Mounting a Database:
• STARTUP NOMOUNT
(Typically used only during database creation)

• Restricting access to an instance at startup:


• STARTUP RESTRICT
(To start instance and optionally mount it and open a database but restrict
access only to administrative personnel.

Can be used in combination with mount, no mount and open modes.

Generally used to import or export data.


To temporarily prevent users from using data.
To perform migration or upgrade operations)

Start-up Database
• Forcing an instance to start:
• STARTUP FORCE
(rarely used; when experiencing problems to startup or unable to
shutdown properly)

• Starting up, Mounting, Starting Complete Media Recovery:


• STARTUP OPEN RECOVER
(have recovery process automatically start, if media recovery is required)

• Automatic Database Startup at Operating System Start


29/02/16

Already Started Instance


• Mount a database to an already started but not opened
instance:
• ALTER DATABASE MOUNT;

• To make a mounted but closed database available:


• ALTER DATABASE OPEN;

• Opening a database in Read-only mode:


• ALTER DATABASE OPEN READ ONLY;

• Opening a database in read/write mode:


• ALTER DATABASE OPEN READ WRITE;

Shut Down Database


• Shutting Down a database in normal situations:
• SHUTDOWN
• SHUTDOWN NORMAL
(No new connections are allowed.
Waits for all currently connected users to disconnect.)

• Shutting Down immediately:


• SHUTDOWN IMMEDIATE
(No new connections are allowed.
No new transactions are allowed to be started.
Any uncommitted transactions are rolled back.
Does not wait for connected users to disconnect themselves.)
29/02/16

Shut Down Database


• Shutting Down a database with transactional mode:
• SHUTDOWN TRANSACTIONAL
• (No new connections are allowed.
• No new transactions are allowed.
• Waits for all ongoing transactions to get completed.
• Any connected users are disconnected right after completing ongoing
transactions.)

• Shutting Down a database instantaneously:


• SHUTDOWN ABORT
• (No new connections or transactions are allowed.
• Current SQL statements being processed are terminated.
• Uncommitted transactions are not rolled back.
• Does not wait for users to disconnect themselves. Disconnects them all.

Suspend & Resume Database


• Suspending and Resuming a Database:
• Halts all input and output to datafiles and control files.

• ALTER SYSTEM SUSPEND;


• ALTER SYSTEM RESUME;
29/02/16

Initialization Parameter File


• Initialization Parameter Files specify location and size limits of
various structures as well as connection limits.

• One of two types of files:


• Text-based: init<SID>.ora (init.ora or PFILE)
• Server-side binary: spfile<SID>.ora (spfile.ora or SPFILE)

• Instance looks for SPFILE in default location otherwise the


startup command can specify PFILE.

• Default location:
• C:\APP\ADMINISTRATOR\ADMIN\mydb\PFILE\init.ora
• $ORACLE_HOME\DATABASE
• $ORACLE_HOME\DBS

Initialization Parameter File


• Two broad categories of Initialization Parameters:
• Basic Initialization Parameters. (when creating a new database)
• Advanced Initialization Parameters. (283 parameters in total)

• Parameter Examples:
• CONTROL_FILES: One or more control file names
• DB_FILES: Maximum number of database files
• PROCESSES: Maximum number of OS user processes that can
simultaneously connect
• DB_BLOCK_SIZE: Standard database block size used by all tablespaces
• DB_CACHE_SIZE: Size of the standard block buffer cache
• SGA_TARGET: Total size of all SGA components
• MEMORY_TARGET: Oracle system-wide usable memory
• PGA_AGGREGATE_TARGET: Amount of PGA memory for all server processes
• SHARED_POOL_SIZE: Size of shared pool (in bytes)
• UNDO_MANAGEMENT: Undo space management mode to be used
29/02/16

Initialization Parameter File


• Use SQL Plus to view parameters and their values using.
• SELECT name, value FROM v$parameter;

• Read a particular parameter.


• SHOW parameter SHARED_POOL_SIZE;

Initialization Parameter File


• Static Parameters:
• Can be changed only in the parameter file.
• Require restarting the instance before taking effect.

• Dynamic Parameters:
• Can be changes while database is online.
• Can be altered at session and system level.
• Are valid for duration of session.
• Are changed by using ALTER SESSION and ALTER SYSTEM commands.
29/02/16

Initialization Parameter File


SQL> ALTER SESSION
SET NLS_DATE_FORMAT ='mon dd yyyy';

Session altered.

SQL> SELECT SYSDATE FROM dual;

SYSDATE
-----------
mar 12 2015

SQL> ALTER SYSTEM SET SEC_MAX_FAILED_LOGIN_ATTEMPTS=2


COMMENT='Reduce from 10 for tighter security.' SCOPE=SPFILE;

System altered.

Initialization Parameter File


• Starting-up with a Non-default Server Parameter File:
• (create a one-line text initialization parameter file that contains only the
SPFILE parameter location.

• Example: create file init.ora and write following line inside.


• SPFILE = C:\ORACLE_HOME\DATABASE\SPFILE.ORA

• Store init.ora in c:\test\

• Start up the instance pointing to this file:


• STARTUP PFILE = C:\TEST\INIT.ORA
29/02/16

Creating SPFILE
• Server Parameter Files are binary files that exist only on server and a
called from client location to start-up database.

• Can be created using the CREATE SPFILE statement.

• Connect SQL PLUS as SYSDBA then:

• Syntax: create SPFILE from PFILE;

• Example : CREATE SPFILE


FROM PFILE = ‘$ORACLE_HOME/dbs/init.ora’;

CREATE SPFILE = ‘mySPFILE.ora’


FROM PFILE = ‘$ORACLE_HOME/dbs/init.ora’;

• Oracle database uses default server parameter filename.

Oracle Managed Files (OMF)


• Oracle Managed Files simplify the administration.
• Prior to Oracle 9i the DBA had to remember where the existing
datafiles were stored by querying DBA_DATA_FILES and
DBA_TEMP_FILES views.
• Can make tablespace datafile management even easier by
automating the creation and removal of datafiles.
• Without OMF a DBA might drop a tablespace and forgets to
remove the underlying (one or many) datafiles. Making
inefficient use of disk resources and unnecessary backup time
for datafiles.
• OMF ensures that each filename is unique.
• All ASM files are OMF.
• Non-OMF files can be converted to OMF.
29/02/16

Alert Log File


• Oracle writes messages to the alert log when things go wrong.

• Located in directory specified by initialization parameter


• BACKGROUND_DUMP_DEST

• Contains both routine status messages and error conditions.

• Log into Oracle Enterprise Manager and click on ALERT LOG


CONTENTS:

Alert Log File


• Database Home Page > Related Links Region > Alert Log Content
29/02/16

Alert Log File


• Database Home Page > Related Links Region > Alert History

Trace Files
• Processes are stored in Trace Files. (user, server, background)
• Located at
C:\APP\ADMINISTRATOR\DIAG\RDBMS\MYDB\MYDB\..
• Initialization Parameters are:
• BACKGROUND_DUMP_DEST
• USER_DUMP_DEST
• CORE_DUMP_DEST

• Automatic Diagnostic Repository (ADR) is a system-managed


central tracing and logging repository for storing database alert
logs, trace files and health monitor reports.
29/02/16

Data Dictionary
• Data Dictionary base tables store information about all user-
defined objects in database.

• Oracle automatically creates the data dictionary when we use


Database Configuration Assistant.

• Oracle updates data dictionary in response to every DDL


statement. (Data Definition Language by T-SQL to define data structures
i.e. CREATE / ALTER / DROP)

• Data Dictionary base tables are first objects created in any


Oracle Database. They are created in SYSTEM tablespace and
must remain there.

Data Dictionary
• Usage Examples:

• SELECT table_name, tablespace_name FROM user_tables;

• SELECT sequence_name, min_value, max_value, increment_by FROM


all_sequences WHERE sequence_owner IN ('MDSYS','XDB');

• SELECT USERNAME, ACCOUNT_STATUS FROM dba_users WHERE


ACCOUNT_STATUS = 'OPEN';

• DESCRIBE dba_indexes;
29/02/16

Creating Data Dictionary


• Following scripts run automatically when database is created
using Database Configuration Assistant. They might be needed
to executed if a database is created manually.
• To run them the user must be connected to Oracle as a SYSDBA.
Script Name Needed For Description
Creates the data dictionary
and public synonyms for
catalog.sql All databases many of its views
Grants PUBLIC access to the
synonyms
Runs all scripts required for,
catproc.sql All databases
or used with PL/SQL
Creates Real Application
catclust.sql Real Application Clusters Clusters data dictionary
views

You might also like