week 2 lecture 1 creating an oracle instance. learning objectives learn the steps for creating a...
TRANSCRIPT
![Page 1: Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives Learn the steps for creating a database Understand the prerequisites for creating](https://reader035.vdocuments.mx/reader035/viewer/2022062519/5697bfc51a28abf838ca6bf0/html5/thumbnails/1.jpg)
Week 2Lecture 1
Creating an Oracle Instance
![Page 2: Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives Learn the steps for creating a database Understand the prerequisites for creating](https://reader035.vdocuments.mx/reader035/viewer/2022062519/5697bfc51a28abf838ca6bf0/html5/thumbnails/2.jpg)
Learning Objectives
Learn the steps for creating a database Understand the prerequisites for creating a
database Configure initial settings for database
creation Create, start, and stop a database
instance
![Page 3: Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives Learn the steps for creating a database Understand the prerequisites for creating](https://reader035.vdocuments.mx/reader035/viewer/2022062519/5697bfc51a28abf838ca6bf0/html5/thumbnails/3.jpg)
Steps for Creating a Database
Steps in a nutshell:
1. Install Oracle software
2. Create appropriate users (Unix only)
3. Confirm memory and disk storage availability
4. Choose file management, DBA authentication, and initialization parameters
5. Create the database (manual or automated)
6. Test the database (start up and shut down)
![Page 4: Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives Learn the steps for creating a database Understand the prerequisites for creating](https://reader035.vdocuments.mx/reader035/viewer/2022062519/5697bfc51a28abf838ca6bf0/html5/thumbnails/4.jpg)
Overview of Prerequisites for Creating a Database See your Installation Guide for exact details.
Example of Windows 2000 requirements:
RAM: 128 Megabytes
Virtual Memory: 200 Megabytes
Temp space: 400 Megabytes
Storage:
ORACLE_HOME: 4.5 Gigabytes
System drive: 140 Megabytes
![Page 5: Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives Learn the steps for creating a database Understand the prerequisites for creating](https://reader035.vdocuments.mx/reader035/viewer/2022062519/5697bfc51a28abf838ca6bf0/html5/thumbnails/5.jpg)
Configuring Initial Settings
Three configuration decisions that must be done prior to creating the database:
Choose DBA authentication method
Choose file management method
Set initialization parameters
![Page 6: Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives Learn the steps for creating a database Understand the prerequisites for creating](https://reader035.vdocuments.mx/reader035/viewer/2022062519/5697bfc51a28abf838ca6bf0/html5/thumbnails/6.jpg)
DBA Authentication Method
Primarily used to authenticate users who log in with the SYSDBA or SYSOPER roles
Important due to the capabilities of users with these roles
Operating system authentication method can be used for other Oracle users
Password file authentication method can only be used for users with SYSDBA or SYSOPER role assigned
![Page 7: Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives Learn the steps for creating a database Understand the prerequisites for creating](https://reader035.vdocuments.mx/reader035/viewer/2022062519/5697bfc51a28abf838ca6bf0/html5/thumbnails/7.jpg)
Operating System AuthenticationType of DBA Authentication (first of two methods)
Pros:
Users log on without specifying additional password or user name
Best when only local access or secured line access are allowed
Cons:
Can be a security risk if used with non-secure internet or network lines
Requires knowledge of operating system security
![Page 8: Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives Learn the steps for creating a database Understand the prerequisites for creating](https://reader035.vdocuments.mx/reader035/viewer/2022062519/5697bfc51a28abf838ca6bf0/html5/thumbnails/8.jpg)
Operating System AuthenticationHow to implement:
Create operating system user for DBA use
Create OSDBA group (UNIX only because Windows automatically creates the group)
Assign operating system user to OSDBA group
Set REMOTE_LOGIN_PASSWORDFILE = NONE
Set OS_AUTHENT_PREFIX as desired
Create Oracle user with same name or name with prefix
![Page 9: Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives Learn the steps for creating a database Understand the prerequisites for creating](https://reader035.vdocuments.mx/reader035/viewer/2022062519/5697bfc51a28abf838ca6bf0/html5/thumbnails/9.jpg)
Password File AuthenticationType of DBA Authentication (second of two methods)
Pros:
Users must know their Oracle username and password to log onto the database
Best for non-secured line access, such as Internet, is allowed
Cons:
Users required to remember multiple usernames and passwords
Possible security risk due to storage of passwords in an encrypted operating system file
![Page 10: Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives Learn the steps for creating a database Understand the prerequisites for creating](https://reader035.vdocuments.mx/reader035/viewer/2022062519/5697bfc51a28abf838ca6bf0/html5/thumbnails/10.jpg)
Password File AuthenticationHow to implement: Set REMOTE_LOGIN_PASSWORDFILE = EXCLUSIVE (or SHARE if
database is part of distributed system)
Create password file using the orapwd utility
SYSTEM user is ready at this point
Add more SYSDBA or SYSOPER users by: Creating new Oracle user
Assigning SYSDBA or SYSOPER role to the user
Password file is automatically updated when new users are assigned these roles and when any of these users change their passwords
Set OS_AUTHENT_PREFIX as desired
Create Oracle user with same name or name with prefix
![Page 11: Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives Learn the steps for creating a database Understand the prerequisites for creating](https://reader035.vdocuments.mx/reader035/viewer/2022062519/5697bfc51a28abf838ca6bf0/html5/thumbnails/11.jpg)
File Management Methods
Files controlled by the file management method are control files, data files, and redo log files
Determines how files are located to help with:
Multiplexing of control and redo log files
I/O load balancing
Determines how files are added, extended, or deleted
![Page 12: Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives Learn the steps for creating a database Understand the prerequisites for creating](https://reader035.vdocuments.mx/reader035/viewer/2022062519/5697bfc51a28abf838ca6bf0/html5/thumbnails/12.jpg)
User-Managed File ManagementType of File Management (first of two methods)
Pros:
DBA has complete control of names, locations, and sizes of all files
Compatible with older versions
Cons:
DBA must manually delete files after their associated tablespace is dropped
DBA must monitor and adjust file sizes over time
![Page 13: Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives Learn the steps for creating a database Understand the prerequisites for creating](https://reader035.vdocuments.mx/reader035/viewer/2022062519/5697bfc51a28abf838ca6bf0/html5/thumbnails/13.jpg)
User-Managed File ManagementHow to implement:
For user-managed control files, set CONTROL_FILES to a list of files. For example:
For user-managed redo log files, use the LOGFILE clause in the CREATE DATABASE command.
For user-managed data files, use the DATAFILE clause in the CREATE DATABSE command or the CREATE TABLESPACE command
![Page 14: Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives Learn the steps for creating a database Understand the prerequisites for creating](https://reader035.vdocuments.mx/reader035/viewer/2022062519/5697bfc51a28abf838ca6bf0/html5/thumbnails/14.jpg)
User-Managed File Management
Example
Initialization parameter:CONTROL_FILES = (/d1/oracle/control01.ctl, /d2/oracle/control02.ctl)
CREATE DATABASE command:CREATE DATABASE TECHNO92
MAXDATAFILES 100
DATAFILE ‘C:\ora\oradata\system01.dbf' SIZE 325M
AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
LOGFILE GROUP 1 (‘C:\ora\oralogs\redo01.log') SIZE 50M,
GROUP 2 (‘D:\ora\oralogs\redo02.log') SIZE 50M;
![Page 15: Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives Learn the steps for creating a database Understand the prerequisites for creating](https://reader035.vdocuments.mx/reader035/viewer/2022062519/5697bfc51a28abf838ca6bf0/html5/thumbnails/15.jpg)
Oracle Managed File Management
Type of File Management (second of two methods)
Pros: Automated control of control of names and sizes of all files
DBA only has to determine the locations
Less monitoring required due to automated size adjustment and deleting of appropriate files
Cons: File names can be somewhat cryptic
No control over exact sizes and names of files
![Page 16: Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives Learn the steps for creating a database Understand the prerequisites for creating](https://reader035.vdocuments.mx/reader035/viewer/2022062519/5697bfc51a28abf838ca6bf0/html5/thumbnails/16.jpg)
Oracle Managed File Management
How to implement:
For Oracle-managed data files, set the DB_CREATE_FILE_DEST to a valid directory
For Oracle-managed control files and redo log files, set DB_CREATE_ONLINE_LOG_DEST_n to a valid directory
![Page 17: Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives Learn the steps for creating a database Understand the prerequisites for creating](https://reader035.vdocuments.mx/reader035/viewer/2022062519/5697bfc51a28abf838ca6bf0/html5/thumbnails/17.jpg)
Oracle Managed File Management
Example
Initialization parameters:
DB_CREATE_FILE_DEST = ‘C:\ora\oradata'
DB_CREATE_ONLINE_LOG_DEST_1= ‘C:\ora\oralogs’
DB_CREATE_ONLINE_LOG_DEST_2= ‘D:\ora\oralogs’
CREATE DATABASE command:
CREATE DATABASE TECHNO92
MAXDATAFILES 100;
![Page 18: Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives Learn the steps for creating a database Understand the prerequisites for creating](https://reader035.vdocuments.mx/reader035/viewer/2022062519/5697bfc51a28abf838ca6bf0/html5/thumbnails/18.jpg)
Set the Initialization Parameters Stored in a file named init<sid>.ora prior to
creating the database (<sid> = database name)
The init<sid>.ora is used for many purposes:
Tune memory
Limit the number of users
Set the location of files
Determine how to handle of SQL parsing
Much more
![Page 19: Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives Learn the steps for creating a database Understand the prerequisites for creating](https://reader035.vdocuments.mx/reader035/viewer/2022062519/5697bfc51a28abf838ca6bf0/html5/thumbnails/19.jpg)
Set the Initialization Parameters
Initial setting
Alternate settings (comments)
![Page 20: Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives Learn the steps for creating a database Understand the prerequisites for creating](https://reader035.vdocuments.mx/reader035/viewer/2022062519/5697bfc51a28abf838ca6bf0/html5/thumbnails/20.jpg)
Set the Initialization Parameters Important initialization parameters to set
prior to creating a database
DB_BLOCK_SIZE
DB_NAME
DB_DOMAIN
COMPATIBLE
Parameters mentioned in previous slides
![Page 21: Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives Learn the steps for creating a database Understand the prerequisites for creating](https://reader035.vdocuments.mx/reader035/viewer/2022062519/5697bfc51a28abf838ca6bf0/html5/thumbnails/21.jpg)
Creating a Database
Two distinct methods:
Automated: Database Configuration Assistant
• Better for novice DBA
• Easier to use due to the many pre-defined settings
Manual: CREATE DATABASE command
• More flexible
• Useful when using script for creating multiple identical (or similar) databases on several sites
![Page 22: Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives Learn the steps for creating a database Understand the prerequisites for creating](https://reader035.vdocuments.mx/reader035/viewer/2022062519/5697bfc51a28abf838ca6bf0/html5/thumbnails/22.jpg)
Create a New Database Using the Database Configuration Assistant
![Page 23: Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives Learn the steps for creating a database Understand the prerequisites for creating](https://reader035.vdocuments.mx/reader035/viewer/2022062519/5697bfc51a28abf838ca6bf0/html5/thumbnails/23.jpg)
Create a New Database Using the Database Configuration Assistant
The SYS and SYSTEM users must have secure passwords to prevent unauthorized access
![Page 24: Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives Learn the steps for creating a database Understand the prerequisites for creating](https://reader035.vdocuments.mx/reader035/viewer/2022062519/5697bfc51a28abf838ca6bf0/html5/thumbnails/24.jpg)
Starting and Stopping the Database with Instance Manager
Before going to the console, create an Oracle Net connection for the new database using Net Manager
![Page 25: Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives Learn the steps for creating a database Understand the prerequisites for creating](https://reader035.vdocuments.mx/reader035/viewer/2022062519/5697bfc51a28abf838ca6bf0/html5/thumbnails/25.jpg)
Starting and Stopping the Database with Instance Manager
When logging into the database in the console, select “SYSDBA” in the Connect as box so you have authority to start or stop the database
![Page 26: Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives Learn the steps for creating a database Understand the prerequisites for creating](https://reader035.vdocuments.mx/reader035/viewer/2022062519/5697bfc51a28abf838ca6bf0/html5/thumbnails/26.jpg)
Starting and Stopping the Database with Instance Manager
Click this button to begin the shutdown process
![Page 27: Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives Learn the steps for creating a database Understand the prerequisites for creating](https://reader035.vdocuments.mx/reader035/viewer/2022062519/5697bfc51a28abf838ca6bf0/html5/thumbnails/27.jpg)
Creating a Database Manually
Highlights include these steps:
Create three directories in which files are to be stored:
newlog – for redo log files and control files
newdata – for data files
newadmin – for the init<sid>.ora file and scripts used to create the database
![Page 28: Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives Learn the steps for creating a database Understand the prerequisites for creating](https://reader035.vdocuments.mx/reader035/viewer/2022062519/5697bfc51a28abf838ca6bf0/html5/thumbnails/28.jpg)
Creating a Database Manually
Create a password file using the orapwd utility from a command line:
orapwd file=“<Z:\zzz>\database\pwdtrial02.ora” password=change_on_install entries=5
Replace <Z:\zzz> with the actual directory path of ORACLE_HOME before typing the command
![Page 29: Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives Learn the steps for creating a database Understand the prerequisites for creating](https://reader035.vdocuments.mx/reader035/viewer/2022062519/5697bfc51a28abf838ca6bf0/html5/thumbnails/29.jpg)
Creating a Database Manually
Create a Windows service for the database instance from a command line:
oradim –new –sid trial02 –startmode a –pfile <X:\xxx>\newadmin\inittrial02.ora
Replace <X:\xxx> with the actual directory path of root directory for the three new directories
This is only needed in Windows, not in UNIX
![Page 30: Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives Learn the steps for creating a database Understand the prerequisites for creating](https://reader035.vdocuments.mx/reader035/viewer/2022062519/5697bfc51a28abf838ca6bf0/html5/thumbnails/30.jpg)
Creating a Database Manually
Prepare a CREATE DATABASE statement:CREATE DATABASE <databasename>
MAXDATAFILES <n>
MAXINSTANCES <n>
MAXLOGFILES <n>
MAXLOGMEMBERS <n>
DATAFILE '<path>/<datafilename>' <storage_settings>
UNDO TABLESPACE <undo> DATAFILE '<path>/<file>‘ <storage>
CHARACTER SET <charsetname>
NATIONAL CHARACTER SET <ncharsetname>
LOGFILE GROUP <n> ('<path>/<file>','<path>/<file>', ...)
GROUP <n> ('<path>/<file>','<path>/<file>', ...);
![Page 31: Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives Learn the steps for creating a database Understand the prerequisites for creating](https://reader035.vdocuments.mx/reader035/viewer/2022062519/5697bfc51a28abf838ca6bf0/html5/thumbnails/31.jpg)
Creating a Database Manually
After running the CREATE DATABSE command, follow up with these steps:
Create TEMP and USERS tablespaces
Create the data dictionary views
Create the PL/SQL packages
Register the database in Windows
![Page 32: Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives Learn the steps for creating a database Understand the prerequisites for creating](https://reader035.vdocuments.mx/reader035/viewer/2022062519/5697bfc51a28abf838ca6bf0/html5/thumbnails/32.jpg)
Starting and Stopping the Database Manually
Use SQL*Plus from a command line
Start SQL*Plus and log on as SYS:sqlplus /nolog
CONNECT SYS/change_on_install AS SYSDBA
Shut down the database:
SHUTDOWN IMMEDIATE
Start up the database:
STARTUP PFILE=<X:\xxx>\newadmin\inittrial02.ora
![Page 33: Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives Learn the steps for creating a database Understand the prerequisites for creating](https://reader035.vdocuments.mx/reader035/viewer/2022062519/5697bfc51a28abf838ca6bf0/html5/thumbnails/33.jpg)
Lecture Summary
Installing the Oracle software (if needed) is the first step in creating a new database
Databases can be created manually or by using the Database Configuration Assistant
The DBA authentication method can be either Operating System authentication or password file authentication
File management involves determining the location, name and size of files
![Page 34: Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives Learn the steps for creating a database Understand the prerequisites for creating](https://reader035.vdocuments.mx/reader035/viewer/2022062519/5697bfc51a28abf838ca6bf0/html5/thumbnails/34.jpg)
Lecture Summary
User-managed file management gives the DBA complete control but requires more monitoring and manual changes
Oracle-managed file (OMF) management automates names, sizes, and tuning of files
Some initialization parameters never change after the database is created
Other initialization parameters can be changed later
![Page 35: Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives Learn the steps for creating a database Understand the prerequisites for creating](https://reader035.vdocuments.mx/reader035/viewer/2022062519/5697bfc51a28abf838ca6bf0/html5/thumbnails/35.jpg)
Lecture Summary
Database Configuration Assistant provides selections among many default settings for the new database
The new database must have an Oracle Net connection defined prior to accessing it in the console
The Instance Manager can be used to shut down or start up the database
You must be logged on with SYSDBA authority to start or stop the database
Creating a database manually means using the CREATE DATABASE command
A new database service starts up a new database instance in Windows
![Page 36: Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives Learn the steps for creating a database Understand the prerequisites for creating](https://reader035.vdocuments.mx/reader035/viewer/2022062519/5697bfc51a28abf838ca6bf0/html5/thumbnails/36.jpg)
Lecture Summary
After creating the database manually:
Add tablespaces for users and temporary storage
Add the data dictionary and PL/SQL packages
Add the database to the Windows registry
Use SQL*Plus to shut down or start up a database