熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Oracle >> 正文

手工建庫腳本

2013-11-13 15:43:31  來源: Oracle 

  作為數據庫管理員大部分時候要創建自己的數據庫實例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
From:http://tw.wingwit.com/Article/program/Oracle/201311/17193.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.