Create an Oracle database manually in Linux

Source: Internet
Author: User

As a result, you can create a project by following the steps I have mentioned. If you have any questions, ask me.

Let's take a look at the steps below!

 

1. Set the variables, which are required in the following environment variables and can be easily executed in the script. Change the name to chlaws. env, for example.

Oracle_base =/u01

ORACLE_HOME =/u01/Oracle

# The SID of the database to be created is chlaws.

Oracle_sid = chlaws

Ora_nls33 = $ ORACLE_HOME/ocommon/NLS/admin/Data

Path = $ oralce_home/bin: $ path :.

LD_LIBRARY_PATH = $ ORACLE_HOME/lib: $ LD_LIBRARY_PATH

 

Export oracle_base ORACLE_HOME oracle_sid ora_nls33 path LD_LIBRARY_PATH

 

 

2. Create a pfile: initchlaws. ora.

# Export a pfile whose Sid is equal to chlaws from the spfile of the database later

# Operation: ENV | grep ora: view the SID and find the spfile used by the current database in the DBS directory.

# If there is a database created using dbca with Sid equal to ora9i on my machine, there is a spfileora9i. ora in the DBS directory.

# Execute in Shell

Strings spfileora9i. ora> initchlaws. ora

# Modify initchlaws. ora and replace ora9i with the SID of the database you want to create.

# Here, I will replace it with chlaws, VI initchlaws. ora. In command mode, run 1, $ S/ora9i/chlaws/g

# Note that the parameter in pfile is undo_tablespace = 'undotbs1 ',

# The Name Of The undo tablespace in the following create database Command must be the same as the value of this parameter.

 

 

3. Use orapwd to generate the password file in shell. The DBA account password is admin. By default, sys is sysdba permission, and the password is admin.

Orapwd file = orapwchlaws Password = admin entries = 5;

 

4. Create related folders // SID = chlaws

Create a chlaws folder in the Admin directory, and then create five bdump cdump create pfile udump folders in chlaws.

Create a chlaws folder in the oradata directory, and then create an archive folder in the chlaws directory.

 

 

5. Connect to the database instance

Sqlplus/nolog

Conn/As sysdba

 

6. Create spfile for chlaws such as Sid

Create spfile from pfile

 

7. Place the database in the unmounted state

Startup nomount

 

8. Start creating a database.

# CREATE command: -- view the tzname field of the V $ timezone_names view in time_zone;

# Here, save the command to the SQL script. I am using createchlawsdb. SQL in the $ ORACLE_HOME/chlawsdir/directory.

# If you do not understand the following commands, you can view the Oracle help file. It seems that there is an online file. If not, you can view the corresponding version.

# Creating an Oracle database in chapter 2 of the Administrator's Guide

 

Create Database chlaws

Maxdatafiles 100

Maxinstances 8

Character Set utf8

National Character Set al16utf16

Maxlogfiles 50

Archivelog

Logfile

Group 1 ('$ oracle_base/oradata/chlaws/redo01.log') size 50 m,

Group 2 ('$ oracle_base/oradata/chlaws/redo02.log') size 50 m,

Group 3 ('$ oracle_base/oradata/chlaws/redo03.log') size 50 m

Datafile '$ oracle_base/oradata/chlaws/system01.dbf' size 200 m

Extent management local

Default temporary tablespace temp

Tempfile '$ oracle_base/oradata/chlaws/temptbs01.dbf' size 100 m extent management local

Undo tablespace undotbs1 datafile '$ oracle_base/oradata/chlaws/undotbs01.dbf' size 50 m

Set time_zone = 'Asia/Shanghai ';

 

9. Create an additional tablespace. To put it bluntly, it is the user tablespace.

Create tablespace users logging

Datafile '/u01/oradata/chlaws/users01.dbf'

Size 25 m reuse autoextend on next 1 m maxsize 100 m

Extent management local;

 

10. Run the SQL script to create a data dictionary View

 

Run the following three scripts. The third one is not required.

Catalog. sqlcreates the views of the data dictionary tables, the dynamic performance views, and public

 

Synonyms for versions of the Views. grants public access to the synonyms.

Catproc. sqlruns all scripts required for or used with PL/SQL.

Pupbld. SQL: Creates the product user profile table and related procedures. Running this script will prevent

 

Warning Message each time a user connects to SQL * Plus.

 

Conn sys/admin as sysdba

@/U01/Oracle/rdbms/admin/CATALOG. SQL

@/U01/Oracle/rdbms/admin/catproc. SQL

@/U01/Oracle/rdbms/admin/pupbld. SQL

 

End: Here, a database named chlaws is successfully created. You can create a table to check the results.

The test results are as follows:

SQL> Create Table chlawstb (ID integer, name char (10 ));

 

Table created.

 

SQL> insert into chlawstb values (0, 'chlaws ');

 

1 row created.

 

SQL> select * From chlawstb;

 

ID name

--------------------

0 chlaws

 

SQL>

 

 

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.