作为数据库管理员大部分时候要创建自己的数据库实例for rman或者更改db_block_size等但手工建库步骤复杂令人生畏所以找了个脚本供大家参考脚本上有各个步骤地说明比较好用! 手工创建数据库的全部脚本及说明 系统环境 操作系统Windows Server机器内存M 数据库Oracle i R () for NT 企业版 安装路径D:\ORACLE 建库步骤 手工创建相关目录 D:\Oracle\admin\test D:\Oracle\admin\test\adhoc D:\Oracle\admin\test\bdump D:\Oracle\admin\test\cdump D:\Oracle\admin\test\create D:\Oracle\admin\test\exp D:\Oracle\admin\test\pfile D:\Oracle\admin\test\udump D:\Oracle\oradata\test D:\Oracle\oradata\test\archive 手工创建初始化启动参数文件D:\Oracle\admin\test\pfile\inittestora内容 手工创建D:\Oracle\Ora\DATABASE\inittestora文件 内容IFILE=D:\Oracle\admin\test\pfile\inittestora 使用orapwdexe命令创建D:\Oracle\Ora\DATABASE\PWDtestora 命令D:\Oracle\Ora\bin\orapwd file=D:\Oracle\Ora\DATABASE\PWDtestora password=ORACLE entries= 通过oradimexe命令在服务里生成一个新的实例管理服务启动方式为手工 set ORACLE_SID=test D:\Oracle\Ora\bin\oradim new sid test startmode manual pfile D:\Oracle\admin\test\pfile\inittestora 生成各种数据库对象 D:\>svrmgrl 创建数据库 connect INTERNAL/oracle startup nomount pfile=D:\Oracle\admin\test\pfile\inittestora CREATE DATABASE test LOGFILE D:\Oracle\oradata\test\redolog SIZE K D:\Oracle\oradata\test\redolog SIZE K D:\Oracle\oradata\test\redolog SIZE K MAXLOGFILES MAXLOGMEMBERS MAXLOGHISTORY DATAFILE D:\Oracle\oradata\test\systemdbf SIZE M REUSE AUTOEXTEND ON NEXT K MAXDATAFILES MAXINSTANCES CHARACTER SET ZHSGBK NATIONAL CHARACTER SET ZHSGBK; 控制文件日志文件在上面语句执行时生成 connect INTERNAL/oracle 修改系统表空间 ALTER TABLESPACE SYSTEM DEFAULT STORAGE ( INITIAL K NEXT K MINEXTENTS MAXEXTENTS UNLIMITED PCTINCREASE ); ALTER TABLESPACE SYSTEM MINIMUM EXTENT K; 创建回滚表空间 CREATE TABLESPACE RBS DATAFILE D:\Oracle\oradata\test\rbsdbf SIZE M REUSE AUTOEXTEND ON NEXT K MINIMUM EXTENT K DEFAULT STORAGE ( INITIAL K NEXT K MINEXTENTS MAXEXTENTS ); 创建用户表空间 CREATE TABLESPACE USERS DATAFILE D:\Oracle\oradata\test\usersdbf SIZE M REUSE AUTOEXTEND ON NEXT K MINIMUM EXTENT K DEFAULT STORAGE ( INITIAL K NEXT K MINEXTENTS MAXEXTENTS PCTINCREASE ); 创建临时表空间 CREATE TABLESPACE TEMP DATAFILE D:\Oracle\oradata\test\tempdbf SIZE M REUSE AUTOEXTEND ON NEXT K MINIMUM EXTENT K DEFAULT STORAGE ( INITIAL K NEXT K MINEXTENTS MAXEXTENTS UNLIMITED PCTINCREASE ) TEMPORARY; 创建工具表空间 CREATE TABLESPACE TOOLS DATAFILE D:\Oracle\oradata\test\toolsdbf SIZE M REUSE AUTOEXTEND ON NEXT K MINIMUM EXTENT K DEFAULT STORAGE ( INITIAL K NEXT K MINEXTENTS MAXEXTENTS PCTINCREASE ); 创建索引表空间 CREATE TABLESPACE INDX DATAFILE D:\Oracle\oradata\test\indxdbf SIZE M REUSE AUTOEXTEND ON NEXT K MINIMUM EXTENT K DEFAULT STORAGE ( INITIAL K NEXT K MINEXTENTS MAXEXTENTS PCTINCREASE ); 创建回滚段 CREATE PUBLIC ROLLBACK SEGMENT RBS TABLESPACE RBS STORAGE ( OPTIMAL K ); CREATE PUBLIC ROLLBACK SEGMENT RBS TABLESPACE RBS STORAGE ( OPTIMAL K ); CREATE PUBLIC ROLLBACK SEGMENT RBS TABLESPACE RBS STORAGE ( OPTIMAL K ); CREATE PUBLIC ROLLBACK SEGMENT RBS TABLESPACE RBS STORAGE ( OPTIMAL K ); CREATE PUBLIC ROLLBACK SEGMENT RBS TABLESPACE RBS STORAGE ( OPTIMAL K ); CREATE PUBLIC ROLLBACK SEGMENT RBS TABLESPACE RBS STORAGE ( OPTIMAL K ); CREATE PUBLIC ROLLBACK SEGMENT RBS TABLESPACE RBS STORAGE ( OPTIMAL K ); CREATE PUBLIC ROLLBACK SEGMENT RBS TABLESPACE RBS STORAGE ( OPTIMAL K ); CREATE PUBLIC ROLLBACK SEGMENT RBS TABLESPACE RBS STORAGE ( OPTIMAL K ); CREATE PUBLIC ROLLBACK SEGMENT RBS TABLESPACE RBS STORAGE ( OPTIMAL K ); CREATE PUBLIC ROLLBACK SEGMENT RBS TABLESPACE RBS STORAGE ( OPTIMAL K ); CREATE PUBLIC ROLLBACK SEGMENT RBS TABLESPACE RBS STORAGE ( OPTIMAL K ); CREATE PUBLIC ROLLBACK SEGMENT RBS TABLESPACE RBS STORAGE ( OPTIMAL K ); CREATE PUBLIC ROLLBACK SEGMENT RBS TABLESPACE RBS STORAGE ( OPTIMAL K ); CREATE PUBLIC ROLLBACK SEGMENT RBS TABLESPACE RBS STORAGE ( OPTIMAL K ); CREATE PUBLIC ROLLBACK SEGMENT RBS TABLESPACE RBS STORAGE ( OPTIMAL K ); CREATE PUBLIC ROLLBACK SEGMENT RBS TABLESPACE RBS STORAGE ( OPTIMAL K ); CREATE PUBLIC ROLLBACK SEGMENT RBS TABLESPACE RBS STORAGE ( OPTIMAL K ); CREATE PUBLIC ROLLBACK SEGMENT RBS TABLESPACE RBS STORAGE ( OPTIMAL K ); CREATE PUBLIC ROLLBACK SEGMENT RBS TABLESPACE RBS STORAGE ( OPTIMAL K ); CREATE PUBLIC ROLLBACK SEGMENT RBS TABLESPACE RBS STORAGE ( OPTIMAL K ); CREATE PUBLIC ROLLBACK SEGMENT RBS TABLESPACE RBS STORAGE ( OPTIMAL K ); CREATE PUBLIC ROLLBACK SEGMENT RBS TABLESPACE RBS STORAGE ( OPTIMAL K ); CREATE PUBLIC ROLLBACK SEGMENT RBS TABLESPACE RBS STORAGE ( OPTIMAL K ); CREATE PUBLIC ROLLBACK SEGMENT RBS TABLESPACE RBS STORAGE ( OPTIMAL K ); 使回滚段在线 ALTER ROLLBACK SEGMENT RBS ONLINE; ALTER ROLLBACK SEGMENT RBS ONLINE; ALTER ROLLBACK SEGMENT RBS ONLINE; ALTER ROLLBACK SEGMENT RBS ONLINE; ALTER ROLLBACK SEGMENT RBS ONLINE; ALTER ROLLBACK SEGMENT RBS ONLINE; ALTER ROLLBACK SEGMENT RBS ONLINE; ALTER ROLLBACK SEGMENT RBS ONLINE; ALTER ROLLBACK SEGMENT RBS ONLINE; ALTER ROLLBACK SEGMENT RBS ONLINE; ALTER ROLLBACK SEGMENT RBS ONLINE; ALTER ROLLBACK SEGMENT RBS ONLINE; ALTER ROLLBACK SEGMENT RBS ONLINE; ALTER ROLLBACK SEGMENT RBS ONLINE; ALTER ROLLBACK SEGMENT RBS ONLINE; ALTER ROLLBACK SEGMENT RBS ONLINE; ALTER ROLLBACK SEGMENT RBS ON |