Create an Oracle 11g database using commands

Source: Internet
Author: User

Create an Oracle 11g database using commands

This document describes how to create an Oracle database that complies with the OFA specification using the create database Command of the Oracle database.

1. Set the environment variable (vi. bash_profile or save it as an executable file for creation)

ORACLE_BASE =/u01/app

ORACLE_HOME = $ ORACLE_HOME/oracle

ORACLE_SID = hsj

PATH = $ ORACLE_HOME/bin: $ PATH

LD_LIBRARY_PATH = $ ORACLE_HOME/lib: $ LD_LIBRARY_PATH

DISPLAY = 192.168.138.1: 0.0

Export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH LD_LIBRARY_PATH DISPLAY

2. Create some directories (log directory, data file directory, control file directory, and archive directory)

Mkdir-p/u01/app/flash_recovery_area/hsj

Mkdir-p/u01/app/diag/rdbms/hsj # used to store alert trace logs

Mkdir-p/u01/app/oradata/hsj/archive # is used to store archived logs. The upper-level directory is used to store control files, data files, and online log files.

Mkdir-p/u01/app/admin/hsj/adump

Mkdir-p/u01/app/admin/hsj/dpdump

Mkdir-p/u01/app/admin/hsj/pfile

Mkdir-p/u01/app/admin/hsj/scripts

3. Create the parameter file inithsj. ora and use inithsj. ora to create a spfile. The spfile must be stored in the $ ORACLE_HOME/dbs/directory.

Mkdir

Inithsj. ora File class (some parameters need to be modified according to the actual environment)

V inithsj. ora

Hsj. _ db_cache_size = 327155712

Hsj. _ java_pool_size = 4194304

Hsj. _ large_pool_size = 4194304

Hsj. _ oracle_base = '/u01/app' # ORACLE_BASE set from environment

Hsj. _ pga_aggregate_target = 331350016

Hsj. _ sga_target = 490733568

Hsj. _ shared_io_pool_size = 0

Hsj. _ shared_pool_size = 146800640

Hsj. _ streams_pool_size = 0

Audit_file_dest = '/u01/app/admin/hsj/adump'

Audit_trail = 'db'

Compatible = '11. 2.0.0.0'

Control_files = '/u01/app/oradata/hsj/control01.ctl', '/u01/app/flash_recovery_area/hsj/control02.ctl'

DB _ block_size = 8192

Db_domain =''

Db_name = 'hsj'

Db_recovery_file_dest = '/u01/app/flash_recovery_area'

Db_recovery_file_dest_size = 4039114752

Diagnostic_dest = '/u01/app'

Dispatchers = '(PROTOCOL = TCP) (SERVICE = hsjXDB )'

Log_archive_format = '% t _ % s _ % r. dbf'

Memory_target = 818937856

Nls_language = 'American'

Open_cursors = 300

Remote_login_passwordfile = 'clusive'

Undo_tablespace = 'undotbs1'

Sqlplus/as sysdba

Create spfile from pfile # Make sure it is in the dbs directory. Otherwise, you must specify the path and name of the pfile.

4. Start the database to the nomount status.

Startup nomount;

5. Create the database script createdb. SQL

Spool createdb. log

Create database hsj

User sys identified by root

User system identified by root

Logfile group 1

('/U01/app/oradata/hsj/redo01.log') size 50 M blocksize 512,

Group 2

('/U01/app/oradata/hsj/redo02.log') size 50 M blocksize 512,

Group 3

('/U01/app/oradata/hsj/redo03.log') size 50 M blocksize 512

Maxlogfiles 30

Maxlogmembers 5

Maxloghistory 1

Maxdatafiles 100

Character set al32utf8

National character set al16utf16

Extent management local

Datafile '/u01/app/oradata/hsj/system01.dbf' size 300 M reuse

Sysaux datafile '/u01/app/oradata/hsj/sysaux01.dbf' size 300 M reuse

Default tablespace users

Datafile '/u01/app/oradata/hsj/users01.dbf' size 300 M reuse

Autoextend on maxsize unlimited

Default temporary tablespace tempts1

Tempfile '/u01/app/oradata/hsj/temp01.dbf' size 20 M reuse

Undo tablespace UNDOTBS1

Datafile '/u01/app/oradata/hsj/undotbs01.dbf'

Size 200 M reuse autoextend on maxsize unlimited;

Spool off

6. Go to sqlplus and execute the database creation script.

@ Createdb. SQL

7. If an error is reported, check the createdb. log alert log and trace log.

8. Go to the $ ORACLE_HOME/rdbms/admin directory and run the SQL statement used to create the data dictionary and system package.

@ Catalog. SQL

@ Catproc. SQL

-------------------------------------- Split line --------------------------------------

Oracle 11g installation manual on RedHat Linux 5.8 _ x64 Platform

Installing Oracle 12C in Linux-6-64

Install Oracle 11gR2 (x64) in CentOS 6.4)

Steps for installing Oracle 11gR2 in vmwarevm

Install Oracle 11g XE R2 In Debian

Related Article

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.