欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

Linux 下手工给Oracle 10g 建库

程序员文章站 2022-04-10 13:13:51
...

Linux 下安装Oracle 10g,创建database,安装完后,手工创建。以下是手工建库步骤:1:创建目录:/oracle/ora_data/xldb 2:创建

Linux 下安装Oracle 10g,创建database,安装完后,手工创建。以下是手工建库步骤:

1:创建目录:/oracle/ora_data/xldb

2:创建参数文件: /oracle/product/10.2.0/db_1/dbs/initXLDB.ora
$cp init.ora initXLDB.ora
initXLDB.ora被修改的地方:
db_name=XLDB
control_files = ("$ORACLE_HOME/dbs/XLDB_ctl01.ctl", "$ORACLE_HOME/dbs/XLDB_ctl02.ctl")
3:创建口令文件:orapwd file=$ORACLE_HOME/dbs/orapwXLDB password=oracle

4:创建建库脚本:/oracle/ora_data/XLDB/createXLDB.sql
create database XLDB
datafile '/oracle/ora_data/XLDB/system01.dbf' size 300m
sysaux datafile '/oracle/ora_data/XLDB/sysaux01.dbf' size 120m
undo tablespace undotbs1 datafile '/oracle/ora_data/XLDB/undotbs01.dbf' size 100m autoextend on next 5M maxsize unlimited
default temporary tablespace temp tempfile '/oracle/ora_data/XLDB/temp01.dbf' size 50m autoextend on next 5M maxsize unlimited
logfile group 1 ('/oracle/ora_data/XLDB/redo01.log') size 50m,
group 2 ('/oracle/ora_data/XLDB/redo02.log') size 50m,
group 3 ('/oracle/ora_data/XLDB/redo03.log') size 50m
maxlogfiles 5
character set ZHS16GBK
national character set AL16UTF16;

5:执行 createXLDB.sql
$export ORACLE_SID=XLDB (安装oracle时已设定)
$sqlplus / as sysdba
SQL> startup nomount
ORA-00371: not enough shared pool memory, should be atleast 62198988 bytes
修改 initXLDB.ora 的 shared_pool_size = 75000000
SQL> shutdown immediate
SQL> startup nomount
ORACLE instance started.
Total System Global Area 113246208 bytes
Fixed Size 1217956 bytes
Variable Size 100665948 bytes
Database Buffers 8388608 bytes
Redo Buffers 2973696 bytes
SQL> start /oracle/ora_data/XLDB/createXLDB.sql
create database XLDB
*
ERROR at line 1:
ORA-30014: operation only supported in Automatic Undo Management mode
修改 initXLDB.ora 增加一行 undo_management=AUTO
SQL> shutdown immediate
SQL> startup nomount
ORACLE instance started.
Total System Global Area 113246208 bytes
Fixed Size 1217956 bytes
Variable Size 100665948 bytes
Database Buffers 8388608 bytes
Redo Buffers 2973696 bytes
SQL> start createXLDB.sql
Database created.

6:执行catalog.sql创建数据字典,执行catproc.sql创建包:
SQL>start $ORACLE_HOME/rdbms/admin/catalog.sql
SQL>start $ORACLE_HOME/rdbms/admin/catproc.sql
这两步比较顺利,不过需要等十几分钟。

7:执行 pupbld.sql脚本,,使所有用户可以使用sqlplus:
SQL> start $ORACLE_HOME/sqlplus/admin/pupbld.sql

8:创建users表空间,
SQL> create tablespace users
2 datafile '/oracle/ora_data/XLDB/users01.dbf' size 50m
3 /
Tablespace created.
SQL> alter database default tablespace users;
Database altered.

9:执行utlsampl.sql 脚本,创建scolt测试模式:
SQL> start $ORACLE_HOME/rdbms/admin/utlsampl.sql
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
测试 $ sqlplus scott/tiger
SQL> select count(*) from dept;
COUNT(*)
----------
4

10:数据库创建完毕。

Linux 下手工给Oracle 10g 建库