How to manually create data for Oracle10g (Linux)

Source: Internet
Author: User

 

By convention, you should have a few words before writing a blog post. I have been not interested in the database. This is my personal weakness, so I am eager to learn it. In the Oracle video of instructor Xiao Bu, the structure, startup process, and parameter files mentioned in the previous sections will directly take me away.

It is very easy for Oracle to create a database automatically by using the Wizard. It is OK Step by step as prompted. Manual creation is essential for professional personnel. This process now seems difficult (because I didn't pay attention to the details ). However, I spent three nights preparing for the draft. Here, I declare that this article focuses on the process. Through this process, you will have an understanding of manual creation, so it will be cool.

------------- Local Oracle directory structure ------------------------------------------------------------

Ora10

| -- Product

| -- Admin

| -- Ora10

Adump bdump cdump dpdump pfile udump

| -- Oradate

| -- Ora10

| -- 10.2.0

| -- Db_1

| -- DBS

Spfileora10.ora init. ora orapwora10 .....

Bytes ---------------------------------------------------------------------------------------

Understand the creation process of Oracle databases

 

Step 1:SpecifySid

This step is simple. give a name to our database.

Oracle_sidThe length is12Only numbers and letters are allowed, which are case sensitive.

 

Step 2:Make sure the required environment variable settings

Oracle_base

ORACLE_HOME

Oracle_sid

Ora_nls33

Path

LD_LIBRARY_PATH

Warranty RetrievalORACLE_HOME And Oracle_sidThe two options are to be set.

 

[Ora10 @ localhost pfile] $Env | grep oraView environment variables

Oracle_sid = ora10

Oracle_base =/ora10/product

ORACLE_HOME =/ora10/product/10.2.0/db_1

 

[Ora10 @ localhost ~] $Vi. bash_profileView the settings of your local environment

#. Bash_profile

# Get the aliases and functions

If [-f ~ /. Bashrc]; then

.~ /. Bashrc

Fi

# User specific environment and startup programs

Path = $ path: $ home/bin

Export path

Export oracle_base =/ora10/product

Export ORACLE_HOME = $ oracle_base/10.2.0/db_1

Export oracle_sid = ora10

Export LD_LIBRARY_PATH = $ ORACLE_HOME/JDK/fre/lib/i386: $ ORACLE_HOME/JDK/JRE/lib/i386/Server: $ ORACLE_HOME/rdbms/lib: $ ORACLE_HOME/lib: $ LD_LIBRARY_PATH

Export Path = $ ORACLE_HOME/bin: $ path

Export nls_lang = american_america.zhs16gbk

 

[Ora10 @ localhost DBS] $Touch chongshi. envCreateChongshi. envFile

[Ora10 @ localhost DBS] $VI chongshi. envEdit

Oracle_base =/ora10/product

ORACLE_HOME = $ oracle_base/10.2.0/db_1

Oracle_sid =Chongshi

Prompt:The above environment is configured according to the original configuration of your machine. In fact, you need to modifyOracle_sidOther content can be consistent with the previous one. I used it too, onlyORACLE_HOME And Oracle_sidThe two options must be set to avoid environment variable settings. The default value is provided here. Therefore, the content above is simplified.

[Ora10 @ localhost DBS] $Chmod U + x chongshi. envAdd an executable permission to the file

[Ora10 @ localhost DBS] $ LL

Total52

-RWXR -- 1 ora10 DBA 257 07-17 chongshi. env

 

[Ora10 @ localhost DBS] $../Chongshi. envExecution file (with spaces in the middle of the first two points)

[Ora10 @ localhost DBS] $Env | grep oraCheck again that our environment variable has been modified.

Oracle_sid =Chongshi

Oracle_base =/ora10/product

ORACLE_HOME =/ora10/product/10.2.0/dba_1

PromptIn this example, you do not need to use environment variables to switch back to other users. The environment variable becomes the default environment variable. Of course, you still need to execute../Chongshi. env.

 

Step 3:Select a database administrator authentication method

Here we useOracleGroup users directly in and outOracle

[Ora10 @ localhost pfile] $IDView the local ID

Uid = 501 (Ora10) Gid = 501 (DBA) groups = 501 (DBA)

 

Step 4:Create an initialization parameter file

We need to createOracleParameter filePfile/spfile

Pfile/spfileFunction:

OracleYou can configure the database by using a series of parameters. The parameter file is the place where the parameters are stored,OracleThe related configurations are read from the parameters at startup.

How can we configure this parameter file??This seems to beOracleA very good player will do things. After we create a database,OracleThese parameters are automatically generated. All we need to do is create a file.

[Ora10 @ localhost DBS] $Touch initchongshi. ora

AccordingPfile/spfileYou must useInitAddSid.

[Ora10 @ localhost DBS] $VI initchongshi. ora

Db_name = 'chongshi'-----You only need to create this parameter.

 

Step 5:(Windows only) Create a table instance

This tableWindowsThe system is available. The test environment on the local machine isLinux, So skip it directly.

 

Step 6:Connect to an instance

This step is very simple, it is equivalent to entering the database

[Ora10 @ localhost DBS] $Sqlplus/nolog

SQL * Plus: Release 10.2.0.1.0-production on Wed Jul 18 00:12:23 2012

Copyright (c) 1982,200 5, Oracle. All rights reserved.

SQL>Connect/As sysdba

Connected to an idle instance.

If the preceding environment variable settings are incorrect, errors will occur. I got stuck here. Go back and check the environment variables carefully.

 

Step 7:, Create a server parameter file

This step is also very simple. Keep up with the previous step. In the database status, enter the following command to createSpfile

SQL> Create spfile from pfile;

File Created.

SQL>!//ExitSQL

[Ora10 @ localhost DBS] $ LL

Total60

-Rwxr -- r -- 1 ora10 DBA 88 07-18 chongshi. env

-RW ---- 1 ora10 DBA 1544 07-17 hc_ora10.dat

-RW-r -- 1 ora10 DBA 19 07-17 23:33Initchongshi. ora

-RW-r ----- 1 ora10 DBA 12920 initdw. ora

-RW-r ----- 1 ora10 DBA 8385 init. ora

-RW ---- 1 ora10 DBA 24 06-18 23:29 lkora10

-RW-r ----- 1 ora10 DBA 1536 06-18 orapwora10

-RW-r ----- 1 ora10 DBA 2560 07-16 orapwtest

-RW-r ----- 1 ora10 DBA 1536 07-18Spfilechongshi. ora

-RW-r ----- 1 ora10 DBA 3584 07-17 spfileora10.ora

Use the pfile (initchongshi. ora) file to generate the spfile (spfilechongshi. ora) file!

In fact, this step is similar to Step 4 in creating a Startup File. Default. No impact on the future. However,OracleWe recommend that you create a new database.Spfile, Do not create and usePfile.SpfileAndPfileWhat is the difference. The difference between the old and the new is better than the old one.

 

Step 8: Start an instance

[Ora10 @ localhost DBS] $Exit

Exit

SQL>Startup nomountStart Database

Oracle instance started.

Total system global area 113246208 bytes

Fixed size 1218004 bytes

Variable Size 58722860 bytes

Database buffers 50331648 bytes

Redo buffers 2973696 bytes

SQL>

At this time, our background database was not started. Then I enterStartup nomountThe Command actually readsSpfilechongshi. oraFile Content. The previous step is required. Haha!

 

Step 9: Issues the statement for creating a database

In this step, you can create a database by using a command. Note that the name of the database created here is the same as the name set in the parameter file created in step 4.

[Ora10 @ localhost DBS] $Cat initchongshi. ora

Db_name = 'chongshi'

[Ora10 @ localhost DBS] $ exit

Exit

SQL> Create Database chongshi;

Creating a large file is slow. Please wait!

[Ora10 @ localhost DBS] $ LL

Total188628

-Rwxr -- r -- 1 ora10 DBA 88 07-18 chongshi. env

-RW-r ----- 1 ora10 DBA 6078464 07-18Cntrlchongshi. DBF

-RW-r ----- 1 ora10 DBA 81928192 07-18 Dbs1chongshi. DBF

-RW ---- 1 ora10 DBA 1544 07-18Hc_chongshi.dat

-RW ---- 1 ora10 DBA 1544 07-17 hc_ora10.dat

-RW-r -- 1 ora10 DBA 19 07-17 23:33Initchongshi. ora

-RW-r ----- 1 ora10 DBA 12920 initdw. ora

-RW-r ----- 1 ora10 DBA 8385 init. ora

-RW ---- 1 ora10 DBA 24 07-18 21:39 lkchongshi

-RW ---- 1 ora10 DBA 24 06-18 23:29 lkora10

-RW-r ----- 1 ora10 DBA 52429312 07-18Log1chongshi. DBF

-RW-r ----- 1 ora10 DBA 52429312 07-18Log2chongshi. DBF

-RW-r ----- 1 ora10 DBA 1536 06-18 orapwora10

-RW-r ----- 1 ora10 DBA 2560 07-16 orapwtest

-RW-r ----- 1 ora10 DBA 1536 07-18Spfilechongshi. ora

-RW-r ----- 1 ora10 DBA 3584 07-17 spfileora10.ora

The databases we created are highlighted in the above list.

========================================================== ====================================

OK! After a few simple steps above, we have created a complete database because it is too simple to set up. This database is basically unavailable. Although the sparrow is small, the steps are complete.

Difficulties in creating databases manuallyStep 4AndStep 9.

Step 4, because the abovePfileFile Settings are too simple. Step 9: create a more practical database. It is not as simple as a command.

So we will take out the several files we have created and try again. Haha! Are you angry?

Cntrlchongshi. DBF

Dbs1chongshi. DBF

Log1chongshi. DBF

Log2chongshi. DBF

Initchongshi. ora

Spfilechongshi. ora

Don't be angry. According to the operations above, we probably already know the process of manually creating a database. Next, we only need to focus on step 4 and Step 9. I will introduce this in the next section.

 

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.