The following information is logged in the ALERT file: ORA-01578 Manager statements such as STARTUP, SHUTDOWN, ARCHIVE LOG, and RECOVER • The values of all nondefault initialization para
Trang 1The following parameters control the location and size of the trace files:
are dynamic initialization parameters
• On UNIX, the alert file is named alert_<SID>.log and is located in the
3-24 Copyright Oracle Corporation, 1998 All rights reserved.
Controlling the Trace File
User
process
Server process
USER_DUMP_DEST BACKGROUND_DUMP_DEST
ALERT file
Instance SGA Shared pool
Trang 2It is important for the database administrator to check the ALERT file
regularly to detect problems before they become serious
The following information is logged in the ALERT file:
(ORA-01578)
Manager statements such as STARTUP, SHUTDOWN, ARCHIVE
LOG, and RECOVER
• The values of all nondefault initialization parameters at the time the
instance starts
Instructor Note
You may query the current setting for BACKGROUND_DUMP_DEST,
change to that directory, and show the alert and trace files in the directory
3-25 Copyright Oracle Corporation, 1998 All rights reserved.
Guidelines
Check the ALERT file periodically to:
• Detect internal errors (ORA-600)
and block corruption errors
• Monitor database operations
• View the nondefault initialization
parameter
Trang 4Quick Reference
Initialization parameters DB_NAME
CONTROL_FILES SHARED_POOL_SIZE BACKGROUND_DUMP_DEST DB_BLOCK_BUFFERS
COMPATIBLE IFILE
LOG_BUFFER PROCESSES SQL_TRACE Dynamic initialization
parameters
USER_DUMP_DEST MAX_DUMP_FILE_SIZE TIMED_STATISTICS Dynamic initialization
parameters (deferred)
SORT_AREA_SIZE
Dynamic performance views V$FIXED_TABLE
V$PARAMETER V$CONTROLFILE V$DATABASE V$DATAFILE V$DATAFILE_HEADER V$INSTANCE
V$LOGFILE V$OPTION V$PROCESS V$PWFILE_USERS V$SESSION
V$SGA
V$VERSION
Trang 5Data dictionary views None
Commands CONNECT / AS SYSDBA
CONNECT / AS SYSOPER STARTUP
SHUTDOWN SHOW PARAMETER ALTER SYSTEM KILL SESSION ALTER SYSTEM DISCONNECT SESSION
POST_TRANSACTION ALTER SYSTEM ENABLE RESTRICTED SESSION ALTER SYSTEM DISABLE RESTRICTED SESSION ALTER SESSION SET
ALTER SYSTEM SET ALTER SYSTEM SET DEFERRED ALTER DATABASE MOUNT
ALTER DATABASE OPEN Packaged procedure and
functions
None
Trang 7
4
Creating a Database
Trang 94-2 Copyright Oracle Corporation, 1998 All rights reserved.
Objectives
Trang 10Creating the database is the first step in managing and organizing a database
system
Database creation is a task that prepares several operating system files and is
needed only once no matter how many data files the database has This is a
very important task because the database administrator must decide on
database settings, such as the size of the database block and the database
character set, which cannot be changed after the creation
Depending on the operating system, a database may have been created
automatically as part of the installation
You can use this initial database, or you can erase it and create a new one
manually
During migration from an older version of Oracle, database creation is
necessary only if an entirely new database is needed Otherwise you can use
version of the database
You can create a database with new data files or by erasing information in an
existing database that has the same physical structure
The CREATE DATABASE command initiates the creation of the control
files, redo log files, and the data dictionary structure that Oracle server
requires to access the database
4-3 Copyright Oracle Corporation, 1998 All rights reserved.
Overview
Password file
Parameter file
User
process
Server process
PGA
Instance SGA Shared Pool
Database
Control files Datafiles Redo log
files
Trang 11Preparing the Operating System
The database administrator should be fully privileged on the operating
system or should use the password file authentication (see the lesson
“Managing an Oracle Instance”)
Before you create the database, make sure that the memory for the SGA, the
Oracle executable, and the processes is sufficient Refer to your operating
system installation and administration guides
Calculate the necessary disk space for the database, including online redo
log files, control files, and the data files
4-4 Copyright Oracle Corporation, 1998 All rights reserved.
Creation Prerequisites
one of the following ways:
- By the operating system
- Using a password file
database
Trang 12Planning File Location
Plan how to protect the database, including the online redo log files, control
files, data files, and archived redo log files, and provide a backup strategy
Control Files
For the sake of safety, you should create at least two control files on two
different disks (see the lesson “Maintaining the Control File”) Because
control file copies must always be placed on different disks, they can have
identical names, such as control01.ctl on UNIX or control.ora on NT.
Online Redo Log Files
The online redo log files of a database should consist of multiplexed groups
of online redo log files A group of log files consists of identical copies,
which should be located on different disks (see the lesson “Maintaining
Redo Log Files”)
To distinguish between groups and their members, use a name like
log0101.rdo or log01a.rdo.
4-5 Copyright Oracle Corporation, 1998 All rights reserved.
Planning Database File Locations
• Keep at least two active copies of a database
control file on at least two different devices.
• Multiplex the redo log files and put group
members on different disks.
• Separate data files whose data:
– Will participate in disk resource contention
across different physical disk resources
– Have different life-spans
– Have different administrative characteristics
Trang 13Data Files
Name data files by relating to the contents as the root of the name—for
example, data files such as system01.dbf, temp01.dbf, users01.dbf on UNIX
and system01.ora, temp01.ora on NT.
Consider the characteristics of the data to be stored before determining the
structure appropriate for your database in order to:
To minimize fragmentation of the database, you should separate database
objects with different life spans, such as application data and temporary
data, into different tablespaces
To ensure well-balanced I/O loads, you should separate objects with
competing I/O requirements, such as tables and indexes into different
tablespaces
Note
These subjects are covered in detail in the lessons “Maintaining Tablespaces
and Data Files” and “Storage Structure and Relationships.”
Trang 144-6 Copyright Oracle Corporation, 1998 All rights reserved.
Oracle Software Locations /u01/app/oracle
/u02/app/applmgr
/product
/admin /local
4-7 Copyright Oracle Corporation, 1998 All rights reserved.
Oracle Database Files /u02/
oradata/
db01/
system01.dbf control01.ctl redo0101.rdo
db02/
system01.dbf control01.ctl redo0101.rdo
/u03/
oradata/
db01/
tools01.dbf control02.ctl redo0102.rdo
db02/
users01.dbf control02.ctl redo0102.rdo
Trang 15Optimal Flexible Architecture
Another important issue during installation and creation of a database is
organizing the file system so that it is easy to administer growth by adding
data into an existing database, adding users, creating new databases, and
adding hardware and distributing I/O load across sufficiently many drives
The Optimal Flexible Architecture (OFA) standard, which provides one
solution to these issues was written by an Oracle team responsible for
installing, tuning, and upgrading UNIX Systems OFA facilitates
configuration of complex Oracle systems with low maintenance During an
Oracle installation on several UNIX platforms, Oracle automatically uses
this standard configuration
The following steps explain the OFA structure:
into a unit, called a mount point (A mount point is a directory on UNIX
denoting where the file subsystem for a single disk slice will be linked
into an existing file system The selection of mount points makes it
possible to hide device details) In the example, u01 and u02 are
different mount points
2 Name all devices that might contain Oracle server data so that a wildcard
can be used to refer to the collection of devices as a unit
In the example, /u01/app/oracle is the Oracle software owner home
directory and /u02/app/applmgr is the Oracle Financial Applications
owner
software and tools, administrative files like database creation scripts,
initialization scripts, and local software which is used with Oracle
In the example, the directories product, admin, and local satisfy this
requirement
4 Store each version of Oracle server distribution software in a directory
matching the software such as /u01/app/oracle/product/7.3.3 or /u01/
app/oracle/product/8.0.3
5 Make a directory explicitly for storing Oracle server data at the same
level of each of the devices, such as /u02/oradata
on the system In the example, the databases are named dba01 and db01
Trang 16are used to identify the directory structure
because of the naming conventions and the lack of symbolic links To
circumvent this problem, the creation of hard directories instead of
symbolic links like u01 and u02 is necessary
For example, instead of the creation /u01/oradata/db01/, where u01
represents a mount point on UNIX, you would create a directory
DISK_3:\ORADATA\DB01\ on NT
Instructor Note
For information about OFA architecture, see The OFA Standard— Oracle7
for Open Systems, by Cary V Millsap, Oracle Corporation Oracle part
number A19308-1
or http://guts.us.oracle.com:80/sgrepo/papers/cmillsap
For information about OFA and NT see
http://scalable.us.oracle.com/nt/collateral/coll_list.html
Trang 17Oracle Software Directory Structure
After the Oracle installation, the ORACLE_HOME directory is
/mount_point/app/oracle/product
On UNIX the ORACLE_HOME directory contains the following
subdirectories, as well as subdirectories for each Oracle product, depending
on the Oracle products available on the platform:
Some examples of the contents of the product subdirectories are:
Note
Subdirectory Description
orainst Installation files and programs
log Log files
Trang 18Creating a Database
If you use the installer to create a database, the installer prompts you to enter
the number and the location of the mount points, the character set, the
national character set, passwords for user SYS and SYSTEM, and the UNIX
group password to enable operating system authentications
On NT, during the installation you are prompted to create a database with a
wizard, the Oracle Database Assistant This utility can also be used after
installation to create or to delete a database
4-8 Copyright Oracle Corporation, 1998 All rights reserved.
Creating a Database: Considerations
Trang 19This lesson covers the first six steps in detail The last step,generating the
data dictionary, is discussed in the lesson “Data Dictionary Views and
Standard Packages.”
4-9 Copyright Oracle Corporation, 1998 All rights reserved.
Creating a Database Manually
1 Decide on a unique instance and
database name and database character
set.
2 Set the operating system variables.
3 Prepare the parameter file.
4 Create a password file (recommended).
5 Start the instance.
6 Create the database.
7 Run scripts to generate the data dictionary
and accomplish postcreation steps.
Trang 20Decide on a unique name for the instance and set the following environment
variables:
Variable Description
ORACLE_HOME Set to the directory where the Oracle software will be installed
(Example: /u01/app/oracle/product/8.0.3)
instances running on the same machine
installation (Example: /u01/app/oracle)
than US7ASCII (Example: $ORACLE_HOME/ocommon/nls/admin/data)
4-10 Copyright Oracle Corporation, 1998 All rights reserved.
Operating System Environment
On UNIX set the following environment
Trang 21For example, set the environment variables in a Korn Shell with the
following command:
$ORACLE_SID=U16; export ORACLE_SID
In a C-shell, execute the following command:
$setenv ORACLE_SID U16
Note
and character sets than the database default, they will not be recognized
operating system
Trang 22Oracle on NT uses variables in the NT registry similar to the way Oracle on
UNIX uses shell environment variables
The Oracle Installer, the ORADIM80, and the Oracle Database Assistant
utilities define variables in the registry as well as registering the Oracle
instance as a service You can edit the registry manually via the regedit.exe
utility
For example, parameters such as ORACLE_HOME, ORA_NLS33, and
ORACLE_SID (the default is ORCL for the starter database), are stored in
the folder HKEY_LOCAL_MACHINE\ SOFTWARE \ORACLE folder
Therefore the creation of a new database requires ORACLE_SID to be set
with the following command:
C:\> set ORACLE_SID=U16
Now you create a new service and the new password file, if required, to run
the database with the ORADIM80 utility:
C:\>ORADIM80 -NEW -SID sid [-INTPWD internal_pwd][SRVC svrcname] [MAXUSERS number][STARTMODE auto,manual][-PFILE filename]
4-11 Copyright Oracle Corporation, 1998 All rights reserved.
Operating System Environment
On NT
• Set the variable ORACLE_SID to use
SVRMGR30.
• Create the service and the password
file with ORADIM80.
C:\> ORADIM80 -NEW -SID u16
-INTPWD password -STARTMODE auto
-PFILE ORACLE_HOME\DATABASE\initU16.ora
Trang 23The Oracle server records all operations that are executed with the
ORADIM80 utility in the ORACLE_HOME\RDBMS80\ORADIM80.LOG
file
Instructor Note
The students can review the description of the ORADIM80 utility in
the lesson “Managing an Oracle Instance.”
Trang 244-12 Copyright Oracle Corporation, 1998 All rights reserved.
Preparing the Parameter File
Trang 25Preparing the Parameter File
When preparing the new database, copy the default init.ora file with the new
name init<SID>.ora.
Change the settings for some parameters; others can be left to default
You should specify at least the following parameters before starting the
instance:
Note
The database name is associated with a database at create database time and
is stored in the control files To change the name of an existing database, use
the CREATE CONTROLFILE command to re-create the control file (see the
course Oracle8: Backup and Recovery Workshop).
This is the only parameter that is required whencreating a new database.This parameter does notneed to match the ORACLE_SID, but must matchthe name used in the CREATE DATABASEstatement
least two control filenames, placed on separatedisks if possible The control files do not need toexist at this point The Oracle server can createnew operating system files when creating thedatabase.)
size cannot be changed after database creation.)
Trang 26Connect as SYSDBA using operating system authentication or the password
file method and start the instance using the STARTUP command
The password is the one that was previously used to create the service with
the ORDIM80 utility on NT or that was previously created by using the
orapwd utility on UNIX.
If the parameter file is not in the default location, you may need to
specify the PFILE clause in the STARTUP command For this course,
the parameter file is located in the current directory
4-14 Copyright Oracle Corporation, 1998 All rights reserved.
Starting the Instance
Trang 27To create a database, use the following SQL command:
CREATE DATABASE [database]
[CONTROLFILE REUSE]
[LOGFILE [GROUP integer] filespec
[, [GROUP integer] filespec] ]
[CHARACTER SET charset]
[NATIONAL CHARACTER SET charset]
[DATAFILE filespec [autoextend_clause]
4-15 Copyright Oracle Corporation, 1998 All rights reserved.
SPOOL creU16.log
STARTUP NOMOUNT PFILE=initU16.ora
CREATE DATABASE U16
GROUP 1 ('/DISK3/log1a.rdo',/DISK4/log1b.rdo’) SIZE 1 M,
GROUP 2 ('/DISK3/log2a.rdo',/DISK4/log2b.rdo’) SIZE 1 M
DATAFILE
'/DISK1/system01.dbf' size 50M autoextend on
CHARACTER SET WE8ISO8859P1;
Creating the Database