-
Decide on a unique instance name and database character set
-
Set the operating system variables
(UNIX)
ORACLE_HOME
ORACLE_SID
ORACLE_BASE
ORA_NLS33
PATH
(NT)
ORADIM80 -NEW -SID u16
-INTPWD password -STARTMODE auto
-PFILE ORACLE_HOMEDATABASEinitu16.ora
You must decide the SID, Password, and
Create the parameter file (initu16.ora)
SET ORACLE_SID=u16
SET LOCAL=2:u16
Statement 1 : Make u16 the current SID
Statement 2 : Override the LOCAL environment variable
-
Prepare the parameter file
use init.ora as a parameter file template
db_name = Eight characters or fewer that identify the database
control_files = the location of three control files
DB_BLOCK_SIZE = Determines the database block size (can not change after the database has been created)
-
Create a password file
-
Start the instance
STARTUP NOMOUNT pfile=initu16.ora
-
Create the database
MANUALLY FROM Server Manager
CREATE DATABASE "U16"
MAXLOGFILES 6
MAXLOGMEMBERS 6
MAXDATAFILES 30
MAXLOGHISTORY 100
ARCHIVELOG
LOGFILE
GROUP 1
'E:DATAU16GROUP1log1a.rdo' SIZE 200K,
'E:DATAU16GROUP1log1b.rdo' SIZE 200K
GROUP 2
'E:DATAU16GROUP2log2a.rdo' SIZE 200K,
'E:DATAU16GROUP2log2b.rdo' SIZE 200K
GROUP 3
'E:DATAU16GROUP3log3a.rdo' SIZE 200K,
'E:DATAU16GROUP3log3b.rdo' SIZE 200K
DATAFILE
'E:DATAU16DATAFILESsystem01.dbf'
size 30M
CHARACTER SET WE8ISO8859P1;
Database
select name,created,log_mode from v$database;
Thread
select status, instance from v$thread;
Datafiles
select name from v$datafile;
Logfiles
select member from v$logfile;
Controlfiles
select name from v$controlfile;
Verify System Creation
select file_name from dba_data_files
where tablespace_name='SYSTEM';
Look at the database users
select username, created from dba_users;
-
Run scripts to generate the data dictionary and accomplish postcreation steps.
Create the data dictionary
CATALOG.SQL
prostcreation objects
CATPROC.SQL
-
Maintaining Redo Log Files
(Determine Archiving Status)
select log_mode from v$database;
(Determine is Automatic Archiving is enabled)
select archiver from v$instance
(if you need to add a new group of redo logs)
ALTER DATABASE ADD LOGFILE
(
'c:datalog3a.rdo',
'e:datalog3b.rdo'
) size 200k;
select * from v$log_file;
-
Create tablespaces with associated Datafiles
Consider the following tables and design the location for storage of the datafile
Determine if the tablespace is permanent or temporary
-
[User] Data tablespace stores data: tables, snapshots, views,
functions, procedures, and triggers
-
[Index] Data tablespace stores index, primary key constraints
-
[Temporary] Data tablespace stores sort data and is a temporary tablespace type
-
[Rollback] data tablespace stores rollback segments
-
[Work] data tablespace allows the user to create personal tables (helpful for reports)
See DBA Administrative Tasks
-
Create Application role
CREATE ROLE APPLICATION_ROLE NOT IDENTIFIED;
GRANT ANALYZE ANY,
CREATE CLUSTER,
CREATE DATABASE LINK,
CREATE PROCEDURE,
CREATE ROLE,
CREATE SESSION,
ALTER SESSION,
CREATE SEQUENCE,
CREATE SNAPSHOT,
CREATE SYNONYM,
CREATE ANY SYNONYM,
DROP ANY SYNONYM,
CREATE TABLE,
FORCE TRANSACTION,
CREATE TRIGGER,
CREATE VIEW
TO APPLICATION_ROLE;
-
Create User role
CREATE ROLE USER_ROLE NOT IDENTIFIED;
GRANT CREATE DATABASE LINK,
CREATE SESSION,
ALTER SESSION,
CREATE SNAPSHOT,
CREATE SYNONYM,
CREATE TABLE,
CREATE VIEW
TO USER_ROLE;
-
Create table privilege roles (build the schema–assign object privileges latter)
CREATE ROLE APPL_1_ROLE;
CREATE ROLE APPL_2_ROLE;
-
Create application/programmer users
CREATE USER {application_user}
IDENTIFIED BY PASSWORD
DEFAULT TABLESPACE {data tablespace name}
TEMPORARY TABLESPACE {temporary tablespace name}
QUOTA UNLIMITED ON {data tablespace name}
QUOTA UNLIMITED ON {index tablespace name}
QUOTA UNLIMITED ON {temporary tablespace name};
GRANT APPLICATION_ROLE TO {application_user};
GRANT {APPL_1_ROLE} TO {application_user};
-
Create online users
CREATE USER {online_user}
IDENTIFIED BY PASSWORD
DEFAULT TABLESPACE {data tablespace name}
TEMPORARY TABLESPACE {temporary tablespace name}
QUOTA 5M ON {data tablespace name}
QUOTA UNLIMITED ON {index tablespace name}
QUOTA 10M ON {temporary tablespace name};
GRANT {APPL_1_ROLE} TO {online_user};
-
Create data schema (tables,indexes, primary and foreign contraints, snapshots, views, function, packages, procedures, and synonyms)
- Create your tables
- Create primary and foreign key constraints
- Create indexes
- Create Snapshot, Views
- Create Functions, Packages, and Stored Procedures
- Create Database Links
- Create Private and Public Synonyms
-
Assign object priviledges to the table privilege roles
GRANT SELECT,UPDATE,DELETE,INSERT ON myTable TO {APPL_1_ROLE};
GRANT EXECUTE ON myFunction TO {APPL_1_ROLE};