Oracle 10g 手工建库全流程

说明:建库前请确保Oracle软件已成功安装。

手工建库全流程

1. 设置oracle用户环境变量实例名

使用oracle用户

vi .bash_profile
export ORACLE_SID=trans
export ORACLE_BASE=/oracle
export ORACLE_HOME=/oracle/product/10.2.0
export PATH=$PATH:$ORALCE_HOME/bin:.

2. 新建 /etc/oratab

使用root用户:

vi /etc/oratab

添加如下内容

trans:/oracle/product/10.2.0:N

然后

chown oracle:dba /etc/oratab

3. 创建sys口令认证文件

使用oracle用户:

orapwd file=$ORACLE_HOME/dbs/orapwtrans password=system entries=5

4. 创建目录

使用oracle用户

mkdir -p $ORACLE_BASE/admin/trans/bdump
mkdir -p $ORACLE_BASE/admin/trans/udump
mkdir -p $ORACLE_BASE/admin/trans/cdump
mkdir -p $ORACLE_BASE/admin/trans/adump
mkdir -p $ORACLE_BASE/oradata

5. 创建pfile

使用oracle用户

cd $ORACLE_HOME/dbs
cat init.ora |grep -v ^# |grep -v ^$>inittrans.ora

修改参数文件内容,一些关键参数修改

db_name=trans
db_files = 200                                                         # SMALL
db_file_multiblock_read_count = 8                                     # SMALL
shared_pool_size = 3500000                                            # SMALL
log_checkpoint_interval = 10000
processes = 50                                                        # SMALL
parallel_max_servers = 150                                              # SMALL
log_buffer = 32768                                                    # SMALL
max_dump_file_size = 10240      # limit trace file size to 5 Meg each
global_names = FALSE
control_files = ('/oracle/oradata/control01.ctl','/oracle/oradata/control02.ctl')
sga_max_size = 12800M
sga_target = 8182M
undo_management=AUTO
audit_file_dest='/oracle/admin/trans/adump'
background_dump_dest='/oracle/admin/trans/bdump'
core_dump_dest='/oracle/admin/trans/cdump'
user_dump_dest='/oracle/admin/trans/udump'

创建spfile文件。

sqlplus / as sysdba
SQL> startup nomount
ORACLE instance started.

Total System Global Area 1.3422E+10 bytes
Fixed Size                  2043768 bytes
Variable Size            5083496584 bytes
Database Buffers         8321499136 bytes
Redo Buffers               14733312 bytes
SQL> create spfile from pfile;

File created.

6. 运行建库脚本

启动数据库到nomount

sqlplus / as sysdba
stratup nomount

建立系统表空间

CREATE DATABASE trans
USER SYS IDENTIFIED BY system
USER SYSTEM IDENTIFIED by system
LOGFILE
GROUP 1 ('/oracle/oradata/redo01.log') SIZE 100M,
GROUP 2 ('/oracle/oradata/redo02.log') SIZE 100M,
GROUP 3 ('/oracle/oradata/redo03.log') SIZE 100M
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
MAXINSTANCES 1
CHARACTER SET ZHS16GBK
NATIONAL CHARACTER SET AL16UTF16
DATAFILE '/oracle/oradata/system01.dbf' SIZE 500M
EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE '/oracle/oradata/sysaux01.dbf' SIZE 500M
DEFAULT TEMPORARY TABLESPACE temp
TEMPFILE '/oracle/oradata/temp01.dbf'
SIZE 1024M
UNDO TABLESPACE undotbs
DATAFILE '/oracle/oradata/undotbs01.dbf'
SIZE 300M  AUTOEXTEND ON NEXT 50M MAXSIZE UNLIMITED;

7. 运行创建数据字典脚本

sqlplus / as sysdba
startup
@$ORACLE_HOME/rdbms/admin/catalog.sql
@$ORACLE_HOME/rdbms/admin/catproc.sql

完成。

你可能感兴趣的:(数据库,oracle)