Create an Oracle database

Source: Internet
Author: User
Tags dedicated server

Preface

It is not enough to install the Oracle software. We still need to create a database on it before learning Oracle normally. Let's take a look at how to create a database.

Oracle Configuration Assistant Database Configuration Assistant (DBCA) is a very convenient Database creation tool provided by Oracle. Let's take a look at using DBCA to create a Database

Create a database

[Oracle @ ebs ~] $ Dbca

Execute the dbca command under the Oracle account to bring up the welcome page

650) this. width = 650; "height =" 548 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R1013314-0.png "alt =" clip_image001 "title =" clip_image001 "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

After the welcome page appears, click Next to continue

650) this. width = 650; "height =" 548 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R1014W6-1.png "alt =" clip_image002 "title =" clip_image002 "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

Select the database creation option and click Next to continue

650) this. width = 650; "height =" 548 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R1013N9-2.png "alt =" clip_image003 "title =" clip_image003 "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

Select the database type as needed and click Next to continue

650) this. width = 650; "height =" 548 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R1013P2-3.png "alt =" clip_image004 "title =" clip_image004 "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

Enter the global database name and ORACLE_SID name. Note: in single-instance mode, the global database name must be consistent with the ORACLE_SID name.) Click Next to continue.

650) this. width = 650; "height =" 548 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R101L05-4.png "alt =" clip_image005 "title =" clip_image005 "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

Do not configure the OEM Enterprise Manager temporarily. Click Next to continue

650) this. width = 650; "height =" 548 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R1012259-5.png "alt =" clip_image006 "title =" clip_image006 "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

Create passwords for sys and system users according to actual needs.) In the exercise environment, the uniform management password oracle is used here. Click Next to continue.

650) this. width = 650; "height =" 548 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R1015244-6.png "alt =" clip_image007 "title =" clip_image007 "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

For convenience, use OMF to manage tablespaces and click Next to continue

650) this. width = 650; "height =" 548 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R10114A-7.png "alt =" clip_image008 "title =" clip_image008 "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

Enable the quick flash back area, follow the default configuration, and click Next to continue

650) this. width = 650; "height =" 548 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R101Ja-8.png "alt =" clip_image009 "title =" clip_image009 "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

The example scheme is added in the exercise mode, so that some sample objects and libraries will exist in the database we created for our learning and use. Click Next to continue.

650) this. width = 650; "height =" 548 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R1013X0-9.png "alt =" clip_image010 "title =" clip_image010 "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

Because 11g adopts the latest automatic memory management mechanism, which is more advanced than 10g SGA automatic management), the default 40% is usually used.

650) this. width = 650; "height =" 548 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R101J32-10.png "alt =" clip_image011 "title =" clip_image011 "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

If the process is complete, you can do 200 exercises.

650) this. width = 650; "height =" 548 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R1013215-11.png "alt =" clip_image012 "title =" clip_image012 "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

After confirming the character set, click Next to continue

650) this. width = 650; "height =" 548 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R1013163-12.png "alt =" clip_image013 "title =" clip_image013 "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

This can be changed based on actual needs. The database in DBCA is used by default. Click Next to continue.

650) this. width = 650; "height =" 548 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R1013529-13.png "alt =" clip_image014 "title =" clip_image014 "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

Select create database and click Finish.

650) this. width = 650; "height =" 620 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R1011N8-14.png "alt =" clip_image015 "title =" clip_image015 "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

After confirming that all the content in the abstract is correct, click OK to start creating the database.

650) this. width = 650; "height =" 339 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R101I46-15.png "alt =" clip_image016 "title =" clip_image016 "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

Now, the Oracle database has been created. Click the exit button to close the page.

650) this. width = 650; "height =" 383 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R1013436-16.png "alt =" clip_image017 "title =" clip_image017 "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

Log on to the console and check that the database is created properly.

Configure Database

[Oracle @ ebs ~] $ Dbca

Execute the dbca command under the Oracle account to bring up the welcome page

650) this. width = 650; "height =" 548 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R1012147-17.png "alt =" clip_image018 "title =" clip_image018 "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

After the welcome page appears, click Next to continue

650) this. width = 650; "height =" 548 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R1013021-18.png "alt =" clip_image019 "title =" clip_image019 "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

Select the database configuration option and click Next to continue

650) this. width = 650; "height =" 548 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R1012K2-19.png "alt =" clip_image020 "title =" clip_image020 "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

Select the database we just created and click Next to continue

650) this. width = 650; "height =" 548 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R1012G0-20.png "alt =" clip_image021 "title =" clip_image021 "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

Select configure OEM and click Next to continue

650) this. width = 650; "height =" 548 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R1012294-21.png "alt =" clip_image022 "title =" clip_image022 "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

Select the Oracle Label Security Option and click Next to continue

650) this. width = 650; "height =" 548 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R1015K3-22.png "alt =" clip_image023 "title =" clip_image023 "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

Add a password for the DBSNMP and SYSMAN accounts, and use oracle again. Click Next to continue.

650) this. width = 650; "height =" 548 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R10153F-23.png "alt =" clip_image024 "title =" clip_image024 "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

Confirm that the connection mode of the dedicated server is basically dedicated server connection.) Click Finish.

Configure the PL/SQL Develop tool

PL/SQL Develop is a very useful integrated client application tool. After PL/SQL Develop is installed, you must install the client program locally and set the Client Connection Program, you can use PL/SQL Develop to connect to a remote database.

Install the Oracle client

Download and decompress the Windows client program, go to the client installation directory, and double-click the setup icon.

650) this. width = 650; "height =" 604 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R10162I-24.png "alt =" clip_image025 "title =" clip_image025 "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

Select the Administrator type in the installation type and click Next to continue

650) this. width = 650; "height =" 604 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R101L93-25.png "alt =" clip_image026 "title =" clip_image026 "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

Select Simplified Chinese and English in the product language, and click Next to continue

650) this. width = 650; "height =" 604 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R1013224-26.png "alt =" clip_image027 "title =" clip_image027 "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

Determine the Oracle base Directory ORACLE_BASE) and Oracle software location ORACLE_HOME according to actual needs), click Next to continue

650) this. width = 650; "height =" 6 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R101J52-27.gif "alt =" clip_image028 "title =" clip_image028 "style =" background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

650) this. width = 650; "height =" 604 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R1015638-28.png "alt =" clip_image029 "title =" clip_image029 "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

There will be some minor problems in the prerequisite check, because we didn't set the parameter. Ignore it all and click Next to continue.

650) this. width = 650; "height =" 604 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R1012022-29.png "alt =" clip_image030 "title =" clip_image030 "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

Click Finish to start installation.

650) this. width = 650; "height =" 604 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R1014206-30.png "alt =" clip_image031 "title =" clip_image031 "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

After the installation is complete, click Close to close the page

Configure PL/SQL Develop

There is a network/admin directory in the client installation directory, which corresponds to the same directory structure on the server. Download the client Connection Program tnsnames. ora on the server to this directory.

650) this. width = 650; "height =" 23 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R101E49-31.png "alt =" clip_image032 "title =" clip_image032 "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

Start the PL/SQL Develop tool and find that it can be connected.

650) this. width = 650; "height =" 207 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R1011220-32.png "alt =" clip_image033 "title =" clip_image033 "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

After determining the user name and password for the connection and the database to be connected, click OK.

650) this. width = 650; "height =" 327 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R101O50-33.png "alt =" clip_image034 "title =" clip_image034 "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

Create an SQL window and execute a query statement. The result is displayed. OK. Then, our PL/SQL has been formally connected to the remote database.

Preface

In the production environment, the database server is often not installed with X-Windows or has no image interface. In this case, we need to use a manual script to create a database, therefore, writing database creation scripts is a basic technology required by Oracle DBAs.

Prerequisites

650) this. length = 650; "height =" 142 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R101L51-34.png "alt =" clip_image001 [4] "title =" clip_image001 [4] "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

Create the folder shown in to store various required files and scripts

Configure the password file

[Oracle @ ebs dbs] $ orapwd file = orapwprod password = oracle entries = 20

Run the preceding command in the dbs directory of ORACLE_HOME to generate a password file. The file name format is orapwSID, And the password is the password of the sys user, entries indicates that the maximum value allowed to connect to sys is 0 by default, that is, unlimited)

Compile the initialization parameter file

[Oracle @ ebs dbs] $ vi initprod. ora

Run the preceding command in the dbs directory of ORACLE_HOME to write the initialization parameter file.

650) this. length = 650; "height =" 161 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R1014626-35.png "alt =" clip_image002 [4] "title =" clip_image002 [4] "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

Shows the file content.

Compile a database creation script

[Oracle @ ebs dbs] $ vi/home/oracle/scripts/createDB. SQL

Run the preceding command to compile the database creation script.

650) this. length = 650; "height =" 443 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R1015036-36.png "alt =" clip_image003 [4] "title =" clip_image003 [4] "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

Shows the script content.

Configure scripts

After writing the database creation script, you also need to write some configuration scripts. After creating the database using the database creation script, you also need to run these configuration scripts to make the database work normally.

[Oracle @ ebs dbs] $ vi/home/oracle/scripts/alterDB. SQL

650) this. length = 650; "height =" 109 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R1011939-37.png "alt =" clip_image004 [4] "title =" clip_image004 [4] "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

Shows the configuration script content.

Create a database

After all preparations are ready, let's start to create a database. Let's take a look at it.

650) this. length = 650; "height =" 479 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R101GX-38.png "alt =" clip_image005 [4] "title =" clip_image005 [4] "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

Run the following commands to create a database:

650) this. length = 650; "height =" 204 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R1015C1-39.png "alt =" clip_image006 [4] "title =" clip_image006 [4] "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

As shown in, the database creation is OK.

650) this. length = 650; "height =" 39 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R101J52-40.png "alt =" clip_image007 [4] "title =" clip_image007 [4] "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

Run the preceding command to run the configuration script.

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

SQL> @? /Sqlplus/admin/help/hlpbld. SQL helpus

After the execution is complete, log on to the database using the system user and execute the preceding two commands. Now the database is fully created and available.

Create an example Scheme

Create two temporary tablespaces and add them to the temporary tablespace group.

650) this. length = 650; "height =" 465 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R1015191-41.png "alt =" clip_image008 [4] "title =" clip_image008 [4] "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

After the temporary tablespace group is created, the script for creating the example scheme is executed.

650) this. length = 650; "height =" 71 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R10162T-42.png "alt =" clip_image009 [4] "title =" clip_image009 [4] "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

Configure Automatic startup script

We can use some configuration scripts to enable and disable Oracle automatically. Let's take a look.

[Root @ ebs ~] # Vi/etc/oratab

650) this. length = 650; "height =" 40 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R101L11-43.png "alt =" clip_image010 [4] "title =" clip_image010 [4] "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

Write the above file and configure the two lines of code to enable the instance to start

[Root @ ebs ~] # Vi/etc/rc. d/init. d/oracle

Run the preceding command to write a self-starting script.

650) this. length = 650; "height =" 827 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R1011143-44.png "alt =" clip_image011 [4] "title =" clip_image011 [4] "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

Shows the script content. After writing the script, do not forget to add execution permissions for it.

650) this. length = 650; "height =" 519 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R1011045-45.png "alt =" clip_image012 [4] "title =" clip_image012 [4] "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

In this way, start OK.

650) this. length = 650; "height =" 68 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131229/1R1015924-46.png "alt =" clip_image013 [4] "title =" clip_image013 [4] "style =" background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px "/>

Load it to the startup service, so that Oracle will automatically start each boot.

This article from the "happy life of cats and bears" blog, please be sure to keep this source http://bearlovecat.blog.51cto.com/1293914/1147585

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.