1、确定用户的实例标志(DB_NAME 和SID)。racle实例标志隐该与数据库名字(DB_NAME)
一致。该实例标志用来避免与其他Oracle 实例混淆,而这里所指的其他Oracle 实例你可在系统上创建和运行。
2、创建安装参数文件
对于人已一个Oracle 数据库的实例(系统全局区域和后台进程)使用安装参数文件来启动。要为数据库创建参数文件,用户将要使用用户的操作系统来制作一个Oracle在其发行介质
上的安装参数文件的一份拷贝。给这个新的拷贝起一个新的文件名。然后用户可以编辑并定制数据库的这个新文件。
3确认db_name=erp 并且环境变量ORACLE_SID也为erp
第一步、把原来的一个文本启动参数文件命名为cp initcorcl.ora initerp.ora
因该在目录 $ORACLE_HOME/dbs下面。
二、编辑initerp.ora
重要的编辑这几个参数:
orcl.__db_cache_size=146800640
orcl.__java_pool_size=4194304
orcl.__large_pool_size=4194304
orcl.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
orcl.__pga_aggregate_target=188743680
orcl.__sga_target=200321536
orcl.__shared_io_pool_size=0
orcl.__shared_pool_size=94549376
orcl.__streams_pool_size=4194304
*.audit_file_dest='/u01/app/oracle/admin/erp/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u01/app/oracle/oradata/erp/control01.ctl','/u01/app/oracle/flash_recovery_area/erp/control02.ctl'
*.db_block_size=8192
*.db_domain='localdomain'
*.db_name='erp'
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=4039114752
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=erpXDB)'
*.memory_target=188968064 #这个数要小于 /etc/shm
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDO01'
红色标注非常重要一定要把原来的orcl改为 erp
如果是目录的地一定要建立目录。
这里 : mkdir –p /u01/app/oracle/admin/erp/adump 会的鬼递归简历子目录
mkdir –p /u01/app/oracle/oradata/erp
第二步打开term设定环境变量,其中 ORACLE_SID=erp
Sqlplus “/as sysdba”
SQL> startup nomount
如果nomount起来了,那么说明initerp.ora好了。
就可以进行第二步
1.创建数据库
SQL>
CREATE DATABASE erp CONTROLFILE REUSE
LOGFILE
'/u01/app/oracle/erp/redo01.log' SIZE 10M REUSE,
'/u01/app/oracle/erp/redo02.log' SIZE 10M REUSE,
'/u01/app/oracle/erp/redo03.log' SIZE 10M REUSE,
'/u01/app/oracle/erp/redo04.log' SIZE 10M REUSE,
DATAFILE '/u01/app/oracle/erp/system01.dbf' SIZE 10M
REUSE AUTOEXTEND ON NEXT 10M
MAXSIZE 200M
UNDO TABLESPACE undo01 DATAFILE '/u01/app/oracle/erp/undo01.dbf' size 10m
SYSAUX datafile '/u01/app/oracle/erp/sysaux.dbf' size 10M autoextend on next 50m maxsize 100m
CHARACTER SET WE8ISO8859P1;
上面这段话的作用如下:
① 创建数据库的数据文件;
② 创建数据库的控制文件;
③ 创建数据库的重做日志文件;
④ 创建SYSTEM 表空间及回滚段;
⑤ 创建数据目录;
⑥ 创建用户SYS和SYSTEM;
⑦ 指定数据库中存储数据的字符集;
⑧ 装入、打开数据库
2.创建系统回滚段,创建一个临时的回滚段来支持数据库的创建,后来在删除掉。
CREATE ROLLBACK SEGMENT rb_temp STORAGE(INITIAL 100k NEXT 250k);
ALTER ROLLBACK SEGMENT rb1 ONLINE;
3.为回滚段创建表空间
CREATE TABLESPACE rbs DATAFILE '/u01/app/oracle/erp/rbs01.dbf' SIZE 5M REUSE AUTOEXTEND ON NEXT 5M MAXSIZE 150M;
4.创建用户表空间
CREATE TABLESPACE users DATAFILE '/u01/app/oracle/erp/user01.dbf' SIZE 3M REUSE
AUTOEXTEND ON NEXT 5M MAXSIZE 150M;
5.创建临时表空间
CREATE TABLESPACE temp DATAFILE ‘/u01/app/oracle/erp/temp01.dbf’ SIZE 2M REUSE AUTOEXTEND ON NEXT 5M MAXSIZE 150M;
6.创建回滚段
CREATE ROLLBACK SEGMENT rb1 STORAGE (INITIAL 50k NEXT 250k) TABLESPACE rbs;
CREATE ROLLBACK SEGMENT rb2 STORAGE (INITIAL 50k NEXT 250k) TABLESPACE rbs;
CREATE ROLLBACK SEGMENT rb3 STORAGE (INITIAL 50k NEXT 250k) TABLESPACE rbs;
CREATE ROLLBACK SEGMENT rb4 STORAGE (INITIAL 50k NEXT 250k) TABLESPACE rbs;
7.吧刚创建的回滚段上线
ALTER ROLLBACK SEGMENT rb1 ONLINE;
ALTER ROLLBACK SEGMENT rb2 ONLINE;
ALTER ROLLBACK SEGMENT rb3 ONLINE;
ALTER ROLLBACK SEGMENT rb4 ONLINE;
ALTER ROLLBACK SEGMENT rb_temp OFFLINE;
DROP ROLLBACK SEGMENT rb_temp;
在数据库OPEN状态下,执行数据字典创建和PLSQL支持
SQL>@/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/catalog.sql
SQL>@/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/catproc.sql
SQL>@/u01/app/oracle/product/11.2.0/dbhome_1/sqlplus/admin/pupbld.sql
~
全部代码如下list
CREATE DATABASE erp CONTROLFILE REUSE
LOGFILE
'/u01/app/oracle/erp/redo01.log' SIZE 10M REUSE,
'/u01/app/oracle/erp/redo02.log' SIZE 10M REUSE,
'/u01/app/oracle/erp/redo03.log' SIZE 10M REUSE,
'/u01/app/oracle/erp/redo04.log' SIZE 10M REUSE,
DATAFILE '/u01/app/oracle/erp/system01.dbf' SIZE 10M
REUSE AUTOEXTEND ON NEXT 10M
MAXSIZE 200M
UNDO TABLESPACE undo01 DATAFILE '/u01/app/oracle/erp/undo01.dbf' size 10m
SYSAUX datafile '/u01/app/oracle/erp/sysaux.dbf' size 10M autoextend on next 50m maxsize 100m
CHARACTER SET WE8ISO8859P1;
CREATE ROLLBACK SEGMENT rb_temp STORAGE(INITIAL 100k NEXT 250k);
ALTER ROLLBACK SEGMENT rb1 ONLINE;
CREATE TABLESPACE rbs DATAFILE '/u01/app/oracle/erp/rbs01.dbf' SIZE 5M REUSE
AUTOEXTEND ON
NEXT 5M MAXSIZE 150M;
CREATE TABLESPACE users DATAFILE '/u01/app/oracle/erp/user01.dbf' SIZE 3M REUSE
AUTOEXTEND ON NEXT 5M MAXSIZE 150M;
CREATE ROLLBACK SEGMENT rb1 STORAGE (INITIAL 50k NEXT 250k) TABLESPACE rbs;
CREATE ROLLBACK SEGMENT rb2 STORAGE (INITIAL 50k NEXT 250k) TABLESPACE rbs;
CREATE ROLLBACK SEGMENT rb3 STORAGE (INITIAL 50k NEXT 250k) TABLESPACE rbs;
CREATE ROLLBACK SEGMENT rb4 STORAGE (INITIAL 50k NEXT 250k) TABLESPACE rbs;
ALTER ROLLBACK SEGMENT rb1 ONLINE;
ALTER ROLLBACK SEGMENT rb2 ONLINE;
ALTER ROLLBACK SEGMENT rb3 ONLINE;
ALTER ROLLBACK SEGMENT rb4 ONLINE;
ALTER ROLLBACK SEGMENT rb_temp OFFLINE;
DROP ROLLBACK SEGMENT rb_temp;
SQL>@/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/catalog.sql
SQL>@/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/catproc.sql
SQL>@/u01/app/oracle/product/11.2.0/dbhome_1/sqlplus/admin/pupbld.sql