Windows Oracle 10 Gb manual database creation

Source: Internet
Author: User

There are two methods to create a database in Oracle.

The first is to use ORACLE database builder and dbca, which is a graphical interface and easy to understand because of its friendly and beautiful interface and complete prompts. In Windows, this tool can be opened in the Oracle program group ("START"-"program"-"Oracle oradb10g_home1"-"configuration and migration tools"-"database configurationassistant "), you can also directly enter dbca in the command line ("START"-"run"-"cmd") tool.

Another method is to create a database manually. This is what we will talk about below. Manual database creation is more troublesome than dbca database creation. However, if we have learned how to manually create a database, we can better understand the architecture of the Oracle database.

Manual database creation requires several steps, each of which is critical. It includes:
1. create necessary Directories
2. Create an initialization parameter file
3. Set the environment variable oracle_sid.
4. Create an instance
5. Create a password file
6. Start the database to the nomount (Instance) Status
7. Execute the database creation script
8. Execute catalog to create a data dictionary.
9. Run catproc to create a package.
10. Run pupbld.
11. Create a spfile file from the initialization parameter file
12. Execute the Scott script to create the Scott mode.

After completing the above steps, you can use "SQL> alter database open;" to open the normal use of the database.

Next, I will use the above steps as an experiment. Lab System Platform: Windows Server 2000 Database System Version: Oracle Database 10g Oracle installation path: D disk. Created database name: Book

1. Open the command line tool and create related directories.
C:/> mkdir D:/Oracle/product/10.1.0/admin/book
C:/> mkdir D:/Oracle/product/10.1.0/admin/book/bdump
C:/> mkdir D:/Oracle/product/10.1.0/admin/book/udump
C:/> mkdir D:/Oracle/product/10.1.0/admin/book/cdump
C:/> mkdir D:/Oracle/product/10.1.0/admin/book/pfile
C:/> mkdir D:/Oracle/product/10.1.0/admin/book/create
C:/> mkdir D:/Oracle/product/10.1.0/oradata/book
You can also create a directory on the GUI of windows. Where

D: The subdirectories in the/Oracle/product/10.1.0/admin/book directory are mainly used to store tracking information during database operation. The two most important sub-directories are the bdump and udump directories. The bdump directory stores the tracking information of various background processes in the database's dynamic process. The alert file is a warning file, the file name is called alert_book.log. When a database encounters a problem, you can first view the file to find out the cause. You can also find the cause of various problems during manual creation. The udump directory stores trace information related to specific sessions. D: The/Oracle/product/10.1.0/oradata/book directory stores various database files, including control files, data files, and redo log files.

2. Create an initialization parameter file
When starting the database system, you must use the initialization parameter file settings to allocate memory and start necessary background processes. Therefore, whether the initialization parameter file is created correctly or whether the parameter settings are correct is related to the "fate" of the entire database ". To create an initialization parameter file, you can copy the current initialization parameter file and modify it as needed.
Manually write it out in one sentence, because the structure of the initialization parameter file is basically the same. When we install Oracle, the system has installed a database named orcl for us, so we can get an initialization parameter file from it. Open D:/Oracle/product/10.1.0/admin/orcl/pfile and find init. ora file, copy it to D:/Oracle/product/10.1.0/bd_1/Databse, and rename it initbook. ora. Open initbook. ora in notepad and modify the following content: db_domain = ""
Db_name = book
Control_files = ("D:/Oracle/product/10.1.0/oradata/book/control01.ctl ",
"D:/Oracle/product/10.1.0/oradata/book/control02.ctl ",
"D:/Oracle/product/10.1.0/oradata/book/control03.ctl") undo_management = auto
Undo_tablespace = undotbs1
-Note that the "undotbs1" here must correspond to the database creation step.
Background_dump_dest = D:/Oracle/product/10.1.0/admin/book/bdump
Core_dump_dest = D:/Oracle/product/10.1.0/admin/book/cdump
User_dump_dest = D:/Oracle/product/10.1.0/admin/book/udump

3. Open the command line and set the environment variable oracle_sid.
C:/> set oracle_sid = book. Set the environment variable to book by default.

4. Create an instance (that is, the background Control Service)
C:/> oradim-New-Sid book oradim is the name of the tool program used to create the instance.-New indicates that the new instance is executed, and-delete indicates that the instance is deleted, -Sid: specify the name of the victim.

5. Create a password file
C:/> orapwd file = D:/Oracle/product/10.1.0/db_1/database/pwdbook. ora Password = bookstore entries = 2
Orapwd is the name of the worker program used to create the password file. The file parameter specifies the Directory and file name of the password file, and the password parameter specifies the password of the Sys user, the entries parameter specifies the number of users with DBA permissions in the database. Of course, there is also a force parameter. I believe you do not mean it, so I will not detail it here. Note that the command here requires a line of input, and line breaks are not allowed in the middle; otherwise, unnecessary errors may occur. The password file is used to store the password of a sys user. Because a sys user is responsible for creating a database, starting a database, and shutting down the database, the password file is separately stored in the password file as a sys user, in this way, password verification can also be performed when the database is opened at the end.

6. Start data
Database to nomount (Instance) status C:/> sqlplus/nolog SQL * Plus: Release on Wednesday June 29

23:09:35 2005 copyright 1982,2004, Oracle. All rights reserved.

SQL> connect sys/bookstore as sysdba
--- In this example, sys is used to connect to a database that has been connected to an idle routine.
SQL> startup nomount Oracle routine has been started.
Total system global area 319888364
Bytes fixed size 453612 bytes
Variable Size 209715200 bytes
Databasebuffers 109051904 bytes
Redo buffers 667648 bytes

7. Execute the database creation script
To execute the database creation script, you must first have the database creation script. (Where can I find the database creation script? I have no !) Don't worry, please proceed. There are two methods to obtain a database creation script that meets your requirements. One is to use dbca to create a database on your computer and follow the prompts to perform the script step by step, when completing step 1, select "generate database creation script". After that, you can find the script in the corresponding directory and fix it as needed. Another method is to manually write a database creation script. This is also the method to be used here. Use notepad to edit the following content, and save it as a file name with the suffix (*. SQL) SQL script, saved here to the root directory of the E disk, and the file name is called book. SQL.

Create Database book datafile 'd:/Oracle/product/10.1.0/oradata/book/system01.dbf 'size 300 m Reuse
Autoextend on next 10240 kmaxsize unlimited extent management local sysaux datafile
'D:/Oracle/product/10.1.0/oradata/book/sysaux01.dbf 'size 120 m reuse autoextend on next 10240 K
Maxsize unlimited default temporary tablespace temp tempfile
'D:/Oracle/product/10.1.0/oradata/book/temp01.dbf 'size 20 m reuse autoextend on next 640 kmaxsize unlimited undo tablespace "undotbs1"
-- Note that the Undo tablespace corresponds to the datafile of the parameter file.
'D:/Oracle/product/10.1.0/oradata/book/undotbs01.dbf 'size 200 m reuse autoextend on next 5120 K
Maxsize unlimited logfile
Group 1 ('d:/Oracle/product/10.1.0/oradata/book/redo01.log ') size 10240 K,
Group 2 ('d:/Oracle/product/10.1.0/oradata/book/redo02.log ') size 10240 K, group 3 ('d: /Oracle/product/10.1.0/oradata/book/redo03.log ') size 10240 K and then execute the newly created database creation script:
SQL> Start E:/book. SQL

8. Execute catalog to create a data dictionary.
SQL> Start D:/Oracle/product/10.1.0/db_1/rdbms/admin/CATALOG. SQL

9. Run catproc to create a package.

SQL> Start
D:/Oracle/product/10.1.0/db_1/rdbms/admin/catproc. SQL

10. Run pupbld.
Before executing pupbld, you must convert the current user (sys) to system, that is, connect to the database using the system account. Because the database is just created, the system password is the default password of the system, that is, the manager. You can reset the account password after the database is created.
SQL> connectsystem/Manager
SQL> Start D:/Oracle/product/10.1.0/db_1/sqlplus/admin/pupbld. SQL

11. Initiated Parameters
Create a spfile File

SQL> Create spfile from pfile;

12. Execute the Scott script to create the Scott mode.

SQL> Start
D:/Oracle/product/10.1.0/db_1/rdbms/admin/Scott. SQL

13. Open the database to a normal state

SQL> alter database open;

14. Connect to the database with Scott (password: Tiger) and test whether the new database can run normally. The whole database has been created. Then you can create your own account, table space, and database objects on this database.
Description in multiple places.

Note: I originally wanted to create an oracle instance on Linux. I used this document for a long time and found that this method can only be used on Windows. Dizzy. The Oracle 11g is mounted on the sub-host. It is a little different from Oracle 10g:
Without careful research, we found that the directories in Amin are different:
In Oracle 10 Gb, bdump, udump, cdump, pfile, and create
Oracle 11g only has three options: adump, dpdump, and pfile. Study now.
I still want to manually create one in Linux.

There is no oradim command in UNIX and Linux, because it is useless. oradim is mainly used to control services. Oracle instances on Unix/Linux do not need to establish services, so there is no such command.

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: 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.