简单记录Oracle 9i数据库手工建库过程Oracle 9i手工建库
By Oracle老菜
今天客户要用oracle 9.2.0.5,aix 6.1已经不支持了,只好从别的数据库把软件拷贝过来重编译。但是建库只能用手工建库了。很久没有使用手工建库了,简单记录下建库过程
1.设置oracle用户环境
su - oracle
export ORACLE_SID=radius
export ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/9.2.0
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export LD_LIBRARY_PATH$ORACLE_BASE/product/9.2.0/lib
export TNS_ADMIN=$ORACLE_BASE/product/9.2.0/network/admin
export PATH=/bin:/usr/bin:/usr/local/bin:/usr/bin/X11:/usr/X11R6/bin:/home/oracle/bin:$ORACLE_BASE/product/9.2.0/bin
export ORACLE_TERM=xterm
export CLASSPATH=$ORACLE_BASE/product/9.2.0/JRE:$ORACLE_BASE/product/9.2.0/jlib:$ORACLE_BASE/product/9.2.0/rdbms/jlib:/oracle/product/9.2.0/network/jlib
export ORA_NLS33=$ORACLE_BASE/product/9.2.0/ocommon/nls/admin/data
umask 022
set -o vi
2.创建启动的pfile文件
cat /home/oracle/yd.ora
*.aq_tm_processes=1
*.background_dump_dest='/u01/app/oracle/admin/dcmsuat/bdump'
*.compatible='9.2.0.0.0'
*.control_files='/u01/app/oracle/oradata/dcmsuat/control01.ctl','/u01/app/oracle/oradata/dcmsuat/control02.ctl','/u01/app/oracle/or
adata/dcmsuat/control03.ctl'
*.core_dump_dest='/u01/app/oracle/admin/dcmsuat/cdump'
*.db_block_size=8192
*.db_cache_size=86777216
*.db_domain='dcmsuat'
*.db_file_multiblock_read_count=16
*.db_name='dcmsuat'
*.fast_start_mttr_target=300
*.hash_area_size=1048576
*.hash_join_enabled=TRUE
*.instance_name='dcmsuat'
*.java_pool_size=83886080
*.job_queue_processes=10
*.large_pool_size=16777216
*.log_archive_dest='/u01/app/oracle/arch/dcmsuat/'
*.log_archive_format='%S.dat'
*.log_archive_start=TRUE
*.open_cursors=3000
*.pga_aggregate_target=33554432
*.processes=1500
*.query_rewrite_enabled='TRUE'
*.remote_login_passwordfile='EXCLUSIVE'
*.resource_limit=TRUE
*.shared_pool_size=183886080
*.sort_area_size=5048576
*.star_transformation_enabled='TRUE'
*.timed_statistics=TRUE
*.undo_management='AUTO'
*.undo_retention=10800
*.undo_tablespace='undotbs'
*.user_dump_dest='/u01/app/oracle/admin/dcmsuat/udump'
mkdir -p /u01/app/oracle/admin/dcmsuat/bdump
mkdir -p /u01/app/oracle/admin/dcmsuat/cdump
mkdir -p /u01/app/oracle/admin/dcmsuat/udump
mkdir -p /u01/app/oracle/admin/dcmsuat/pfile
mkdir -p /u01/app/oracle/admin/dcmsuat/create
mkdir -p /u01/app/oracle/oradata/dcmsuat
3.创建密码文件
orapwd file=/u01/app/oracle/product/9.2.0/dbs/orapwdcmsuat password=oracle entries=10
4.创建建库脚本
CreateDb.sql
CREATE DATABASE dcmsuat
MAXINSTANCES 10
MAXLOGHISTORY 1
MAXLOGFILES 8
MAXLOGMEMBERS 3
MAXDATAFILES 1024
DATAFILE '$ORACLE_BASE/oradata/dcmsuat/system01.dbf' SIZE 512M autoextend on next 2M maxsize unlimited
LOGFILE
GROUP 1 ('$ORACLE_BASE/oradata/dcmsuat/redo01.log') SIZE 500M,
GROUP 2 ('$ORACLE_BASE/oradata/dcmsuat/redo02.log') SIZE 500M,
GROUP 3 ('$ORACLE_BASE/oradata/dcmsuat/redo03.log') SIZE 500M;
undo tablespace undotbs datafile '$ORACLE_BASE/oradata/dcmsuat/undotbs01.dbf' size 800M reuse autoextend on next 2M maxsize unlimited
default temporary tablespace temp tempfile '$ORACLE_BASE/oradata/radius/temp01.dbf' reuse size 800M autoextend on next 5m maxsize unlimited
CHARACTER SET ZHS16GBK
NATIONAL CHARACTER SET AL16UTF16
5.建库过程
export ORACLE_SID=dcmsuat
su - oracle
sqlplus /nolog
connect /as sysdba
startup nomount pfile=/home/oracle/yd.ora
@CreateDb.sql.sql
6.创建数据库字典
SQL> conn sys/sys as sysdba
SQL> @/u01/app/oracle/product/9.2.0/rdbms/admin/catalog ----加载常用数据字典
SQL> @/u01/app/oracle/product/9.2.0/rdbms/admin/catproc ----加载PL/SQL 程序包
SQL> @/u01/app/oracle/product/9.2.0/rdbms/admin/catrep ---加载数据复制支持程序包
SQL> @/u01/app/oracle/product/9.2.0/javavm/install/initjvm ---加载JAVA程序包
SQL> conn system/manager
SQL> @/u01/app/oracle/product/9.2.0/sqlplus/admin/pupbld ----加载环境文件程序包
7.创建users表空间
create tablespace users
datafile '$ORACLE_HOME/oradata/user01.dbf' size 600m
autoextend on next 1024k maxsize unlimited
extent management local uniform size 500K;
create user test identified by test;
great dba,connect to test;
8.创建默认spfile和pfile
create spfile from pfile='/home/oracle/yd.ora';
create pfile from spfile;
9.创建网络监听
cd $ORACLE_HOME/network/admin
cat listener.ora
在listener.ora中增加以下语句
( sid_desc=
(global_dbname=dcmsuat)
(oracle_home=/u01/app/oracle/product/9.2.0)
(sid_name=dcmsuat)
)
cat tnsnames.ora
dcmsuat=
( description=
(address_list=
(address=(protocol=tcp)(host=103.160.128.29)(port=1521))
)
(connect_data=
(server=dedicated)
(service_name=dcmsuat)
)
)
10.测试数据库(略)