Creating databases-with CREATE DATABASE STATEMENT

Source: Internet
Author: User
Tags auth

1. Set SID
In bash
oracle_sid=ocm
Export Oracle_sid


2. Set ENV Vars
Oracle_sid and Oracle_home

3. Choose a Database Administrator authentication Method
Password file
OS Auth

4. Create Init Parameter File
$ORACLE _home/dbs/initocm.ora


6. Connect to the Instance
PASSOWRD file Auth
$ sqlplus/nolog
Sql> CONNECT SYS as SYSDBA

OS Auth
$ sqlplus/nolog
Sql> Connect/as SYSDBA


7. Create SPFile
CREATE SPFILE from PFILE;

8. Start instance in Nomount
Sql>start Nomount


9. Issue CREATE DATABASE STATEMENT

(1) Please create the OCM directory in $ORACLE _base/oradata/folder before run below commands
(2) Make sure the db_name and undo_tablespace value of the pfile match what in the CREATE DATABASE statement

CREATE DATABASE OCM
USER SYS identified by pehz123q
USER SYSTEM identified by pehz123q
LOGFILE GROUP 1 ('/opt/oracle/oradata/ocm/redo01a.log ', '/opt/oracle/oradata/ocm/redo01b.log ') SIZE 100M BLOCKSIZE 512 ,
GROUP 2 ('/opt/oracle/oradata/ocm/redo02a.log ', '/opt/oracle/oradata/ocm/redo02b.log ') SIZE 100M BLOCKSIZE 512,
GROUP 3 ('/opt/oracle/oradata/ocm/redo03a.log ', '/opt/oracle/oradata/ocm/redo03b.log ') SIZE 100M BLOCKSIZE 512
Maxlogfiles 5
Maxlogmembers 5
Maxloghistory 1
Maxdatafiles 100
CHARACTER SET Al32utf8
National CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
DataFile '/opt/oracle/oradata/ocm/system01.dbf ' SIZE 325M reuse
Sysaux datafile '/opt/oracle/oradata/ocm/sysaux01.dbf ' SIZE 325M reuse
DEFAULT tablespace Users
DataFile '/opt/oracle/oradata/ocm/users01.dbf '
SIZE 500M Reuse autoextend on MAXSIZE UNLIMITED
DEFAULT Temporary tablespace tempts1
Tempfile '/opt/oracle/oradata/ocm/temp01.dbf '
SIZE 20M Reuse
UNDO tablespace OCM_UNDOTBS1
DataFile '/opt/oracle/oradata/ocm/undotbs01.dbf '
SIZE 200M Reuse autoextend on MAXSIZE UNLIMITED;


(2) SAMPLE 2, use OMF
SET db_create_file_dest= '/u01/app/oracle/oradata ' in SPFILE
Db_create_file_dest
Db_create_online_log_dest_n
Db_recovery_file_dest

CREATE DATABASE mynewdb
USER SYS identified by Sys_password
USER SYSTEM identified by System_password
EXTENT MANAGEMENT LOCAL
DEFAULT Temporary Tablespace Temp
UNDO tablespace UNDOTBS1
DEFAULT tablespace users;


Create additional tablespaces

CREATE tablespace Apps_tbs LOGGING
DataFile '/opt/oracle/oradata/ocm/apps01.dbf '
SIZE 500M Reuse autoextend on NEXT 1280K MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL;

--Create a tablespace for indexes, separate from user tablespace (optional)
CREATE tablespace Indx_tbs LOGGING
DataFile '/opt/oracle/oradata/ocm/indx01.dbf '
SIZE 100M Reuse autoextend on NEXT 1280K MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL;


11.Run Scripts to Build Data Dictionary views

Login as SYSDBA
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql

Login as SYSTEM
@?/sqlplus/admin/pupbld.sql


Install other options on Oracle Database Reference online Book
Back up the Database.
Enable Automatic Instance Startup


#################################################
What does the CREATE DATABASE do?
The actual operations performed depend on the clauses so you specify in the CREATE DATABASE statement and the Initializa tion parameters that you have set.
Basicly it do the following things
Creates the data files for the database
Creates the control files for the database
Creates the redo log files for the database and establishes the ARCHIVELOG mode
Creates the SYSTEM tablespace
Creates the Sysaux tablespace
Creates the data dictionary
Sets the character set that stores data in the database
Sets the database time zone
Mounts and opens the database for use



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.