ORACLE 10G manual database creation, oracle10 G manual database creation

Source: Internet
Author: User

ORACLE 10G manual database creation, oracle10 G manual database creation

Original Works are from the blog of "Deep Blue blog". You are welcome to reprint them. Please note the following source when reprinting them. Otherwise, you will be held legally liable for copyright.

Deep Blue blog: http://blog.csdn.net/huangyanlong/article/details/43926321

 

Step 1: Directory

-- Database file directory

$ Cd $ ORACLE_BASE/oradata

$ Ls

-- View the SID of an existing database

PROD

$ Pwd

-- Check the absolute path.

/U01/app/oracle/oradata

$ Mkdir HYL

$ Ls-l

-- Production: Check the Directory and permissions

-- Plan different disk directories for storing data files. The plan here depends on the actual situation.

$ Cd HYL

$ Mkdir dump disk1 disk2 disk3 disk4 disk5

-- Disk indicates different disks, which are used to prepare for file diversification.

$ Cd dump

$ Mkdir bdump cdump udump

-- Three directories are created for different dump files.

 

Step 2: Permission

$ Chown-R oracle: oinstall/u01/app/oracle/oradata/HYL

-- Grant the HYL directory created in the previous step to the oracle user

-- The above file path and dump file path should all be in this directory, and the database creation can be completed only when the permission is correct

$ Chmod-R 755 HYL

-- Grant the access permission to the HYL directory. The permission level is 755.

Step 3: Initialize Parameters

-- In this step, the initialization parameter file must be created.

$ Cd $ ORACLE_HOME/dbs

-- Store the initialization parameter file of the database in this directory. We need to create a pfile file in this directory.

$ Vi initHYL. ora

-- The initialization parameter is named init and SID.

Sga_target = 400 M -- generally, the total memory size is 80% of the physical memory, and sga accounts for 80% of the total memory size (representing the relationship between sga: pga =)-The following is the data name, the initial plan is SID Name db_name = HYL -- The following is the control file path, it is recommended that the control files in different paths be named control_files = '/u01/app/oracle/oradata/HYL/disk1/control01.ctl' with the same name ', '/u01/app/oracle/oradata/HYL/disk2/control01.ctl ', '/u01/app/oracle/oradata/HYL/disk3/control01.ctl' -- below is the undo tablespace information undo_management = autoundo_tablespace = undotbs -- below is the Three dump files user_dump_dest =/u01/app /oracle/oradata/HYL/dump/dumps =/u01/app/oracle/oradata/HYL/dump/bdumpcore_dump_dest =/u01/app/oracle/oradata/HYL/dump/cdump

 

Step 4: Start the database to nomount

$ Export ORACLE_SID = HYL

$ Sqlplus '/as sysdba'

SQL> startup nomount;

 

Step 5: Compile database creation statements using official documents

For more information about the official documentation, see:Http://blog.csdn.net/huangyanlong/article/details/43925813

-- Delete unnecessary settings based on the actual modification script

-- Diversity of log group members

-- Modify the path information according to the actual situation.

CREATE DATABASE HYL

Logfile group 1 ('/u01/app/oracle/oradata/HYL/disk1/redo01a. log ',

'/U01/app/oracle/oradata/HYL/disk2/redo01b. log ')

SIZE 100 M,

GROUP 2 ('/u01/app/oracle/oradata/HYL/disk1/redo02a. log ',

'/U01/app/oracle/oradata/HYL/disk2/redo02b. log ')

SIZE 100 M,

GROUP 3 ('/u01/app/oracle/oradata/HYL/disk1/redo03a. log ',

'/U01/app/oracle/oradata/HYL/disk2/redo03b. log ')

SIZE 100 M

Character set zhs16gbk

National character set AL16UTF16

EXTENT MANAGEMENT LOCAL

DATAFILE '/u01/app/oracle/oradata/HYL/disk3/system01.dbf' SIZE 325 M REUSE

Sysaux datafile '/u01/app/oracle/oradata/HYL/sysaux01.dbf' SIZE 325 M REUSE

Default temporary tablespace tempts1

TEMPFILE '/u01/app/oracle/oradata/HYL/disk4/temp01.dbf'

SIZE 20 M REUSE

Undo tablespace undotbs

DATAFILE '/u01/app/oracle/oradata/HYL/disk5/undotbs01.dbf'

SIZE 200 m reuse autoextend on maxsize unlimited;

 

-- Place the preceding script in the oracle directory and execute

$ Cd/u01/app/oracle/

$ Vi createDB. sh

SQL> @/u01/app/oracle/createDB. sh

 

Step 6: run the script

SQL> @? /Rdbms/admin/catalog. SQL

-- About 2 minutes. function: create a data dictionary

SQL> @? /Rdbms/admin/catproc. SQL

-- In about 5 minutes, the database has been created after the two scripts are run. Role: Create a stored procedure and Package

SQL> conn system/manager

SQL> @? /Sqlplus/admin/pupbld. SQL

-- Run this script with conn system/manager in about 1 minute: set some packages of sqlplus so that other users can log on to sqlplus.

SQL> conn/as sysdba

SQL> select instance_name, status from v $ instance;--Check the status. The database should be open.

 

Step 7: optimize database creation

To avoid the use of system tablespace when creating other users and objects, a new user tablespace is used by default by other new users. Because the data dictionary is stored in the system tablespace, new users or objects are stored in the system tablespace by default, which affects the database performance.

This problem can be solved in the early stage of database creation script writing. However, this error is caused by the reference statements provided in the official documentation, so we can create the default tablespace manually after creating the database. This problem is solved in the reference provided by the official documentation in the 11G.

(See article: http://blog.csdn.net/huangyanlong/article/details/43926437)

SQL> create tablespace users datafile '/u01/app/oracle/oradata/HYL/disk3/user01.dbf' size 100 m autoextend on next 50 m maxsize unlimited;

-- Create a new tablespace for use as the default tablespace

SQL> alter database default tablespace users;

-- Change the default tablespace of the database to users.


Now the manual database creation is complete.

 

Original Works are from the blog of "Deep Blue blog". You are welcome to reprint them. Please note the following source when reprinting them. Otherwise, you will be held legally liable for copyright.

Deep Blue blog: http://blog.csdn.net/huangyanlong/article/details/43926321

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.