How to manually create an Oracle database

Source: Internet
Author: User

The following lab is a detailed step to manually create a database through Oracle ONLINE Help document instead of creating an Oracle database through DBCA:

1, Edit Oracle Profile
[Email protected] ~]# su-oracle
[Email protected] ~]$ Vi./.bash_profile
Path= $PATH: $HOME/bin

Export PATH
Export Oracle_base=/u01/app/oracle
Export Oracle_home= $ORACLE _base/product/10.2.0/db_1
Export Oracle_sid=prod
Export path= $ORACLE _home/jdk/bin: $ORACLE _home/bin: $PATH
Export Ld_library_path= $ORACLE _home/lib

2. Create a directory of the corresponding Oracle data files
[Email protected] ~]$ mkdir-p/u01/app/oracle/oradata/prod/disk1
[Email protected] ~]$ mkdir-p/u01/app/oracle/oradata/prod/disk2
[Email protected] ~]$ mkdir-p/U01/APP/ORACLE/ORADATA/PROD/DISK3
[Email protected] ~]$ mkdir-p/u01/app/oracle/admin/prod/{a,b,c,u,dp}dump

3, create the password file for the ORACLE database
[[[email protected] ~]$ cd $ORACLE _home/dbs
[[email protected] dbs]$ ll
Total
-rw-r-----1 Oracle Oinstall 12920 may  3  2001 Initdw.ora
-rw-r-----1 Oracle oinstall  838 5 Sep 11  1998 Init.ora
[[email protected] dbs]$ orapwd
usage:orapwd file=<fname> password=< Password> entries=<users> force=<y/n>

  WHERE
    file-name of password file (mand),
    Password-password for S YS (Mand),
    entries-maximum number of distinct DBA and     force-whether to O Verwrite existing file (opt),
Opers (opt),
  There is no spaces around the equal-to (=) character.
[[email protected] dbs]$ orapwd file=orapwprod password=oracle entries=5 force=y;
[[email protected] dbs]$ ll
Total
-rw-r-----1 Oracle Oinstall 12920 may  3  2001 initdw.ora< BR>-RW-R-----1 Oracle oinstall  8385 SEP 11  1998 Init.ora
-rw-r-----1 Oracle oinstall  2048 Nov 25 20 : Orapwprod

4. Create a parameter file for the startup database
[Email protected] dbs]$ VI Initprod.ora
db_block_size=8192
Db_name=prod
control_files= ('/u01/app/oracle/oradata/prod/disk1/control01.ctl ', '/u01/app/oracle/oradata/prod/disk2/ Control02.ctl ')
compatible=10.2.0.1.0
processes=150
pga_aggregate_target=90m
Undo_tablespace=undotbs
Undo_management=auto
sga_target=300m

5. In the help document, look for the script to create the database manually and make the appropriate changes.

[Email protected] dbs]$ VI createdb.sql
CREATE DATABASE PROD
USER SYS identified by Oracle
USER SYSTEM identified by Oracle
LOGFILE GROUP 1 ('/u01/app/oracle/oradata/prod/disk1/redo01a.log ', '/u01/app/oracle/oradata/prod/disk2/redo01b.log ') SIZE

100M,
GROUP 2 ('/u01/app/oracle/oradata/prod/disk1/redo02a.log ', '/u01/app/oracle/oradata/prod/disk2/redo02b.log ') SIZE

100M,
           GROUP 3 ('/u01/app/oracle/oradata/prod/ Disk1/redo03a.log ', '/u01/app/oracle/oradata/prod/disk2/redo03b.log ') SIZE

100M
Maxlogfiles 15
Maxlogmembers 5
Maxloghistory 1
Maxdatafiles 100
Maxinstances 1
CHARACTER SET Al32utf8
National CHARACTER SET AL16UTF16
DataFile '/u01/app/oracle/oradata/prod/disk1/system01.dbf ' SIZE 325M reuse
EXTENT MANAGEMENT LOCAL
Sysaux datafile '/u01/app/oracle/oradata/prod/disk1/sysaux01.dbf ' SIZE 325M reuse
DEFAULT Temporary tablespace TEMP
Tempfile '/u01/app/oracle/oradata/prod/disk1/temp01.dbf '
SIZE 20M Reuse
UNDO tablespace Undotbs
DataFile '/u01/app/oracle/oradata/prod/disk1/undotbs01.dbf '
SIZE 200M Reuse autoextend on MAXSIZE UNLIMITED;


6. Launch database into Nomount state to create database
[Email protected] dbs]$ Sqlplus/as SYSDBA

Sql*plus:release 10.2.0.1.0-production on Sun Nov 25 21:06:32 2012

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to an idle instance.

sql> startup Nomount;
ORACLE instance started.

Total System Global area 314572800 bytes
Fixed Size 1219160 bytes
Variable Size 96470440 bytes
Database buffers 213909504 bytes
Redo buffers 2973696 bytes
sql> @createDB. sql

Database created.


7, run the underlying script for the corresponding database
The following 5 scripts are executed under the SYS schema:
Create a data dictionary view
@/u01/app/oracle/product/10.2.0/db_1/rdbms/admin/catalog.sql; (it must be executed before catproc.sql can be executed)
Create some lock mechanism related views in Oracle
@/u01/app/oracle/product/10.2.0/db_1/rdbms/admin/catblock.sql;
Create some Oracle stored procedures and packages
@/u01/app/oracle/product/10.2.0/db_1/rdbms/admin/catproc.sql;
Create an interface that requires the PL/SQL encryption tool
@/u01/app/oracle/product/10.2.0/db_1/rdbms/admin/catoctk.sql;
Install the Sql*plus table Product_user_profile as if it were something related to the Data warehouse.
@/u01/app/oracle/product/10.2.0/db_1/rdbms/admin/owminst.plb;

The following 2 scripts are executed under the system schema.
Connect system/oracle
@/u01/app/oracle/product/10.2.0/db_1/sqlplus/admin/pupbld.sql;
Connect system/oracle
@/u01/app/oracle/product/10.2.0/db_1/sqlplus/admin/help/hlpbld.sql Helpus.sql;


8. Create a SPFile file
Sql> Conn/as SYSDBA
Connected.
Sql> create SPFile from Pfile;

File created.


9. Close the database and re-start the database with SPFile
sql> shutdown Immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
Sql> Startup
ORACLE instance started.

Total System Global area 314572800 bytes
Fixed Size 1219160 bytes
Variable Size 96470440 bytes
Database buffers 213909504 bytes
Redo buffers 2973696 bytes
Database mounted.
Database opened.

To manually create the database successfully!

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.