Database Reference
In-Depth Information
Listing 11-45.
Create Database Files and Tablespaces
DATAFILE 'D:\app\oracle\oradata\apver\SYSTEM01.DBF' SIZE 512M REUSE
SYSAUX DATAFILE 'D:\app\oracle\oradata\apver\SYSAUX01.DBF' SIZE 512M REUSE
DEFAULT TABLESPACE users DATAFILE 'D:\app\oracle\oradata\apver\USERS01.DBF'
SIZE 256M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE tempts1 TEMPFILE 'D:\app\oracle\oradata\apver\TEMP01.DBF'
SIZE 16M REUSE
UNDO TABLESPACE undotbs1 DATAFILE 'D:\app\oracle\oradata\apver\UNDOTBS01.DBF'
SIZE 64M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
Create and Configure the Database
With your configuration and initialization files in place and edited for your unique installation, and with
the required directories created, you are ready to create the new database instance,
apver
. First, let's set
our environment to specify the instance we want to deal with to
apver
. This keeps us from tramping on
the parameters and identity of the default database,
orcl
.
In an administrator command prompt window, set the
ORACLE_SID
environment variable. This
setting will be in effect as long as the command prompt window is open. After it is closed, the setting will
go away, so redo this if you need to come back to these procedures in a new command prompt window.
SET ORACLE_SID=apver
You already created a new Oracle service for the
apver
instance (it will have a name like
OracleServiceapver
), and that service should be running. You can check what Oracle services are
running from the Services area of the Computer Management Windows program—scroll down to the
services that start with “Oracle.” All other Oracle services can be stopped and, in fact, it is safer while
manually installing a new Oracle instance if you stop all the others.
We are going to run SQL*Plus and basically connect to NO instance (No Login or
NOLOG
)
AS
SYSDBA
.
This is the equivalent to what
CONNECT INTERNAL
had been in earlier versions of Oracle database. You
must be an administrator on the server, or the account that installed Oracle Database, in order to run
this
CONNECT
command.
%ORACLE_HOME%\BIN\sqlplus /NOLOG
CONNECT/AS SYSDBA
Note
These commands can be found in the file
Chapter11/apver/ApverSys.sql
We want to be sure we are working on the
apver
instance. The
CONNECT
command should display the
message “Connected to an idle instance.” If you see the error message “ORA-12560: TNS:protocol
adapter error,” then your
apver
instance service is not running. Start it as described previously, using the
Services area of the Computer Management program.
If an Oracle database instance is running, the message will simply be “Connected.” If you see that
message, check what instance you are using with this command:
SELECT VALUE FROM V$PARAMETER WHERE NAME = 'db_name';