Oracle Manual Build library under Linux

Source: Internet
Author: User

When the database name and physical structure are the same as the existing databases, the original information will be overwritten;

To create a database preparation:

1. Plan database tables and indexes to evaluate footprint

2. Plan the database will contain the basic operating system file layout, reasonable file distribution can improve the performance of the database

The Redo log files can be placed on no disk or tape, reducing data file contact

Fast recovery files need to be placed in a different directory than the data file, preferably partitioned

The simplest is a fool's use of ready-made database creation

3. Create a database name by setting the db_name and Dn_domain initialization parameters, preferably including a database mesh structure

4. Try to familiarize yourself with most of the initialization parameter files

5. Select a database

6. Select the database character set

Basic steps:

1) Specify a SID

2) Create the required file directory

3) Create initialization parameter file Pfile

4) Determine the database authentication method, if based on password authentication, create a password file

5) Write the CREATE database script

6) Connect instance, boot to Nomount state, execute Create script

7) Execute individual creation scripts to refine the database

This test is operated under Redhat 4, and if it does not change much in Windows, note that the file writing format of the two systems is inconsistent with the individual commands.

Lab Environment: Redhat Linux 4 + oracle10g

1. First set the SID of the Oracle to be created, if the variable is set in the. bash_profile file, it is not set.

View:

$env | grep ORA

oracle_sid=***//Display the current DB instance name

root directory of Oracle_base=/opt/app/oracle//oracle

Oracle_home= $ORACLE _base/product/10.2.0/db_1//oracle Product Catalog

If it is not set, set it manually, and you will need to set it manually if you want to run multiple instances of Oracle on one server.

$export Oracle_sid=mydb

2. Create the required diagnostic directories, which are required by the Oracle process when it encounters an error or user manual trace.

$mkdir-P $ORACLE _base/admin/mydb/adump

$mkdir-P $ORACLE _base/admin/mydb/bdump

$mkdir-P $ORACLE _base/admin/mydb/cdump

$mkdir-P $ORACLE _base/admin/mydb/udump

$mkdir-P $ORACLE _base/admin/mydb/pfile

Create an Oracle data file directory

$mkdir-P $ORACLE _base/oradata/mydb

3. Create a parameter file for ORACLE $oracle_home/dbs/initmydb.ora

Here, for the novice, may not know so many parameters and specific use, so, here is to provide a relatively lazy approach, is to use the database created by the DBCA parameter file as a template, slightly modified, although it is a universal one, and relatively simple, but it does have a worthy reference side, Novice may wish to try first, through the official documents to understand the meaning of each parameter, pondering, proficiency after writing a.

Method One:

$CD $ORACLE _home/dbs//general default database initialization parameter file repository

###########################################

If you have a Initaaa.ora file, use the command

$cat Initaaa.ora >> Initmydb.ora//initaaa.ora is a database parameter file created by DBCA

###########################################

If only Spfileaa.ora, use the command

$strings Spfileaaa.ora | more//Read binary files, copy content directly with the mouse

$vi Initmydb.ora//Paste the contents of the above copy

$vi Initmydb.ora

:%s/name/mydb/g//Replace all strings of name with MyDB in text

: wq! Save

Method Two:

$CD $ORACLE _home/dbs

$vi Initmydb.ora//paste the following parameters in the text

##############################################################################

# Copyright (c) 1991, 2001, 2002 by Oracle Corporation

##############################################################################

###########################################

# SGA Memory

###########################################

sga_target=287309824

###########################################

# Job Queues

###########################################

job_queue_processes=10

###########################################

# Miscellaneous

###########################################

compatible=10.2.0.1.0

###########################################

# Security and Auditing

###########################################

Audit_file_dest=/opt/app/oracle/admin/mydb/adump

Remote_login_passwordfile=exclusive

###########################################

# Sort, Hash Joins, Bitmap Indexes

###########################################

pga_aggregate_target=95420416

###########################################

# Database Identification

###########################################

db_domain=jmu.edu.cn

Db_name=mydb

###########################################

# File Configuration

###########################################

control_files= ("/opt/app/oracle/oradata/mydbcontrol01.ctl", "/opt/app/oracle/oradata/mydbcontrol02.ctl", "/opt/ App/oracle/oradata/mydbcontrol03.ctl ")

###########################################

# Cursors and Library Cache

###########################################

open_cursors=300

###########################################

# System Managed Undo and Rollback segments

###########################################

Undo_management=auto

Undo_tablespace=undotbs1

###########################################

# Diagnostics and Statistics

###########################################

Background_dump_dest=/opt/app/oracle/admin/mydb/bdump

Core_dump_dest=/opt/app/oracle/admin/mydb/cdump

User_dump_dest=/opt/app/oracle/admin/mydb/udump

###########################################

# Processes and Sessions

###########################################

processes=150

###########################################

# Cache and I/O

###########################################

db_block_size=8192

Db_file_multiblock_read_count=16

4. Create a password file

Orapwd file= $ORACLE _home/dbs/orapwmydb password=oracle entries=5 force=y

5. Create Oracle's Build library script Createdb.sql, which reads as follows:

Set echo on

Spool/home/oracle/createdb.log//installation process information output to CreateDB.log

You can see if an error occurred after installation

CREATE DATABASE "MyDB"

Maxinstances 8

Maxloghistory 1

Maxlogfiles 16

Maxlogmembers 3

Maxdatafiles 100

DataFile

'/opt/app/oracle/oradata/mydb/system01.dbf ' SIZE 300M reuse autoextend on

NEXT 10240K MAXSIZE UNLIMITED

EXTENT MANAGEMENT LOCAL

Sysaux datafile

'/opt/app/oracle/oradata/mydb/sysaux01.dbf ' SIZE 120M reuse autoextend on

NEXT 10240K MAXSIZE UNLIMITED

Smallfile DEFAULT temporary tablespace TEMP tempfile

'/opt/app/oracle/oradata/mydb/temp01.dbf ' SIZE 20M reuse autoextend on

NEXT 640K MAXSIZE UNLIMITED

Smallfile UNDO tablespace "UNDOTBS1" datafile

'/opt/app/oracle/oradata/mydb/undo01.dbf ' SIZE 200M reuse autoextend on

NEXT 5120K MAXSIZE UNLIMITED

LOGFILE

GROUP 1 ('/opt/app/oracle/oradata/mydb/redo1.dbf ') SIZE 51200K,

GROUP 2 ('/opt/app/oracle/oradata/mydb/redo2.dbf ') SIZE 51200K,

GROUP 3 ('/opt/app/oracle/oradata/mydb/redo3.dbf ') SIZE 51200K

CHARACTER SET ZHS16GBK

National CHARACTER SET Al16utf16;

Spool off

6. Start the database creation

Start Database to Nomount state

$sqlplus/nolog

Sql>conn Sys/oracle as Sysdba

Sql>startup Nomount

Start execution Create DATABASE script

Sql>@/home/oracle/createdb.sql//@+ You write the full path of the Createdb.sql script, the table executes

7. Once the database is created, create the Oracle data dictionary.

Sql>@?/rdbms/admin/catalog.sql//The data dictionary file used to create the database

Sql>@?/rdbms/admin/catproc.sql//The basic procedures and packages used to create the database

Sql>@?/rdbms/admin/catexp.sql//export required view is created by Catexp.sql

Execute AS System identity

Sql>conn system/oracle

Sql>@?/sqlplus/admin/pupbld.sql

It is generally recommended that you create a spfile (dynamic initialization parameter file) and start with SPFile the next time you start

Sql>create SPFile from Pfile

Restart the database, check again, confirm the error

Sql>shutdown Immediate

Sql>startup

Sql>select * from dual;

Sql>show parameter service_name

Oracle Manual Build library under Linux

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.