Create an Oracle database manually)

Source: Internet
Author: User
System Environment:
1. Operating System: Windows 2000 Server

2. Database: Oracle 8i R2 (8.1.6) for NT Enterprise Edition/Oracle 9i for NT Enterprise Edition
3. installation path: D: \ oracle

Steps:

1. manually create related directories
2. manually create an initialization parameter file
3. Create an Oracle service through oradim
4. Create a database
5. Create database data files and execute scripts.
6. Create and run a data dictionary.

Complete steps to manually create a database

System Environment
Operating System: Windows 2000 Server
Database: Oracle 9i
Installation path: C: \ oracle
1. manually create related directories

C: \ oracle \ admin \ Web
C: \ oracle \ admin \ WEB \ bdump
C: \ oracle \ admin \ WEB \ udump
C: \ oracle \ admin \ WEB \ cdump
C: \ oracle \ admin \ WEB \ pfile
C: \ oracle \ admin \ WEB \ create
C: \ oracle \ oradata \ Web
C: \ oracle \ oradata \ WEB \ archive

2. manually create the initialization parameter file c: \ oracle \ admin \ WEB \ pfile \ init. ora. The content can be changed after copying the init. ora file of another instance.
3. manually create the initweb. ora file. Content: ifile = c: \ oracle \ admin \ WEB \ pfile \ init. ora
4. Use the orapwd.exe command to create the password file pwdweb. ora. The command format is as follows:

Orapwd.exe file = c: \ oracle \ ora90 \ database \ pwdweb. ora Password = ltjsb entries = 5

5. Use the oradim.exe command to generate a new instance Management Service in the service.

Set oracle_sid = web
C: \ oracle \ ora90 \ bin \ oradim-New-Sid web-startmode m
-Pfile c: \ oracle \ ora90 \ database \ initweb. ora

6. Create a database and run the createdb. SQL script command,

SQL> sqlplus/nolog
SQL> connect sys/change_on_install as sysdba
SQL> @ createdb. SQL

The content of the createdb. SQL script is as follows:

Set echo on
Spool c: \ oracle \ admin \ mydb \ create \ createdb. Log
Startup nomount pfile = "C: \ oracle \ admin \ WEB \ pfile \ init. ora ";
Create Database Web
Maxinstances 1
Maxloghistory 1
Maxlogfiles 5
Maxlogmembers 5
Maxdatafiles 100
Datafile 'C: \ oracle \ oradata \ WEB \ system01.dbf' size 325 m reuse autoextend on next 10240 K maxsize Unlimited
Undo tablespace "undotbs" datafile 'C: \ oracle \ oradata \ WEB \ undotbs01.dbf' size 200 m reuse autoextend on next 5120 K maxsize Unlimited
Character Set zhs16gbk
National Character Set al16utf16
Logfile group 1 ('C: \ oracle \ oradata \ WEB \ redo01.log') size 100 m,
Group 2 ('C: \ oracle \ oradata \ WEB \ redo02.log ') size 100 m,
Group 3 ('C: \ oracle \ oradata \ WEB \ redo03.log ') size 100 m;
Spool off
Exit;

Note:When creating a database, run the SQL. bsqj script command to create the following content:
Create control files and online log files
Create Database System table empty System
Create a system rollback segment in the system tablespace
Create sys and system accounts
Create base tables and clusters
Create data dictionary tables, indexes, and Sequences
Create related role Permissions
7. Create a database data file and execute the script createfiles. SQL

SQL> sqlplus/nolog
SQL> connect sys/change_on_install as sysdba
SQL> @ createfiles. SQL

The content of the createfiles. SQL script is as follows:

Set echo on
Spool c: \ oracle \ admin \ mydb \ create \ createdbfiles. Log
Create tablespace "indx" logging datafile 'C: \ oracle \ oradata \ WEB \ indx01.dbf' size 25 m reuse autoextend on next 1280 K maxsize unlimited extent management local;
Create temporary tablespace "Temp" tempfile 'C: \ oracle \ oradata \ WEB \ temp01.dbf' size 40 m reuse autoextend on next 640 K maxsize unlimited extent management local;
Alter database default temporary tablespace "Temp ";
Create tablespace "Tools" logging datafile 'C: \ oracle \ oradata \ WEB \ tools01.dbf' size 10 m reuse autoextend on next 320 k maxsize unlimited extent management local;
Create tablespace "users" logging datafile 'C: \ oracle \ oradata \ WEB \ users01.dbf' size 25 m reuse autoextend on next 1280 K maxsize unlimited extent management local;
Create undo tablespace "undotbs" datafile 'C: \ oracle \ oradata \ WEB \ undotbs01.dbf' size 200 m reuse autoextend on next 5120 K;
Spool off
Exit;


8. Create a data dictionary and run the createdbcatalog. SQL script command.

SQL> sqlplus/nolog
SQL> connect sys/change_on_install as sysdba
SQL> @ createdbcatalog. SQL

The content of the createdbcatalog. SQL script is as follows:

Set echo on
Spool c: \ oracle \ admin \ mydb \ create \ createdbcatalog. Log
@ C: \ oracle \ ora90 \ RDBMS \ admin \ catalog. SQL;
@ C: \ oracle \ ora90 \ RDBMS \ admin \ catexp7. SQL;
@ C: \ oracle \ ora90 \ RDBMS \ admin \ catblock. SQL;
@ C: \ oracle \ ora90 \ RDBMS \ admin \ catproc. SQL;
@ C: \ oracle \ ora90 \ RDBMS \ admin \ catoctk. SQL;
@ C: \ oracle \ ora90 \ RDBMS \ admin \ catobtk. SQL;
@ C: \ oracle \ ora90 \ RDBMS \ admin \ caths. SQL;
@ C: \ oracle \ ora90 \ RDBMS \ admin \ owminst. PLB;
Connect system/Manager
@ C: \ oracle \ ora90 \ sqlplus \ admin \ pupbld. SQL;
Connect system/Manager
Set echo on
Spool c: \ oracle \ ora90 \ assistants \ dbca \ logs \ sqlplushelp. Log
@ C: \ oracle \ ora90 \ sqlplus \ admin \ HELP \ hlpbld. SQL helpus. SQL;
Spool off
Spool off
Exit;

9. Complete the database, create a spfile file, and set the database instance startup service to the Automatic startup mode.

SQL> sqlplus/nolog
SQL> connect sys/change_on_install as sysdba
SQL> @ postdbcreation. SQL

Postdbcreation. The SQL script content is as follows:

Set echo on
Spool c: \ oracle \ admin \ WEB \ create \ postdbcreation. Log
Create spfile = 'C: \ oracle \ ora90 \ database \ spfileweb. ora 'from pfile = 'C: \ oracle \ admin \ WEB \ init. ora ';
Connect sys/change_on_install as sysdba
Set echo on
Spool c: \ oracle \ ora90 \ assistants \ dbca \ logs \ postdbcreation. Log
Shutdown;
Startup;

Note: The Path Environment variables are set above. Add the bin directory to the path to facilitate the use of tools such as gmgrll and sqlplus.

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.